[GHC] #8326: Place heap checks common in case alternatives before the case

GHC ghc-devs at haskell.org
Fri Oct 31 12:49:23 UTC 2014


#8326: Place heap checks common in case alternatives before the case
-------------------------------------+-------------------------------------
              Reporter:  jstolarek   |            Owner:  jstolarek
                  Type:  task        |           Status:  new
              Priority:  normal      |        Milestone:
             Component:  Compiler    |          Version:  7.7
            Resolution:              |         Keywords:
      Operating System:              |     Architecture:  Unknown/Multiple
  Unknown/Multiple                   |       Difficulty:  Unknown
       Type of failure:              |       Blocked By:
  None/Unknown                       |  Related Tickets:  #1498
             Test Case:              |
              Blocking:  8317        |
Differential Revisions:  Phab:D343   |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 I'm sure this is do-able by knot-tying, but it'll need a bit of care.

  * Each alternative can start by emitting a pure blob of code that is a
 function of the GC plan

  * The GC plan is computed from the heap-allocation info from all the
 alternatives (this is the knot-tied bit)

  * So it must be possible to run the alternative `FCode` blobs without yet
 knowing the GC plan.

  * Currently `cgAlts` is strict in the plan, but I don't think it needs to
 be.  After all, the code we generate for the alternatives does not depend
 on whether there's a heap check at the beginning.  You probably need to
 allocate a label regardless since that is a monadic operation.

 So not trivial, but ought to be quite possible.  ''Semantically'' the data
 dependencies are just fine!

 Simon

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


More information about the ghc-tickets mailing list