Changes between Version 10 and Version 11 of Commentary/Rts/HaskellExecution/PointerTagging


Ignore:
Timestamp:
Dec 10, 2009 1:47:11 PM (4 years ago)
Author:
simonmar
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Rts/HaskellExecution/PointerTagging

    v10 v11  
    77In GHC we "tag" pointers to heap objects with information about the object they point to.  The tag goes in the low 2 bits (3 bits on a 64-bit platform) of the pointer, which would normally be zero since heap objects are always [wiki:Commentary/Rts/Word word]-aligned. 
    88 
     9== Meaning of the tag bits == 
     10 
    911The way the tag bits are used depends on the type of object pointed to: 
    1012 
    11  * If the object is a constructor, the tag bits contain the ''constructor tag'', if the number of 
     13 * If the object is a '''constructor''', the tag bits contain the ''constructor tag'', if the number of 
    1214   constructors in the datatype is less than 4 (less than 8 on a 64-bit platform).  If the number of 
    1315   constructors in the datatype is more than 4 (resp 8), then the tag bits have the value 1, and the constructor tag 
    1416   is extracted from the constructor's info table instead. 
    1517 
    16  * If the object is a function, the tag bits contain the ''arity'' of the function, if the arity fits 
     18 * If the object is a '''function''', the tag bits contain the ''arity'' of the function, if the arity fits 
    1719   in the tag bits. 
    1820 
    1921 * For a pointer to any other object, the tag bits are always zero. 
     22 
     23== Optimisations enabled by tag bits == 
    2024 
    2125The presence of tag bits enables certain optimisations: