Changes between Version 5 and Version 6 of Commentary/Compiler/CPS


Ignore:
Timestamp:
May 14, 2007 2:43:53 PM (7 years ago)
Author:
guest
Comment:

Added info on continuation representation

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Compiler/CPS

    v5 v6  
    2323   * Eventually could be passed implicitly but keeping things explicit makes things easier 
    2424   * Evantually could use a custom calling convention 
     25   * Actual syntax is probably virtual.  (I.e. in an external table, not in actual syntax because that would require changes to the type for Cmm code) 
     26     * Input code: 
     27       {{{ 
     28f { 
     29  y = 1; 
     30  z = 2; 
     31  x = call g(a, b); // y, z live 
     32  return x+y+z; 
     33} 
     34}}} 
     35     * Output code: 
     36       {{{ 
     37f { 
     38  y = 1; 
     39  z = 2; 
     40  push_continuation h [y, z]; // Probably virtual 
     41  jump g(a, b); 
     42} 
     43 
     44foreign "ret" h(x) { 
     45  (y, z) = expand_continuation; // Probably virtual 
     46  return x+y+z; 
     47}  
     48}}} 
    2549 * Save live values before a call in the continuation 
    2650   * Must arrange for both the caller and callee to know field order 
     
    2852   * Eventually needs to be optimized to reduce continuation shuffling 
    2953     * Can register allocation algorithms be unified with this into one framework? 
     54 
     55== To be worked out == 
     56 * The continuations for {{{f}}} and {{{g}}} are different. 
     57   {{{ 
     58if (test) { 
     59  x = f(); 
     60} else { 
     61  y = g(); 
     62} 
     63}}} 
     64   * Could make a for each that shuffles the arguments into a common format. 
     65   * Could make one branch primary and shuffle the other to match it, but that might entail unnessisary memory writes. 
    3066 
    3167== Pipeline ==