This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH to split up cpp_read_main_file
- From: Mike Stump <mrs at apple dot com>
- To: Neil Booth <neil at daikokuya dot co dot uk>
- Cc: Per Bothner <per at bothner dot com>, Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 6 Aug 2003 11:09:50 -0700
- Subject: Re: PATCH to split up cpp_read_main_file
On Tuesday, August 5, 2003, at 01:25 PM, Neil Booth wrote:
I confess to being unsure how exactly cpp state is being properly
reset between each source file...
In my scheme, we leave the cpp state alone from translation unit to
translation unit. In Per's scheme, we reinitialize the state to the
initial stating state. In my scheme, lookups are the conditionalized
based upon which fragments are active.
unit1.c:
#define foo bar
unit2.c:
#define foo bee
symbol table:
unit1:foo=bar
unit1:foo=bee
lookup(foo) in context unit1, gives bar
lookup(foo) in context unit2, gives bee
The advantage is that the symbol table doesn't need reinitialization
between units, and that as each fragment is seen, we don't have to play
with the symbol table at all, it can remain on disk, or out of L3 cache
for example. This way, the ultimate cost of a reused header is about
0, instead of linear with respect to the size of the header. 0 is
cheaper than O(n).