This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GC changes
- To: egcs at tantalophile dot demon dot co dot uk (Jamie Lokier)
- Subject: Re: GC changes
- From: Joern Rennecke <amylaar at cambridge dot redhat dot com>
- Date: Sun, 14 Jan 2001 23:03:51 +0000 (GMT)
- Cc: tej at melbpc dot org dot au (Tim Josling),geoffk at geoffk dot org (Geoff Keating), gcc at gcc dot gnu dot org
>
> 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).