GC changes
Joern Rennecke
amylaar@cambridge.redhat.com
Sun Jan 14 15:03:00 GMT 2001
>
> Tim Josling 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).
More information about the Gcc
mailing list