Demangler: support stack allocation for the Demangler's allocator

The demangler can be initialized with a preallocated memory on the stack. Only in case of an overflow, the bump pointer allocator mallocs new memory.
Also, support that a new instance of a demangler can "borrow" the free memory from an existing demangler. This is useful because in the runtime the demangler is invoked recursively. With this feature, all the nested demanglers can share a single stack allocated space.
This commit is contained in:
Erik Eckstein
2019-02-15 09:17:08 -08:00
parent b04ebcfacf
commit 8404c73dba
5 changed files with 87 additions and 19 deletions

View File

@@ -408,6 +408,7 @@ void NodeFactory::freeSlabs(Slab *slab) {
}
void NodeFactory::clear() {
assert(!isBorrowed);
if (CurrentSlab) {
#ifdef NODE_FACTORY_DEBUGGING
std::cerr << indent() << "## clear: allocated memory = " << allocatedMemory << "\n";