[GHC] #9281: Rewrite `integer-gmp` to use only non-allocating GMP functions

GHC ghc-devs at haskell.org
Tue Jul 22 08:29:26 UTC 2014


#9281: Rewrite `integer-gmp` to use only non-allocating GMP functions
-------------------------------------+-------------------------------------
              Reporter:  hvr         |             Owner:  hvr
                  Type:  task        |            Status:  patch
              Priority:  normal      |         Milestone:  7.10.1
             Component:  libraries   |           Version:
  (other)                            |          Keywords:  integer-gmp
            Resolution:              |  Operating System:  Unknown/Multiple
Differential Revisions:  Phab:D82    |   Type of failure:  None/Unknown
          Architecture:              |         Test Case:
  Unknown/Multiple                   |          Blocking:
            Difficulty:  Unknown     |
            Blocked By:              |
       Related Tickets:  #8647       |
-------------------------------------+-------------------------------------

Comment (by simonmar):

 `foreign import prim` has a different calling convention from `foreign
 import ccall` (obviously) and they look different at the `Cmm` level.  The
 code generation for these two is quite different - the former is a
 `StgPrimCallOp` while the latter is a `StgFCallOp`.

 But I think all the machinery to do this already exists, as Simon said.
 When we foreign-import something with an IO type there's a wrapper around
 the primitive foreign call to add the IO, but the primitive call itself
 will have a type of the form `State# s -> (# State# s, a #)`, so we can
 already codegen these properly.  All we need to do is make sure that there
 is no wrapper, which might already happen automatically if the typechecker
 is changed to allow `State#` arguments and `State#` or `(# State# s, a #)`
 results with `UnliftedFFITypes`.

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


More information about the ghc-tickets mailing list