This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: PCH versus --enable-mapped-location
Per Bothner <per@bothner.com> writes:
> Daniel Jacobowitz wrote:
> > That's exactly what Geoff said. There are two relevant properties of
> > GCed memory here:
> > - Anything in GCed memory will be saved to the PCH
> > - Anything in GCed memory will be overwritten by loading the PCH.
>
> So the corrollary: After a restore any pointers from non-gc'd memory to
> gc'd memory will be a dangling pointer, if we count static variables
> marked with GTY as "gc'd memory" in this context.
Yes. Don't keep pointers to GCed memory in non-GCed memory. The GC/PCH
machinery assumes that it can see all pointers to the objects it
allocates.
> Right now, as far as I can tell, the filenames in the line_table are
> allocated from non-gc'd memory. This complicates using gc.
This is the reverse case: pointers to non-GCed memory in GCed memory.
There is one case where this is allowed, which just happens to be the
case that you want: a pointer to a C string.