- Timestamp:
- Feb 6, 2018, 10:29:52 AM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, 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. - Location:
- src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/PassVisitor.impl.h
r7323573 r5f95b5f 998 998 template< typename pass_type > 999 999 void PassVisitor< pass_type >::visit( FinallyStmt * node ) { 1000 VISIT_BODY( node ); 1000 VISIT_START( node ); 1001 1002 maybeAccept_impl( node->block, *this ); 1003 1004 VISIT_END( node ); 1001 1005 } 1002 1006 1003 1007 template< typename pass_type > 1004 1008 Statement * PassVisitor< pass_type >::mutate( FinallyStmt * node ) { 1005 MUTATE_BODY( Statement, node ); 1009 MUTATE_START( node ); 1010 1011 maybeMutate_impl( node->block, *this ); 1012 1013 MUTATE_END( Statement, node ); 1006 1014 } 1007 1015 -
src/GenPoly/Box.cc
r7323573 r5f95b5f 988 988 989 989 Expression *Pass1::handleIntrinsics( ApplicationExpr *appExpr ) { 990 if ( VariableExpr *varExpr = dynamic_cast< VariableExpr *>( appExpr-> get_function()) ) {991 if ( varExpr-> get_var()->get_linkage()== LinkageSpec::Intrinsic ) {992 if ( varExpr-> get_var()->get_name()== "?[?]" ) {990 if ( VariableExpr *varExpr = dynamic_cast< VariableExpr *>( appExpr->function ) ) { 991 if ( varExpr->var->linkage == LinkageSpec::Intrinsic ) { 992 if ( varExpr->var->name == "?[?]" ) { 993 993 assert( appExpr->result ); 994 994 assert( appExpr->get_args().size() == 2 ); 995 Type *baseType1 = isPolyPtr( appExpr-> get_args().front()->get_result(), scopeTyVars, env );996 Type *baseType2 = isPolyPtr( appExpr-> get_args().back()->get_result(), scopeTyVars, env );995 Type *baseType1 = isPolyPtr( appExpr->args.front()->result, scopeTyVars, env ); 996 Type *baseType2 = isPolyPtr( appExpr->args.back()->result, scopeTyVars, env ); 997 997 assert( ! baseType1 || ! baseType2 ); // the arguments cannot both be polymorphic pointers 998 998 UntypedExpr *ret = 0; … … 1555 1555 // only mutate member expressions for polymorphic types 1556 1556 int tyDepth; 1557 Type *objectType = hasPolyBase( memberExpr-> get_aggregate()->get_result(), scopeTyVars, &tyDepth );1557 Type *objectType = hasPolyBase( memberExpr->aggregate->result, scopeTyVars, &tyDepth ); 1558 1558 if ( ! objectType ) return memberExpr; 1559 1559 findGeneric( objectType ); // ensure layout for this type is available 1560 1560 1561 1561 // replace member expression with dynamically-computed layout expression 1562 Expression *newMemberExpr = 0;1562 Expression *newMemberExpr = nullptr; 1563 1563 if ( StructInstType *structType = dynamic_cast< StructInstType* >( objectType ) ) { 1564 1564 // look up offset index 1565 long i = findMember( memberExpr-> get_member(), structType->get_baseStruct()->get_members());1565 long i = findMember( memberExpr->member, structType->baseStruct->members ); 1566 1566 if ( i == -1 ) return memberExpr; 1567 1567 1568 1568 // replace member expression with pointer to base plus offset 1569 1569 UntypedExpr *fieldLoc = new UntypedExpr( new NameExpr( "?+?" ) ); 1570 Expression * aggr = memberExpr-> get_aggregate()->clone();1571 delete aggr-> get_env(); // xxx - there's a problem with keeping the env for some reason, so for now just get rid of it1572 aggr-> set_env( nullptr );1570 Expression * aggr = memberExpr->aggregate->clone(); 1571 delete aggr->env; // xxx - there's a problem with keeping the env for some reason, so for now just get rid of it 1572 aggr->env = nullptr; 1573 1573 fieldLoc->get_args().push_back( aggr ); 1574 1574 fieldLoc->get_args().push_back( makeOffsetIndex( objectType, i ) ); 1575 fieldLoc->set_result( memberExpr-> get_result()->clone() );1575 fieldLoc->set_result( memberExpr->result->clone() ); 1576 1576 newMemberExpr = fieldLoc; 1577 1577 } else if ( dynamic_cast< UnionInstType* >( objectType ) ) { 1578 1578 // union members are all at offset zero, so just use the aggregate expr 1579 Expression * aggr = memberExpr-> get_aggregate()->clone();1580 delete aggr-> get_env(); // xxx - there's a problem with keeping the env for some reason, so for now just get rid of it1581 aggr-> set_env( nullptr );1579 Expression * aggr = memberExpr->aggregate->clone(); 1580 delete aggr->env; // xxx - there's a problem with keeping the env for some reason, so for now just get rid of it 1581 aggr->env= nullptr; 1582 1582 newMemberExpr = aggr; 1583 newMemberExpr-> set_result( memberExpr->get_result()->clone());1583 newMemberExpr->result = memberExpr->result->clone(); 1584 1584 } else return memberExpr; 1585 1585 assert( newMemberExpr ); 1586 1586 1587 Type *memberType = memberExpr-> get_member()->get_type();1587 Type *memberType = memberExpr->member->get_type(); 1588 1588 if ( ! isPolyType( memberType, scopeTyVars ) ) { 1589 1589 // 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 … … 1598 1598 1599 1599 ObjectDecl *PolyGenericCalculator::makeVar( const std::string &name, Type *type, Initializer *init ) { 1600 ObjectDecl *newObj = new ObjectDecl( name, Type::StorageClasses(), LinkageSpec::C, 0, type, init );1600 ObjectDecl *newObj = new ObjectDecl( name, Type::StorageClasses(), LinkageSpec::C, nullptr, type, init ); 1601 1601 stmtsToAddBefore.push_back( new DeclStmt( newObj ) ); 1602 1602 return newObj; -
src/GenPoly/InstantiateGeneric.cc
r7323573 r5f95b5f 476 476 DeclarationWithType * field = strict_dynamic_cast< DeclarationWithType * >( member ); 477 477 MemberExpr * ret = new MemberExpr( field, memberExpr->aggregate->clone() ); 478 ResolvExpr::adjustExprType( ret->result ); // pointer decay 478 479 std::swap( ret->env, memberExpr->env ); 479 480 delete memberExpr; -
src/ResolvExpr/AdjustExprType.cc
r7323573 r5f95b5f 24 24 class AdjustExprType : public WithShortCircuiting { 25 25 public: 26 AdjustExprType( const TypeEnvironment & env, const SymTab::Indexer &indexer );26 AdjustExprType( const TypeEnvironment & env, const SymTab::Indexer & indexer ); 27 27 void premutate( VoidType * ) { visit_children = false; } 28 28 void premutate( BasicType * ) { visit_children = false; } … … 45 45 46 46 private: 47 const TypeEnvironment & env;48 const SymTab::Indexer & indexer;47 const TypeEnvironment & env; 48 const SymTab::Indexer & indexer; 49 49 }; 50 50 … … 53 53 Type *newType = type->acceptMutator( adjuster ); 54 54 type = newType; 55 } 56 57 void adjustExprType( Type *& type ) { 58 TypeEnvironment env; 59 SymTab::Indexer indexer; 60 adjustExprType( type, env, indexer ); 55 61 } 56 62 -
src/ResolvExpr/Resolver.cc
r7323573 r5f95b5f 280 280 std::list< Statement * > newStmts; 281 281 resolveWithExprs( functionDecl->withExprs, newStmts ); 282 functionDecl->statements->kids.splice( functionDecl->statements->kids.begin(), newStmts ); 282 if ( functionDecl->statements ) { 283 functionDecl->statements->kids.splice( functionDecl->statements->kids.begin(), newStmts ); 284 } else { 285 assertf( functionDecl->withExprs.empty() && newStmts.empty(), "Function %s without a body has with-clause and/or generated with declarations.", functionDecl->name.c_str() ); 286 } 283 287 } 284 288 } -
src/ResolvExpr/typeops.h
r7323573 r5f95b5f 55 55 /// Replaces array types with the equivalent pointer, and function types with a pointer-to-function 56 56 void adjustExprType( Type *&type, const TypeEnvironment &env, const SymTab::Indexer &indexer ); 57 58 /// Replaces array types with the equivalent pointer, and function types with a pointer-to-function using empty TypeEnvironment and Indexer 59 void adjustExprType( Type *& type ); 57 60 58 61 template< typename ForwardIterator > -
src/driver/cfa.cc
r7323573 r5f95b5f 10 10 // Created On : Tue Aug 20 13:44:49 2002 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 1 22:26:10201813 // Update Count : 16 312 // Last Modified On : Mon Feb 5 22:05:28 2018 13 // Update Count : 166 14 14 // 15 15 … … 258 258 #endif 259 259 260 args[nargs] = "-Xlinker"; 261 nargs += 1; 262 args[nargs] = "--undefined=__cfaabi_dbg_bits_write"; 263 nargs += 1; 264 args[nargs] = "-Xlinker"; 265 nargs += 1; 266 args[nargs] = "--undefined=__cfaabi_interpose_startup"; 267 nargs += 1; 268 260 269 // include the cfa library in case it's needed 261 270 args[nargs] = "-L" CFA_LIBDIR; … … 273 282 args[nargs] = "-lrt"; 274 283 nargs += 1; 275 args[nargs] = "-Xlinker"; 276 nargs += 1; 277 args[nargs] = "--undefined=__cfaabi_dbg_bits_write"; 278 nargs += 1; 279 args[nargs] = "-Xlinker"; 280 nargs += 1; 281 args[nargs] = "--undefined=__cfaabi_interpose_startup"; 282 nargs += 1; 283 284 } // if 285 #endif //HAVE_LIBCFA 284 } // if 285 #endif // HAVE_LIBCFA 286 286 287 287 // Add exception flags (unconditionally) … … 333 333 nargs += 1; 334 334 } // if 335 336 args[nargs] = "-Xlinker"; // used by backtrace 337 nargs += 1; 338 args[nargs] = "-export-dynamic"; 339 nargs += 1; 335 340 336 341 // execute the compilation command -
src/libcfa/interpose.c
r7323573 r5f95b5f 10 10 // Created On : Wed Mar 29 16:10:31 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 21 22:27:33 201713 // Update Count : 1 12 // Last Modified On : Mon Feb 5 23:40:04 2018 13 // Update Count : 17 14 14 // 15 15 … … 32 32 #include "bits/signal.h" 33 33 #include "startup.h" 34 35 void __cfaabi_interpose_startup(void) __attribute__(( constructor( STARTUP_PRIORITY_CORE ) ));36 34 37 35 typedef void (*generic_fptr_t)(void); … … 92 90 void sigHandler_abort( __CFA_SIGPARMS__ ); 93 91 94 void __cfaabi_interpose_startup() { 95 const char *version = NULL; 96 97 INIT_REALRTN( abort, version ); 98 INIT_REALRTN( exit, version ); 99 100 __kernel_sigaction( SIGSEGV, sigHandler_segv , SA_SIGINFO ); // Failure handler 101 __kernel_sigaction( SIGBUS , sigHandler_segv , SA_SIGINFO ); // Failure handler 102 __kernel_sigaction( SIGABRT, sigHandler_abort, SA_SIGINFO ); // Failure handler 92 extern "C" { 93 void __cfaabi_interpose_startup(void) __attribute__(( constructor( STARTUP_PRIORITY_CORE ) )); 94 void __cfaabi_interpose_startup( void ) { 95 const char *version = NULL; 96 97 INIT_REALRTN( abort, version ); 98 INIT_REALRTN( exit, version ); 99 100 __kernel_sigaction( SIGSEGV, sigHandler_segv , SA_SIGINFO ); // Failure handler 101 __kernel_sigaction( SIGBUS , sigHandler_segv , SA_SIGINFO ); // Failure handler 102 __kernel_sigaction( SIGABRT, sigHandler_abort, SA_SIGINFO ); // Failure handler 103 } 103 104 } 104 105 … … 108 109 109 110 extern "C" { 110 void abort (void) __attribute__ ((__nothrow__, __leaf__, __noreturn__)) {111 void abort( void ) __attribute__ ((__nothrow__, __leaf__, __noreturn__)) { 111 112 abortf( NULL ); 112 113 } 113 114 114 void exit (int __status) __attribute__ ((__nothrow__, __leaf__, __noreturn__)) {115 void exit( int __status ) __attribute__ ((__nothrow__, __leaf__, __noreturn__)) { 115 116 libc_exit(__status); 116 117 } … … 121 122 } 122 123 123 void * kernel_abort ( void) __attribute__ ((__nothrow__, __leaf__, __weak__)) { return NULL; }124 void kernel_abort_msg( void * data, char * buffer, int size) __attribute__ ((__nothrow__, __leaf__, __weak__)) {}124 void * kernel_abort ( void ) __attribute__ ((__nothrow__, __leaf__, __weak__)) { return NULL; } 125 void kernel_abort_msg( void * data, char * buffer, int size ) __attribute__ ((__nothrow__, __leaf__, __weak__)) {} 125 126 126 127 enum { abort_text_size = 1024 }; … … 133 134 int len; 134 135 135 if ( fmt ) {136 if ( fmt ) { 136 137 va_list args; 137 138 va_start( args, fmt ); … … 142 143 143 144 __cfaabi_dbg_bits_write( abort_text, len ); 144 __cfaabi_dbg_bits_write( "\n", 1 );145 //__cfaabi_dbg_bits_write( "\n", 1 ); 145 146 } 146 147 … … 162 163 enum { Frames = 50 }; 163 164 void * array[Frames]; 164 int size = backtrace( array, Frames );165 size_t size = backtrace( array, Frames ); 165 166 char ** messages = backtrace_symbols( array, size ); 166 167 … … 176 177 177 178 for ( char *p = messages[i]; *p; ++p ) { 179 //__cfaabi_dbg_bits_print_nolock( "X %s\n", p); 178 180 // find parantheses and +offset 179 181 if ( *p == '(' ) {
Note:
See TracChangeset
for help on using the changeset viewer.