more radical change?
Henry Cejtin
henry@sourcelight.com
Wed, 28 Nov 2001 00:59:44 -0600
In the following, by a reference to an object, I mean what ever the mutator
and other objects have when the have a pointer to another object.
Consider what the point of all the header and the like words are:
The only thing that the mutator cares about is being able to get to the
length of an array given a reference to the array and be able to get
to the data associated with an object given a reference to it.
The GC must be able to recognize an object given a pointer to the first
word occupied by the object. This is required since it walks through
a semi-space and has to understand objects as it comes to them.
In addition, if an object contains a reference to another object, the GC
must be able to understand the referred to object from the reference.
This is so that it can forward it.
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.
The mutator code would now be more intimately involved with heap layout.
Currently it only knows when it is creating an object, but now it
would also have to know when it is accessing an object. It would
have to know about header words and the like.
This could be a serious objection if we go to some fancy generational
GC where one might want to use some kind of BBOP for small objects.
What do people think of this (more radical?) change?