Changes between Version 1 and Version 2 of SemiTagging


Ignore:
Timestamp:
Oct 11, 2006 12:45:00 PM (8 years ago)
Author:
alexey
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SemiTagging

    v1 v2  
    22 
    33Here I describe the design of the semi-tagging optimisation. Currently most of the text comes from http://hackage.haskell.org/trac/summer-of-code/ticket/48 
     4 
     5This page reflects my current understanding on the compiler and the RTS, so if there is something wrong, just yell! 
    46 
    57== Tagging the LSB of an evaluated closure == 
     
    911case x of { ... } 
    1012}}} 
    11 GHC jumps to the code for the x closure, which returns when x is evaluated. Commonly, x is already evaluated, and the code for an evaluated constructor just returns immediately. The idea is to encode the fact that a pointer points to an evaluated object by setting the LSB of the pointer. If the case expression detects that the closure is evaluated, it can avoid the jump and return, which are expensive on modern processors (indirect jumps). 
     13GHC jumps to the code for the x closure, which returns when x is evaluated. Commonly, x is already evaluated, and the code for an evaluated constructor just (vector) returns immediately. The idea is to encode the fact that a pointer points to an evaluated object by setting the LSB of the pointer. If the case expression detects that the closure is evaluated, it can avoid the jump and return, which are expensive on modern processors (indirect jumps). 
     14 
     15This would require modifying 
     16- the GC to set the LSB bit of constructor closure pointers, 
     17- the GC and the RTS code to mask out the LSB pointer when dereferencing it, 
     18- the code generation to test the LSB bit and case expressions and avoid the indirect jump. 
    1219 
    1320== Using more than one bit ==