[MLton-devel] new GC object layout

Matthew Fluet Matthew Fluet <fluet@CS.Cornell.EDU>
Wed, 8 May 2002 16:12:57 -0400 (EDT)


> 1. Array objects have both a header word and a counter word.  A header
> word also includes counter bits; in the description, it seems both are used
> in the mark phase.  What's the reason for both?  Will only 11 bits in the counter word for the array be valid?

My guess is that Steve won't use the count bits in the header word at all.
We're allowing arrays of length Int.maxInt, so there are 2^31 positions in
the array that could be pointers.  So, we need a full word for the count.

Note, the above only works for arrays whose elements are either pointers
or non-pointers.  If we have flattened arrays of 2-tuples, with each tuple
element being a pointer, then we have 2^32 positions.  But, then we can
use the count in the header.

Actually, maybe Steve has this in mind.  An array's header's index would
indicate the shape of the array elements (right now, either 1 non-pointer
or 1 pointer).  Then the count word would indicate the array element and
the count in the header would indicate the position in the element.

> 2. What is the rationale for the header word to follow the length?  Where
> in the array do array references actually point?

Pointers (in objects pointing to other objects) always point to
the first word of the actual object.  For arrays, this corresponds to the
element at index 0.  Then, the header is always one word behind where the
pointer points.  Furthermore, if the header turns out to tell us that the
object is actually an array, we know the length is yet one more word
behind.



_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: bandwidth@sourceforge.net
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel