From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14222 invoked by alias); 27 Apr 2009 21:25:20 -0000 Received: (qmail 14190 invoked by uid 22791); 27 Apr 2009 21:25:16 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mailout03.t-online.de (HELO mailout03.t-online.de) (194.25.134.81) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 27 Apr 2009 21:25:01 +0000 Received: from fwd10.aul.t-online.de by mailout03.sul.t-online.de with smtp id 1LyYJc-0000PS-01; Mon, 27 Apr 2009 23:24:40 +0200 Received: from [192.168.178.27] (SarmG8ZSohPqjlXCRF1OehlfTzTzLec-qS0zFC5HOCCac9sGSatRboO1xBqRL5tZuP@[84.156.232.252]) by fwd10.aul.t-online.de with esmtp id 1LyYJW-0TExRg0; Mon, 27 Apr 2009 23:24:34 +0200 Subject: Re: [gnat] reuse of ASTs already constructed From: oliver.kellogg@t-online.de (Oliver Kellogg) Reply-To: okellogg@users.sourceforge.net To: Tom Tromey Cc: gcc@gcc.gnu.org In-Reply-To: References: <1239557374.7565.37.camel@tidbit.site> <1240253122.4554.64.camel@tidbit.site> <8656490A-EA10-49F3-815C-E584DA3CAE7C@adacore.com> <1240752645.5074.102.camel@tidbit.site> <1240861937.19721.24.camel@tidbit.site> Content-Type: text/plain Date: Mon, 27 Apr 2009 22:44:00 -0000 Message-Id: <1240867839.19721.33.camel@tidbit.site> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2009-04/txt/msg00721.txt.bz2 On 2009-04-27, at 14:28, Tom Tromey wrote: > > Tom> I am curious how you handle locations on shared bits of the AST. > Tom> I needed some disturbing hacks to make this work well for C. > > Oliver> I'm not sure what you mean; could you explain? > > In the server, the global line map is reset for each compile job (and > it sounds like this is true for your patch as well). So, suppose a > compilation reuses a declaration that was parsed during an earlier > job. The location_t values in this declaration will no longer be > valid; if the compiler emits a diagnostic using this declaration, then > the location will be incorrect. > > In the C compiler I worked around this by resetting locations on > shared decls. The details of this are tied to how the C compiler > implements sharing. > > I was curious to know how you handled this situation. If you re-lower > AST bits to trees for each job, or something like that, then it > probably is not as big a problem for you. > Ah, yes. There's a GNAT to GNU tree transformation pass (gigi) which is called afresh each time thus I haven't needed to worry about that (AFAIK the line info is filled in from the GNAT tree.) IMHO it would be much more demanding to try to optimize away (parts of) this pass. Certainly beyond me :) Oliver