From 43c146794aab638924d2ab838d10f8af2ebf02a7 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Fri, 5 Jun 2020 18:20:09 -0400 Subject: ASTNodes use MemoryArena (#1376) * Add a ASTBuilder to a Module Only construct on valid ASTBuilder (was being called on nullptr on occassion) * Add nodes to ASTBuilder. * Compiles with RefPtr removed from AST node types. * Initialize all AST node pointer variables in headers to nullptr; * Initialize AST node variables as nullptr. Make ASTBuilder keep a ref on node types. Make SyntaxParseCallback returns a NodeBase * Don't release canonicalType on dtor (managed by ASTBuilder). * Give ASTBuilders a name and id, to help in debugging. For now destroy the session TypeCache, to stop it holding things released when the compile request destroys ASTBuilders. * Moved the TypeCheckingCache over to Linkage from Session. * NodeBase no longer derived from RefObject. * Only add/dtor nodes that need destruction. First pass compile on linux. --- source/slang/slang-lookup.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'source/slang/slang-lookup.cpp') diff --git a/source/slang/slang-lookup.cpp b/source/slang/slang-lookup.cpp index fae00c6a2..19cd4cafe 100644 --- a/source/slang/slang-lookup.cpp +++ b/source/slang/slang-lookup.cpp @@ -11,7 +11,7 @@ void ensureDecl(SemanticsVisitor* visitor, Decl* decl, DeclCheckState state); DeclRef ApplyExtensionToType( SemanticsVisitor* semantics, ExtensionDecl* extDecl, - RefPtr type); + Type* type); // @@ -268,7 +268,7 @@ LookupResult lookUpDirectAndTransparentMembers( } -static RefPtr _makeSubtypeWitness( +static SubtypeWitness* _makeSubtypeWitness( ASTBuilder* astBuilder, Type* subType, SubtypeWitness* subToMidWitness, @@ -277,7 +277,7 @@ static RefPtr _makeSubtypeWitness( { if(subToMidWitness) { - RefPtr transitiveWitness = astBuilder->create(); + TransitiveSubtypeWitness* transitiveWitness = astBuilder->create(); transitiveWitness->subToMid = subToMidWitness; transitiveWitness->midToSup = midToSuperConstraint; transitiveWitness->sub = subType; @@ -286,7 +286,7 @@ static RefPtr _makeSubtypeWitness( } else { - RefPtr declaredWitness = astBuilder->create(); + DeclaredSubtypeWitness* declaredWitness = astBuilder->create(); declaredWitness->declRef = midToSuperConstraint; declaredWitness->sub = subType; declaredWitness->sup = superType; @@ -295,7 +295,7 @@ static RefPtr _makeSubtypeWitness( } // Same as the above, but we are specializing a type instead of a decl-ref -static RefPtr _maybeSpecializeSuperType( +static Type* _maybeSpecializeSuperType( ASTBuilder* astBuilder, Type* superType, SubtypeWitness* subIsSuperWitness) @@ -304,7 +304,7 @@ static RefPtr _maybeSpecializeSuperType( { if (auto superInterfaceDeclRef = superDeclRefType->declRef.as()) { - RefPtr thisTypeSubst = astBuilder->create(); + ThisTypeSubstitution* thisTypeSubst = astBuilder->create(); thisTypeSubst->interfaceDecl = superInterfaceDeclRef.getDecl(); thisTypeSubst->witness = subIsSuperWitness; thisTypeSubst->outer = superInterfaceDeclRef.substitutions.substitutions; @@ -322,7 +322,7 @@ static RefPtr _maybeSpecializeSuperType( static void _lookUpMembersInType( ASTBuilder* astBuilder, Name* name, - RefPtr type, + Type* type, LookupRequest const& request, LookupResult& ioResult, BreadcrumbInfo* breadcrumbs); @@ -584,7 +584,7 @@ static void _lookUpMembersInSuperTypeImpl( static void _lookUpMembersInType( ASTBuilder* astBuilder, Name* name, - RefPtr type, + Type* type, LookupRequest const& request, LookupResult& ioResult, BreadcrumbInfo* breadcrumbs) @@ -679,7 +679,7 @@ static void _lookUpInScopes( breadcrumb.declRef = aggTypeDeclBaseRef; breadcrumb.prev = nullptr; - RefPtr type; + Type* type = nullptr; if(auto extDeclRef = aggTypeDeclBaseRef.as()) { if( request.semantics ) -- cgit v1.2.3