diff options
author | John Kessenich <cepheus@frii.com> | 2013-07-31 18:44:13 +0000 |
---|---|---|
committer | John Kessenich <cepheus@frii.com> | 2013-07-31 18:44:13 +0000 |
commit | 2b07c7e70a4dd73a5a7c98f91cd5753b70f92f46 (patch) | |
tree | 3469818944a17245de5d88f59af0e630d04610d6 /glslang/MachineIndependent/SymbolTable.h | |
parent | b40a488e89fcf5536469370315d0b8a95788fca9 (diff) | |
download | glslang-2b07c7e70a4dd73a5a7c98f91cd5753b70f92f46.tar.gz |
Improve multi-threading and move Standalone to a multi-threading model (currently off though).
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22565 e7fa87d3-cd2b-0410-9028-fcbf551c1848
Diffstat (limited to 'glslang/MachineIndependent/SymbolTable.h')
-rw-r--r-- | glslang/MachineIndependent/SymbolTable.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/glslang/MachineIndependent/SymbolTable.h b/glslang/MachineIndependent/SymbolTable.h index 79325393..4c62656f 100644 --- a/glslang/MachineIndependent/SymbolTable.h +++ b/glslang/MachineIndependent/SymbolTable.h @@ -77,7 +77,7 @@ class TFunction; class TAnonMember; class TSymbol { public: - POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator) + POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) explicit TSymbol(const TString *n) : name(n) { } virtual TSymbol* clone(TStructureMap& remapper) = 0; virtual ~TSymbol() { } @@ -245,7 +245,7 @@ protected: class TSymbolTableLevel { public: - POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator) + POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) TSymbolTableLevel() : defaultPrecision (0), anonId(0) { } ~TSymbolTableLevel(); @@ -365,24 +365,23 @@ protected: class TSymbolTable { public: - TSymbolTable() : uniqueId(0), noBuiltInRedeclarations(false) + TSymbolTable() : uniqueId(0), noBuiltInRedeclarations(false), adoptedLevels(1) // TODO: memory: can we make adoptedLevels be 0 for symbol tables we don't keep? { // - // The symbol table cannot be used until push() is called, but - // the lack of an initial call to push() can be used to detect - // that the symbol table has not been preloaded with built-ins. + // This symbol table cannot be used until push() is called. // } explicit TSymbolTable(TSymbolTable& symTable) { table.push_back(symTable.table[0]); + adoptedLevels = 1; uniqueId = symTable.uniqueId; noBuiltInRedeclarations = symTable.noBuiltInRedeclarations; } ~TSymbolTable() { - // level 0 is always built-in symbols, so we never pop that out - while (table.size() > 1) + // don't deallocate levels passed in from elsewhere + while (table.size() > adoptedLevels) pop(0); } @@ -463,6 +462,7 @@ protected: std::vector<TSymbolTableLevel*> table; int uniqueId; // for unique identification in code generation bool noBuiltInRedeclarations; + unsigned int adoptedLevels; }; #endif // _SYMBOL_TABLE_INCLUDED_ |