Changes between Version 25 and Version 26 of Commentary/Compiler/NewCodeGenPipeline


Ignore:
Timestamp:
Sep 10, 2009 11:00:59 AM (6 years ago)
Author:
simonpj
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Compiler/NewCodeGenPipeline

    v25 v26  
    5353   * Convert the `CmmInfo` for each `CmmProc` into a `[CmmStatic]`, using the live variable information computed just before "Figure out stack layout". 
    5454
     55=== Branches to continuations and the "Adams optimisation" ===
     56A GC block for a heap check after a call should only take one or two instructions.
     57However the natural code:
     58{{{
     59    r = foo(1, 2) returns to L
     60 L: r = R1   -- get return value
     61    goto M
     62 M: if (Hp < HpLim) { do_gc() returns to K;
     63                   K: goto M; }
     64}}}
     65The label M is the head of the call-gc-and-try-again loop.
     66If we do this, we'll generate two info tables, one for L and one for K.
    5567
    56 '''The Adams optimisation''' is done by stuff above.  Given:
     68We can do better like this:
    5769{{{
    58   call f returns to K
    59   K: CopyIn retvals; goto L
    60   L: <code>
     70    r = foo(1, 2) returns to L
     71 L: r = R1
     72    goto M
     73 M: if (Hp < HpLim) { r = do_gc_p(r) returns to K;
     74                   K: r = R1; goto M; }
    6175}}}
    62  transform to
    63 {{{
    64   call f returns to L
    65   L : CopyIn retvals; <code>
    66 }}}
    67  ''and'' move `CopyOut` into L's other predecessors.  !ToDo: explain why this is a good thing.  In fact Common Block Elimination does this, we think.
    6876
     77Now the {{{do_gc_p}}} call has the same return signature as {{{foo}}}
     78and can use the same continuation.
     79(A call followed by a {{{goto}}} thus gets optimized down to just the call.)
    6980
     81Now things are good.  Simple common block elimination (CBE) will common up K and L, so both calls share the same info table.
    7082
    7183== Runtime system ==