From 4cb3eeb832b5fb29a61f2934b3daa5e42a3d6cde Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 18 Jul 2023 08:08:11 -0700 Subject: Simplify Lookup and improve compiler performance. (#2996) * Simplify lookup. * Various bug fixes. * Report type dictionary size in perf benchmark. * Remove type duplication. * increase initial dict size. * Bug fix. * Fix bugs. * Fixup. * Revert type legalization looping. * Fix specialization pass. --------- Co-authored-by: Yong He --- source/slang/slang-check-conformance.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'source/slang/slang-check-conformance.cpp') diff --git a/source/slang/slang-check-conformance.cpp b/source/slang/slang-check-conformance.cpp index 0eb44399d..2696f798d 100644 --- a/source/slang/slang-check-conformance.cpp +++ b/source/slang/slang-check-conformance.cpp @@ -50,6 +50,18 @@ namespace Slang } SubtypeWitness* SemanticsVisitor::isSubtype( + Type* subType, + Type* superType) + { + SubtypeWitness* result = nullptr; + if (getShared()->tryGetSubtypeWitness(subType, superType, result)) + return result; + result = checkAndConstructSubtypeWitness(subType, superType); + getShared()->cacheSubtypeWitness(subType, superType, result); + return result; + } + + SubtypeWitness* SemanticsVisitor::checkAndConstructSubtypeWitness( Type* subType, Type* superType) { @@ -92,9 +104,6 @@ namespace Slang // For now we are continuing to conflate all the subtype-ish relationships but not // tangling convertibility into it. - // TODO: Evaluate whether it is beneficial to memo-cache - // the results of subtype tests on the `SharedSemanticsContext`. - // In the common case, we can use the pre-computed inheritance information for `subType` // to enumerate all the types it transitively inherits from. // -- cgit v1.2.3