diff options
| author | Yong He <yonghe@outlook.com> | 2023-08-09 09:11:23 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-09 09:11:23 -0700 |
| commit | c4615fe0ae7e1849b23e9a96d1453794b0b40e90 (patch) | |
| tree | 0d8d4eed0c90df9664420737d60749f391c11ffb /source/slang/slang-stdlib.cpp | |
| parent | 793a29afc9539f893883b5ad8d88639d63f401e0 (diff) | |
Clean up and improve Val deduplication performance. (#3069)
* Clean up and improve Val deuplication performance.
* Fix.
* Fix.
* Fix.
* Fix.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-stdlib.cpp')
| -rw-r--r-- | source/slang/slang-stdlib.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/slang/slang-stdlib.cpp b/source/slang/slang-stdlib.cpp index f3f8f325e..65d5cf758 100644 --- a/source/slang/slang-stdlib.cpp +++ b/source/slang/slang-stdlib.cpp @@ -112,6 +112,31 @@ namespace Slang }; + void Session::finalizeSharedASTBuilder() + { + // Force creation of all builtin types so we can make sure + // they are created by the builtin AST builder instead of + // some user linkage's ast builder. This avoid the problem + // of storing a reference to these global types that are + // owned by a user linkage that gets deleted with the linkage. + // + globalAstBuilder->getNoneType(); + globalAstBuilder->getNullPtrType(); + globalAstBuilder->getBottomType(); + globalAstBuilder->getErrorType(); + globalAstBuilder->getInitializerListType(); + globalAstBuilder->getOverloadedType(); + globalAstBuilder->getStringType(); + globalAstBuilder->getEnumTypeType(); + globalAstBuilder->getDiffInterfaceType(); + globalAstBuilder->getSharedASTBuilder()->getDynamicType(); + globalAstBuilder->getSharedASTBuilder()->getDiffInterfaceType(); + globalAstBuilder->getSharedASTBuilder()->getNativeStringType(); + for (auto& baseType : kBaseTypes) + globalAstBuilder->getBuiltinType(baseType.tag); + } + + // Given two base types, we need to be able to compute the cost of converting between them. ConversionCost getBaseTypeConversionCost( BaseTypeConversionInfo const& toInfo, |
