This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: GC changes


Joern Rennecke wrote:
> > > 2. What is a good way to make things GC proof for a while until
> > > they get into the main tree structure? At the moment I define
> > > various roots to handle the intermediate allocations. 
> > 
> > You might try implementing conservative roots.  I think it's quite easy
> > to get access to all the pointers stored in registers and on the stack:
> > just call setjmp.  As a comment in some code says, "Callee-saved
> > registers are recorded in buf [setjmp(buf)]; caller-saved registers are
> > on the stack already.".
> 
> That is not safe.  You can't predict what kind of address arithmetic the
> compiler will make.  For example, strength reduction could cause a pointer
> to be pointing into the middle of an array, or worse, somewhere beyond it
> (incorporating some constant adjustments).

Pointers into the middle of an array aren't a problem; you can make the
GC handle that.  Pointers outside the array are a real problem with all
kinds of conservative GC, but only when the pointer into the array is
not also available.  We've had a thread here before asking for a switch
to make GCC GC-safe in this regard.

TREE and RTL objects aren't accessed in arrays though, are they?
(Arrays of pointers to them are used, but not arrays of the objects
themselves).  So I would think that in practice, address arithmetic on
these objects will not result in a pointer outside the object existing
without a pointer to or into the object.

-- Jamie

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]