This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

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).


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