[GHC] #10867: Primop types should not mention ()

GHC ghc-devs at haskell.org
Mon Sep 14 14:50:34 UTC 2015


#10867: Primop types should not mention ()
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.10.2
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by simonpj):

 OK, talked to Simon.

 My "I believe the following.." is false.  In fact all those finalisers are
 packed into an array in `Weak.c` (function `scheduleFinalizers`) and
 handed off to the Haskell function `GHC.Weak.runFinalizerBatch`.  So the
 latter certainly needs to know the type of the finaliser.

 With that in mind, I think we should not change the `Weak#` type (as I
 wrongly proposed above) but instead change the type of  `mkWeak#` to
 {{{
 primop  MkWeakOp "mkWeak#" GenPrimOp
    key -> value
    -> (State# RealWorld -> State# RealWorld)
    -> (# State# RealWorld, Weak# b #)
 }}}
 and `GHC.Weak.runFinalizerBatch` to
 {{{
 runFinalizerBatch :: Int
                   -> Array# (State# RealWorld -> State# RealWorld)
                   -> IO ()
 }}}

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


More information about the ghc-tickets mailing list