This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GTY and const
Geoff Keating <geoffk@geoffk.org> writes:
> On 22/12/2004, at 3:10 PM, Zack Weinberg wrote:
>> Daniel Berlin <dberlin@dberlin.org> writes:
>>> On Tue, 2004-12-21 at 11:01 -0800, Zack Weinberg wrote:
>> While what you say is trueÂ, this particular data structure needs
>> to be in GC memory not because it can point to other things that
>> are in GC memory, but because it's part of a precompiled header.
>
> And, as a consequence of this, these data structures are not truly
> write-once; any pointers contained in them will be changed by saving
> a PCH.
Sure; however, that happens behind the back of the code that uses this
data structure. The 'const' is correctly placed to catch bugs in that
code, which is what I care about.
> [I think I disagree with Dan's statement, but I'm not sure what he
> means by "GC allocate". Certainly all roots need to be under control
> of the GC machinery. Equally certainly, not all roots need to be in
> memory that can be freed, and there are two obvious counterexamples in
> the current compiler, static variables and PCH files.]
I think Dan wants to be able to dynamically declare roots which are
somewhere in malloc space, or something like that.
zw