
| Actually there isn't always a ByteArray# allocated; the patch got rid of
| all mpz_init() calls for the result-mpz_t (which would have allocated 1-
| limb ByteArray#s);
|
| Now instead, the single word-sized limb that would have been heap-
| allocated via mpz_init() before calling the actual GMP operation, is
| allocated on the stack instead, and only if the GMP routines need to
| grow the passed in mpz_t's an actual ByteArray# is allocated.
|
| That's why I needed a way to return either a single stack-allocated limb
| (hence the word#), *or* an heap-allocated 'ByteArray#', which lead to
| the MPZ# 3-tuple.
Interesting! To risk becoming like a broken record, have you described this overall strategy somewhere? And linked to that explanation from suitable places? This "big picture" information is invaluable.
Simon
| -----Original Message-----
| From: ghc-devs [mailto:ghc-devs-bounces@haskell.org] On Behalf Of
| Herbert Valerio Riedel
| Sent: 13 January 2014 21:50
| To: Simon Marlow
| Cc: ghc-devs@haskell.org
| Subject: Re: [commit: packages/integer-gmp] master: Allocate initial 1-
| limb mpz_t on the Stack and introduce MPZ# type (7bdcadd)
|
| On 2014-01-13 at 21:57:03 +0100, Simon Marlow wrote:
| > On 13/01/14 13:25, git@git.haskell.org wrote:
| >> Repository : ssh://git@git.haskell.org/integer-gmp
| >>
| >> On branch : master
| >> Link :
| http://ghc.haskell.org/trac/ghc/changeset/7bdcadda7e884edffb1427f0685493
| f3a2e5c5fa/integer-gmp
| >>
| >>> ---------------------------------------------------------------
| >>
| >> commit 7bdcadda7e884edffb1427f0685493f3a2e5c5fa
| >> Author: Herbert Valerio Riedel