diff options
Diffstat (limited to 'source/compiler-core')
| -rw-r--r-- | source/compiler-core/slang-doc-extractor.cpp | 2 | ||||
| -rw-r--r-- | source/compiler-core/slang-lexer.cpp | 2 | ||||
| -rw-r--r-- | source/compiler-core/slang-name.cpp | 6 | ||||
| -rw-r--r-- | source/compiler-core/slang-name.h | 30 |
4 files changed, 7 insertions, 33 deletions
diff --git a/source/compiler-core/slang-doc-extractor.cpp b/source/compiler-core/slang-doc-extractor.cpp index f2f4775fa..0a5c1355d 100644 --- a/source/compiler-core/slang-doc-extractor.cpp +++ b/source/compiler-core/slang-doc-extractor.cpp @@ -885,9 +885,7 @@ SlangResult DocMarkupExtractor::extract( MemoryArena memoryArena(4096); - RootNamePool rootNamePool; NamePool namePool; - namePool.setRootNamePool(&rootNamePool); Index viewIndex = -1; SourceView* sourceView = nullptr; diff --git a/source/compiler-core/slang-lexer.cpp b/source/compiler-core/slang-lexer.cpp index 119c34d48..d9ff9c0f0 100644 --- a/source/compiler-core/slang-lexer.cpp +++ b/source/compiler-core/slang-lexer.cpp @@ -1921,9 +1921,7 @@ TokenList Lexer::lexAllTokens() MemoryArena arena; - RootNamePool rootNamePool; NamePool namePool; - namePool.setRootNamePool(&rootNamePool); lexer.initialize(sourceView, &sink, &namePool, &arena); diff --git a/source/compiler-core/slang-name.cpp b/source/compiler-core/slang-name.cpp index 6f79d25b5..da19dfe3b 100644 --- a/source/compiler-core/slang-name.cpp +++ b/source/compiler-core/slang-name.cpp @@ -24,12 +24,12 @@ const char* getCstr(Name* name) Name* NamePool::getName(UnownedStringSlice text) { RefPtr<Name> name; - if (rootPool->names.tryGetValue(text, name)) + if (names.tryGetValue(text, name)) return name; name = new Name(); name->text = text; - rootPool->names.add(text, name); + names.add(text, name); return name; } @@ -41,7 +41,7 @@ Name* NamePool::getName(String const& text) Name* NamePool::tryGetName(String const& text) { RefPtr<Name> name; - if (rootPool->names.tryGetValue(text, name)) + if (names.tryGetValue(text, name)) return name; return nullptr; } diff --git a/source/compiler-core/slang-name.h b/source/compiler-core/slang-name.h index 331086d77..aa178968d 100644 --- a/source/compiler-core/slang-name.h +++ b/source/compiler-core/slang-name.h @@ -43,28 +43,10 @@ UnownedStringSlice getUnownedStringSliceText(Name* name); // Get a name as a C style string, or nullptr if name is nullptr const char* getCstr(Name* name); -// A `RootNamePool` is used to store and look up names. +// A `NamePool` is used to store and look up names. // If two systems need to work together with names, and be sure that they // get equivalent names for a string like `"Foo"`, then they need to use -// the same root name pool (directly or indirectly). -// -struct RootNamePool -{ - // The mapping from text strings to the corresponding name. - Dictionary<String, RefPtr<Name>> names; -}; - -// A `NamePool` is effectively a way of storing a subset of the -// names that have been created through a `RootNamePool`. -// -// The intention is that eventually we will add the ability to clean -// up a `NamePool`, and remove the names it created from the corresponding -// `RootNamePool` *if* those names are no longer in use. -// -// The goal of such an approach would be to ensure that the memory -// usage of a `Session` can't bloat over time just because of multiple -// `CompileRequest`s being created, used, and then destroyed (each time -// adding just a few more strings to the name mapping). +// the same name pool (directly or indirectly). // struct NamePool { @@ -74,13 +56,9 @@ struct NamePool // Try find the `Name` that represents the given `text`. // If the name does not exist, return nullptr Name* tryGetName(String const& text); - // Set the parent name pool to use for lookup - void setRootNamePool(RootNamePool* rootNamePool) { this->rootPool = rootNamePool; } - - // - // The root name pool to use for storage/lookup - RootNamePool* rootPool = nullptr; + // The mapping from text strings to the corresponding name. + Dictionary<String, RefPtr<Name>> names; }; } // namespace Slang |
