Changeset 5c4a473
- Timestamp:
- Aug 15, 2019, 10:31:53 AM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 6daaee3
- Parents:
- d65f92c (diff), 3c7f01b (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. - Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
Jenkins/FullBuild
rd65f92c r5c4a473 132 132 133 133 <img src="https://cforall.uwaterloo.ca/jenkins/job/Cforall/job/master/plot/Compilation/getPlot?index=0" > 134 <img src="https://cforall.uwaterloo.ca/jenkins/job/Cforall/job/master/plot/Compilation/getPlot?index=1" > 134 135 135 136 <p>- Logs ----------------------------------------------------------------</p> -
Jenkinsfile
rd65f92c r5c4a473 197 197 if( Settings.Publish && !Settings.RunBenchmark ) { echo 'No results to publish!!!' } 198 198 199 def groupCompile = new PlotGroup('Compilation', ' seconds', true)200 def groupConcurrency = new PlotGroup('Concurrency', ' nanoseconds', false)199 def groupCompile = new PlotGroup('Compilation', 'duration (s) - lower is better', true) 200 def groupConcurrency = new PlotGroup('Concurrency', 'duration (n) - lower is better', false) 201 201 202 202 //Then publish the results 203 do_plot(Settings.RunBenchmark && Settings.Publish, 'compile' , groupCompile , 'Compilation')204 do_plot(Settings.RunBenchmark && Settings.Publish, 'compile.diff' , groupCompile , 'Compilation Speed-Up')205 do_plot(Settings.RunBenchmark && Settings.Publish, 'ctxswitch' , groupConcurrency, 'Context Switching')206 do_plot(Settings.RunBenchmark && Settings.Publish, 'ctxswitch.diff', groupConcurrency, 'Context Switching Speed-Up')207 do_plot(Settings.RunBenchmark && Settings.Publish, 'mutex' , groupConcurrency, 'Mutual Exclusion')208 do_plot(Settings.RunBenchmark && Settings.Publish, 'mutex.diff' , groupConcurrency, 'Mutual Exclusion Speed-Up')209 do_plot(Settings.RunBenchmark && Settings.Publish, 'signal' , groupConcurrency, 'Internal and External Scheduling')210 do_plot(Settings.RunBenchmark && Settings.Publish, 'signal.diff' , groupConcurrency, 'Internal and External Scheduling Speed-Up')203 do_plot(Settings.RunBenchmark && Settings.Publish, 'compile' , groupCompile , false, 'Compilation') 204 do_plot(Settings.RunBenchmark && Settings.Publish, 'compile.diff' , groupCompile , true , 'Compilation (relative)') 205 do_plot(Settings.RunBenchmark && Settings.Publish, 'ctxswitch' , groupConcurrency, false, 'Context Switching') 206 do_plot(Settings.RunBenchmark && Settings.Publish, 'ctxswitch.diff', groupConcurrency, true , 'Context Switching (relative)') 207 do_plot(Settings.RunBenchmark && Settings.Publish, 'mutex' , groupConcurrency, false, 'Mutual Exclusion') 208 do_plot(Settings.RunBenchmark && Settings.Publish, 'mutex.diff' , groupConcurrency, true , 'Mutual Exclusion (relative)') 209 do_plot(Settings.RunBenchmark && Settings.Publish, 'signal' , groupConcurrency, false, 'Internal and External Scheduling') 210 do_plot(Settings.RunBenchmark && Settings.Publish, 'signal.diff' , groupConcurrency, true , 'Internal and External Scheduling (relative)') 211 211 } 212 212 } … … 466 466 } 467 467 468 def do_plot(boolean new_data, String file, PlotGroup group, String title) {468 def do_plot(boolean new_data, String file, PlotGroup group, boolean relative, String title) { 469 469 470 470 if(new_data) { … … 489 489 exclZero: false, 490 490 keepRecords: false, 491 logarithmic: group.log,491 logarithmic: !relative && group.log, 492 492 numBuilds: '120', 493 493 useDescr: true, -
libcfa/src/Makefile.am
rd65f92c r5c4a473 26 26 VPATH += :../prelude 27 27 28 gdbwaittarget="" 29 28 30 # AM_CFLAGS for all cfa source 29 31 # AM_CFAFLAGS for only cfa source 30 32 # use -no-include-stdhdr to prevent rebuild cycles 31 33 # The built sources must not depend on the installed headers 32 AM_CFAFLAGS = -quiet -cfalib @PRELUDEFLAG@ -I$(srcdir)/stdhdr @CONFIG_CFAFLAGS@34 AM_CFAFLAGS = -quiet -cfalib @PRELUDEFLAG@ -I$(srcdir)/stdhdr $(if $(findstring ${gdbwaittarget}, ${@}), -XCFA --gdb) @CONFIG_CFAFLAGS@ 33 35 AM_CFLAGS = -g -Wall -Wno-unused-function -fPIC @ARCH_FLAGS@ @CONFIG_CFLAGS@ 34 36 AM_CCASFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@ -
libcfa/src/Makefile.in
rd65f92c r5c4a473 438 438 am__v_UPP_1 = 439 439 lib_LTLIBRARIES = libcfa.la libcfathread.la 440 gdbwaittarget = "" 440 441 441 442 # AM_CFLAGS for all cfa source … … 443 444 # use -no-include-stdhdr to prevent rebuild cycles 444 445 # The built sources must not depend on the installed headers 445 AM_CFAFLAGS = -quiet -cfalib @PRELUDEFLAG@ -I$(srcdir)/stdhdr @CONFIG_CFAFLAGS@446 AM_CFAFLAGS = -quiet -cfalib @PRELUDEFLAG@ -I$(srcdir)/stdhdr $(if $(findstring ${gdbwaittarget}, ${@}), -XCFA --gdb) @CONFIG_CFAFLAGS@ 446 447 AM_CFLAGS = -g -Wall -Wno-unused-function -fPIC @ARCH_FLAGS@ @CONFIG_CFLAGS@ 447 448 AM_CCASFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@ -
src/ResolvExpr/AlternativeFinder.cc
rd65f92c r5c4a473 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sat May 16 23:52:08 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Thu Jul 25 22:37:46201913 // Update Count : 3 711 // Last Modified By : Andrew Beach 12 // Last Modified On : Thu Aug 8 16:35:00 2019 13 // Update Count : 38 14 14 // 15 15 … … 377 377 } 378 378 379 Cost computeConversionCost( Type * actualType, Type * formalType, const SymTab::Indexer &indexer, const TypeEnvironment & env ) { 379 Cost computeConversionCost( Type * actualType, Type * formalType, bool actualIsLvalue, 380 const SymTab::Indexer &indexer, const TypeEnvironment & env ) { 380 381 PRINT( 381 382 std::cerr << std::endl << "converting "; … … 387 388 std::cerr << std::endl; 388 389 ) 389 Cost convCost = conversionCost( actualType, formalType, indexer, env );390 Cost convCost = conversionCost( actualType, formalType, actualIsLvalue, indexer, env ); 390 391 PRINT( 391 392 std::cerr << std::endl << "cost is " << convCost << std::endl; … … 402 403 403 404 Cost computeExpressionConversionCost( Expression *& actualExpr, Type * formalType, const SymTab::Indexer &indexer, const TypeEnvironment & env ) { 404 Cost convCost = computeConversionCost( actualExpr->result, formalType, indexer, env ); 405 Cost convCost = computeConversionCost( 406 actualExpr->result, formalType, actualExpr->get_lvalue(), indexer, env ); 405 407 406 408 // if there is a non-zero conversion cost, ignoring poly cost, then the expression requires conversion. … … 1186 1188 assert( toType ); 1187 1189 toType = resolveTypeof( toType, indexer ); 1190 assert(!dynamic_cast<TypeofType *>(toType)); 1188 1191 SymTab::validateType( toType, &indexer ); 1189 1192 adjustExprType( toType, env, indexer ); … … 1212 1215 unify( castExpr->result, alt.expr->result, alt.env, needAssertions, 1213 1216 haveAssertions, openVars, indexer ); 1214 Cost thisCost = castCost( alt.expr->result, castExpr->result, indexer,1215 alt.env );1217 Cost thisCost = castCost( alt.expr->result, castExpr->result, alt.expr->get_lvalue(), 1218 indexer, alt.env ); 1216 1219 PRINT( 1217 1220 std::cerr << "working on cast with result: " << castExpr->result << std::endl; … … 1640 1643 // xxx - do some inspecting on this line... why isn't result bound to initAlt.type? 1641 1644 1642 Cost thisCost = castCost( alt.expr->result, toType, indexer, newEnv ); 1645 Cost thisCost = castCost( alt.expr->result, toType, alt.expr->get_lvalue(), 1646 indexer, newEnv ); 1643 1647 if ( thisCost != Cost::infinity ) { 1644 1648 // count one safe conversion for each value that is thrown away -
src/ResolvExpr/CastCost.cc
rd65f92c r5c4a473 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 06:57:43 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : T ue Feb 2 15:34:36 201613 // Update Count : 711 // Last Modified By : Andrew Beach 12 // Last Modified On : Thu Aug 8 16:12:00 2019 13 // Update Count : 8 14 14 // 15 15 … … 37 37 struct CastCost_old : public ConversionCost { 38 38 public: 39 CastCost_old( const Type * dest, const SymTab::Indexer &indexer, const TypeEnvironment &env, CostFunction costFunc ); 39 CastCost_old( const Type * dest, bool srcIsLvalue, 40 const SymTab::Indexer &indexer, const TypeEnvironment &env, CostFunction costFunc ); 40 41 41 42 using ConversionCost::previsit; … … 45 46 }; 46 47 47 Cost castCost( const Type * src, const Type * dest, const SymTab::Indexer &indexer, const TypeEnvironment &env ) { 48 Cost castCost( const Type * src, const Type * dest, bool srcIsLvalue, 49 const SymTab::Indexer &indexer, const TypeEnvironment &env ) { 48 50 if ( const TypeInstType * destAsTypeInst = dynamic_cast< const TypeInstType * >( dest ) ) { 49 51 if ( const EqvClass * eqvClass = env.lookup( destAsTypeInst->name ) ) { 50 52 if ( eqvClass->type ) { 51 return castCost( src, eqvClass->type, indexer, env );53 return castCost( src, eqvClass->type, srcIsLvalue, indexer, env ); 52 54 } else { 53 55 return Cost::infinity; … … 57 59 const TypeDecl * type = strict_dynamic_cast< const TypeDecl * >( namedType ); 58 60 if ( type->base ) { 59 return castCost( src, type->base, indexer, env ) + Cost::safe;61 return castCost( src, type->base, srcIsLvalue, indexer, env ) + Cost::safe; 60 62 } // if 61 63 } // if … … 78 80 } else if ( const ReferenceType * refType = dynamic_cast< const ReferenceType * > ( dest ) ) { 79 81 PRINT( std::cerr << "conversionCost: dest is reference" << std::endl; ) 80 return convertToReferenceCost( src, refType, indexer, env, [](const Type * t1, const Type * t2, const SymTab::Indexer & indexer, const TypeEnvironment & env ) {82 return convertToReferenceCost( src, refType, srcIsLvalue, indexer, env, [](const Type * t1, const Type * t2, const SymTab::Indexer & indexer, const TypeEnvironment & env ) { 81 83 return ptrsCastable( t1, t2, env, indexer ); 82 84 }); 83 85 } else { 84 86 PassVisitor<CastCost_old> converter( 85 dest, indexer, env,86 (Cost (*)( const Type *, const Type *, const SymTab::Indexer &, const TypeEnvironment & ))87 dest, srcIsLvalue, indexer, env, 88 (Cost (*)( const Type *, const Type *, bool, const SymTab::Indexer &, const TypeEnvironment & )) 87 89 castCost ); 88 90 src->accept( converter ); … … 96 98 } 97 99 98 CastCost_old::CastCost_old( const Type * dest, const SymTab::Indexer &indexer, const TypeEnvironment &env, CostFunction costFunc ) 99 : ConversionCost( dest, indexer, env, costFunc ) { 100 CastCost_old::CastCost_old( const Type * dest, bool srcIsLvalue, 101 const SymTab::Indexer &indexer, const TypeEnvironment &env, CostFunction costFunc ) 102 : ConversionCost( dest, srcIsLvalue, indexer, env, costFunc ) { 100 103 } 101 104 … … 106 109 cost = Cost::unsafe; 107 110 } else { 108 cost = conversionCost( basicType, dest, indexer, env );111 cost = conversionCost( basicType, dest, srcIsLvalue, indexer, env ); 109 112 } // if 110 113 } -
src/ResolvExpr/ConversionCost.cc
rd65f92c r5c4a473 10 10 // Created On : Sun May 17 07:06:19 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Jun 24 13:33:00 201913 // Update Count : 2 612 // Last Modified On : Mon Aug 12 10:21:00 2019 13 // Update Count : 27 14 14 // 15 15 … … 46 46 #endif 47 47 48 Cost conversionCost( const Type * src, const Type * dest, const SymTab::Indexer &indexer, const TypeEnvironment &env ) { 48 Cost conversionCost( const Type * src, const Type * dest, bool srcIsLvalue, 49 const SymTab::Indexer &indexer, const TypeEnvironment &env ) { 49 50 if ( const TypeInstType * destAsTypeInst = dynamic_cast< const TypeInstType * >( dest ) ) { 50 51 PRINT( std::cerr << "type inst " << destAsTypeInst->name; ) 51 52 if ( const EqvClass * eqvClass = env.lookup( destAsTypeInst->name ) ) { 52 53 if ( eqvClass->type ) { 53 return conversionCost( src, eqvClass->type, indexer, env );54 return conversionCost( src, eqvClass->type, srcIsLvalue, indexer, env ); 54 55 } else { 55 56 return Cost::infinity; … … 61 62 assert( type ); 62 63 if ( type->base ) { 63 return conversionCost( src, type->base, indexer, env ) + Cost::safe; 64 return conversionCost( src, type->base, srcIsLvalue, indexer, env ) 65 + Cost::safe; 64 66 } // if 65 67 } // if … … 81 83 } else if ( const ReferenceType * refType = dynamic_cast< const ReferenceType * > ( dest ) ) { 82 84 PRINT( std::cerr << "conversionCost: dest is reference" << std::endl; ) 83 return convertToReferenceCost( src, refType, indexer, env, [](const Type * const t1, const Type * t2, const SymTab::Indexer &, const TypeEnvironment & env ){85 return convertToReferenceCost( src, refType, srcIsLvalue, indexer, env, [](const Type * const t1, const Type * t2, const SymTab::Indexer &, const TypeEnvironment & env ){ 84 86 return ptrsAssignable( t1, t2, env ); 85 87 }); 86 88 } else { 87 89 PassVisitor<ConversionCost> converter( 88 dest, indexer, env,89 (Cost (*)(const Type *, const Type *, const SymTab::Indexer&, const TypeEnvironment&))90 dest, srcIsLvalue, indexer, env, 91 (Cost (*)(const Type *, const Type *, bool, const SymTab::Indexer&, const TypeEnvironment&)) 90 92 conversionCost ); 91 93 src->accept( converter ); … … 98 100 } 99 101 100 static Cost convertToReferenceCost( const Type * src, const Type * dest, int diff, const SymTab::Indexer & indexer, const TypeEnvironment & env, PtrsFunction func ) { 102 static Cost convertToReferenceCost( const Type * src, const Type * dest, bool srcIsLvalue, 103 int diff, const SymTab::Indexer & indexer, const TypeEnvironment & env, PtrsFunction func ) { 101 104 PRINT( std::cerr << "convert to reference cost... diff " << diff << " " << src << " / " << dest << std::endl; ) 102 105 if ( diff > 0 ) { 103 106 // TODO: document this 104 Cost cost = convertToReferenceCost( strict_dynamic_cast< const ReferenceType * >( src )->base, dest, diff-1, indexer, env, func ); 107 Cost cost = convertToReferenceCost( 108 strict_dynamic_cast< const ReferenceType * >( src )->base, dest, srcIsLvalue, 109 diff-1, indexer, env, func ); 105 110 cost.incReference(); 106 111 return cost; 107 112 } else if ( diff < -1 ) { 108 113 // TODO: document this 109 Cost cost = convertToReferenceCost( src, strict_dynamic_cast< const ReferenceType * >( dest )->base, diff+1, indexer, env, func ); 114 Cost cost = convertToReferenceCost( 115 src, strict_dynamic_cast< const ReferenceType * >( dest )->base, srcIsLvalue, 116 diff+1, indexer, env, func ); 110 117 cost.incReference(); 111 118 return cost; … … 138 145 PRINT( std::cerr << "reference to rvalue conversion" << std::endl; ) 139 146 PassVisitor<ConversionCost> converter( 140 dest, indexer, env,141 (Cost (*)(const Type *, const Type *, const SymTab::Indexer&, const TypeEnvironment&))147 dest, srcIsLvalue, indexer, env, 148 (Cost (*)(const Type *, const Type *, bool, const SymTab::Indexer&, const TypeEnvironment&)) 142 149 conversionCost ); 143 150 src->accept( converter ); … … 150 157 if ( typesCompatibleIgnoreQualifiers( src, destAsRef->base, indexer, env ) ) { 151 158 PRINT( std::cerr << "converting compatible base type" << std::endl; ) 152 if ( src->get_lvalue() ) { 159 assert( src->get_lvalue() == srcIsLvalue ); 160 if ( srcIsLvalue ) { 153 161 PRINT( 154 162 std::cerr << "lvalue to reference conversion" << std::endl; … … 178 186 } 179 187 180 Cost convertToReferenceCost( const Type * src, const ReferenceType * dest, const SymTab::Indexer & indexer, const TypeEnvironment & env, PtrsFunction func ) { 188 Cost convertToReferenceCost( const Type * src, const ReferenceType * dest, bool srcIsLvalue, 189 const SymTab::Indexer & indexer, const TypeEnvironment & env, PtrsFunction func ) { 181 190 int sdepth = src->referenceDepth(), ddepth = dest->referenceDepth(); 182 Cost cost = convertToReferenceCost( src, dest, s depth-ddepth, indexer, env, func );191 Cost cost = convertToReferenceCost( src, dest, srcIsLvalue, sdepth-ddepth, indexer, env, func ); 183 192 PRINT( std::cerr << "convertToReferenceCost result: " << cost << std::endl; ) 184 193 return cost; 185 194 } 186 195 187 ConversionCost::ConversionCost( const Type * dest, const SymTab::Indexer &indexer, const TypeEnvironment &env, CostFunction costFunc )188 : dest( dest ), indexer( indexer ), cost( Cost::infinity ), env( env ), costFunc( costFunc ) {196 ConversionCost::ConversionCost( const Type * dest, bool srcIsLvalue, const SymTab::Indexer &indexer, const TypeEnvironment &env, CostFunction costFunc ) 197 : dest( dest ), srcIsLvalue( srcIsLvalue ), indexer( indexer ), cost( Cost::infinity ), env( env ), costFunc( costFunc ) { 189 198 } 190 199 … … 371 380 // recursively compute conversion cost from T1 to T2. 372 381 // cv can be safely dropped because of 'implicit dereference' behavior. 373 cost = costFunc( refType->base, dest, indexer, env );382 cost = costFunc( refType->base, dest, srcIsLvalue, indexer, env ); 374 383 if ( refType->base->tq == dest->tq ) { 375 384 cost.incReference(); // prefer exact qualifiers … … 403 412 static Type::Qualifiers q; 404 413 static BasicType integer( q, BasicType::SignedInt ); 405 cost = costFunc( &integer, dest, indexer, env ); // safe if dest >= int414 cost = costFunc( &integer, dest, srcIsLvalue, indexer, env ); // safe if dest >= int 406 415 if ( cost < Cost::unsafe ) { 407 416 cost.incSafe(); … … 413 422 void ConversionCost::postvisit( const TypeInstType * inst ) { 414 423 if ( const EqvClass * eqvClass = env.lookup( inst->name ) ) { 415 cost = costFunc( eqvClass->type, dest, indexer, env );424 cost = costFunc( eqvClass->type, dest, srcIsLvalue, indexer, env ); 416 425 } else if ( const TypeInstType * destAsInst = dynamic_cast< const TypeInstType * >( dest ) ) { 417 426 if ( inst->name == destAsInst->name ) { … … 423 432 assert( type ); 424 433 if ( type->base ) { 425 cost = costFunc( type->base, dest, indexer, env ) + Cost::safe;434 cost = costFunc( type->base, dest, srcIsLvalue, indexer, env ) + Cost::safe; 426 435 } // if 427 436 } // if … … 434 443 std::list< Type * >::const_iterator destIt = destAsTuple->types.begin(); 435 444 while ( srcIt != tupleType->types.end() && destIt != destAsTuple->types.end() ) { 436 Cost newCost = costFunc( * srcIt++, * destIt++, indexer, env );445 Cost newCost = costFunc( * srcIt++, * destIt++, srcIsLvalue, indexer, env ); 437 446 if ( newCost == Cost::infinity ) { 438 447 return; -
src/ResolvExpr/ConversionCost.h
rd65f92c r5c4a473 10 10 // Created On : Sun May 17 09:37:28 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Jun 24 10:00:00 201913 // Update Count : 512 // Last Modified On : Thu Aug 8 16:13:00 2019 13 // Update Count : 6 14 14 // 15 15 … … 33 33 class TypeEnvironment; 34 34 35 typedef std::function<Cost(const Type *, const Type *, const SymTab::Indexer &, const TypeEnvironment &)> CostFunction; 35 typedef std::function<Cost(const Type *, const Type *, bool, 36 const SymTab::Indexer &, const TypeEnvironment &)> CostFunction; 37 36 38 struct ConversionCost : public WithShortCircuiting { 37 39 public: 38 ConversionCost( const Type * dest, const SymTab::Indexer &indexer, const TypeEnvironment &env, CostFunction ); 40 ConversionCost( const Type * dest, bool srcIsLvalue, 41 const SymTab::Indexer &indexer, const TypeEnvironment &env, CostFunction ); 39 42 40 43 Cost get_cost() const { return cost; } … … 59 62 protected: 60 63 const Type * dest; 64 bool srcIsLvalue; 61 65 const SymTab::Indexer &indexer; 62 66 Cost cost; … … 66 70 67 71 typedef std::function<int(const Type *, const Type *, const SymTab::Indexer &, const TypeEnvironment &)> PtrsFunction; 68 Cost convertToReferenceCost( const Type * src, const ReferenceType * dest, const SymTab::Indexer & indexer, const TypeEnvironment & env, PtrsFunction func ); 72 Cost convertToReferenceCost( const Type * src, const ReferenceType * dest, bool srcIsLvalue, 73 const SymTab::Indexer & indexer, const TypeEnvironment & env, PtrsFunction func ); 69 74 70 75 // Some function pointer types, differ in return type. -
src/ResolvExpr/ResolveAssertions.cc
rd65f92c r5c4a473 9 9 // Author : Aaron B. Moss 10 10 // Created On : Fri Oct 05 13:46:00 2018 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Wed Jul 10 16:10:37201913 // Update Count : 211 // Last Modified By : Andrew Beach 12 // Last Modified On : Thu Aug 8 16:47:00 2019 13 // Update Count : 3 14 14 // 15 15 … … 156 156 for ( const auto& assn : x.assns ) { 157 157 // compute conversion cost from satisfying decl to assertion 158 assert( !assn.match.adjType->get_lvalue() ); 158 159 k += computeConversionCost( 159 assn.match.adjType, assn.decl->get_type(), indexer, x.env );160 assn.match.adjType, assn.decl->get_type(), false, indexer, x.env ); 160 161 161 162 // mark vars+specialization cost on function-type assertions -
src/ResolvExpr/typeops.h
rd65f92c r5c4a473 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 07:28:22 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Feb 8 09:30:34201913 // Update Count : 411 // Last Modified By : Andrew Beach 12 // Last Modified On : Thu Aug 8 16:36:00 2019 13 // Update Count : 5 14 14 // 15 15 … … 80 80 81 81 // in CastCost.cc 82 Cost castCost( const Type * src, const Type * dest, const SymTab::Indexer & indexer, const TypeEnvironment & env ); 82 Cost castCost( const Type * src, const Type * dest, bool srcIsLvalue, 83 const SymTab::Indexer & indexer, const TypeEnvironment & env ); 83 84 Cost castCost( 84 85 const ast::Type * src, const ast::Type * dst, const ast::SymbolTable & symtab, … … 86 87 87 88 // in ConversionCost.cc 88 Cost conversionCost( const Type * src, const Type * dest, const SymTab::Indexer & indexer, const TypeEnvironment & env ); 89 Cost conversionCost( const Type * src, const Type * dest, bool srcIsLvalue, 90 const SymTab::Indexer & indexer, const TypeEnvironment & env ); 89 91 Cost conversionCost( 90 92 const ast::Type * src, const ast::Type * dst, const ast::SymbolTable & symtab, … … 92 94 93 95 // in AlternativeFinder.cc 94 Cost computeConversionCost( Type * actualType, Type * formalType, 96 Cost computeConversionCost( Type * actualType, Type * formalType, bool actualIsLvalue, 95 97 const SymTab::Indexer & indexer, const TypeEnvironment & env ); 96 98 -
src/SynTree/ApplicationExpr.cc
rd65f92c r5c4a473 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Tue Apr 26 12:41:06 201613 // Update Count : 411 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Aug 12 14:28:00 2019 13 // Update Count : 5 14 14 // 15 15 … … 76 76 } 77 77 78 bool ApplicationExpr::get_lvalue() const { 79 return result->get_lvalue(); 80 } 81 78 82 void ApplicationExpr::print( std::ostream &os, Indenter indent ) const { 79 83 os << "Application of" << std::endl << indent+1; -
src/SynTree/CommaExpr.cc
rd65f92c r5c4a473 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Mon May 02 15:19:44201613 // Update Count : 111 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Arg 12 16:11:00 2016 13 // Update Count : 2 14 14 // 15 15 … … 39 39 } 40 40 41 bool CommaExpr::get_lvalue() const { 42 // xxx - as above, shouldn't be an lvalue but that information is used anyways. 43 return result->get_lvalue(); 44 } 45 41 46 void CommaExpr::print( std::ostream &os, Indenter indent ) const { 42 47 os << "Comma Expression:" << std::endl; -
src/SynTree/Expression.cc
rd65f92c r5c4a473 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Aug 7 17:03:00 201913 // Update Count : 6 212 // Last Modified On : Tue Aug 13 11:31:00 2019 13 // Update Count : 63 14 14 // 15 15 … … 64 64 65 65 bool Expression::get_lvalue() const { 66 return result->get_lvalue(); 66 assert( !result->get_lvalue() ); 67 return false; 67 68 } 68 69 … … 138 139 } 139 140 141 bool VariableExpr::get_lvalue() const { 142 return result->get_lvalue(); 143 } 144 140 145 VariableExpr * VariableExpr::functionPointer( FunctionDecl * func ) { 141 146 VariableExpr * funcExpr = new VariableExpr( func ); … … 269 274 CastExpr::~CastExpr() { 270 275 delete arg; 276 } 277 278 bool CastExpr::get_lvalue() const { 279 return result->get_lvalue(); 271 280 } 272 281 … … 380 389 // don't delete the member declaration, since it points somewhere else in the tree 381 390 delete aggregate; 391 } 392 393 bool MemberExpr::get_lvalue() const { 394 assert( result->get_lvalue() ); 395 return true; 382 396 } 383 397 … … 432 446 } 433 447 448 bool UntypedExpr::get_lvalue() const { 449 return result->get_lvalue(); 450 } 434 451 435 452 void UntypedExpr::print( std::ostream & os, Indenter indent ) const { … … 490 507 delete arg2; 491 508 delete arg3; 509 } 510 511 bool ConditionalExpr::get_lvalue() const { 512 return result->get_lvalue(); 492 513 } 493 514 … … 548 569 } 549 570 571 bool ConstructorExpr::get_lvalue() const { 572 return result->get_lvalue(); 573 } 574 550 575 void ConstructorExpr::print( std::ostream & os, Indenter indent ) const { 551 576 os << "Constructor Expression: " << std::endl << indent+1; … … 565 590 CompoundLiteralExpr::~CompoundLiteralExpr() { 566 591 delete initializer; 592 } 593 594 bool CompoundLiteralExpr::get_lvalue() const { 595 assert( result->get_lvalue() ); 596 return true; 567 597 } 568 598 -
src/SynTree/Expression.h
rd65f92c r5c4a473 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Aug 7 16:56:00 201913 // Update Count : 5 112 // Last Modified On : Wed Aug 14 14:24:00 2019 13 // Update Count : 53 14 14 // 15 15 … … 71 71 const Type * get_result() const { return result; } 72 72 void set_result( Type * newValue ) { result = newValue; } 73 bool get_lvalue() const;73 virtual bool get_lvalue() const; 74 74 75 75 TypeSubstitution * get_env() const { return env; } … … 99 99 virtual ~ApplicationExpr(); 100 100 101 bool get_lvalue() const final; 102 101 103 Expression * get_function() const { return function; } 102 104 void set_function( Expression * newValue ) { function = newValue; } … … 121 123 UntypedExpr( const UntypedExpr & other ); 122 124 virtual ~UntypedExpr(); 125 126 bool get_lvalue() const final; 123 127 124 128 Expression * get_function() const { return function; } … … 209 213 virtual ~CastExpr(); 210 214 215 bool get_lvalue() const final; 216 211 217 Expression * get_arg() const { return arg; } 212 218 void set_arg( Expression * newValue ) { arg = newValue; } … … 292 298 virtual ~MemberExpr(); 293 299 300 bool get_lvalue() const final; 301 294 302 DeclarationWithType * get_member() const { return member; } 295 303 void set_member( DeclarationWithType * newValue ) { member = newValue; } … … 314 322 VariableExpr( const VariableExpr & other ); 315 323 virtual ~VariableExpr(); 324 325 bool get_lvalue() const final; 316 326 317 327 DeclarationWithType * get_var() const { return var; } … … 501 511 virtual ~ConditionalExpr(); 502 512 513 bool get_lvalue() const final; 514 503 515 Expression * get_arg1() const { return arg1; } 504 516 void set_arg1( Expression * newValue ) { arg1 = newValue; } … … 525 537 virtual ~CommaExpr(); 526 538 539 bool get_lvalue() const final; 540 527 541 Expression * get_arg1() const { return arg1; } 528 542 void set_arg1( Expression * newValue ) { arg1 = newValue; } … … 611 625 ~ConstructorExpr(); 612 626 627 bool get_lvalue() const final; 628 613 629 Expression * get_callExpr() const { return callExpr; } 614 630 void set_callExpr( Expression * newValue ) { callExpr = newValue; } … … 629 645 CompoundLiteralExpr( const CompoundLiteralExpr & other ); 630 646 virtual ~CompoundLiteralExpr(); 647 648 bool get_lvalue() const final; 631 649 632 650 Initializer * get_initializer() const { return initializer; } … … 687 705 virtual ~TupleExpr(); 688 706 707 bool get_lvalue() const final; 708 689 709 std::list<Expression*>& get_exprs() { return exprs; } 690 710 … … 705 725 TupleIndexExpr( const TupleIndexExpr & other ); 706 726 virtual ~TupleIndexExpr(); 727 728 bool get_lvalue() const final; 707 729 708 730 Expression * get_tuple() const { return tuple; } -
src/SynTree/TupleExpr.cc
rd65f92c r5c4a473 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Mar 17 09:42:29 201713 // Update Count : 311 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Aug 14 14:34:00 2019 13 // Update Count : 5 14 14 // 15 15 … … 57 57 } 58 58 59 bool TupleExpr::get_lvalue() const { 60 return result->get_lvalue(); 61 } 62 59 63 void TupleExpr::print( std::ostream &os, Indenter indent ) const { 60 64 os << "Tuple:" << std::endl; … … 76 80 TupleIndexExpr::~TupleIndexExpr() { 77 81 delete tuple; 82 } 83 84 bool TupleIndexExpr::get_lvalue() const { 85 assert( result->get_lvalue() ); 86 return true; 78 87 } 79 88 -
src/main.cc
rd65f92c r5c4a473 17 17 #include <execinfo.h> // for backtrace, backtrace_symbols 18 18 #include <getopt.h> // for no_argument, optind, geto... 19 #include <signal.h> // for signal, SIGABRT, SIGSEGV20 19 #include <cassert> // for assertf 21 20 #include <cstdio> // for fopen, FILE, fclose, stdin 22 21 #include <cstdlib> // for exit, free, abort, EXIT_F... 22 #include <csignal> // for signal, SIGABRT, SIGSEGV 23 23 #include <cstring> // for index 24 24 #include <fstream> // for ofstream … … 96 96 DeclarationNode * parseTree = nullptr; // program parse tree 97 97 98 static bool waiting_for_gdb = false; // flag to set cfa-cpp to wait for gdb on start 99 98 100 static std::string PreludeDirector = ""; 99 101 … … 167 169 } // sigAbortHandler 168 170 169 170 171 int main( int argc, char * argv[] ) { 171 172 FILE * input; // use FILE rather than istream because yyin is FILE … … 185 186 parse_cmdline( argc, argv, filename ); // process command-line arguments 186 187 CodeGen::FixMain::setReplaceMain( !nomainp ); 188 189 if(waiting_for_gdb) { 190 std::cerr << "Waiting for gdb" << std::endl; 191 std::cerr << "run :" << std::endl; 192 std::cerr << " gdb attach " << getpid() << std::endl; 193 raise(SIGSTOP); 194 } 187 195 188 196 try { … … 198 206 } else { // no input file name 199 207 input = stdin; 208 std::cerr << "Input from stdin" << std::endl; 200 209 // if running cfa-cpp directly, might forget to pass -F option. Since this takes from stdin, pass 201 210 // a fake name along … … 438 447 439 448 440 static const char optstring[] = ":hlLmNnpP:S:t wW:D:F:";449 static const char optstring[] = ":hlLmNnpP:S:tgwW:D:F:"; 441 450 442 451 enum { PreludeDir = 128 }; … … 453 462 { "statistics", required_argument, nullptr, 'S' }, 454 463 { "tree", no_argument, nullptr, 't' }, 464 { "gdb", no_argument, nullptr, 'g' }, 455 465 { "", no_argument, nullptr, 0 }, // -w 456 466 { "", no_argument, nullptr, 0 }, // -W … … 471 481 "<directory> prelude directory for debug/nodebug", // no flag 472 482 "<option-list> enable profiling information:\n counters,heap,time,all,none", // -S 473 "build in tree", // -t 483 "building cfa standard lib", // -t 484 "wait for gdb to attach", // -g 474 485 "", // -w 475 486 "", // -W … … 582 593 Stats::parse_params( optarg ); 583 594 break; 584 case 't': // build in tree595 case 't': // building cfa stdlib 585 596 treep = true; 597 break; 598 case 'g': // wait for gdb 599 waiting_for_gdb = true; 586 600 break; 587 601 case 'w': // suppress all warnings, hidden -
tests/Makefile.am
rd65f92c r5c4a473 22 22 debug=yes 23 23 installed=no 24 archiveerrors= 24 25 25 26 INSTALL_FLAGS=-in-tree … … 58 59 #---------------------------------------------------------------------------------------------------------------- 59 60 all-local : 60 @+${TEST_PY} --debug=${debug} --install=${installed} ${concurrent} ${timeouts} ${quick_test}61 @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test} 61 62 62 63 all-tests : 63 @+${TEST_PY} --debug=${debug} --install=${installed} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program64 @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program 64 65 65 66 clean-local : -
tests/Makefile.in
rd65f92c r5c4a473 378 378 debug = yes 379 379 installed = no 380 archiveerrors = 380 381 INSTALL_FLAGS = -in-tree 381 382 DEBUG_FLAGS = -debug -O0 … … 777 778 #---------------------------------------------------------------------------------------------------------------- 778 779 all-local : 779 @+${TEST_PY} --debug=${debug} --install=${installed} ${concurrent} ${timeouts} ${quick_test}780 @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test} 780 781 781 782 all-tests : 782 @+${TEST_PY} --debug=${debug} --install=${installed} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program783 @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program 783 784 784 785 clean-local : -
tests/pybin/settings.py
rd65f92c r5c4a473 4 4 from . import tools 5 5 6 global original_path 7 6 8 try : 9 original_path = os.getcwd() 7 10 testpath = os.path.dirname(os.path.abspath(os.path.join(os.getcwd(), sys.argv[0]))) 8 11 sys.path.append(testpath) … … 118 121 global timeout 119 122 global output_width 123 <<<<<<< HEAD 120 124 global distcc 125 ======= 126 global archive 127 >>>>>>> master 121 128 122 129 dry_run = options.dry_run … … 128 135 timeout = Timeouts(options.timeout, options.global_timeout) 129 136 output_width = 24 137 <<<<<<< HEAD 130 138 distcc = "DISTCC_CFA_PATH=~/.cfadistcc/%s/cfa" % tools.config_hash() 139 ======= 140 archive = os.path.abspath(os.path.join(original_path, options.archive_errors)) if options.archive_errors else None 141 >>>>>>> master 131 142 132 143 if distribute and not os.environ.get('DISTCC_LOG'): -
tests/pybin/tools.py
rd65f92c r5c4a473 2 2 import argparse 3 3 import contextlib 4 import datetime 4 5 import fileinput 5 6 import multiprocessing … … 289 290 return out.strip() 290 291 292 # get pretty string for time of day 293 def pretty_now(): 294 ts = time.time() 295 print(ts, file=sys.stderr) 296 return datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d_%H:%M:%S') 297 291 298 # check if arguments is yes or no 292 299 def yes_no(string): … … 320 327 return sh('gdb', '-n', path, core, '-batch', '-x', cmd, output_file=subprocess.PIPE) 321 328 329 def core_archive(dst, name, exe): 330 # Get the files to copy 331 core = os.path.join(os.getcwd(), "core" ) 332 333 # Uncomment if we want timestamps on coredumps 334 # dst = os.path.join(dst, "%s_%s" % (name, pretty_now())) 335 336 # make a directory for this test 337 mkdir(os.path.join(dst, "dir")) 338 339 # moves the files 340 mv( core, os.path.join(dst, "core" ) ) 341 mv( exe , os.path.join(dst, name ) ) 342 343 # return explanatory test 344 return "Archiving %s (executable and core) to %s" % (os.path.relpath(exe, settings.BUILDDIR), os.path.relpath(dst, settings.original_path)) 345 322 346 class Timed: 323 347 def __enter__(self): -
tests/test.py
rd65f92c r5c4a473 91 91 parser.add_argument('--all', help='Run all test available', action='store_true') 92 92 parser.add_argument('--regenerate-expected', help='Regenerate the .expect by running the specified tets, can be used with --all option', action='store_true') 93 parser.add_argument('--archive-errors', help='If called with a valid path, on test crashes the test script will copy the core dump and the executable to the specified path.', type=str, default='') 93 94 parser.add_argument('-j', '--jobs', help='Number of tests to run simultaneously', type=int) 94 95 parser.add_argument('--list-comp', help='List all valide arguments', action='store_true') … … 179 180 error = error + info if error else info 180 181 182 if settings.archive: 183 error = error + '\n' + core_archive(settings.archive, test.target(), exe_file) 184 181 185 182 186 … … 295 299 # users may want to simply list the tests 296 300 if options.list_comp : 297 print("-h --help --debug --dry-run --list --arch --all --regenerate-expected -- install --timeout --global-timeout -j --jobs ", end='')301 print("-h --help --debug --dry-run --list --arch --all --regenerate-expected --archive-errors --install --timeout --global-timeout -j --jobs ", end='') 298 302 print(" ".join(map(lambda t: "%s" % (t.target()), tests))) 299 303
Note: See TracChangeset
for help on using the changeset viewer.