[gclist]

Fergus Henderson fjh@cs.mu.OZ.AU
Mon, 10 Jun 2002 12:51:44 +1000


On 08-Jun-2002, Gregory Morrisett <jgm@cs.cornell.edu> wrote:
> > 	(2) For each type with at least one pointer field,
> > 	    record the offset of the first pointer field;
> > 	    store the forwarding pointer in that field.  Use address
> > 	    range comparisons (or tag bits) to distinguish forwarding pointers.
> > 	    For objects which don't have any pointer fields,
> > 	  	(a) allocate an extra word for use as a forwarding pointer, or
> > 		(b) keep a separate hash table to record which objects
> > 		    contain forwarding pointers.
> > 
> > Any opinions on which of these is likely to be best?
> 
> In terms of space overhead, I think that 2b will probably work best
> for a language like Mercury.  Many objects will have a pointer field
> and so will hit the common case.  Assuming a word-aligned allocator,
> you can use the 2 low-order bits to encode forwarding/non-forwarding.

This is not so easy in our case, because in many cases the Mercury compiler
is already using those low-order bits, for discriminated union tags.

But we could distinguish between forwarding and non-forwarding pointers using
address range comparisons: pointers which point into the "to space"
must be forwarding pointers.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.