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

GHC ghc-devs at haskell.org
Tue Oct 28 16:32:03 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 jstolarek):

 Status update:

 [https://github.com/jstolarek/ghc/blob/T8326-heap-checks-alternative-
 plan/compiler/codeGen/StgCmmExpr.hs#L398 I tried knot-tying] but it
 doesn't work - `cgAlts` is strict in `gc_plan` and changing that doesn't
 look trivial. The only alternative I see at the moment is to:

  a) compile the alternatives without heap checks;
  b) examine heap usage of compiled alternatives
  c) create a GC plan
  d) add heap checks to compiled alternatives, if necessary

 That sounds simple but I have no idea how to leverage FCode monadery to
 add heap checks to compiled `CmmAGraph`. Am I right to think that
 currently there is no plumbing for compiling more code on top of already
 existing `CmmAGraph`? So far I was only able to came up with a prototype
 that
 [https://github.com/jstolarek/ghc/commit/266b1295abfc807f6aab2d6b3578f8d52e9295c9
 #diff-6f97a583ff892976f6b49509aec5ab28R403 implements point a-c above but
 instead of d) it re-compiles the alternatives from scratch].

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


More information about the ghc-tickets mailing list