GTY and const
Daniel Berlin
dberlin@dberlin.org
Wed Dec 22 23:11:00 GMT 2004
On Tue, 2004-12-21 at 11:01 -0800, Zack Weinberg wrote:
> Geoffrey Keating <geoffk@geoffk.org> writes:
>
> >> > Would it be better to add a cast around the assignment or to make
> >> > the GTY code handle const members?
> >>
> >> I'd prefer that you improved gengtype.
> >
> > It's not gengtype, the problem really is that you cannot have const
> > GCed memory, for the same underlying reasons that you cannot free() a
> > const pointer.
>
> No, that's just plain not true. cpplib makes extensive use of 'const'
> to indicate write-once data structures (they are initialized through a
> non-const pointer, of course). Those definitely can be GC memory.
Right. There is a significant difference between what we need to walk
for marking, and what we really need to GC allocate.
Right now we GTY/gc allocate a lot of things just so we can mark some
things they may point to.
The fact that we *have* to do this is *bad*.
Roots are roots, whether they occur in GC memory or not.
The requirement that they be in GC memory is just bogus and an artifact
of the way ggc-page marks.
--Dan
More information about the Gcc
mailing list