diff options
| author | Yong He <yonghe@outlook.com> | 2022-09-13 13:11:48 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-13 13:11:48 -0700 |
| commit | f216b77752b9e4aea52882b2110ceb1cc64a2171 (patch) | |
| tree | fbb33485b7260bc0f89b406e1be6fb8196f94196 /source/slang/slang-ast-substitutions.cpp | |
| parent | 9f3e83cf0d664c87a618edf08d834829178030e6 (diff) | |
Deduplicate AST type nodes and cache lookup operations. (#2397)
* wip: dedup AST type nodes and cache lookup.
* Fix.
* Remove profiling.
* Fixes.
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ast-substitutions.cpp')
| -rw-r--r-- | source/slang/slang-ast-substitutions.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/source/slang/slang-ast-substitutions.cpp b/source/slang/slang-ast-substitutions.cpp index 6656f1fa6..7c6cf1bc6 100644 --- a/source/slang/slang-ast-substitutions.cpp +++ b/source/slang/slang-ast-substitutions.cpp @@ -63,10 +63,8 @@ Substitutions* GenericSubstitution::_applySubstitutionsShallowOverride(ASTBuilde if (!diff) return this; (*ioDiff)++; - auto substSubst = astBuilder->create<GenericSubstitution>(); - substSubst->genericDecl = genericDecl; - substSubst->args = substArgs; - substSubst->outer = substOuter; + + auto substSubst = astBuilder->getOrCreateGenericSubstitution(genericDecl, substArgs, substOuter); return substSubst; } @@ -126,10 +124,9 @@ Substitutions* ThisTypeSubstitution::_applySubstitutionsShallowOverride(ASTBuild if (!diff) return this; (*ioDiff)++; - auto substSubst = astBuilder->create<ThisTypeSubstitution>(); - substSubst->interfaceDecl = interfaceDecl; - substSubst->witness = substWitness; - substSubst->outer = substOuter; + ThisTypeSubstitution* substSubst; + + substSubst = astBuilder->getOrCreateThisTypeSubstitution(interfaceDecl, substWitness, substOuter); return substSubst; } |
