[cfe-commits] r91391 - in /cfe/trunk: include/clang/Lex/Preprocessor.h lib/Lex/MacroArgs.cpp lib/Lex/MacroArgs.h lib/Lex/Preprocessor.cpp

Chris Lattner clattner at apple.com
Mon Dec 14 22:20:13 PST 2009


On Dec 14, 2009, at 6:38 PM, Daniel Dunbar wrote:

>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=91391&view=rev
>> Log:
>> set up the machinery for a MacroArgs cache hanging off Preprocessor.
>> We creating and free thousands of MacroArgs objects (and the related
>> std::vectors hanging off them) for the testcase in PR5610 even though
>> there are only ~20 live at a time.  This doesn't actually use the
>> cache yet.
> 
> It looks like this is just adding a free list, would it make sense to
> factor out a generic implementation? It seems generally useful,
> especially if done as a generic allocator, for example one can imagine
> FIFO / doubly linked, batch free'd free lists.

Definitely possible, but I don't think the added abstraction would actually make the code better.  This would need to be an intrusive free list because the objects are variable size.  All the type traits code would be complete overkill for a stupid singly linked list.

-Chris



More information about the cfe-commits mailing list