more radical change?

Matthew Fluet fluet@CS.Cornell.EDU
Wed, 28 Nov 2001 12:14:30 -0500 (EST)


> > The difficulties we have currently are all caused by the fact that references
> > to  objects  are NOT the same as pointers to the first word used by an object
> > in the heap.  This could be changed.  The only disadvantages  I  see  to  the
> > change are:
> > 
> >     Getting  to  the  data associated with an object would involve a slightly
> >         larger offset from the reference.  For array  subscript  calculations
> >         it would mean that the address of X[i] would be
> >             X + offset + i * size-of-element
> >         where  offset is the number of bytes from the first word of the array
> >         object to the first first word of data.
> > 
> >         I don't think that this is important.
> 
> Simpler array subscript calculations was one of the reasons we chose
> the scheme we did.  I don't agree with your statement that the extra
> offset is not important, and need to be convinced.

Another objection is that getting to the data associated with an object
should be fast.  Only the GC really needs to know about header words.  If
a program is spending most of its time in ML code, it makes sense to make
references to data objects fast.  If we pass around a pointer to the
header, then every reference to the actual object requires an offset; that
means all boxed primitive types (e.g., int refs), require an offset, and
also every component of a tuple type.  We'll pay a little (maybe alot) in
code size, because non-zero offsets in memory operands require a slightly
larger instruction encoding (IIRC).