diff options
| author | Yong He <yonghe@outlook.com> | 2023-08-04 15:47:39 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-04 15:47:39 -0700 |
| commit | a2d90fb275962da84611160f8ddd74d934a68dbd (patch) | |
| tree | 066084537b9f4fe1f367de100ed6638a88a028c1 /source/compiler-core | |
| parent | 17da4f0dec2b86ba3a4bdaf8a2ae112047d23623 (diff) | |
Redesign `DeclRef` and systematic `Val` deduplication (#3049)
* Redesign DeclRef + Deduplicate Val.
* Update project files
* Fix warning.
* Fix.
* Fix.
* Remove `Val::_equalsImplOverride`.
* Rmove `Val::_getHashCodeOverride`.
* Remove `semanticVisitor` param from `resolve`.
* Cleanups.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/compiler-core')
| -rw-r--r-- | source/compiler-core/slang-diagnostic-sink.h | 2 | ||||
| -rw-r--r-- | source/compiler-core/slang-name.cpp | 7 | ||||
| -rw-r--r-- | source/compiler-core/slang-name.h | 1 | ||||
| -rw-r--r-- | source/compiler-core/slang-slice-allocator.h | 2 |
4 files changed, 9 insertions, 3 deletions
diff --git a/source/compiler-core/slang-diagnostic-sink.h b/source/compiler-core/slang-diagnostic-sink.h index e4d131e37..fc5e31b47 100644 --- a/source/compiler-core/slang-diagnostic-sink.h +++ b/source/compiler-core/slang-diagnostic-sink.h @@ -310,7 +310,7 @@ private: class DiagnosticsLookup : public RefObject { public: - static const Index kArenaInitialSize = 2048; + static const Index kArenaInitialSize = 65536; /// Will take into account the slice name could be using different conventions const DiagnosticInfo* findDiagnosticByName(const UnownedStringSlice& slice) const; diff --git a/source/compiler-core/slang-name.cpp b/source/compiler-core/slang-name.cpp index cc2033339..c815b8aa8 100644 --- a/source/compiler-core/slang-name.cpp +++ b/source/compiler-core/slang-name.cpp @@ -19,7 +19,7 @@ const char* getCstr(Name* name) return name ? name->text.getBuffer() : nullptr; } -Name* NamePool::getName(String const& text) +Name* NamePool::getName(UnownedStringSlice text) { RefPtr<Name> name; if (rootPool->names.tryGetValue(text, name)) @@ -31,6 +31,11 @@ Name* NamePool::getName(String const& text) return name; } +Name* NamePool::getName(String const& text) +{ + return getName(text.getUnownedSlice()); +} + Name* NamePool::tryGetName(String const& text) { RefPtr<Name> name; diff --git a/source/compiler-core/slang-name.h b/source/compiler-core/slang-name.h index cf702686b..f8c1201af 100644 --- a/source/compiler-core/slang-name.h +++ b/source/compiler-core/slang-name.h @@ -68,6 +68,7 @@ struct RootNamePool struct NamePool { // Find or create the `Name` that represents the given `text`. + Name* getName(UnownedStringSlice text); Name* getName(String const& text); // Try find the `Name` that represents the given `text`. // If the name does not exist, return nullptr diff --git a/source/compiler-core/slang-slice-allocator.h b/source/compiler-core/slang-slice-allocator.h index e4ba9e907..a6f0cd5c1 100644 --- a/source/compiler-core/slang-slice-allocator.h +++ b/source/compiler-core/slang-slice-allocator.h @@ -97,7 +97,7 @@ struct SliceAllocator void deallocateAll() { m_arena.deallocateAll(); } SliceAllocator(): - m_arena(1024) + m_arena(2097152) { } protected: |
