From f216b77752b9e4aea52882b2110ceb1cc64a2171 Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 13 Sep 2022 13:11:48 -0700 Subject: 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 --- source/slang/slang-ast-type.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source/slang/slang-ast-type.cpp') diff --git a/source/slang/slang-ast-type.cpp b/source/slang/slang-ast-type.cpp index a84f04a32..077d6de0a 100644 --- a/source/slang/slang-ast-type.cpp +++ b/source/slang/slang-ast-type.cpp @@ -224,7 +224,7 @@ Val* DeclRefType::_substituteImplOverride(ASTBuilder* astBuilder, SubstitutionSe { // We've found it, so return the corresponding specialization argument (*ioDiff)++; - return genericSubst->args[index]; + return genericSubst->getArgs()[index]; } else if (auto typeParam = as(m)) { @@ -351,17 +351,17 @@ BasicExpressionType* MatrixExpressionType::_getScalarTypeOverride() Type* MatrixExpressionType::getElementType() { - return as(findInnerMostGenericSubstitution(declRef.substitutions)->args[0]); + return as(findInnerMostGenericSubstitution(declRef.substitutions)->getArgs()[0]); } IntVal* MatrixExpressionType::getRowCount() { - return as(findInnerMostGenericSubstitution(declRef.substitutions)->args[1]); + return as(findInnerMostGenericSubstitution(declRef.substitutions)->getArgs()[1]); } IntVal* MatrixExpressionType::getColumnCount() { - return as(findInnerMostGenericSubstitution(declRef.substitutions)->args[2]); + return as(findInnerMostGenericSubstitution(declRef.substitutions)->getArgs()[2]); } Type* MatrixExpressionType::getRowType() @@ -518,12 +518,12 @@ Type* NamespaceType::_createCanonicalTypeOverride() Type* PtrTypeBase::getValueType() { - return as(findInnerMostGenericSubstitution(declRef.substitutions)->args[0]); + return as(findInnerMostGenericSubstitution(declRef.substitutions)->getArgs()[0]); } Type* OptionalType::getValueType() { - return as(findInnerMostGenericSubstitution(declRef.substitutions)->args[0]); + return as(findInnerMostGenericSubstitution(declRef.substitutions)->getArgs()[0]); } // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! NamedExpressionType !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -- cgit v1.2.3