[GHC] #8647: Reduce allocations in `integer-gmp`

GHC ghc-devs at haskell.org
Sun Jan 12 23:45:07 UTC 2014


#8647: Reduce allocations in `integer-gmp`
--------------------------------------------+------------------------------
        Reporter:  hvr                      |            Owner:
            Type:  task                     |           Status:  patch
        Priority:  normal                   |        Milestone:  7.8.1
       Component:  libraries (other)        |          Version:  7.6.3
      Resolution:                           |         Keywords:  integer-
Operating System:  Unknown/Multiple         |  gmp
 Type of failure:  Runtime performance bug  |     Architecture:  x86_64
       Test Case:                           |  (amd64)
        Blocking:                           |       Difficulty:  Unknown
                                            |       Blocked By:
                                            |  Related Tickets:  #8638
--------------------------------------------+------------------------------

Comment (by hvr):

 Replying to [comment:7 hvr]:
 > Otoh, passing a 0-pointer for the 3-tuple variant has the same danger.
 >
 > So now I'm left wondering if I can somehow statically allocate a dummy
 `ByteArray#` I can return in Cmm when there's no need to allocate a proper
 `ByteArray#` in order to avoid confusing the GC.

 I've workarounded this by returning a pointer to one of the statically
 allocated INTLIKE `Int`s, (which as far as I understand it should
 correspond to `unsafeCoerce#`ing an `Int` into a `ByteArray#`) which
 should be somewhat more polite to the garbage collector than coercing a
 non-pointer `0## :: Word#` into a `ByteArray#`.

 The latest patch for review with more details in its commit message can be
 found at
 [20d7bfdd29917f5a8b8937fba9b724f7e71cd8dd/integer-gmp].

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8647#comment:11>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list