[GHC] #8647: Reduce allocations in `integer-gmp`
GHC
ghc-devs at haskell.org
Tue Jan 7 15:35:57 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
--------------------------------------------+------------------------------
Changes (by hvr):
* status: new => patch
Comment:
I attached the patch instead of pushing to Git, as I'm not satisfied yet
with it. It's works stable here (passes `validate` & `nofib`), but I'm not
sure about the `unsafeCoerce#`.
In my first version of this patch, I used a 3-tuple `(# Int#, ByteArray#,
Word# #)` as return value, but that wasted 1 return register per `Integer`
result, and still had to return a NULL pointer for `ByteArray#` for the
case it wasn't used.
I'm wondering if it would be feasible and sensible to return a properly
constructed `Integer` value from the Cmm wrappers (i.e. to fold
`tupToInteger` into gmp-`wrappers.cmm`), but I haven't figured out yet how
to implement that in Cmm.
Moreover, I'm also still wondering how to properly allocate stack-space in
"high-level" Cmm procedures (see [http://www.haskell.org/pipermail/ghc-
devs/2014-January/003616.html posting on ghc-devs@]), as the current code
seems to work properly only as long the Cmm procedures don't force the
code generator to save registers to the stack.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8647#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list