Changes between Version 1 and Version 2 of Commentary/Rts/HeapObjects


Ignore:
Timestamp:
Sep 6, 2006 10:29:19 AM (8 years ago)
Author:
simonmar
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Rts/HeapObjects

    v1 v2  
    22 
    33= GHC Commentary: The Layout of Heap Objects = 
     4 
     5== Terminology == 
     6 
     7 * A ''lifted'' type is one that contains bottom (_|_), conversely an ''unlifted'' type does not contain _|_. 
     8   For example, {{{Array}}} is lifted, but {{{ByteArray#}}} is unlifted. 
     9 
     10 * A ''boxed'' type is represented by a pointer to an object in the heap, an ''unboxed'' object is represented by a value. 
     11   For example, {{{Int}}} is boxed, but {{{Int#}}} is unboxed. 
     12 
     13The representation of _|_ must be a pointer: it is an object that when evaluated throws an exception or enters an infinite loop.  Therefore, only boxed types may be lifted. 
     14 
     15There are boxed unlifted types: eg. {{{ByteArray#}}}.  If you have a value of type {{{ByteArray#}}}, it definitely points to a heap object with type {{{ARR_WORDS}}} (see below), rather than an unevaluated thunk. 
     16 
     17Unboxed tuples {{{(#...#)}}} are both unlifted and unboxed.  They are represented by multiple values passed in registers or on the stack, according to the [wiki:Commentary/Rts/HaskellExecution return convention]. 
     18 
     19== Heap Objects == 
     20 
     21All heap objects have the same basic layout, embodied by the type {{{StgClosure}}} in [http://darcs.haskell.org/ghc/includes/Closures.h Closures.h].  The diagram below shows the layout of a heap object: 
     22 
     23 
     24== Info Tables == 
     25 
     26 
     27== Types of Heap Object ==