[GHC] #13219: CSE for join points

GHC ghc-devs at haskell.org
Wed Feb 1 21:33:44 UTC 2017


#13219: CSE for join points
-------------------------------------+-------------------------------------
           Reporter:  lukemaurer     |             Owner:  lukemaurer
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.1
           Keywords:  JoinPoints     |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Join points are hazardous for CSE:

 {{{
 join j = e in ... f e ...
 }}}
 The temptation is of course to rewrite to
 {{{
 join j = e in ... f (jump j) ...
 }}}
 which doesn't typecheck because you can't have a jump in an argument.

 Similarly:
 {{{
 join j x = e in
 let y = (... join j2 x = e in ...) in ...
 }}}
 can't be rewritten to
 {{{
 join j x = e in
 let y = (... join j2 x = jump j x ...) in ...
 }}}
 because you can't jump out of a value binding.

 This doesn't seem to come up very often (took a long time for me to trip
 over it). The simple solution is simply to ignore CSE for join points.
 That's what we do at the moment. But this is saddening in some cases:

 {{{
 join j x = e in
 join j2 x = e in ...
 }}}
 can perfectly well become
 {{{
 join j x = e in
 join j2 x = jump j x in ...
 }}}

 We just need to track which join points are still currently valid.

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


More information about the ghc-tickets mailing list