This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PCH, and more generally C++ parser performance


Geoff Keating <geoffk@cygnus.com> writes:

| > Cc: Zack Weinberg <zack@wolery.cumb.org>, Stan Shebs <shebs@apple.com>,
| >         gcc@gcc.gnu.org
| > From: Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
| > Organization: CMLA, ENS Cachan -- CNRS UMR 8536 (France)
| > Date: 31 Aug 2000 06:53:22 +0200
| > 
| > Geoff Keating <geoffk@cygnus.com> writes:
| > 
| > | Zack Weinberg <zack@wolery.cumb.org> writes:
| > | 
| > | > Look over at the conversation I've been having with Mark Mitchell.  He
| > | > thinks we can't get away with lazy parsing of anything in C++, and has
| > | > some solid arguments for it.
| > 
| > Yes, I'm also of the opinion that you can't simply do lazy parsing in
| > C++, unless you have indeed a very very sophisticated scheme to get
| > name resolution right, especially to get the two-phase name lookup in
| > templates (see 14.6 of the C++ Standard).  You also need to keep
| > track of points of instantiation. 

[...]

| In the worst case, consider someone who thinks it a good idea to feed
| an entire .cc file to the precompiler, and whose `source' consists of
| 
| #include <foo.cc>
| /* ha ha ha */

This is not very far from what people are doing currently because of
lack of separate template compilation.

| I don't think we have to make this work for PCH to be useful.
| 
| > That idiom is, for example, used to initialize the global stream
| > objects in the C++ Standard Library.
| > 
| > The idea is generalized into the idiom "resource acquisition is
| > initialization".  And we need to support it correctly, whether we like
| > it or not.
| 
| I agree that it must be supported correctly if it supported at all.
| I do not agree that PCH would be useless if it was not supported
| fully, or even if it was not supported at all.

I was not questioning the usefulness of PCH.

I'm worried about the things affected by PCH.  And I'm even more
worried when I'm hearing the plan of lazy parsing.

[...]

| > Given that name lookup is not that simple in C++, I would like you be
| > more precise here: how do you handle names found by unqualified name
| > lookup? 
| 
| Name lookup is the determination of which, out of a set of possible
| meanings for a name, is the one meant.  My scheme handles this by
| loading in all the possible definitions of a name before name lookup
| starts.

So you're not arguing for Zack's lazy parsing?

| ...  For instance, when loading "foo" I would load T::foo,
| J::T::foo, and plain ::foo, if they were all defined.  (I might make
| an exception for C::foo if C is not yet loaded; I think, but am not
| sure, that under those circumstances "foo" cannot mean C::foo.)

I think you might need it in depedent name lookup.

-- Gaby
CodeSourcery, LLC                             http://www.codesourcery.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]