# Changeset 5f95b5f

Ignore:
Timestamp:
Feb 6, 2018, 10:29:52 AM (5 years ago)
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
69ce455
Parents:
7323573 (diff), 6bfe5cc (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Files:
9 edited

Unmodified
Removed
• ## doc/papers/general/Paper.tex

• ## src/Common/PassVisitor.impl.h

 r7323573 template< typename pass_type > void PassVisitor< pass_type >::visit( FinallyStmt * node ) { VISIT_BODY( node ); VISIT_START( node ); maybeAccept_impl( node->block, *this ); VISIT_END( node ); } template< typename pass_type > Statement * PassVisitor< pass_type >::mutate( FinallyStmt * node ) { MUTATE_BODY( Statement, node ); MUTATE_START( node ); maybeMutate_impl( node->block, *this ); MUTATE_END( Statement, node ); }
• ## src/GenPoly/Box.cc

 r7323573 Expression *Pass1::handleIntrinsics( ApplicationExpr *appExpr ) { if ( VariableExpr *varExpr = dynamic_cast< VariableExpr *>( appExpr->get_function() ) ) { if ( varExpr->get_var()->get_linkage() == LinkageSpec::Intrinsic ) { if ( varExpr->get_var()->get_name() == "?[?]" ) { if ( VariableExpr *varExpr = dynamic_cast< VariableExpr *>( appExpr->function ) ) { if ( varExpr->var->linkage == LinkageSpec::Intrinsic ) { if ( varExpr->var->name == "?[?]" ) { assert( appExpr->result ); assert( appExpr->get_args().size() == 2 ); Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_result(), scopeTyVars, env ); Type *baseType2 = isPolyPtr( appExpr->get_args().back()->get_result(), scopeTyVars, env ); Type *baseType1 = isPolyPtr( appExpr->args.front()->result, scopeTyVars, env ); Type *baseType2 = isPolyPtr( appExpr->args.back()->result, scopeTyVars, env ); assert( ! baseType1 || ! baseType2 ); // the arguments cannot both be polymorphic pointers UntypedExpr *ret = 0; // only mutate member expressions for polymorphic types int tyDepth; Type *objectType = hasPolyBase( memberExpr->get_aggregate()->get_result(), scopeTyVars, &tyDepth ); Type *objectType = hasPolyBase( memberExpr->aggregate->result, scopeTyVars, &tyDepth ); if ( ! objectType ) return memberExpr; findGeneric( objectType ); // ensure layout for this type is available // replace member expression with dynamically-computed layout expression Expression *newMemberExpr = 0; Expression *newMemberExpr = nullptr; if ( StructInstType *structType = dynamic_cast< StructInstType* >( objectType ) ) { // look up offset index long i = findMember( memberExpr->get_member(), structType->get_baseStruct()->get_members() ); long i = findMember( memberExpr->member, structType->baseStruct->members ); if ( i == -1 ) return memberExpr; // replace member expression with pointer to base plus offset UntypedExpr *fieldLoc = new UntypedExpr( new NameExpr( "?+?" ) ); Expression * aggr = memberExpr->get_aggregate()->clone(); delete aggr->get_env(); // xxx - there's a problem with keeping the env for some reason, so for now just get rid of it aggr->set_env( nullptr ); Expression * aggr = memberExpr->aggregate->clone(); delete aggr->env; // xxx - there's a problem with keeping the env for some reason, so for now just get rid of it aggr->env = nullptr; fieldLoc->get_args().push_back( aggr ); fieldLoc->get_args().push_back( makeOffsetIndex( objectType, i ) ); fieldLoc->set_result( memberExpr->get_result()->clone() ); fieldLoc->set_result( memberExpr->result->clone() ); newMemberExpr = fieldLoc; } else if ( dynamic_cast< UnionInstType* >( objectType ) ) { // union members are all at offset zero, so just use the aggregate expr Expression * aggr = memberExpr->get_aggregate()->clone(); delete aggr->get_env(); // xxx - there's a problem with keeping the env for some reason, so for now just get rid of it aggr->set_env( nullptr ); Expression * aggr = memberExpr->aggregate->clone(); delete aggr->env; // xxx - there's a problem with keeping the env for some reason, so for now just get rid of it aggr->env= nullptr; newMemberExpr = aggr; newMemberExpr->set_result( memberExpr->get_result()->clone() ); newMemberExpr->result = memberExpr->result->clone(); } else return memberExpr; assert( newMemberExpr ); Type *memberType = memberExpr->get_member()->get_type(); Type *memberType = memberExpr->member->get_type(); if ( ! isPolyType( memberType, scopeTyVars ) ) { // Not all members of a polymorphic type are themselves of polymorphic type; in this case the member expression should be wrapped and dereferenced to form an lvalue ObjectDecl *PolyGenericCalculator::makeVar( const std::string &name, Type *type, Initializer *init ) { ObjectDecl *newObj = new ObjectDecl( name, Type::StorageClasses(), LinkageSpec::C, 0, type, init ); ObjectDecl *newObj = new ObjectDecl( name, Type::StorageClasses(), LinkageSpec::C, nullptr, type, init ); stmtsToAddBefore.push_back( new DeclStmt( newObj ) ); return newObj;
• ## src/GenPoly/InstantiateGeneric.cc

 r7323573 DeclarationWithType * field = strict_dynamic_cast< DeclarationWithType * >( member ); MemberExpr * ret = new MemberExpr( field, memberExpr->aggregate->clone() ); ResolvExpr::adjustExprType( ret->result ); // pointer decay std::swap( ret->env, memberExpr->env ); delete memberExpr;

 r7323573 class AdjustExprType : public WithShortCircuiting { public: AdjustExprType( const TypeEnvironment &env, const SymTab::Indexer &indexer ); AdjustExprType( const TypeEnvironment & env, const SymTab::Indexer & indexer ); void premutate( VoidType * ) { visit_children = false; } void premutate( BasicType * ) { visit_children = false; } private: const TypeEnvironment &env; const SymTab::Indexer &indexer; const TypeEnvironment & env; const SymTab::Indexer & indexer; }; Type *newType = type->acceptMutator( adjuster ); type = newType; } void adjustExprType( Type *& type ) { TypeEnvironment env; SymTab::Indexer indexer; adjustExprType( type, env, indexer ); }
• ## src/ResolvExpr/Resolver.cc

 r7323573 std::list< Statement * > newStmts; resolveWithExprs( functionDecl->withExprs, newStmts ); functionDecl->statements->kids.splice( functionDecl->statements->kids.begin(), newStmts ); if ( functionDecl->statements ) { functionDecl->statements->kids.splice( functionDecl->statements->kids.begin(), newStmts ); } else { assertf( functionDecl->withExprs.empty() && newStmts.empty(), "Function %s without a body has with-clause and/or generated with declarations.", functionDecl->name.c_str() ); } } }
• ## src/ResolvExpr/typeops.h

 r7323573 /// Replaces array types with the equivalent pointer, and function types with a pointer-to-function void adjustExprType( Type *&type, const TypeEnvironment &env, const SymTab::Indexer &indexer ); /// Replaces array types with the equivalent pointer, and function types with a pointer-to-function using empty TypeEnvironment and Indexer void adjustExprType( Type *& type ); template< typename ForwardIterator >