GNU bug report logs - #10519
guile and (mini-)gmp

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guile; Severity: wishlist; Reported by: nisse@HIDDEN (Niels Möller); dated Sun, 15 Jan 2012 22:01:02 UTC; Maintainer for guile is bug-guile@HIDDEN.
Severity set to 'wishlist' from 'normal' Request was from Mark H Weaver <mhw@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 10519 <at> debbugs.gnu.org:


Received: (at 10519) by debbugs.gnu.org; 27 Mar 2013 17:02:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 27 13:02:49 2013
Received: from localhost ([127.0.0.1]:47904 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UKtkO-0003SV-U6
	for submit <at> debbugs.gnu.org; Wed, 27 Mar 2013 13:02:49 -0400
Received: from world.peace.net ([96.39.62.75]:49324)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <mhw@HIDDEN>) id 1UKtkM-0003SO-Q6
	for 10519 <at> debbugs.gnu.org; Wed, 27 Mar 2013 13:02:48 -0400
Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com
	([209.6.91.212] helo=tines.lan)
	by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.72) (envelope-from <mhw@HIDDEN>)
	id 1UKtht-00034G-Lz; Wed, 27 Mar 2013 13:00:13 -0400
From: Mark H Weaver <mhw@HIDDEN>
To: nisse@HIDDEN (Niels =?utf-8?Q?M=C3=B6ller?=)
Subject: Re: bug#10519: guile and (mini-)gmp
References: <nnmx9oy83b.fsf@HIDDEN> <874np05fwz.fsf@HIDDEN>
	<nnipdfl71c.fsf@HIDDEN> <874noawh4r.fsf@HIDDEN>
	<nnpq6xg468.fsf@HIDDEN> <87zk61qkjh.fsf@HIDDEN>
	<nnlihlf69e.fsf@HIDDEN> <87lihlqc3u.fsf@HIDDEN>
	<87txotbmag.fsf@HIDDEN> <878v65frid.fsf@HIDDEN>
	<874ngpeka0.fsf@HIDDEN> <87620ph8yu.fsf@HIDDEN>
	<nnboa6mv6l.fsf@HIDDEN>
Date: Wed, 27 Mar 2013 13:00:03 -0400
In-Reply-To: <nnboa6mv6l.fsf@HIDDEN> ("Niels
	\=\?utf-8\?Q\?M\?\= \=\?utf-8\?Q\?\=C3\=B6ller\=22's\?\=
	message of "Tue, 26 Mar 2013 09:17:38 +0100")
Message-ID: <87obe46ang.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 10519
Cc: Andy Wingo <wingo@HIDDEN>, 10519 <at> debbugs.gnu.org,
	Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>,
	Torbjorn Granlund <tg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

Hi Niels,

nisse@HIDDEN (Niels M=C3=B6ller) writes:
> For the small integer gcd code, you may want to have a look at the
> tricks used in
> http://gmplib.org:8000/gmp/file/304af17b9ccc/mpn/generic/gcd_1.c, the
> code under GCD_1_METHOD =3D=3D 2
>
> 1. Shift out the least significant bit of both a and b (they're always
>    one). Maybe you don't need this of you have some extra bits already
>    (signed types, or some bits reserved for type info).
>
> 2. Then, the sign bit of a - b correctly gives the result of the
>    comparison a < b. Constructing a mask from this difference is then a
>    simple right shift (if >> on a signed int is not an arithmetic right
>    shift, you need shift and a negation).
>
> 3. Use this bit mask when forming the absolute value |a - b|, and when
>    swapping values around, to avoid unpredictable branches which
>    typically are quite expensive.

Excellent tricks!  Thanks for sharing.  I'll try to find the time to
apply these ideas soon, but probably not before 2.0.8 -- there are too
many more important things to do for that, and not enough time.

    Regards,
      Mark




Information forwarded to bug-guile@HIDDEN:
bug#10519; Package guile. Full text available.

Message received at 10519 <at> debbugs.gnu.org:


Received: (at 10519) by debbugs.gnu.org; 26 Mar 2013 08:20:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 26 04:20:05 2013
Received: from localhost ([127.0.0.1]:45548 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UKP6y-0002NX-OT
	for submit <at> debbugs.gnu.org; Tue, 26 Mar 2013 04:20:05 -0400
Received: from mail.lysator.liu.se ([130.236.254.3]:56112)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <nisse@HIDDEN>) id 1UKP6t-0002My-QL
	for 10519 <at> debbugs.gnu.org; Tue, 26 Mar 2013 04:20:02 -0400
Received: from mail.lysator.liu.se (localhost [127.0.0.1])
	by mail.lysator.liu.se (Postfix) with ESMTP id EF35240005;
	Tue, 26 Mar 2013 09:17:40 +0100 (CET)
Received: from stalhein.lysator.liu.se (stalhein.lysator.liu.se
	[IPv6:2001:6b0:17:f0a0::cc])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.lysator.liu.se (Postfix) with ESMTPS id 6E1D240002;
	Tue, 26 Mar 2013 09:17:40 +0100 (CET)
Received: from stalhein.lysator.liu.se (localhost [127.0.0.1])
	by stalhein.lysator.liu.se (8.14.4+Sun/8.14.4) with ESMTP id
	r2Q8HeiT013205; Tue, 26 Mar 2013 09:17:40 +0100 (MET)
Received: (from nisse@localhost)
	by stalhein.lysator.liu.se (8.14.4+Sun/8.14.4/Submit) id r2Q8HdO0013204;
	Tue, 26 Mar 2013 09:17:39 +0100 (MET)
X-Authentication-Warning: stalhein.lysator.liu.se: nisse set sender to
	nisse@HIDDEN using -f
From: nisse@HIDDEN (Niels =?iso-8859-1?Q?M=F6ller?=)
To: Mark H Weaver <mhw@HIDDEN>
Subject: Re: bug#10519: guile and (mini-)gmp
References: <nnmx9oy83b.fsf@HIDDEN> <874np05fwz.fsf@HIDDEN>
	<nnipdfl71c.fsf@HIDDEN> <874noawh4r.fsf@HIDDEN>
	<nnpq6xg468.fsf@HIDDEN> <87zk61qkjh.fsf@HIDDEN>
	<nnlihlf69e.fsf@HIDDEN> <87lihlqc3u.fsf@HIDDEN>
	<87txotbmag.fsf@HIDDEN> <878v65frid.fsf@HIDDEN>
	<874ngpeka0.fsf@HIDDEN> <87620ph8yu.fsf@HIDDEN>
Date: Tue, 26 Mar 2013 09:17:38 +0100
In-Reply-To: <87620ph8yu.fsf@HIDDEN> (Mark H. Weaver's message of "Sun, 17
	Mar 2013 20:01:29 -0400")
Message-ID: <nnboa6mv6l.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (usg-unix-v)
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
X-Virus-Scanned: ClamAV using ClamSMTP
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.5 (/)
X-Debbugs-Envelope-To: 10519
Cc: Andy Wingo <wingo@HIDDEN>, 10519 <at> debbugs.gnu.org,
	Ludovic =?iso-8859-1?Q?Court=E8s?= <ludo@HIDDEN>,
	Torbjorn Granlund <tg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -3.2 (---)

Mark H Weaver <mhw@HIDDEN> writes:

> FYI, I've pushed patches to Guile's git repository (stable-2.0 branch)
> which eliminate the known obstacles to mini-gmp integration.

Out of curiosity, I had a quick look at the patches as posted to the
guile devel list.

For the small integer gcd code, you may want to have a look at the
tricks used in
http://gmplib.org:8000/gmp/file/304af17b9ccc/mpn/generic/gcd_1.c, the
code under GCD_1_METHOD =3D=3D 2

1. Shift out the least significant bit of both a and b (they're always
   one). Maybe you don't need this of you have some extra bits already
   (signed types, or some bits reserved for type info).

2. Then, the sign bit of a - b correctly gives the result of the
   comparison a < b. Constructing a mask from this difference is then a
   simple right shift (if >> on a signed int is not an arithmetic right
   shift, you need shift and a negation).

3. Use this bit mask when forming the absolute value |a - b|, and when
   swapping values around, to avoid unpredictable branches which
   typically are quite expensive.

Regards,
/Niels

--=20
Niels M=F6ller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.




Information forwarded to bug-guile@HIDDEN:
bug#10519; Package guile. Full text available.

Message received at 10519 <at> debbugs.gnu.org:


Received: (at 10519) by debbugs.gnu.org; 18 Mar 2013 09:21:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 18 05:21:01 2013
Received: from localhost ([127.0.0.1]:60897 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UHWFY-0006St-Lm
	for submit <at> debbugs.gnu.org; Mon, 18 Mar 2013 05:21:01 -0400
Received: from xanadu.aquilenet.fr ([88.191.123.111]:58164)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <ludo@HIDDEN>) id 1UHWFV-0006Sf-RQ
	for 10519 <at> debbugs.gnu.org; Mon, 18 Mar 2013 05:20:59 -0400
Received: from localhost (localhost [127.0.0.1])
	by xanadu.aquilenet.fr (Postfix) with ESMTP id 654A99AB8;
	Mon, 18 Mar 2013 10:19:23 +0100 (CET)
Received: from xanadu.aquilenet.fr ([127.0.0.1])
	by localhost (xanadu.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id jodmTiaxFq3q; Mon, 18 Mar 2013 10:19:23 +0100 (CET)
Received: from pluto (unknown [193.50.110.224])
	by xanadu.aquilenet.fr (Postfix) with ESMTPSA id 1CB892983;
	Mon, 18 Mar 2013 10:19:23 +0100 (CET)
From: ludo@HIDDEN (Ludovic =?utf-8?Q?Court=C3=A8s?=)
To: Mark H Weaver <mhw@HIDDEN>
Subject: Re: bug#10519: guile and (mini-)gmp
References: <nnmx9oy83b.fsf@HIDDEN> <874np05fwz.fsf@HIDDEN>
	<nnipdfl71c.fsf@HIDDEN> <874noawh4r.fsf@HIDDEN>
	<nnpq6xg468.fsf@HIDDEN> <87zk61qkjh.fsf@HIDDEN>
	<nnlihlf69e.fsf@HIDDEN> <87lihlqc3u.fsf@HIDDEN>
	<87txotbmag.fsf@HIDDEN> <878v65frid.fsf@HIDDEN>
	<874ngpeka0.fsf@HIDDEN> <87620ph8yu.fsf@HIDDEN>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: 28 =?utf-8?Q?Vent=C3=B4se?= an 221 de la =?utf-8?Q?R?=
	=?utf-8?Q?=C3=A9volution?=
X-PGP-Key-ID: 0xEA52ECF4
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA  D15D 77DD 95E2 EA52 ECF4
X-OS: x86_64-unknown-linux-gnu
Date: Mon, 18 Mar 2013 10:19:22 +0100
In-Reply-To: <87620ph8yu.fsf@HIDDEN> (Mark H. Weaver's message of "Sun, 17
	Mar 2013 20:01:29 -0400")
Message-ID: <87620p83qd.fsf@HIDDEN>
User-Agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 10519
Cc: Andy Wingo <wingo@HIDDEN>, 10519 <at> debbugs.gnu.org,
	Niels =?utf-8?Q?M=C3=B6ller?= <nisse@HIDDEN>,
	Torbjorn Granlund <tg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.2 (-)

Mark H Weaver <mhw@HIDDEN> skribis:

> FYI, I've pushed patches to Guile's git repository (stable-2.0 branch)
> which eliminate the known obstacles to mini-gmp integration.

Great, thanks!  And sorry for not following more closely...

Ludo=E2=80=99.




Information forwarded to bug-guile@HIDDEN:
bug#10519; Package guile. Full text available.

Message received at 10519 <at> debbugs.gnu.org:


Received: (at 10519) by debbugs.gnu.org; 18 Mar 2013 00:03:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 17 20:03:19 2013
Received: from localhost ([127.0.0.1]:60467 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UHNXr-000894-4t
	for submit <at> debbugs.gnu.org; Sun, 17 Mar 2013 20:03:19 -0400
Received: from world.peace.net ([96.39.62.75]:35402 ident=hope0)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <mhw@HIDDEN>) id 1UHNXp-00088v-LZ
	for 10519 <at> debbugs.gnu.org; Sun, 17 Mar 2013 20:03:18 -0400
Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com
	([209.6.91.212] helo=tines.lan)
	by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.72) (envelope-from <mhw@HIDDEN>)
	id 1UHNWF-0006bp-FT; Sun, 17 Mar 2013 20:01:39 -0400
From: Mark H Weaver <mhw@HIDDEN>
To: Andy Wingo <wingo@HIDDEN>
Subject: Re: bug#10519: guile and (mini-)gmp
References: <nnmx9oy83b.fsf@HIDDEN> <874np05fwz.fsf@HIDDEN>
	<nnipdfl71c.fsf@HIDDEN> <874noawh4r.fsf@HIDDEN>
	<nnpq6xg468.fsf@HIDDEN> <87zk61qkjh.fsf@HIDDEN>
	<nnlihlf69e.fsf@HIDDEN> <87lihlqc3u.fsf@HIDDEN>
	<87txotbmag.fsf@HIDDEN> <878v65frid.fsf@HIDDEN>
	<874ngpeka0.fsf@HIDDEN>
Date: Sun, 17 Mar 2013 20:01:29 -0400
In-Reply-To: <874ngpeka0.fsf@HIDDEN> (Mark H. Weaver's message of "Tue, 05
	Mar 2013 14:09:11 -0500")
Message-ID: <87620ph8yu.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 10519
Cc: 10519 <at> debbugs.gnu.org, Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>,
	Niels =?utf-8?Q?M=C3=B6ller?= <nisse@HIDDEN>,
	Torbjorn Granlund <tg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

FYI, I've pushed patches to Guile's git repository (stable-2.0 branch)
which eliminate the known obstacles to mini-gmp integration.

     Mark




Information forwarded to bug-guile@HIDDEN:
bug#10519; Package guile. Full text available.

Message received at 10519 <at> debbugs.gnu.org:


Received: (at 10519) by debbugs.gnu.org; 5 Mar 2013 19:09:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 05 14:09:57 2013
Received: from localhost ([127.0.0.1]:32908 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UCxFI-0000xS-Ls
	for submit <at> debbugs.gnu.org; Tue, 05 Mar 2013 14:09:54 -0500
Received: from world.peace.net ([96.39.62.75]:49235 ident=hope4)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <mhw@HIDDEN>) id 1UCxFG-0000xK-Iu
	for 10519 <at> debbugs.gnu.org; Tue, 05 Mar 2013 14:09:51 -0500
Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com
	([209.6.91.212] helo=tines.lan)
	by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.72) (envelope-from <mhw@HIDDEN>)
	id 1UCxEm-0003GO-S0; Tue, 05 Mar 2013 14:09:21 -0500
From: Mark H Weaver <mhw@HIDDEN>
To: Andy Wingo <wingo@HIDDEN>
Subject: Re: bug#10519: guile and (mini-)gmp
References: <nnmx9oy83b.fsf@HIDDEN> <874np05fwz.fsf@HIDDEN>
	<nnipdfl71c.fsf@HIDDEN> <874noawh4r.fsf@HIDDEN>
	<nnpq6xg468.fsf@HIDDEN> <87zk61qkjh.fsf@HIDDEN>
	<nnlihlf69e.fsf@HIDDEN> <87lihlqc3u.fsf@HIDDEN>
	<87txotbmag.fsf@HIDDEN> <878v65frid.fsf@HIDDEN>
Date: Tue, 05 Mar 2013 14:09:11 -0500
In-Reply-To: <878v65frid.fsf@HIDDEN> (Mark H. Weaver's message of "Sat, 02
	Mar 2013 15:58:34 -0500")
Message-ID: <874ngpeka0.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.5 (/)
X-Debbugs-Envelope-To: 10519
Cc: 10519 <at> debbugs.gnu.org, Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>,
	Niels =?utf-8?Q?M=C3=B6ller?= <nisse@HIDDEN>,
	Torbjorn Granlund <tg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

Hello all,

I wrote:
> I'm embarrassed to admit that the integration of mini-gmp into guile has
> long been waiting on my pending numerics patches.  I'll try to get going
> on this (and some other things) for the 2.0.8 release.
>
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10519#8

I've posted a new set of patches for stable-2.0 to guile-devel:

  http://lists.gnu.org/archive/html/guile-devel/2013-03/msg00011.html

This patch set eliminates the known obstacles to integration of
mini-gmp.

    Regards,
      Mark




Information forwarded to bug-guile@HIDDEN:
bug#10519; Package guile. Full text available.

Message received at 10519 <at> debbugs.gnu.org:


Received: (at 10519) by debbugs.gnu.org; 2 Mar 2013 21:45:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 02 16:45:26 2013
Received: from localhost ([127.0.0.1]:55939 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UBuFC-0001cx-Cq
	for submit <at> debbugs.gnu.org; Sat, 02 Mar 2013 16:45:26 -0500
Received: from mail.lysator.liu.se ([130.236.254.3]:57501)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <nisse@HIDDEN>) id 1UBuF9-0001cn-Rf
	for 10519 <at> debbugs.gnu.org; Sat, 02 Mar 2013 16:45:25 -0500
Received: from mail.lysator.liu.se (localhost [127.0.0.1])
	by mail.lysator.liu.se (Postfix) with ESMTP id E86304000C;
	Sat,  2 Mar 2013 22:45:16 +0100 (CET)
Received: from stalhein.lysator.liu.se (stalhein.lysator.liu.se
	[IPv6:2001:6b0:17:f0a0::cc])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.lysator.liu.se (Postfix) with ESMTPS id 6F82840005;
	Sat,  2 Mar 2013 22:45:16 +0100 (CET)
Received: from stalhein.lysator.liu.se (localhost [127.0.0.1])
	by stalhein.lysator.liu.se (8.14.4+Sun/8.14.4) with ESMTP id
	r22LjGUs005014; Sat, 2 Mar 2013 22:45:16 +0100 (MET)
Received: (from nisse@localhost)
	by stalhein.lysator.liu.se (8.14.4+Sun/8.14.4/Submit) id r22LjE0G005013;
	Sat, 2 Mar 2013 22:45:14 +0100 (MET)
X-Authentication-Warning: stalhein.lysator.liu.se: nisse set sender to
	nisse@HIDDEN using -f
From: nisse@HIDDEN (Niels =?iso-8859-1?Q?M=F6ller?=)
To: Andy Wingo <wingo@HIDDEN>
Subject: Re: bug#10519: guile and (mini-)gmp
References: <nnmx9oy83b.fsf@HIDDEN> <874np05fwz.fsf@HIDDEN>
	<nnipdfl71c.fsf@HIDDEN> <874noawh4r.fsf@HIDDEN>
	<nnpq6xg468.fsf@HIDDEN> <87zk61qkjh.fsf@HIDDEN>
	<nnlihlf69e.fsf@HIDDEN> <87lihlqc3u.fsf@HIDDEN>
	<87txotbmag.fsf@HIDDEN>
Date: Sat, 02 Mar 2013 22:45:14 +0100
In-Reply-To: <87txotbmag.fsf@HIDDEN> (Andy Wingo's message of "Sat, 02 Mar
	2013 21:04:55 +0100")
Message-ID: <nnhaktlbmd.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (usg-unix-v)
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
X-Virus-Scanned: ClamAV using ClamSMTP
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.1 (/)
X-Debbugs-Envelope-To: 10519
Cc: 10519 <at> debbugs.gnu.org, Ludovic =?iso-8859-1?Q?Court=E8s?= <ludo@HIDDEN>,
	Torbjorn Granlund <tg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.6 (--)

Andy Wingo <wingo@HIDDEN> writes:

>  1. What is the status of mini-gmp?  I understand that you use it in GM=
P
>     itself, so hopefully mini-gmp is in a good state, upstream.

The version bundled with gmp-5.1.1 is fairly solid. The first release,
with gmp-5.1.0, had some severe bugs. Testsuite has been improved since.

>  2. Has anyone looked at getting mini-gmp into Gnulib?

No idea. But I think configuration should be straight-forward: Either
you use the "real gmp", or you use mini-gmp. And in the latter case, you
know exactly what you have, so there shouldn't be any additional system
dependencies.

I'd expect the difficult issues to be (i) handling of gmp vs mini-gmp in
public headers, API and ABI, and (ii) any features you need which aren't
supported in mini-gmp. I guess you should rarely want the "system guile"
to be linked with mini-gmp, but use mini-gmp only as an option when
guile is bundled with some application.

Regards,
/Niels

--=20
Niels M=F6ller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.




Information forwarded to bug-guile@HIDDEN:
bug#10519; Package guile. Full text available.

Message received at 10519 <at> debbugs.gnu.org:


Received: (at 10519) by debbugs.gnu.org; 2 Mar 2013 20:59:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 02 15:59:08 2013
Received: from localhost ([127.0.0.1]:55879 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UBtWO-0000YP-79
	for submit <at> debbugs.gnu.org; Sat, 02 Mar 2013 15:59:08 -0500
Received: from world.peace.net ([96.39.62.75]:44962 ident=hope4)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <mhw@HIDDEN>) id 1UBtWL-0000YH-Ed
	for 10519 <at> debbugs.gnu.org; Sat, 02 Mar 2013 15:59:06 -0500
Received: from c-98-217-64-74.hsd1.ma.comcast.net ([98.217.64.74]
	helo=tines.lan)
	by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.72) (envelope-from <mhw@HIDDEN>)
	id 1UBtW1-0008Tn-87; Sat, 02 Mar 2013 15:58:45 -0500
From: Mark H Weaver <mhw@HIDDEN>
To: Andy Wingo <wingo@HIDDEN>
Subject: Re: bug#10519: guile and (mini-)gmp
References: <nnmx9oy83b.fsf@HIDDEN> <874np05fwz.fsf@HIDDEN>
	<nnipdfl71c.fsf@HIDDEN> <874noawh4r.fsf@HIDDEN>
	<nnpq6xg468.fsf@HIDDEN> <87zk61qkjh.fsf@HIDDEN>
	<nnlihlf69e.fsf@HIDDEN> <87lihlqc3u.fsf@HIDDEN>
	<87txotbmag.fsf@HIDDEN>
Date: Sat, 02 Mar 2013 15:58:34 -0500
In-Reply-To: <87txotbmag.fsf@HIDDEN> (Andy Wingo's message of "Sat, 02 Mar
	2013 21:04:55 +0100")
Message-ID: <878v65frid.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.8 (/)
X-Debbugs-Envelope-To: 10519
Cc: 10519 <at> debbugs.gnu.org, Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>,
	Niels =?utf-8?Q?M=C3=B6ller?= <nisse@HIDDEN>,
	Torbjorn Granlund <tg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

Hi Andy,

Andy Wingo <wingo@HIDDEN> writes:
> A ping on this bug on getting Guile to have the possibility of using an
> embedded copy of mini-gmp.

I'm embarrassed to admit that the integration of mini-gmp into guile has
long been waiting on my pending numerics patches.  I'll try to get going
on this (and some other things) for the 2.0.8 release.

http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10519#8

    Thanks,
      Mark




Information forwarded to bug-guile@HIDDEN:
bug#10519; Package guile. Full text available.

Message received at 10519 <at> debbugs.gnu.org:


Received: (at 10519) by debbugs.gnu.org; 2 Mar 2013 20:05:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 02 15:05:06 2013
Received: from localhost ([127.0.0.1]:55846 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UBsg5-0007oN-Vb
	for submit <at> debbugs.gnu.org; Sat, 02 Mar 2013 15:05:06 -0500
Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:55635
	helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <wingo@HIDDEN>) id 1UBsg3-0007oG-Vf
	for 10519 <at> debbugs.gnu.org; Sat, 02 Mar 2013 15:05:04 -0500
Received: from sasl.smtp.pobox.com (unknown [127.0.0.1])
	by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id CC64DC538;
	Sat,  2 Mar 2013 15:04:58 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc
	:subject:references:date:in-reply-to:message-id:mime-version
	:content-type; s=sasl; bh=YxD+QpM9qW6K94vuosKr8VjzqOc=; b=ykQhsd
	vRXmq35A8DrX5v6BInvtiYe419sC1xK8oXKK9iIlMZYvL3NVeml9lVZqQ0fM79B8
	S7W76+1s002evpxtFjnm5WTdTkgLJvq5fazcj9VKHQzA6wKcDORtXmPkd24MJbOk
	oY/5h3Cb4ibhe8oU8e4uLMtQvkOMR59FYX2dQ=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc
	:subject:references:date:in-reply-to:message-id:mime-version
	:content-type; q=dns; s=sasl; b=juD92fzTqSp5fY/ueGMZrKLFamXYPF/U
	HEWCZtlLlbQi0F/Xl8WQBPmodfruQ0pYca9+Y6vtuNA/oIgolwUX2VN4xCNN1jyb
	UufRDS1Zx3xBHaONqJqTfkwWV0aqpQnkHA6mByjAbyz9Oo8WLh5joKfvUHaoa4DJ
	bmt5N4XrPz8=
Received: from a-pb-sasl-quonix.pobox.com (unknown [127.0.0.1])
	by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id C4C3BC537;
	Sat,  2 Mar 2013 15:04:58 -0500 (EST)
Received: from badger (unknown [88.160.190.192]) (using TLSv1 with cipher
	DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by
	a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 5515FC536;
	Sat,  2 Mar 2013 15:04:58 -0500 (EST)
From: Andy Wingo <wingo@HIDDEN>
To: ludo@HIDDEN (Ludovic =?utf-8?Q?Court=C3=A8s?=)
Subject: Re: bug#10519: guile and (mini-)gmp
References: <nnmx9oy83b.fsf@HIDDEN> <874np05fwz.fsf@HIDDEN>
	<nnipdfl71c.fsf@HIDDEN> <874noawh4r.fsf@HIDDEN>
	<nnpq6xg468.fsf@HIDDEN> <87zk61qkjh.fsf@HIDDEN>
	<nnlihlf69e.fsf@HIDDEN> <87lihlqc3u.fsf@HIDDEN>
Date: Sat, 02 Mar 2013 21:04:55 +0100
In-Reply-To: <87lihlqc3u.fsf@HIDDEN> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?=
	=?utf-8?Q?s?= message of "Sun, 12 Aug 2012 00:48:21 +0200")
Message-ID: <87txotbmag.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Pobox-Relay-ID: 7577CF26-8374-11E2-B7FA-034D0E5B5709-02397024!a-pb-sasl-quonix.pobox.com
X-Spam-Score: 0.1 (/)
X-Debbugs-Envelope-To: 10519
Cc: 10519 <at> debbugs.gnu.org, Niels =?utf-8?Q?M=C3=B6ller?= <nisse@HIDDEN>,
	Torbjorn Granlund <tg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.6 (--)

Hi,

A ping on this bug on getting Guile to have the possibility of using an
embedded copy of mini-gmp.

 1. What is the status of mini-gmp?  I understand that you use it in GMP
    itself, so hopefully mini-gmp is in a good state, upstream.

 2. Has anyone looked at getting mini-gmp into Gnulib?

We are working on another Guile release and if this feature is close to
completion, it could make it into the release.

Cheers,

Andy
-- 
http://wingolog.org/




Information forwarded to bug-guile@HIDDEN:
bug#10519; Package guile. Full text available.

Message received at 10519 <at> debbugs.gnu.org:


Received: (at 10519) by debbugs.gnu.org; 11 Aug 2012 22:56:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 11 18:56:51 2012
Received: from localhost ([127.0.0.1]:50104 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1T0Kbz-0006F3-4s
	for submit <at> debbugs.gnu.org; Sat, 11 Aug 2012 18:56:51 -0400
Received: from xanadu.aquilenet.fr ([88.191.123.111]:48794)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <ludo@HIDDEN>) id 1T0Kbw-0006Eu-2N
	for 10519 <at> debbugs.gnu.org; Sat, 11 Aug 2012 18:56:49 -0400
Received: from localhost (localhost [127.0.0.1])
	by xanadu.aquilenet.fr (Postfix) with ESMTP id CBB6D8C07;
	Sun, 12 Aug 2012 00:48:22 +0200 (CEST)
Received: from xanadu.aquilenet.fr ([127.0.0.1])
	by localhost (xanadu.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 0a7oAaX5l0m5; Sun, 12 Aug 2012 00:48:22 +0200 (CEST)
Received: from pluto (reverse-83.fdn.fr [80.67.176.83])
	by xanadu.aquilenet.fr (Postfix) with ESMTPSA id 2B5BE8BCF;
	Sun, 12 Aug 2012 00:48:22 +0200 (CEST)
From: ludo@HIDDEN (Ludovic =?iso-8859-1?Q?Court=E8s?=)
To: nisse@HIDDEN (Niels =?iso-8859-1?Q?M=F6ller?=)
Subject: Re: bug#10519: guile and (mini-)gmp
References: <nnmx9oy83b.fsf@HIDDEN> <874np05fwz.fsf@HIDDEN>
	<nnipdfl71c.fsf@HIDDEN> <874noawh4r.fsf@HIDDEN>
	<nnpq6xg468.fsf@HIDDEN> <87zk61qkjh.fsf@HIDDEN>
	<nnlihlf69e.fsf@HIDDEN>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: 26 Thermidor an 220 de la =?iso-8859-1?Q?R=E9volutio?=
	=?iso-8859-1?Q?n?=
X-PGP-Key-ID: 0xEA52ECF4
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA  D15D 77DD 95E2 EA52 ECF4
X-OS: x86_64-unknown-linux-gnu
Date: Sun, 12 Aug 2012 00:48:21 +0200
In-Reply-To: <nnlihlf69e.fsf@HIDDEN> ("Niels
	\=\?iso-8859-1\?Q\?M\=F6ller\=22's\?\=
	message of "Sat, 11 Aug 2012 23:50:05 +0200")
Message-ID: <87lihlqc3u.fsf@HIDDEN>
User-Agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -1.2 (-)
X-Debbugs-Envelope-To: 10519
Cc: 10519 <at> debbugs.gnu.org, Torbjorn Granlund <tg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.2 (-)

nisse@HIDDEN (Niels M=C3=B6ller) skribis:

> ludo@HIDDEN (Ludovic Court=C3=A8s) writes:
>
>> For me/us, the best workflow would be to have a Gnulib module.  That
>> way, whenever GMP developers fix a bug in mini-gmp, we automatically get
>> the fix when running =E2=80=9Cgnulib-tool --update=E2=80=9D.
>
> I guess you can do whatever you want in gnulib. But it should be made
> very clear that the gmp repo is the "official" version. Some gmp
> developers would be upset if a mini-gmp version in gnulib starts to
> diverge.

Yes, sure.  There are cases where Gnulib contains copies of code
actually maintained elsewhere, such as in glibc.  I=E2=80=99ll check with t=
he
Gnulib folks whether/how such an arrangement could be made.

>> What about the maintenance overhead for GMP developers?  I mean, of
>> those 5000 lines, most are copied from GMP, right?
>
> Not really. Some of that code is of course copied from various other gmp
> files, but a lot of it is written from scratch, giving priority to
> simplicity over performance.

OK.

>> So, bugs found in GMP may have to be fixed in mini-GMP too, for
>> instance.
>
> That's possible, but I don't think it's likely to be a big problem. I'd
> expect the typical bug in mini-gmp to be in the code which is *not*
> copied from other GMP files. And I'd expect the typical bug in gmp to be
> in complex algorithms or assembly code, which doesn't have any
> counterpart in mini-gmp.

Right.

> mini-gmp does have a reasonable testsuite, even if it's not as thorough
> as the main gmp testsuite. And mini-gmp is used in a normal gmp build
> (via bootstrap.c), for computing various tables used by the main gmp
> code. So the gmp project itself also depends on mini-gmp.

OK, good to know.  ;-)

Thanks!

Ludo=E2=80=99.




Information forwarded to bug-guile@HIDDEN:
bug#10519; Package guile. Full text available.

Message received at 10519 <at> debbugs.gnu.org:


Received: (at 10519) by debbugs.gnu.org; 11 Aug 2012 21:58:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 11 17:58:36 2012
Received: from localhost ([127.0.0.1]:50028 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1T0Jhc-00042P-0g
	for submit <at> debbugs.gnu.org; Sat, 11 Aug 2012 17:58:36 -0400
Received: from mail.lysator.liu.se ([130.236.254.3]:35119)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <nisse@HIDDEN>) id 1T0JhZ-00042G-In
	for 10519 <at> debbugs.gnu.org; Sat, 11 Aug 2012 17:58:34 -0400
Received: from mail.lysator.liu.se (localhost [127.0.0.1])
	by mail.lysator.liu.se (Postfix) with ESMTP id 4F2E54066D;
	Sat, 11 Aug 2012 23:50:09 +0200 (CEST)
Received: from stalhein.lysator.liu.se (stalhein.lysator.liu.se
	[IPv6:2001:6b0:17:f0a0::cc])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.lysator.liu.se (Postfix) with ESMTPS id D4EDB40656;
	Sat, 11 Aug 2012 23:50:07 +0200 (CEST)
Received: from stalhein.lysator.liu.se (localhost [127.0.0.1])
	by stalhein.lysator.liu.se (8.14.4+Sun/8.14.4) with ESMTP id
	q7BLo7Ab012974; Sat, 11 Aug 2012 23:50:07 +0200 (MEST)
Received: (from nisse@localhost)
	by stalhein.lysator.liu.se (8.14.4+Sun/8.14.4/Submit) id q7BLo5rk012973;
	Sat, 11 Aug 2012 23:50:05 +0200 (MEST)
X-Authentication-Warning: stalhein.lysator.liu.se: nisse set sender to
	nisse@HIDDEN using -f
From: nisse@HIDDEN (Niels =?iso-8859-1?Q?M=F6ller?=)
To: ludo@HIDDEN (Ludovic =?iso-8859-1?Q?Court=E8s?=)
Subject: Re: bug#10519: guile and (mini-)gmp
References: <nnmx9oy83b.fsf@HIDDEN> <874np05fwz.fsf@HIDDEN>
	<nnipdfl71c.fsf@HIDDEN> <874noawh4r.fsf@HIDDEN>
	<nnpq6xg468.fsf@HIDDEN> <87zk61qkjh.fsf@HIDDEN>
Date: Sat, 11 Aug 2012 23:50:05 +0200
In-Reply-To: <87zk61qkjh.fsf@HIDDEN> ("Ludovic =?iso-8859-1?Q?Court=E8s?=
	=?iso-8859-1?Q?=22's?= message of "Sat, 11
	Aug 2012 21:46:10 +0200")
Message-ID: <nnlihlf69e.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (usg-unix-v)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Virus-Scanned: ClamAV using ClamSMTP
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 10519
Cc: 10519 <at> debbugs.gnu.org, Torbjorn Granlund <tg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

ludo@HIDDEN (Ludovic Court=C3=A8s) writes:

> For me/us, the best workflow would be to have a Gnulib module.  That
> way, whenever GMP developers fix a bug in mini-gmp, we automatically get
> the fix when running =E2=80=9Cgnulib-tool --update=E2=80=9D.

I guess you can do whatever you want in gnulib. But it should be made
very clear that the gmp repo is the "official" version. Some gmp
developers would be upset if a mini-gmp version in gnulib starts to
diverge.

> What about the maintenance overhead for GMP developers?  I mean, of
> those 5000 lines, most are copied from GMP, right?

Not really. Some of that code is of course copied from various other gmp
files, but a lot of it is written from scratch, giving priority to
simplicity over performance.

> So, bugs found in GMP may have to be fixed in mini-GMP too, for
> instance.

That's possible, but I don't think it's likely to be a big problem. I'd
expect the typical bug in mini-gmp to be in the code which is *not*
copied from other GMP files. And I'd expect the typical bug in gmp to be
in complex algorithms or assembly code, which doesn't have any
counterpart in mini-gmp.

mini-gmp does have a reasonable testsuite, even if it's not as thorough
as the main gmp testsuite. And mini-gmp is used in a normal gmp build
(via bootstrap.c), for computing various tables used by the main gmp
code. So the gmp project itself also depends on mini-gmp.

Reards,
/Niels

--=20
Niels M=C3=B6ller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.




Information forwarded to bug-guile@HIDDEN:
bug#10519; Package guile. Full text available.

Message received at 10519 <at> debbugs.gnu.org:


Received: (at 10519) by debbugs.gnu.org; 11 Aug 2012 19:54:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 11 15:54:39 2012
Received: from localhost ([127.0.0.1]:49890 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1T0Hle-0001HY-QC
	for submit <at> debbugs.gnu.org; Sat, 11 Aug 2012 15:54:39 -0400
Received: from xanadu.aquilenet.fr ([88.191.123.111]:51983)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <ludo@HIDDEN>) id 1T0Hlc-0001HQ-Ad
	for 10519 <at> debbugs.gnu.org; Sat, 11 Aug 2012 15:54:37 -0400
Received: from localhost (localhost [127.0.0.1])
	by xanadu.aquilenet.fr (Postfix) with ESMTP id 56D938C19;
	Sat, 11 Aug 2012 21:46:12 +0200 (CEST)
Received: from xanadu.aquilenet.fr ([127.0.0.1])
	by localhost (xanadu.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id ZaEL2p0zaoka; Sat, 11 Aug 2012 21:46:12 +0200 (CEST)
Received: from pluto (reverse-83.fdn.fr [80.67.176.83])
	by xanadu.aquilenet.fr (Postfix) with ESMTPSA id A289129E9;
	Sat, 11 Aug 2012 21:46:11 +0200 (CEST)
From: ludo@HIDDEN (Ludovic =?iso-8859-1?Q?Court=E8s?=)
To: nisse@HIDDEN (Niels =?iso-8859-1?Q?M=F6ller?=)
Subject: Re: bug#10519: guile and (mini-)gmp
References: <nnmx9oy83b.fsf@HIDDEN> <874np05fwz.fsf@HIDDEN>
	<nnipdfl71c.fsf@HIDDEN> <874noawh4r.fsf@HIDDEN>
	<nnpq6xg468.fsf@HIDDEN>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: 25 Thermidor an 220 de la =?iso-8859-1?Q?R=E9volutio?=
	=?iso-8859-1?Q?n?=
X-PGP-Key-ID: 0xEA52ECF4
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA  D15D 77DD 95E2 EA52 ECF4
X-OS: x86_64-unknown-linux-gnu
Date: Sat, 11 Aug 2012 21:46:10 +0200
In-Reply-To: <nnpq6xg468.fsf@HIDDEN> ("Niels
	\=\?iso-8859-1\?Q\?M\=F6ller\=22's\?\=
	message of "Sat, 11 Aug 2012 11:37:35 +0200")
Message-ID: <87zk61qkjh.fsf@HIDDEN>
User-Agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -1.2 (-)
X-Debbugs-Envelope-To: 10519
Cc: 10519 <at> debbugs.gnu.org, Torbjorn Granlund <tg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.2 (-)

Hi,

nisse@HIDDEN (Niels M=C3=B6ller) skribis:

> ludo@HIDDEN (Ludovic Court=C3=A8s) writes:
>
>> Yes, thanks.  I just tried it, and here=E2=80=99s the status:
>>
>>   - numbers.c uses =E2=80=98GMP_NUMB_BITS=E2=80=99, which is lacking;
>
> If that's really needed, it can be substituted with something like
>=20=20=20
>   #ifndef GMP_NUMB_BITS
>   #include <limits.h>
>   #define GMP_NUMB_BITS (CHAR_BIT*sizeof(mp_limb_t))
>   #endif

OK.

[...]

>>   - random.c uses =E2=80=98mpz_realloc2=E2=80=99, also lacking.
>
> That call could be conditional on HAVE_LIBGMP, I think.

Right.

>> Currently including <libguile.h> pulls <gmp.h>.  When mini-GMP is used
>> instead, then <libguile/mini-gmp.h> would be pulled instead,
>> transparently.
>
> Might work. You'd need to document that a guile application which wants
> to work with mini-gmp should never include gmp.h directly.

Yes.

>>> Users may also need some way of figuring out if they need to link with
>>> -lgmp or not.
>>
>> libguile-2.0.la and guile-2.0.pc would provide that info.
>
> And on ELF-systems, you should record the dependency (or lack thereof)
> directly in libguile.so.

Of course.

>> I=E2=80=99m slightly concerned about mini-gmp, though.  It=E2=80=99s alm=
ost 5000 lines,
>> mostly copied from GMP AIUI, but with no way to synchronize.  How do you
>> consider the maintenance cost of this?
>
> My view is that you should copy mini-gmp from some gmp release or from
> the main gmp repo. When you have a version which works for you, you
> shouldn't need to modify it or update it very often (maybe once for each
> gmp release or so).

For me/us, the best workflow would be to have a Gnulib module.  That
way, whenever GMP developers fix a bug in mini-gmp, we automatically get
the fix when running =E2=80=9Cgnulib-tool --update=E2=80=9D.

> And if you need to make any modifications, you ought to bug-report the
> corresponding problem. Hopefully, problems can be fixed in the gmp repo,
> so that guile can simply upgrade to the latest version from the gmp
> repo, rather than maintaining your own changes.

Sure.

What about the maintenance overhead for GMP developers?  I mean, of
those 5000 lines, most are copied from GMP, right?  So, bugs found in
GMP may have to be fixed in mini-GMP too, for instance.

Thanks,
Ludo=E2=80=99.




Information forwarded to bug-guile@HIDDEN:
bug#10519; Package guile. Full text available.

Message received at 10519 <at> debbugs.gnu.org:


Received: (at 10519) by debbugs.gnu.org; 11 Aug 2012 09:46:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 11 05:46:03 2012
Received: from localhost ([127.0.0.1]:48205 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1T08Gg-0001ei-P8
	for submit <at> debbugs.gnu.org; Sat, 11 Aug 2012 05:46:03 -0400
Received: from mail.lysator.liu.se ([130.236.254.3]:39302)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <nisse@HIDDEN>) id 1T08Gd-0001eJ-TT
	for 10519 <at> debbugs.gnu.org; Sat, 11 Aug 2012 05:46:01 -0400
Received: from mail.lysator.liu.se (localhost [127.0.0.1])
	by mail.lysator.liu.se (Postfix) with ESMTP id 6D70D4005C;
	Sat, 11 Aug 2012 11:37:38 +0200 (CEST)
Received: from stalhein.lysator.liu.se (stalhein.lysator.liu.se
	[IPv6:2001:6b0:17:f0a0::cc])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.lysator.liu.se (Postfix) with ESMTPS id 5DF6240056;
	Sat, 11 Aug 2012 11:37:37 +0200 (CEST)
Received: from stalhein.lysator.liu.se (localhost [127.0.0.1])
	by stalhein.lysator.liu.se (8.14.4+Sun/8.14.4) with ESMTP id
	q7B9baMh001539; Sat, 11 Aug 2012 11:37:36 +0200 (MEST)
Received: (from nisse@localhost)
	by stalhein.lysator.liu.se (8.14.4+Sun/8.14.4/Submit) id q7B9bZKL001538;
	Sat, 11 Aug 2012 11:37:35 +0200 (MEST)
X-Authentication-Warning: stalhein.lysator.liu.se: nisse set sender to
	nisse@HIDDEN using -f
From: nisse@HIDDEN (Niels =?iso-8859-1?Q?M=F6ller?=)
To: ludo@HIDDEN (Ludovic =?iso-8859-1?Q?Court=E8s?=)
Subject: Re: bug#10519: guile and (mini-)gmp
References: <nnmx9oy83b.fsf@HIDDEN> <874np05fwz.fsf@HIDDEN>
	<nnipdfl71c.fsf@HIDDEN> <874noawh4r.fsf@HIDDEN>
Date: Sat, 11 Aug 2012 11:37:35 +0200
In-Reply-To: <874noawh4r.fsf@HIDDEN> ("Ludovic =?iso-8859-1?Q?Court=E8s?=
	=?iso-8859-1?Q?=22's?= message of "Fri, 10
	Aug 2012 23:51:00 +0200")
Message-ID: <nnpq6xg468.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (usg-unix-v)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Virus-Scanned: ClamAV using ClamSMTP
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 10519
Cc: 10519 <at> debbugs.gnu.org, Torbjorn Granlund <tg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

ludo@HIDDEN (Ludovic Court=C3=A8s) writes:

> Yes, thanks.  I just tried it, and here=E2=80=99s the status:
>
>   - numbers.c uses =E2=80=98GMP_NUMB_BITS=E2=80=99, which is lacking;

If that's really needed, it can be substituted with something like
=20=20
  #ifndef GMP_NUMB_BITS
  #include <limits.h>
  #define GMP_NUMB_BITS (CHAR_BIT*sizeof(mp_limb_t))
  #endif

I hesitate to add it to mini-gmp.h, unless I can find a way to define it
without relying on limits.h or autoconf.

>   - it also still uses mpq=E2=80=99s, as Mark noted;

This is being addressed, I hope.

>   - random.c uses =E2=80=98mpz_realloc2=E2=80=99, also lacking.

That call could be conditional on HAVE_LIBGMP, I think.

> Currently including <libguile.h> pulls <gmp.h>.  When mini-GMP is used
> instead, then <libguile/mini-gmp.h> would be pulled instead,
> transparently.

Might work. You'd need to document that a guile application which wants
to work with mini-gmp should never include gmp.h directly.

>> Users may also need some way of figuring out if they need to link with
>> -lgmp or not.
>
> libguile-2.0.la and guile-2.0.pc would provide that info.

And on ELF-systems, you should record the dependency (or lack thereof)
directly in libguile.so.

> I=E2=80=99m slightly concerned about mini-gmp, though.  It=E2=80=99s almo=
st 5000 lines,
> mostly copied from GMP AIUI, but with no way to synchronize.  How do you
> consider the maintenance cost of this?

My view is that you should copy mini-gmp from some gmp release or from
the main gmp repo. When you have a version which works for you, you
shouldn't need to modify it or update it very often (maybe once for each
gmp release or so).

And if you need to make any modifications, you ought to bug-report the
corresponding problem. Hopefully, problems can be fixed in the gmp repo,
so that guile can simply upgrade to the latest version from the gmp
repo, rather than maintaining your own changes.

The GMP developers have also considered adding #ifdef:ery in mini-gmp.c,
to let the application specify precisely which features are wanted.

(And I'm not sure what you mean with "GMP AIUI").

Regards,
/Niels

--=20
Niels M=C3=B6ller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.




Information forwarded to bug-guile@HIDDEN:
bug#10519; Package guile. Full text available.

Message received at 10519 <at> debbugs.gnu.org:


Received: (at 10519) by debbugs.gnu.org; 10 Aug 2012 21:59:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 10 17:59:25 2012
Received: from localhost ([127.0.0.1]:47646 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SzxEq-0001pm-VO
	for submit <at> debbugs.gnu.org; Fri, 10 Aug 2012 17:59:25 -0400
Received: from xanadu.aquilenet.fr ([88.191.123.111]:48637)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <ludo@HIDDEN>) id 1SzxEn-0001pc-NX
	for 10519 <at> debbugs.gnu.org; Fri, 10 Aug 2012 17:59:23 -0400
Received: from localhost (localhost [127.0.0.1])
	by xanadu.aquilenet.fr (Postfix) with ESMTP id 1EA5011F0;
	Fri, 10 Aug 2012 23:51:02 +0200 (CEST)
Received: from xanadu.aquilenet.fr ([127.0.0.1])
	by localhost (xanadu.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id wy1uHCj4fgGT; Fri, 10 Aug 2012 23:51:02 +0200 (CEST)
Received: from pluto (reverse-83.fdn.fr [80.67.176.83])
	by xanadu.aquilenet.fr (Postfix) with ESMTPSA id 590C82B8;
	Fri, 10 Aug 2012 23:51:01 +0200 (CEST)
From: ludo@HIDDEN (Ludovic =?iso-8859-1?Q?Court=E8s?=)
To: nisse@HIDDEN (Niels =?iso-8859-1?Q?M=F6ller?=)
Subject: Re: bug#10519: guile and (mini-)gmp
References: <nnmx9oy83b.fsf@HIDDEN> <874np05fwz.fsf@HIDDEN>
	<nnipdfl71c.fsf@HIDDEN>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: 24 Thermidor an 220 de la =?iso-8859-1?Q?R=E9volutio?=
	=?iso-8859-1?Q?n?=
X-PGP-Key-ID: 0xEA52ECF4
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA  D15D 77DD 95E2 EA52 ECF4
X-OS: x86_64-unknown-linux-gnu
Date: Fri, 10 Aug 2012 23:51:00 +0200
In-Reply-To: <nnipdfl71c.fsf@HIDDEN> ("Niels
	\=\?iso-8859-1\?Q\?M\=F6ller\=22's\?\=
	message of "Mon, 23 Jul 2012 01:17:51 +0200")
Message-ID: <874noawh4r.fsf@HIDDEN>
User-Agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -1.2 (-)
X-Debbugs-Envelope-To: 10519
Cc: 10519 <at> debbugs.gnu.org, Torbjorn Granlund <tg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.2 (-)

Hi Niels,

nisse@HIDDEN (Niels M=C3=B6ller) skribis:

> ludo@HIDDEN (Ludovic Court=C3=A8s) writes:
>
>> Reviving the discussion, as we=E2=80=99ve been discussing this at the GH=
M, and
>> some people would really like to see it happen.  :-)
>
> Great! Any summary of the discussion, for those of us who couldn't make
> it there?

Mostly a few people reaffirmed the need for this.

> I'm attaching a patch from I tree I have around, without reading it
> carefully. I'm not sure this is the latest version I worked with. Maybe
> it's of some use.

Yes, thanks.  I just tried it, and here=E2=80=99s the status:

  - numbers.c uses =E2=80=98GMP_NUMB_BITS=E2=80=99, which is lacking;
  - it also still uses mpq=E2=80=99s, as Mark noted;
  - random.c uses =E2=80=98mpz_realloc2=E2=80=99, also lacking.

>>> 1. The header file libguile.h. As far as I understand, this is a public
>>>    header file and it's use of <gmp.h> means that the public guile ABI
>>>    depends on gmp.
>>
>> The problem is that there=E2=80=99s a public API dealing with mpz_t:
>
> Exactly. To me, that seems like a potentially hairy problem to get
> right.
>
>>   SCM_API void scm_to_mpz (SCM x, mpz_t rop);
>>   SCM_API SCM  scm_from_mpz (mpz_t rop);
>>
>> So, when mini-gmp is used, a <gmp.h> header should be installed as well,
>> say under <libguile/mini-gmp.h>.  WDYT?
>
> Maybe it would make sense with a level of indirection. User's could
> include libguile/bignum.h, which would in turn include either mini-gmp.h
> or the real gmp.h, depending on how guile was configured.

Users are only supposed to include <libguile.h>; headers under
libguile/ aren=E2=80=99t meant to be included directly.

Currently including <libguile.h> pulls <gmp.h>.  When mini-GMP is used
instead, then <libguile/mini-gmp.h> would be pulled instead,
transparently.

> Users may also need some way of figuring out if they need to link with
> -lgmp or not.

libguile-2.0.la and guile-2.0.pc would provide that info.

>>> Since mini-gmp is not binary compatible,
>>
>> I don=E2=80=99t think there=E2=80=99s a problem, because only mpz_t obje=
cts appear in
>> the API, and they=E2=80=99re pointers.

[...]

> Hmm, or if you're saying that the use of mpz_t in guile's public API is
> pointers only, that that might make things a little simpler. But things
> will still break badly if the user's code is linked with gmp and guile
> uses mini-gmp, or vice versa.

Exactly, that=E2=80=99s the only case where it would break, AFAICS.  And it=
=E2=80=99s
probably an unlikely use case: users who want to use both GMP and Guile
surely have libguile linked against GMP.

>>> 4. mini-gmp has no mp_set_memory_functions.
>
> That's added now, with the subtle difference that mini-gmp doesn't pass
> a valid size for the old_size argument for the free and realloc
> functions. I don't think guile depends on that feature.

No, it doesn=E2=80=99t.

I=E2=80=99m slightly concerned about mini-gmp, though.  It=E2=80=99s almost=
 5000 lines,
mostly copied from GMP AIUI, but with no way to synchronize.  How do you
consider the maintenance cost of this?

I understand some people want this, and I=E2=80=99m happy you=E2=80=99re he=
lping, but
the amount of work and duplication involved would definitely be a
showstopper for me if you and Mark weren=E2=80=99t helping.

Thanks,
Ludo=E2=80=99.




Information forwarded to bug-guile@HIDDEN:
bug#10519; Package guile. Full text available.

Message received at 10519 <at> debbugs.gnu.org:


Received: (at 10519) by debbugs.gnu.org; 22 Jul 2012 23:24:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 22 19:24:30 2012
Received: from localhost ([127.0.0.1]:58097 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1St5Vm-0006Ll-0C
	for submit <at> debbugs.gnu.org; Sun, 22 Jul 2012 19:24:30 -0400
Received: from mail.lysator.liu.se ([130.236.254.3]:53890)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <nisse@HIDDEN>) id 1St5Vi-0006Lc-7D
	for 10519 <at> debbugs.gnu.org; Sun, 22 Jul 2012 19:24:28 -0400
Received: from mail.lysator.liu.se (localhost [127.0.0.1])
	by mail.lysator.liu.se (Postfix) with ESMTP id 5AE1640006;
	Mon, 23 Jul 2012 01:17:54 +0200 (CEST)
Received: from stalhein.lysator.liu.se (stalhein.lysator.liu.se
	[IPv6:2001:6b0:17:f0a0::cc])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.lysator.liu.se (Postfix) with ESMTPS id 0B5AD40005;
	Mon, 23 Jul 2012 01:17:53 +0200 (CEST)
Received: from stalhein.lysator.liu.se (localhost [127.0.0.1])
	by stalhein.lysator.liu.se (8.14.4+Sun/8.14.4) with ESMTP id
	q6MNHrqG015301; Mon, 23 Jul 2012 01:17:53 +0200 (MEST)
Received: (from nisse@localhost)
	by stalhein.lysator.liu.se (8.14.4+Sun/8.14.4/Submit) id q6MNHq3U015300;
	Mon, 23 Jul 2012 01:17:52 +0200 (MEST)
X-Authentication-Warning: stalhein.lysator.liu.se: nisse set sender to
	nisse@HIDDEN using -f
From: nisse@HIDDEN (Niels =?iso-8859-1?Q?M=F6ller?=)
To: ludo@HIDDEN (Ludovic =?iso-8859-1?Q?Court=E8s?=)
Subject: Re: bug#10519: guile and (mini-)gmp
References: <nnmx9oy83b.fsf@HIDDEN> <874np05fwz.fsf@HIDDEN>
Date: Mon, 23 Jul 2012 01:17:51 +0200
In-Reply-To: <874np05fwz.fsf@HIDDEN> ("Ludovic =?iso-8859-1?Q?Court=E8s?=
	=?iso-8859-1?Q?=22's?= message of "Sun, 22
	Jul 2012 11:00:28 +0200")
Message-ID: <nnipdfl71c.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (usg-unix-v)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Virus-Scanned: ClamAV using ClamSMTP
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 10519
Cc: 10519 <at> debbugs.gnu.org, Torbjorn Granlund <tg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

ludo@HIDDEN (Ludovic Court=C3=A8s) writes:

> Reviving the discussion, as we=E2=80=99ve been discussing this at the GHM=
, and
> some people would really like to see it happen.  :-)

Great! Any summary of the discussion, for those of us who couldn't make
it there?

> nisse@HIDDEN (Niels M=C3=B6ller) skribis:
>
>> To try that out, I'm working with a slightly patched guile:
>
> Do you still have the patch around?

I'm attaching a patch from I tree I have around, without reading it
carefully. I'm not sure this is the latest version I worked with. Maybe
it's of some use.

>> 1. The header file libguile.h. As far as I understand, this is a public
>>    header file and it's use of <gmp.h> means that the public guile ABI
>>    depends on gmp.
>
> The problem is that there=E2=80=99s a public API dealing with mpz_t:

Exactly. To me, that seems like a potentially hairy problem to get
right.

>   SCM_API void scm_to_mpz (SCM x, mpz_t rop);
>   SCM_API SCM  scm_from_mpz (mpz_t rop);
>
> So, when mini-gmp is used, a <gmp.h> header should be installed as well,
> say under <libguile/mini-gmp.h>.  WDYT?

Maybe it would make sense with a level of indirection. User's could
include libguile/bignum.h, which would in turn include either mini-gmp.h
or the real gmp.h, depending on how guile was configured. Users may also
need some way of figuring out if they need to link with -lgmp or not.

>> Since mini-gmp is not binary compatible,
>
> I don=E2=80=99t think there=E2=80=99s a problem, because only mpz_t objec=
ts appear in
> the API, and they=E2=80=99re pointers.

mpz_t is a typedef, which is a single element array of a semi-internal
struct. So when you declare

  mpz_t x;

you are really declaring a struct, not a pointer (and then the array
type automatically "decays" to a pointer when passed as a function
argument).

But it's likely that mini-gmp will use the same size of that struct. And
even the same layout. I think the main ABI incompatibilities are that

1. symbol names, as seen by the linker, are different. With gmp, mpz_foo
   is a name mangling #define, and the real name is ___gmpz_foo.
   mini-gmp doesn't do that.

2. mp_limb_t may be of different size: With mini-gmp, it's always
   unsigned long, with gmp it's unsigned long long on some platforms
   (notably 64-bit windows, I think).

Hmm, or if you're saying that the use of mpz_t in guile's public API is
pointers only, that that might make things a little simpler. But things
will still break badly if the user's code is linked with gmp and guile
uses mini-gmp, or vice versa.

>> 4. mini-gmp has no mp_set_memory_functions.

That's added now, with the subtle difference that mini-gmp doesn't pass
a valid size for the old_size argument for the free and realloc
functions. I don't think guile depends on that feature.

Please also note that the most recent version of mini-gmp is now the one
included in the main gmp repo.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline; filename=guile-mini-gmp.patch

diff --git a/configure.ac b/configure.ac
index a32ff4b..089dfbe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -146,6 +146,10 @@ AC_ARG_ENABLE(regex,
   [  --disable-regex         omit regular expression interfaces],,
   enable_regex=yes)
 
+AC_ARG_ENABLE(gmp,
+  [  --disable-gmp	     omit high performance bignums],,
+  enable_gmp=yes)
+
 AC_ARG_ENABLE([deprecated],
   AS_HELP_STRING([--disable-deprecated],[omit deprecated features]))
 
@@ -869,15 +873,20 @@ fi
 AC_CACHE_SAVE
 
 dnl GMP tests
+if test "x$enable_gmp" != xno ; then
 AC_LIB_HAVE_LINKFLAGS([gmp],
   [],
   [#include <gmp.h>],
   [mpz_import (0, 0, 0, 0, 0, 0, 0);])
 
 if test "x$HAVE_LIBGMP" != "xyes"; then
-  AC_MSG_ERROR([GNU MP 4.1 or greater not found, see README])
+  AC_MSG_NOTICE([GNU MP 4.1 or greater not found, see README])
+  enable_gmp=no
+fi
+fi
+if test "x$enable_gmp" = xno ; then
+  AC_LIBOBJ([mini-gmp])
 fi
-
 dnl GNU libunistring is checked for by Gnulib's `libunistring' module.
 if test "x$LTLIBUNISTRING" = "x"; then
   AC_MSG_ERROR([GNU libunistring is required, please install it.])
@@ -1253,7 +1262,7 @@ main (int argc, char **argv)
 # Boehm's GC library
 #
 #--------------------------------------------------------------------
-PKG_CHECK_MODULES([BDW_GC], [bdw-gc])
+# PKG_CHECK_MODULES([BDW_GC], [bdw-gc])
 
 save_LIBS="$LIBS"
 LIBS="$BDW_GC_LIBS $LIBS"
diff --git a/libguile.h b/libguile.h
index 7ac98a5..457dd66 100644
--- a/libguile.h
+++ b/libguile.h
@@ -22,8 +22,11 @@
 
 /* This needs to be included outside of the extern "C" block.
  */
+#if HAVE_LIBGMP
 #include <gmp.h>
-
+#else
+#include "libguile/mini-gmp.h"
+#endif
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/libguile/bytevectors.c b/libguile/bytevectors.c
index 811e8d8..240e457 100644
--- a/libguile/bytevectors.c
+++ b/libguile/bytevectors.c
@@ -24,7 +24,11 @@
 #include <alloca.h>
 #include <assert.h>
 
+#if HAVE_LIBGMP
 #include <gmp.h>
+#else
+#include "mini-gmp.h"
+#endif
 
 #include "libguile/_scm.h"
 #include "libguile/extensions.h"
diff --git a/libguile/init.c b/libguile/init.c
index 35ab856..bb79422 100644
--- a/libguile/init.c
+++ b/libguile/init.c
@@ -29,7 +29,11 @@
 #include <stdio.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#if HAVE_LIBGMP
 #include <gmp.h>
+#else
+#include "mini-gmp.h"
+#endif
 
 #include "libguile/_scm.h"
 
diff --git a/libguile/numbers.h b/libguile/numbers.h
index b7bcfe4..166f222 100644
--- a/libguile/numbers.h
+++ b/libguile/numbers.h
@@ -22,9 +22,11 @@
  */
 
 
-
+#ifdef HAVE_LIBGMP
 #include <gmp.h>
-
+#else
+#include "mini-gmp.h"
+#endif
 #include "libguile/__scm.h"
 #include "libguile/print.h"
 
diff --git a/libguile/random.c b/libguile/random.c
index 8bc0d87..c216245 100644
--- a/libguile/random.c
+++ b/libguile/random.c
@@ -25,7 +25,11 @@
 
 #include "libguile/_scm.h"
 
+#if HAVE_LIBGMP
 #include <gmp.h>
+#else
+#include "mini-gmp.h"
+#endif
 #include <stdio.h>
 #include <math.h>
 #include <string.h>
diff --git a/libguile/socket.c b/libguile/socket.c
index d085d33..5ec20a2 100644
--- a/libguile/socket.c
+++ b/libguile/socket.c
@@ -25,7 +25,11 @@
 #endif
 
 #include <errno.h>
+#if HAVE_LIBGMP
 #include <gmp.h>
+#else
+#include "mini-gmp.h"
+#endif
 
 #include "libguile/_scm.h"
 #include "libguile/arrays.h"

--=-=-=
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable


Regards,
/Niels

--=20
Niels M=F6ller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.

--=-=-=--




Information forwarded to bug-guile@HIDDEN:
bug#10519; Package guile. Full text available.

Message received at 10519 <at> debbugs.gnu.org:


Received: (at 10519) by debbugs.gnu.org; 22 Jul 2012 09:10:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 22 05:10:56 2012
Received: from localhost ([127.0.0.1]:56823 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SssBk-0001hX-1y
	for submit <at> debbugs.gnu.org; Sun, 22 Jul 2012 05:10:56 -0400
Received: from xanadu.aquilenet.fr ([88.191.123.111]:59898)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <ludo@HIDDEN>) id 1SssBh-0001hQ-Ru
	for 10519 <at> debbugs.gnu.org; Sun, 22 Jul 2012 05:10:54 -0400
Received: from localhost (localhost [127.0.0.1])
	by xanadu.aquilenet.fr (Postfix) with ESMTP id 30E1785B3;
	Sun, 22 Jul 2012 11:04:27 +0200 (CEST)
Received: from xanadu.aquilenet.fr ([127.0.0.1])
	by localhost (xanadu.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id pqZ1vEKVNFbE; Sun, 22 Jul 2012 11:04:27 +0200 (CEST)
Received: from pluto (ip-62-143-217-138.unitymediagroup.de [62.143.217.138])
	by xanadu.aquilenet.fr (Postfix) with ESMTPSA id BBD171D5;
	Sun, 22 Jul 2012 11:04:26 +0200 (CEST)
From: ludo@HIDDEN (Ludovic =?iso-8859-1?Q?Court=E8s?=)
To: Mark H Weaver <mhw@HIDDEN>
Subject: Re: bug#10519: guile and (mini-)gmp
References: <nnmx9oy83b.fsf@HIDDEN>
	<87aa5o2bm2.fsf@HIDDEN>
Date: Sun, 22 Jul 2012 11:04:25 +0200
In-Reply-To: <87aa5o2bm2.fsf@HIDDEN> (Mark H. Weaver's message of "Mon, 16
	Jan 2012 05:19:33 -0500")
Message-ID: <87txx0415y.fsf@HIDDEN>
User-Agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -1.2 (-)
X-Debbugs-Envelope-To: 10519
Cc: 10519 <at> debbugs.gnu.org,
	Niels =?iso-8859-1?Q?M=F6ller?= <nisse@HIDDEN>,
	Torbjorn Granlund <tg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.2 (-)

Hi Mark!

Mark H Weaver <mhw@HIDDEN> skribis:

> nisse@HIDDEN (Niels M=C3=B6ller) writes:
>> 2. The next problem is maybe more a nuisance than a real problem. I'm
>>    looking at scm_i_big2dbl, in numbers.c.
>>
>>    I notice this code doesn't currently use mpz_get_d (comment says
>>    that's because gmp-4.2 and earlier didn't do well-defined rounding).

[...]

> Don't worry about this.  I have a patch set that (among other things)
> reimplements scm_i_big2dbl in a much more robust way, with proper
> rounding, and without using such low-level GMP accessors.  I posted this
> patch set to guile-devel on 7 Oct, "[PATCH] Improvements to exact
> rationals et al".  I will resubmit it soon.

Apparently this didn=E2=80=99t make it into the tree yet, right?  Could you
resubmit it?

>> 3. Occcasional use of mpq functions (do_divide, scm_inexact_to_exact),
>>    for conversion of fradctions to and from doubles. mini-gmp has no
>>    mpq-functions (and it shouldn't have), so these calls have to either
>>    be eliminated altogether, or be made conditional on HAVE_LIBGMP.
>>
>>    For conversion double->fraction, mpq seems overkill: Just multiply by
>>    a power of two to make the number an integer, to construct a fraction
>>    p / 2^k, and then eliminate any common factors of two (if fractions
>>    are required to be in some canonical form).
>
> Agreed.  I can easily reimplement this to avoid the mpq functions, and
> will do so.

Nice.  Could you look into it?  :-)

Thanks!

Ludo=E2=80=99.




Information forwarded to bug-guile@HIDDEN:
bug#10519; Package guile. Full text available.

Message received at 10519 <at> debbugs.gnu.org:


Received: (at 10519) by debbugs.gnu.org; 22 Jul 2012 09:07:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 22 05:07:02 2012
Received: from localhost ([127.0.0.1]:56816 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Sss7y-0001cM-0K
	for submit <at> debbugs.gnu.org; Sun, 22 Jul 2012 05:07:02 -0400
Received: from xanadu.aquilenet.fr ([88.191.123.111]:47126)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <ludo@HIDDEN>) id 1Sss7v-0001bw-5X
	for 10519 <at> debbugs.gnu.org; Sun, 22 Jul 2012 05:07:00 -0400
Received: from localhost (localhost [127.0.0.1])
	by xanadu.aquilenet.fr (Postfix) with ESMTP id ABD6085B3;
	Sun, 22 Jul 2012 11:00:30 +0200 (CEST)
Received: from xanadu.aquilenet.fr ([127.0.0.1])
	by localhost (xanadu.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id OqVhI3VZtOM6; Sun, 22 Jul 2012 11:00:30 +0200 (CEST)
Received: from pluto (ip-62-143-217-138.unitymediagroup.de [62.143.217.138])
	by xanadu.aquilenet.fr (Postfix) with ESMTPSA id 4FE4E1D5;
	Sun, 22 Jul 2012 11:00:30 +0200 (CEST)
From: ludo@HIDDEN (Ludovic =?iso-8859-1?Q?Court=E8s?=)
To: nisse@HIDDEN (Niels =?iso-8859-1?Q?M=F6ller?=)
Subject: Re: bug#10519: guile and (mini-)gmp
References: <nnmx9oy83b.fsf@HIDDEN>
Date: Sun, 22 Jul 2012 11:00:28 +0200
In-Reply-To: <nnmx9oy83b.fsf@HIDDEN> ("Niels
	\=\?iso-8859-1\?Q\?M\=F6ller\=22's\?\=
	message of "Sun, 15 Jan 2012 22:22:16 +0100")
Message-ID: <874np05fwz.fsf@HIDDEN>
User-Agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -1.2 (-)
X-Debbugs-Envelope-To: 10519
Cc: 10519 <at> debbugs.gnu.org, Torbjorn Granlund <tg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.2 (-)

Hello!

Reviving the discussion, as we=E2=80=99ve been discussing this at the GHM, =
and
some people would really like to see it happen.  :-)

nisse@HIDDEN (Niels M=C3=B6ller) skribis:

> To try that out, I'm working with a slightly patched guile:

Do you still have the patch around?

> 1. The header file libguile.h. As far as I understand, this is a public
>    header file and it's use of <gmp.h> means that the public guile ABI
>    depends on gmp.

The problem is that there=E2=80=99s a public API dealing with mpz_t:

  SCM_API void scm_to_mpz (SCM x, mpz_t rop);
  SCM_API SCM  scm_from_mpz (mpz_t rop);

So, when mini-gmp is used, a <gmp.h> header should be installed as well,
say under <libguile/mini-gmp.h>.  WDYT?

> Since mini-gmp is not binary compatible,

I don=E2=80=99t think there=E2=80=99s a problem, because only mpz_t objects=
 appear in
the API, and they=E2=80=99re pointers.

> 4. mini-gmp has no mp_set_memory_functions.

So apparently you eventually added them, thanks!

Thanks,
Ludo=E2=80=99.




Information forwarded to bug-guile@HIDDEN:
bug#10519; Package guile. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 4 Feb 2012 22:47:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 04 17:47:54 2012
Received: from localhost ([127.0.0.1]:54717 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1RtoOg-00061U-Gk
	for submit <at> debbugs.gnu.org; Sat, 04 Feb 2012 17:47:54 -0500
Received: from eggs.gnu.org ([140.186.70.92]:38515)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <guile-bugs@HIDDEN>) id 1RtoOe-00061I-0I
	for submit <at> debbugs.gnu.org; Sat, 04 Feb 2012 17:47:53 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <guile-bugs@HIDDEN>) id 1RtoNq-0000DN-Co
	for submit <at> debbugs.gnu.org; Sat, 04 Feb 2012 17:47:05 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD
	autolearn=unavailable version=3.3.2
Received: from lists.gnu.org ([140.186.70.17]:50399)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <guile-bugs@HIDDEN>) id 1RtoNq-0000DJ-BN
	for submit <at> debbugs.gnu.org; Sat, 04 Feb 2012 17:47:02 -0500
Received: from eggs.gnu.org ([140.186.70.92]:59445)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <guile-bugs@HIDDEN>) id 1RtoNm-0007pz-RB
	for bug-guile@HIDDEN; Sat, 04 Feb 2012 17:47:02 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <guile-bugs@HIDDEN>) id 1RtoNj-0000D1-7e
	for bug-guile@HIDDEN; Sat, 04 Feb 2012 17:46:58 -0500
Received: from plane.gmane.org ([80.91.229.3]:35643)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <guile-bugs@HIDDEN>) id 1RtoNj-0000Cu-2c
	for bug-guile@HIDDEN; Sat, 04 Feb 2012 17:46:55 -0500
Received: from list by plane.gmane.org with local (Exim 4.69)
	(envelope-from <guile-bugs@HIDDEN>) id 1RtoNf-0008MU-3n
	for bug-guile@HIDDEN; Sat, 04 Feb 2012 23:46:51 +0100
Received: from 126.1-64-87.adsl-dyn.isp.belgacom.be ([87.64.1.126])
	by main.gmane.org with esmtp (Gmexim 0.1 (Debian))
	id 1AlnuQ-0007hv-00
	for <bug-guile@HIDDEN>; Sat, 04 Feb 2012 23:46:51 +0100
Received: from ludo by 126.1-64-87.adsl-dyn.isp.belgacom.be with local (Gmexim
	0.1 (Debian)) id 1AlnuQ-0007hv-00
	for <bug-guile@HIDDEN>; Sat, 04 Feb 2012 23:46:51 +0100
X-Injected-Via-Gmane: http://gmane.org/
To: bug-guile@HIDDEN
From: ludo@HIDDEN (Ludovic =?iso-8859-1?Q?Court=E8s?=)
Subject: Re: bug#10519: guile and (mini-)gmp
Date: Sat, 04 Feb 2012 23:46:42 +0100
Lines: 24
Message-ID: <87d39ugqst.fsf@HIDDEN>
References: <nnmx9oy83b.fsf@HIDDEN>
	<87ipjojarx.fsf@HIDDEN> <nn62fnadx3.fsf@HIDDEN>
	<86r4ybk7on.fsf@HIDDEN>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Complaints-To: usenet@HIDDEN
X-Gmane-NNTP-Posting-Host: 126.1-64-87.adsl-dyn.isp.belgacom.be
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: 16 =?iso-8859-1?Q?Pluvi=F4se?= an 220 de la
	=?iso-8859-1?Q?R=E9volution?=
X-PGP-Key-ID: 0xEA52ECF4
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA  D15D 77DD 95E2 EA52 ECF4
X-OS: x86_64-unknown-linux-gnu
User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.93 (gnu/linux)
Cancel-Lock: sha1:6cix/AKkMUyeyU5EfEhaRshowbA=
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 140.186.70.17
X-Spam-Score: -4.2 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -4.2 (----)

Hello,

Torbjorn Granlund <tg@HIDDEN> skribis:

> nisse@HIDDEN (Niels Möller) writes:
>
>   Andy Wingo <wingo@HIDDEN> writes:
>   
>   > One suggestion, if it's possible: it would be great if mini-gmp could
>   > make it to be part of gnulib at some point.
>   
>   It's main home will be the GMP repo and distributions. But that doesn't
>   exclude that it's also copied into gnulib, if that's convenient.
>   
> We should make a VERY clear note in the file about the home position,
> and that the file should better not be extended and put into gnulib, to
> avoid incompatibility between two version.

Gnulib has bits from libc, for example, and in that case the module file
has “libc” in its “Maintainer” field.  So I guess the maintainer of the
mini-gmp module could be “gmp”.

Thanks,
Ludo.’





Information forwarded to bug-guile@HIDDEN:
bug#10519; Package guile. Full text available.

Message received at 10519 <at> debbugs.gnu.org:


Received: (at 10519) by debbugs.gnu.org; 3 Feb 2012 20:02:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 03 15:02:07 2012
Received: from localhost ([127.0.0.1]:52721 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1RtPKh-0002M0-B6
	for submit <at> debbugs.gnu.org; Fri, 03 Feb 2012 15:02:07 -0500
Received: from gmplib-02.nada.kth.se ([130.237.222.242]:56991
	helo=shell.gmplib.org) by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <tg@HIDDEN>) id 1RtPKe-0002Ln-0q
	for 10519 <at> debbugs.gnu.org; Fri, 03 Feb 2012 15:02:05 -0500
Received: by shell.gmplib.org (Postfix, from userid 1001)
	id 8587F12867; Fri,  3 Feb 2012 21:01:28 +0100 (CET)
To: nisse@HIDDEN (Niels =?iso-8859-1?Q?M=F6ller?=)
Subject: Re: bug#10519: guile and (mini-)gmp
References: <nnmx9oy83b.fsf@HIDDEN>
	<87ipjojarx.fsf@HIDDEN> <nn62fnadx3.fsf@HIDDEN>
From: Torbjorn Granlund <tg@HIDDEN>
Date: Fri, 03 Feb 2012 21:01:28 +0100
In-Reply-To: <nn62fnadx3.fsf@HIDDEN> ("Niels
	=?iso-8859-1?Q?M=F6ller=22's?= message of "Fri\, 03 Feb 2012 20\:56\:56
	+0100")
Message-ID: <86r4ybk7on.fsf@HIDDEN>
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (berkeley-unix)
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 10519
Cc: Andy Wingo <wingo@HIDDEN>, 10519 <at> debbugs.gnu.org,
	"Mark H. Weaver" <mhw@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

nisse@HIDDEN (Niels M=F6ller) writes:

  Andy Wingo <wingo@HIDDEN> writes:
=20=20
  > One suggestion, if it's possible: it would be great if mini-gmp could
  > make it to be part of gnulib at some point.
=20=20
  It's main home will be the GMP repo and distributions. But that doesn't
  exclude that it's also copied into gnulib, if that's convenient.
=20=20
We should make a VERY clear note in the file about the home position,
and that the file should better not be extended and put into gnulib, to
avoid incompatibility between two version.

This is not about being in control, but about avoiding to confuse users
with incompatible mini-gmp.c variants.

--=20
Torbj=F6rn




Information forwarded to bug-guile@HIDDEN:
bug#10519; Package guile. Full text available.

Message received at 10519 <at> debbugs.gnu.org:


Received: (at 10519) by debbugs.gnu.org; 3 Feb 2012 19:57:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 03 14:57:37 2012
Received: from localhost ([127.0.0.1]:52716 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1RtPGK-0002De-ON
	for submit <at> debbugs.gnu.org; Fri, 03 Feb 2012 14:57:36 -0500
Received: from mail.lysator.liu.se ([130.236.254.3]:49611)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <nisse@HIDDEN>) id 1RtPGI-0002DU-K5
	for 10519 <at> debbugs.gnu.org; Fri, 03 Feb 2012 14:57:36 -0500
Received: from mail.lysator.liu.se (localhost [127.0.0.1])
	by mail.lysator.liu.se (Postfix) with ESMTP id B733E4000C;
	Fri,  3 Feb 2012 20:56:57 +0100 (CET)
Received: from stalhein.lysator.liu.se (stalhein.lysator.liu.se
	[IPv6:2001:6b0:17:f0a0::cc])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.lysator.liu.se (Postfix) with ESMTPS id 4CA8940009;
	Fri,  3 Feb 2012 20:56:57 +0100 (CET)
Received: from stalhein.lysator.liu.se (localhost [127.0.0.1])
	by stalhein.lysator.liu.se (8.14.4+Sun/8.14.4) with ESMTP id
	q13Juvrg008024; Fri, 3 Feb 2012 20:56:57 +0100 (MET)
Received: (from nisse@localhost)
	by stalhein.lysator.liu.se (8.14.4+Sun/8.14.4/Submit) id q13Juuce008023;
	Fri, 3 Feb 2012 20:56:56 +0100 (MET)
X-Authentication-Warning: stalhein.lysator.liu.se: nisse set sender to
	nisse@HIDDEN using -f
From: nisse@HIDDEN (Niels =?iso-8859-1?Q?M=F6ller?=)
To: Andy Wingo <wingo@HIDDEN>
Subject: Re: bug#10519: guile and (mini-)gmp
References: <nnmx9oy83b.fsf@HIDDEN> <87ipjojarx.fsf@HIDDEN>
Date: Fri, 03 Feb 2012 20:56:56 +0100
In-Reply-To: <87ipjojarx.fsf@HIDDEN> (Andy Wingo's message of "Fri, 03 Feb
	2012 14:40:02 +0100")
Message-ID: <nn62fnadx3.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (usg-unix-v)
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
X-Virus-Scanned: ClamAV using ClamSMTP
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 10519
Cc: 10519 <at> debbugs.gnu.org, Torbjorn Granlund <tg@HIDDEN>,
	"Mark H. Weaver" <mhw@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

Andy Wingo <wingo@HIDDEN> writes:

> One suggestion, if it's possible: it would be great if mini-gmp could
> make it to be part of gnulib at some point.

It's main home will be the GMP repo and distributions. But that doesn't
exclude that it's also copied into gnulib, if that's convenient.

BTW, I added the mp_{get,set}_memory_functions a few days ago. Not
exercised by any tests, though.

Regards,
/Niels

--=20
Niels M=F6ller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.




Information forwarded to bug-guile@HIDDEN:
bug#10519; Package guile. Full text available.

Message received at 10519 <at> debbugs.gnu.org:


Received: (at 10519) by debbugs.gnu.org; 3 Feb 2012 19:28:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 03 14:28:37 2012
Received: from localhost ([127.0.0.1]:52632 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1RtOoH-0001Q5-6R
	for submit <at> debbugs.gnu.org; Fri, 03 Feb 2012 14:28:37 -0500
Received: from a-pb-sasl-sd.pobox.com ([74.115.168.62]:57089
	helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <wingo@HIDDEN>) id 1RtOoG-0001Q0-9j
	for 10519 <at> debbugs.gnu.org; Fri, 03 Feb 2012 14:28:36 -0500
Received: from sasl.smtp.pobox.com (unknown [127.0.0.1])
	by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 0D1A691BB;
	Fri,  3 Feb 2012 14:28:02 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc
	:subject:references:date:in-reply-to:message-id:mime-version
	:content-type; s=sasl; bh=f8c3sSyD4BWB2wzdVDj//VsPLe8=; b=ZAKAYp
	J6ogFCcbn7o3an7kKR8nmB4vADh1HADtllCGnzecd0TpA6kam9epXA4ewBkkAIJI
	XjXlrEz3HwIzqv/5QUEdOofqzpPpZN4/x3yIlqye83KQtgCahQi4IAeh8ffHj7Ut
	q1Gd4IWYrsTOiXpaA3njC4r9GEemZNxofWPVg=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc
	:subject:references:date:in-reply-to:message-id:mime-version
	:content-type; q=dns; s=sasl; b=N14Rs2DXEnk7dCY4KGn8uAzH4sHOsGR0
	cBSipI/AnyOHUUYDvwy/GlD+Qky04XK5rRqx843iFWLB+wNAOnSttQAqZcQ8FCle
	K7/S46PubJZzkEEZBg/QkTTAeHH+dbr60nioOgd2tC6LUqsaOoWcVjEl1/ykGViQ
	DIYrCieTvto=
Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1])
	by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 05E0F91BA;
	Fri,  3 Feb 2012 14:28:02 -0500 (EST)
Received: from badger (unknown [94.139.51.40]) (using TLSv1 with cipher
	DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by
	a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id E4C6991B9;
	Fri,  3 Feb 2012 14:28:00 -0500 (EST)
From: Andy Wingo <wingo@HIDDEN>
To: nisse@HIDDEN (Niels =?utf-8?Q?M=C3=B6ller?=)
Subject: Re: bug#10519: guile and (mini-)gmp
References: <nnmx9oy83b.fsf@HIDDEN>
Date: Fri, 03 Feb 2012 14:40:02 +0100
In-Reply-To: <nnmx9oy83b.fsf@HIDDEN> ("Niels =?utf-8?Q?M?=
	=?utf-8?Q?=C3=B6ller=22's?= message of "Sun,
	15 Jan 2012 22:22:16 +0100")
Message-ID: <87ipjojarx.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Pobox-Relay-ID: 2F722FB0-4E9D-11E1-AAEB-65B1DE995924-02397024!a-pb-sasl-sd.pobox.com
X-Spam-Score: -0.3 (/)
X-Debbugs-Envelope-To: 10519
Cc: 10519 <at> debbugs.gnu.org, Torbjorn Granlund <tg@HIDDEN>, "Mark H.
	Weaver" <mhw@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -0.3 (/)

Greets,

Thanks for working on this, Niels, and thanks for following up on it,
Mark.  It's great to have such knowledgeable folk working on this
problem.

One suggestion, if it's possible: it would be great if mini-gmp could
make it to be part of gnulib at some point.  That's probably the easiest
way of providing this functionality to all GNU programs, in a way that
allows changes to mini-gmp to propagate to their users (via the gnulib
update mechanism).

Cheers,

Andy
-- 
http://wingolog.org/




Information forwarded to bug-guile@HIDDEN:
bug#10519; Package guile. Full text available.

Message received at 10519 <at> debbugs.gnu.org:


Received: (at 10519) by debbugs.gnu.org; 28 Jan 2012 10:12:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 28 05:12:08 2012
Received: from localhost ([127.0.0.1]:47515 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Rr5GR-0000UZ-Lj
	for submit <at> debbugs.gnu.org; Sat, 28 Jan 2012 05:12:08 -0500
Received: from world.peace.net ([96.39.62.75]:55581 ident=hope7)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <mhw@HIDDEN>) id 1Rr5GO-0000UR-Sl
	for 10519 <at> debbugs.gnu.org; Sat, 28 Jan 2012 05:12:06 -0500
Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com
	([209.6.91.212] helo=yeeloong)
	by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.69) (envelope-from <mhw@HIDDEN>)
	id 1Rr5Fd-0001Rn-4g; Sat, 28 Jan 2012 05:11:17 -0500
From: Mark H Weaver <mhw@HIDDEN>
To: nisse@HIDDEN (Niels =?utf-8?Q?M=C3=B6ller?=)
Subject: Re: bug#10519: guile and (mini-)gmp
References: <nnmx9oy83b.fsf@HIDDEN>
	<87aa5o2bm2.fsf@HIDDEN> <nnty3gnomo.fsf@HIDDEN>
Date: Sat, 28 Jan 2012 05:10:22 -0500
In-Reply-To: <nnty3gnomo.fsf@HIDDEN> ("Niels
	\=\?utf-8\?Q\?M\?\= \=\?utf-8\?Q\?\=C3\=B6ller\=22's\?\=
	message of "Sat, 28 Jan 2012 10:49:03 +0100")
Message-ID: <87mx98kui9.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 10519
Cc: 10519 <at> debbugs.gnu.org, Torbjorn Granlund <tg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

nisse@HIDDEN (Niels M=C3=B6ller) writes:

> Mark H Weaver <mhw@HIDDEN> writes:
>
>> It would be good if you could duplicate the `mp_set_memory_functions'
>> interface in mini-gmp.
>
> I'm looking into this. I found that the GMP interface has one awkward
> feature: The current allocation size must be passed as an argument to
> the free and realloc functions. See
> http://gmplib.org/list-archives/gmp-devel/2012-January/002161.html
>
> Does guile make any use of these size arguments? I'm considering having
> mini-gmp *not* support this part of the allocation interface, and
> instead always pass zero, for the sake of simplicity.

Guile ignores the size arguments to the free and realloc functions, and
I don't anticipate ever needing them in any future version of Guile.

    Thanks,
      Mark




Information forwarded to bug-guile@HIDDEN:
bug#10519; Package guile. Full text available.

Message received at 10519 <at> debbugs.gnu.org:


Received: (at 10519) by debbugs.gnu.org; 28 Jan 2012 09:49:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 28 04:49:53 2012
Received: from localhost ([127.0.0.1]:47486 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Rr4uv-0007dD-16
	for submit <at> debbugs.gnu.org; Sat, 28 Jan 2012 04:49:53 -0500
Received: from mail.lysator.liu.se ([130.236.254.3]:53939)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <nisse@HIDDEN>) id 1Rr4ur-0007d3-DS
	for 10519 <at> debbugs.gnu.org; Sat, 28 Jan 2012 04:49:51 -0500
Received: from mail.lysator.liu.se (localhost [127.0.0.1])
	by mail.lysator.liu.se (Postfix) with ESMTP id 1901840010;
	Sat, 28 Jan 2012 10:49:05 +0100 (CET)
Received: from stalhein.lysator.liu.se (stalhein.lysator.liu.se
	[IPv6:2001:6b0:17:f0a0::cc])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.lysator.liu.se (Postfix) with ESMTPS id BCCD040008;
	Sat, 28 Jan 2012 10:49:04 +0100 (CET)
Received: from stalhein.lysator.liu.se (localhost [127.0.0.1])
	by stalhein.lysator.liu.se (8.14.4+Sun/8.14.4) with ESMTP id
	q0S9n43K006528; Sat, 28 Jan 2012 10:49:04 +0100 (MET)
Received: (from nisse@localhost)
	by stalhein.lysator.liu.se (8.14.4+Sun/8.14.4/Submit) id q0S9n3nr006527;
	Sat, 28 Jan 2012 10:49:03 +0100 (MET)
X-Authentication-Warning: stalhein.lysator.liu.se: nisse set sender to
	nisse@HIDDEN using -f
From: nisse@HIDDEN (Niels =?iso-8859-1?Q?M=F6ller?=)
To: Mark H Weaver <mhw@HIDDEN>
Subject: Re: bug#10519: guile and (mini-)gmp
References: <nnmx9oy83b.fsf@HIDDEN>
	<87aa5o2bm2.fsf@HIDDEN>
Date: Sat, 28 Jan 2012 10:49:03 +0100
In-Reply-To: <87aa5o2bm2.fsf@HIDDEN> (Mark H. Weaver's message of "Mon, 16
	Jan 2012 05:19:33 -0500")
Message-ID: <nnty3gnomo.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (usg-unix-v)
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
X-Virus-Scanned: ClamAV using ClamSMTP
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 10519
Cc: 10519 <at> debbugs.gnu.org, Torbjorn Granlund <tg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

Mark H Weaver <mhw@HIDDEN> writes:

> It would be good if you could duplicate the `mp_set_memory_functions'
> interface in mini-gmp.

I'm looking into this. I found that the GMP interface has one awkward
feature: The current allocation size must be passed as an argument to
the free and realloc functions. See
http://gmplib.org/list-archives/gmp-devel/2012-January/002161.html

Does guile make any use of these size arguments? I'm considering having
mini-gmp *not* support this part of the allocation interface, and
instead always pass zero, for the sake of simplicity. I imagine that the
vast majority of users of the custom alloction interface ignore these
argments anyway, and store allocation size for each block elsewhere,
e.g., in some block header.

Regards,
/Niels

--=20
Niels M=F6ller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.




Information forwarded to bug-guile@HIDDEN:
bug#10519; Package guile. Full text available.

Message received at 10519 <at> debbugs.gnu.org:


Received: (at 10519) by debbugs.gnu.org; 16 Jan 2012 19:22:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 16 14:22:51 2012
Received: from localhost ([127.0.0.1]:60622 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Rms8p-0006gN-9n
	for submit <at> debbugs.gnu.org; Mon, 16 Jan 2012 14:22:51 -0500
Received: from world.peace.net ([96.39.62.75]:42807)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <mhw@HIDDEN>) id 1Rms8m-0006gF-Ti
	for 10519 <at> debbugs.gnu.org; Mon, 16 Jan 2012 14:22:50 -0500
Received: from c-98-216-245-176.hsd1.ma.comcast.net ([98.216.245.176]
	helo=yeeloong)
	by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.69) (envelope-from <mhw@HIDDEN>)
	id 1Rms7n-000122-G1; Mon, 16 Jan 2012 14:21:47 -0500
From: Mark H Weaver <mhw@HIDDEN>
To: nisse@HIDDEN (Niels =?utf-8?Q?M=C3=B6ller?=)
Subject: Re: bug#10519: guile and (mini-)gmp
References: <nnmx9oy83b.fsf@HIDDEN>
	<87aa5o2bm2.fsf@HIDDEN> <nnaa5nyc5j.fsf@HIDDEN>
Date: Mon, 16 Jan 2012 14:21:12 -0500
In-Reply-To: <nnaa5nyc5j.fsf@HIDDEN> ("Niels
	\=\?utf-8\?Q\?M\?\= \=\?utf-8\?Q\?\=C3\=B6ller\=22's\?\=
	message of "Mon, 16 Jan 2012 15:06:48 +0100")
Message-ID: <871uqz313r.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 10519
Cc: 10519 <at> debbugs.gnu.org, Torbjorn Granlund <tg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

nisse@HIDDEN (Niels M=C3=B6ller) writes:

> Mark H Weaver <mhw@HIDDEN> writes:
>
>> Don't worry about this.  I have a patch set that (among other things)
>> reimplements scm_i_big2dbl in a much more robust way, with proper
>> rounding, and without using such low-level GMP accessors.  I posted this
>> patch set to guile-devel on 7 Oct, "[PATCH] Improvements to exact
>> rationals et al".  I will resubmit it soon.
>
> Nice! I take it you mean
> http://lists.gnu.org/archive/html/guile-devel/2011-10/msg00004.html?
> Please let me know when you post a new revision. I'm not subscribed to
> any guile lists.

Yes, that's the message, and I'll make sure to keep you posted.

>> nisse@HIDDEN (Niels M=C3=B6ller) writes:
>
>>> 4. mini-gmp has no mp_set_memory_functions.
>
>> No, it's much worse than that.  If most of the memory being allocated
>> are bignums, then GC might not be run until the heap is quite large.
>
> Will that be a problem in the cases where mini-gmp is relevant? I
> imagine bignums will usually be at most a dozen limbs, so the storage
> for limbs should just be a small factor larger than the storage for the
> mpz_t structs (which are allocated in scheme objects, I assume).

Even a relatively small factor can still be a problem.  Now that our VM
allows many programs to run without any evaluation-related allocation,
it's easily possible for bignums to be almost 100% of total allocations.
Suppose the ratio of limbs to mpz_t structs is N.  Then the heap will
grow to (N + 1) times the normal size before triggering GC.

Also, just because mini-gmp isn't recommended for very large numbers
doesn't mean that it won't occasionally be used for large numbers.  For
example, mini-gmp would probably do a reasonable job incrementing huge
numbers.  All it takes is a single huge counter that gets incremented
repeatedly to allocate a large amount of memory that GC doesn't know
about, and thus the heap can blow up even if only one or two of these
bignums would survive the next GC.

>> It would be good if you could duplicate the `mp_set_memory_functions'
>> interface in mini-gmp.
>
> I'll consider doing that, then. Are there any alternatives? I guess it
> should be possible (but maybe inconvenient) to examine the allocation
> count of each constructed bignum object and inform the gc.

We could do as you suggest, but this is what scm_malloc and scm_realloc
are meant to do.  Why not provide a way for mini-gmp to use them?  In
general, being able to control how limbs are allocated seems important
in any system that includes GC'd bignums.

> I imagine the bignum objects in guile are immutable once created?

Yes.

    Thanks,
      Mark




Information forwarded to bug-guile@HIDDEN:
bug#10519; Package guile. Full text available.

Message received at 10519 <at> debbugs.gnu.org:


Received: (at 10519) by debbugs.gnu.org; 16 Jan 2012 14:07:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 16 09:07:49 2012
Received: from localhost ([127.0.0.1]:59866 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1RmnDw-0007eg-I2
	for submit <at> debbugs.gnu.org; Mon, 16 Jan 2012 09:07:49 -0500
Received: from mail.lysator.liu.se ([130.236.254.3]:36491)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <nisse@HIDDEN>) id 1RmnDt-0007eY-KL
	for 10519 <at> debbugs.gnu.org; Mon, 16 Jan 2012 09:07:47 -0500
Received: from mail.lysator.liu.se (localhost [127.0.0.1])
	by mail.lysator.liu.se (Postfix) with ESMTP id ECEAB40005;
	Mon, 16 Jan 2012 15:06:49 +0100 (CET)
Received: from stalhein.lysator.liu.se (stalhein.lysator.liu.se
	[IPv6:2001:6b0:17:f0a0::cc])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.lysator.liu.se (Postfix) with ESMTPS id 9878040002;
	Mon, 16 Jan 2012 15:06:49 +0100 (CET)
Received: from stalhein.lysator.liu.se (localhost [127.0.0.1])
	by stalhein.lysator.liu.se (8.14.4+Sun/8.14.4) with ESMTP id
	q0GE6nOX011757; Mon, 16 Jan 2012 15:06:49 +0100 (MET)
Received: (from nisse@localhost)
	by stalhein.lysator.liu.se (8.14.4+Sun/8.14.4/Submit) id q0GE6mAD011756;
	Mon, 16 Jan 2012 15:06:48 +0100 (MET)
X-Authentication-Warning: stalhein.lysator.liu.se: nisse set sender to
	nisse@HIDDEN using -f
From: nisse@HIDDEN (Niels =?iso-8859-1?Q?M=F6ller?=)
To: Mark H Weaver <mhw@HIDDEN>
Subject: Re: bug#10519: guile and (mini-)gmp
References: <nnmx9oy83b.fsf@HIDDEN>
	<87aa5o2bm2.fsf@HIDDEN>
Date: Mon, 16 Jan 2012 15:06:48 +0100
In-Reply-To: <87aa5o2bm2.fsf@HIDDEN> (Mark H. Weaver's message of "Mon, 16
	Jan 2012 05:19:33 -0500")
Message-ID: <nnaa5nyc5j.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (usg-unix-v)
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
X-Virus-Scanned: ClamAV using ClamSMTP
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 10519
Cc: 10519 <at> debbugs.gnu.org, Torbjorn Granlund <tg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

Mark H Weaver <mhw@HIDDEN> writes:

> Don't worry about this.  I have a patch set that (among other things)
> reimplements scm_i_big2dbl in a much more robust way, with proper
> rounding, and without using such low-level GMP accessors.  I posted thi=
s
> patch set to guile-devel on 7 Oct, "[PATCH] Improvements to exact
> rationals et al".  I will resubmit it soon.

Nice! I take it you mean
http://lists.gnu.org/archive/html/guile-devel/2011-10/msg00004.html?
Please let me know when you post a new revision. I'm not subscribed to
any guile lists.

> nisse@HIDDEN (Niels M=F6ller) writes:

>> 4. mini-gmp has no mp_set_memory_functions.

> No, it's much worse than that.  If most of the memory being allocated
> are bignums, then GC might not be run until the heap is quite large.

Will that be a problem in the cases where mini-gmp is relevant? I
imagine bignums will usually be at most a dozen limbs, so the storage
for limbs should just be a small factor larger than the storage for the
mpz_t structs (which are allocated in scheme objects, I assume).

> It would be good if you could duplicate the `mp_set_memory_functions'
> interface in mini-gmp.

I'll consider doing that, then. Are there any alternatives? I guess it
should be possible (but maybe inconvenient) to examine the allocation
count of each constructed bignum object and inform the gc. I imagine the
bignum objects in guile are immutable once created?

Regards,
/Niels

--=20
Niels M=F6ller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.




Information forwarded to bug-guile@HIDDEN:
bug#10519; Package guile. Full text available.

Message received at 10519 <at> debbugs.gnu.org:


Received: (at 10519) by debbugs.gnu.org; 16 Jan 2012 10:21:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 16 05:21:16 2012
Received: from localhost ([127.0.0.1]:59209 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Rmjgh-0001UR-Rf
	for submit <at> debbugs.gnu.org; Mon, 16 Jan 2012 05:21:16 -0500
Received: from world.peace.net ([96.39.62.75]:58661)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <mhw@HIDDEN>) id 1Rmjge-0001UI-IW
	for 10519 <at> debbugs.gnu.org; Mon, 16 Jan 2012 05:21:13 -0500
Received: from c-98-216-245-176.hsd1.ma.comcast.net ([98.216.245.176]
	helo=yeeloong)
	by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.69) (envelope-from <mhw@HIDDEN>)
	id 1Rmjff-0007ma-Rf; Mon, 16 Jan 2012 05:20:12 -0500
From: Mark H Weaver <mhw@HIDDEN>
To: nisse@HIDDEN (Niels =?utf-8?Q?M=C3=B6ller?=)
Subject: Re: bug#10519: guile and (mini-)gmp
References: <nnmx9oy83b.fsf@HIDDEN>
Date: Mon, 16 Jan 2012 05:19:33 -0500
In-Reply-To: <nnmx9oy83b.fsf@HIDDEN> ("Niels
	\=\?utf-8\?Q\?M\?\= \=\?utf-8\?Q\?\=C3\=B6ller\=22's\?\=
	message of "Sun, 15 Jan 2012 22:22:16 +0100")
Message-ID: <87aa5o2bm2.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 10519
Cc: 10519 <at> debbugs.gnu.org, Torbjorn Granlund <tg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

Hi Niels, thanks for looking into this!

nisse@HIDDEN (Niels M=C3=B6ller) writes:
> 2. The next problem is maybe more a nuisance than a real problem. I'm
>    looking at scm_i_big2dbl, in numbers.c.
>
>    I notice this code doesn't currently use mpz_get_d (comment says
>    that's because gmp-4.2 and earlier didn't do well-defined rounding).
>
>    Next, mpz_get_d in current gmp rounds towards zero. guile wants
>    rounding to nearest, and it arranges this by testing the next lower
>    bit. Unfortunately, it can't use mpz_tstbit directly, since for
>    negative values it needs the bit of the abolute value, not of the
>    two's complement. The code instead uses mpz_getlimbn and
>    GMP_NUMB_BITS.
>
>    That's not an unreasonable way to do it, but it causes problems for
>    me because mini-gmp.h doesn't declare GMP_NUMB_BITS (and can't do,

Don't worry about this.  I have a patch set that (among other things)
reimplements scm_i_big2dbl in a much more robust way, with proper
rounding, and without using such low-level GMP accessors.  I posted this
patch set to guile-devel on 7 Oct, "[PATCH] Improvements to exact
rationals et al".  I will resubmit it soon.

> 3. Occcasional use of mpq functions (do_divide, scm_inexact_to_exact),
>    for conversion of fradctions to and from doubles. mini-gmp has no
>    mpq-functions (and it shouldn't have), so these calls have to either
>    be eliminated altogether, or be made conditional on HAVE_LIBGMP.
>
>    For conversion double->fraction, mpq seems overkill: Just multiply by
>    a power of two to make the number an integer, to construct a fraction
>    p / 2^k, and then eliminate any common factors of two (if fractions
>    are required to be in some canonical form).

Agreed.  I can easily reimplement this to avoid the mpq functions, and
will do so.

>    For fraction->double, I think the current code using mpq_get_d rounds
>    towards zero rather than towards nearest, which might not be what's
>    desired. To avoid using mpq, I think converting p/q to a double could
>    be done as follows:

The aforementioned patch set already eliminates this use of the mpq
functions.

> 4. mini-gmp has no mp_set_memory_functions. If I understand the the
>    conservative gc used with guile right, having mini-gmp always use
>    plain malloc and free should not cause any errors, just a slight
>    waste of memory in case some limbs happen to be valid pointers.

No, it's much worse than that.  If most of the memory being allocated
are bignums, then GC might not be run until the heap is quite large.
That's because the GC decides when to run based on the allocations that
it knows about.  A potentially large amount of bignum data may be
allocated before the GC heap gets big enough to trigger a collection.
It doesn't know about memory allocated with plain malloc.  However, it
_does_ now know about memory allocated with scm_malloc.

It would be good if you could duplicate the `mp_set_memory_functions'
interface in mini-gmp.

    Thanks,
      Mark




Information forwarded to bug-guile@HIDDEN:
bug#10519; Package guile. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 15 Jan 2012 22:00:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 15 17:00:30 2012
Received: from localhost ([127.0.0.1]:58953 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1RmY7p-0001UQ-AS
	for submit <at> debbugs.gnu.org; Sun, 15 Jan 2012 17:00:30 -0500
Received: from eggs.gnu.org ([140.186.70.92]:52997)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <nisse@HIDDEN>) id 1RmXXm-0000YN-Kp
	for submit <at> debbugs.gnu.org; Sun, 15 Jan 2012 16:23:17 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <nisse@HIDDEN>) id 1RmXWw-0000vR-Ma
	for submit <at> debbugs.gnu.org; Sun, 15 Jan 2012 16:22:24 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD,
	WEIRD_PORT autolearn=unavailable version=3.3.2
Received: from lists.gnu.org ([140.186.70.17]:46305)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <nisse@HIDDEN>) id 1RmXWw-0000vN-L5
	for submit <at> debbugs.gnu.org; Sun, 15 Jan 2012 16:22:22 -0500
Received: from eggs.gnu.org ([140.186.70.92]:58127)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <nisse@HIDDEN>) id 1RmXWv-0003xV-7i
	for bug-guile@HIDDEN; Sun, 15 Jan 2012 16:22:22 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <nisse@HIDDEN>) id 1RmXWt-0000vB-FL
	for bug-guile@HIDDEN; Sun, 15 Jan 2012 16:22:21 -0500
Received: from mail.lysator.liu.se ([130.236.254.3]:34004)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <nisse@HIDDEN>) id 1RmXWt-0000v7-6r
	for bug-guile@HIDDEN; Sun, 15 Jan 2012 16:22:19 -0500
Received: from mail.lysator.liu.se (localhost [127.0.0.1])
	by mail.lysator.liu.se (Postfix) with ESMTP id C50054000A;
	Sun, 15 Jan 2012 22:22:16 +0100 (CET)
Received: from stalhein.lysator.liu.se (stalhein.lysator.liu.se
	[IPv6:2001:6b0:17:f0a0::cc])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.lysator.liu.se (Postfix) with ESMTPS id B729240009;
	Sun, 15 Jan 2012 22:22:16 +0100 (CET)
Received: from stalhein.lysator.liu.se (localhost [127.0.0.1])
	by stalhein.lysator.liu.se (8.14.4+Sun/8.14.4) with ESMTP id
	q0FLMGte003197; Sun, 15 Jan 2012 22:22:16 +0100 (MET)
Received: (from nisse@localhost)
	by stalhein.lysator.liu.se (8.14.4+Sun/8.14.4/Submit) id q0FLMGTq003196;
	Sun, 15 Jan 2012 22:22:16 +0100 (MET)
X-Authentication-Warning: stalhein.lysator.liu.se: nisse set sender to
	nisse@HIDDEN using -f
From: nisse@HIDDEN (Niels =?iso-8859-1?Q?M=F6ller?=)
To: bug-guile@HIDDEN
Subject: guile and (mini-)gmp
Date: Sun, 15 Jan 2012 22:22:16 +0100
Message-ID: <nnmx9oy83b.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (usg-unix-v)
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
X-Virus-Scanned: ClamAV using ClamSMTP
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 140.186.70.17
X-Spam-Score: -3.4 (---)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Sun, 15 Jan 2012 17:00:27 -0500
Cc: Torbjorn Granlund <tg@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -3.4 (---)

Hi,

I'm hacking on something called "mini-gmp" (see
http://gmplib.org:8000/mini-gmp/). This is inteded to be a small and
simple implementation of a GMP subset, suitable for programs which needs
bignums, but which don't use very large numbers or very high
performance. (I aimed for mini-gmp.c to be smaller than gmp's
configure.in; currently, mini-gmp.c is some 10% larger).

In part, this work was triggered by a discussion on how guile's gmp
dependency is causing problems for programs using guile as an
extension language, but which don't have any particular bignum needs.
And I think minimality in terms of both dependencies and size of "core
guile" is pretty important for guile to be successful as an extension
language.

One way to use mini-gmp, which I think would be appropriate for guile,
is to bundle mini-gmp with the guile sources, and use it as a fallback
in case the real GMP is not available.

To try that out, I'm working with a slightly patched guile:

  I copied mini-gmp.c and .h to the libguile directory.

  configure.ac: Don't fail if gmp is not present, instead just add
  mini-gmp.o to LIBOBJS. And add an option --disable-gmp, to always use
  the bundled mini-gmp.

  Other files: #include <gmp.h> only when HAVE_LIBGMP is defined, and
  fall back to including "mini-gmp.h" otherwise.

I'm then compiling guile to see how far I get and solve the problems I
find.

**End of background**

I'm now going to describe a few of the problems.

1. The header file libguile.h. As far as I understand, this is a public
   header file and it's use of <gmp.h> means that the public guile ABI
   depends on gmp. Since mini-gmp is not binary compatible, that
   probably makes it more or less impossible to *install* guile when
   built with mini-gmp. The remaining case is an applications which
   bundle guile for using it as an extension language. Wnen the real gmp
   is unavailable, they still need a libguile.h which somehow includes
   mini-gmp.h rather than gmp.h.

   One solution might be to not modify include directives, but instead
   have configure create some symlink gmp.h -> mini-gmp.h in the build
   directory (to make --disable-gmp work, that directory must come
   before system directories where the real gmp-h file may be
   installed). The same directory also must be in the include path when
   building the application wanting to use guile.

2. The next problem is maybe more a nuisance than a real problem. I'm
   looking at scm_i_big2dbl, in numbers.c.

   I notice this code doesn't currently use mpz_get_d (comment says
   that's because gmp-4.2 and earlier didn't do well-defined rounding).

   Next, mpz_get_d in current gmp rounds towards zero. guile wants
   rounding to nearest, and it arranges this by testing the next lower
   bit. Unfortunately, it can't use mpz_tstbit directly, since for
   negative values it needs the bit of the abolute value, not of the
   two's complement. The code instead uses mpz_getlimbn and
   GMP_NUMB_BITS.

   That's not an unreasonable way to do it, but it causes problems for
   me because mini-gmp.h doesn't declare GMP_NUMB_BITS (and can't do,
   without including <limits.h> for CHAR_BIT, which is somewhat
   undesirable in the interface definition header, or use autoconf,
   which I'd really like to avoid here. Maybe I have to bite the
   bullet and define these constants (in mini-gmp, the correct value for
   both GMP_LIMB_BITS and GMP_NUMB_BITS is CHAR_BIT * sizeof(unsigned
   long)).

   Testing the bit in the absolute value could be done as

     mpz_init (t);
     mpz_abs (t, SCM_I_BIG_MPZ(b));
     ...mpz_tstbit(t, pos)...
     mpz_clear (t);

   but that's an unnecessary allocation and copy.

   Maybe gmp (and mini-gmp) should have a function mpz_tstbitabs (and
   similarly for other bitops) which ignore the sign? Or should there be
   some mpz_get_d-like function with configurable rounding (I imagine
   libmpfr interfaces could provide some inspiration)?

3. Occcasional use of mpq functions (do_divide, scm_inexact_to_exact),
   for conversion of fradctions to and from doubles. mini-gmp has no
   mpq-functions (and it shouldn't have), so these calls have to either
   be eliminated altogether, or be made conditional on HAVE_LIBGMP.

   For conversion double->fraction, mpq seems overkill: Just multiply by
   a power of two to make the number an integer, to construct a fraction
   p / 2^k, and then eliminate any common factors of two (if fractions
   are required to be in some canonical form).

   For fraction->double, I think the current code using mpq_get_d rounds
   towards zero rather than towards nearest, which might not be what's
   desired. To avoid using mpq, I think converting p/q to a double could
   be done as follows:

   Find k so that floor (2^k p / q) is precisely the right number of
   bits (i.e., if precicion is n bits, 2^{n-1} q <=3D 2^k p < 2^n p).
   Compute the 2^k p / q appropriately rounded, and convert to double.
   There may be some corner case when 2^k p / q to have one more bit
   when rounded (upward) than when truncated.

4. mini-gmp has no mp_set_memory_functions. If I understand the the
   conservative gc used with guile right, having mini-gmp always use
   plain malloc and free should not cause any errors, just a slight
   waste of memory in case some limbs happen to be valid pointers. Which
   should be a small problem since one shouldn't use mini-gmp if the
   numbers get large.

   In guile, the calls could then just be made conditional on
   HAVE_LIBGMP.
  =20
I'd apppreciate comments both on mini-gmp in general, and on the proper
solution of the above issues. I may be able to prepare a few patches to
guile, if I know what's desired.

Ah, and I can report one build problem: The debian package of libgc
doesn't include any .pc file, so when run without arguments, guile's
configure failed to detect the precense of this library, even though I
had the -dev package with libraries and header files installed.

I figured out I should rerun configure with BDW_GC_LIBS=3D"-lgc" and
BDW_GC_CFLAGS=3D"", and then the configure test passed, but -lgc for some
reason wasn't added where it should in the Makefiles. I had to edit the
generated libguile/Makefile and add it to LIBS there to be able to link.

Happy hacking,
/Niels

--=20
Niels M=F6ller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.




Acknowledgement sent to nisse@HIDDEN (Niels Möller):
New bug report received and forwarded. Copy sent to bug-guile@HIDDEN. Full text available.
Report forwarded to bug-guile@HIDDEN:
bug#10519; Package guile. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 31 Oct 2014 17:00:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.