[GHC] #13104: runRW# ruins join points

GHC ghc-devs at haskell.org
Thu Feb 9 21:28:51 UTC 2017


#13104: runRW# ruins join points
-------------------------------------+-------------------------------------
        Reporter:  lukemaurer        |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.4.1
       Component:  Compiler          |              Version:  8.1
      Resolution:                    |             Keywords:  JoinPoints
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by dobenour):

 What about adding a new function `runRW##` and allowing -1 to be the phase
 argument to INLINE?

 Specifically:

 {{{#!hs
 {-# LANGAUGE MagicHash #-}

 import GHC.Prim

 runRW## :: forall (r1 :: RuntimeRep). (o :: TYPE r)
         => State# RealWorld -> (# State# RealWorld, o #)
         -> (# State# RealWorld, o#)
 runRW## f = f realWorld#
 {-# INLINE [-1] runRW## #-}
 }}}

 with `runRW# f` having the compulsory unfolding

 {{{#!hs
 join
   $j s = f s
   {-# INLINE [-1] $j #-}
 in runRW## @ 'PtrRepLifted @ _ (
   \s0 -> $j s
 }}}

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


More information about the ghc-tickets mailing list