[gclist] Pointers, values, roots and stacks

Douglas.Atique@br.abnamro.com Douglas.Atique@br.abnamro.com
Sat, 17 Jun 2000 15:37:01 -0300




Thank you all for your help.
I have bought the Jones & Lins book and started reading it, but it seems to have
lots of algorithms before I get to the point that makes me the most curious (I
don't know exactly whether it contains such implementation issues).
When we talk about roots, the garbage collector is supposed to go to these roots
and get the pointers to the objects that are alive, because by definition the
roots are the beginning of the scan, right? If one says the root is an object
which is pointed by the register R1 (more accurately, the root is the register
R1) there is no doubt it is a pointer because the register contents are always
interpreted (by convention) as an address and that register might never hold an
integer. But how does one know which locations in a stack are pointers? I think
this question can be related to the other one (of how to find pointers in an
object) in this way: both an object and a stack are commonly implemented as
chunks of contiguous memory containing a bit pattern that is described by a type
definition (a class, for example). An object usually has its class to describe
its type and this class (or whatever other kind of descriptor)  is immutable for
the whole object's lifetime. But what about a stack which is always changing its
configuration (can I say its "type"?) as scopes are entered and exited in the
execution of a program? How does one describe it? Are there stack descriptors
pointed to by the first word of the stack? How are these managed then?
In my opinion, these issues are most basic to understanding how GC works before
one goes to the algorithm comparison and they are usually not dealt with in the
proper physical implementation detail in tutorial publications. Please comment.
Regards,
Douglas Atique