Changes between Version 10 and Version 11 of Commentary/Rts/HaskellExecution/PointerTagging
- Timestamp:
- 12/10/09 05:47:11 (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Commentary/Rts/HaskellExecution/PointerTagging
v10 v11 7 7 In 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. 8 8 9 == Meaning of the tag bits == 10 9 11 The way the tag bits are used depends on the type of object pointed to: 10 12 11 * If the object is a constructor, the tag bits contain the ''constructor tag'', if the number of13 * If the object is a '''constructor''', the tag bits contain the ''constructor tag'', if the number of 12 14 constructors in the datatype is less than 4 (less than 8 on a 64-bit platform). If the number of 13 15 constructors in the datatype is more than 4 (resp 8), then the tag bits have the value 1, and the constructor tag 14 16 is extracted from the constructor's info table instead. 15 17 16 * If the object is a function, the tag bits contain the ''arity'' of the function, if the arity fits18 * If the object is a '''function''', the tag bits contain the ''arity'' of the function, if the arity fits 17 19 in the tag bits. 18 20 19 21 * For a pointer to any other object, the tag bits are always zero. 22 23 == Optimisations enabled by tag bits == 20 24 21 25 The presence of tag bits enables certain optimisations:
