From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7666 invoked by alias); 22 Dec 2004 23:11:00 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 7644 invoked from network); 22 Dec 2004 23:10:54 -0000 Received: from unknown (HELO mail.codesourcery.com) (65.74.133.9) by sourceware.org with SMTP; 22 Dec 2004 23:10:54 -0000 Received: (qmail 15621 invoked from network); 22 Dec 2004 23:10:53 -0000 Received: from localhost (HELO taltos.codesourcery.com) (zack@127.0.0.1) by mail.codesourcery.com with SMTP; 22 Dec 2004 23:10:53 -0000 Received: by taltos.codesourcery.com (sSMTP sendmail emulation); Wed, 22 Dec 2004 15:10:53 -0800 To: Daniel Berlin Cc: Geoffrey Keating , gcc@gcc.gnu.org Subject: Re: GTY and const References: <20041213203007.GA4907@localhost.localdomain> <87fz28enjk.fsf@codesourcery.com> <877jnbiih7.fsf@codesourcery.com> <1103756747.20660.27.camel@linux.site> From: Zack Weinberg Date: Wed, 22 Dec 2004 23:24:00 -0000 In-Reply-To: <1103756747.20660.27.camel@linux.site> (Daniel Berlin's message of "Wed, 22 Dec 2004 18:05:47 -0500") Message-ID: <87zn06exoi.fsf@codesourcery.com> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2004-12/txt/msg01005.txt.bz2 Daniel Berlin writes: > On Tue, 2004-12-21 at 11:01 -0800, Zack Weinberg wrote: >> Geoffrey Keating writes: >>=20 >> >> > Would it be better to add a cast around the assignment or to make >> >> > the GTY code handle const members? >> >>=20 >> >> 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. >>=20 >> 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. While what you say is true=C2=B9, 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. zw =C2=B9 however, I am still sympathetic to the notion that GC-allocating everything would be a good idea if we could just get a non-sucky GC algorithm. Remember that glorious time in the 3.1-3.3 timeframe when we never had use-after-free bugs?