[commit: packages/integer-gmp] master: Allocate initial 1-limb mpz_t on the Stack and introduce MPZ# type (7bdcadd)

Simon Marlow marlowsd at gmail.com
Mon Jan 13 20:57:03 UTC 2014


On 13/01/14 13:25, git at git.haskell.org wrote:
> Repository : ssh://git@git.haskell.org/integer-gmp
>
> On branch  : master
> Link       : http://ghc.haskell.org/trac/ghc/changeset/7bdcadda7e884edffb1427f0685493f3a2e5c5fa/integer-gmp
>
>> ---------------------------------------------------------------
>
> commit 7bdcadda7e884edffb1427f0685493f3a2e5c5fa
> Author: Herbert Valerio Riedel <hvr at gnu.org>
> Date:   Thu Jan 9 00:19:31 2014 +0100
>
>      Allocate initial 1-limb mpz_t on the Stack and introduce MPZ# type
>
>      We now allocate a 1-limb mpz_t on the stack instead of doing a more
>      expensive heap-allocation (especially if the heap-allocated copy becomes
>      garbage right away); this addresses #8647.

While this is quite cool (turning some J# back into S#), I don't 
understand why you've done it this way.  Couldn't it be done in the 
Haskell layer rather than modifying the primops?  The ByteArray# has 
already been allocated by GMP, so you don't lose anything by returning 
it to Haskell and checking the size there.  Then all the DUMMY_BYTEARRAY 
stuff would go away.

Cheers,
Simon



More information about the ghc-devs mailing list