Changeset 310e5b7
- Timestamp:
- Sep 14, 2017, 4:26:54 PM (7 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:
- e149f77
- Parents:
- 1dcd9554
- Location:
- src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Concurrency/Waitfor.cc
r1dcd9554 r310e5b7 204 204 return new ConstantExpr( Constant::from_bool( ifnull ) ); 205 205 } 206 207 VariableExpr * extractVariable( Expression * func ) { 208 if( VariableExpr * var = dynamic_cast< VariableExpr * >( func ) ) { 209 return var; 210 } 211 212 CastExpr * cast = strict_dynamic_cast< CastExpr * >( func ); 213 return strict_dynamic_cast< VariableExpr * >( cast->arg ); 214 } 215 216 Expression * betterIsDtor( Expression * func ) { 217 VariableExpr * typed_func = extractVariable( func ); 218 bool is_dtor = InitTweak::isDestructor( typed_func->var ); 219 return new ConstantExpr( Constant::from_bool( is_dtor ) ); 220 } 206 221 }; 207 222 … … 212 227 213 228 void GenerateWaitForPass::premutate( FunctionDecl * decl) { 214 if( decl->name != "__ accept_internal" ) return;229 if( decl->name != "__waitfor_internal" ) return; 215 230 216 231 decl_waitfor = decl; … … 313 328 Type * fptr_t = new PointerType( noQualifiers, new FunctionType( noQualifiers, true ) ); 314 329 330 Expression * is_dtor = betterIsDtor( clause.target.function ); 315 331 CompoundStmt * compound = new CompoundStmt( noLabels ); 316 332 compound->push_back( makeAccStatement( acceptables, index, "func" , new CastExpr( clause.target.function, fptr_t ) , indexer ) ); 317 333 compound->push_back( makeAccStatement( acceptables, index, "count" , new ConstantExpr( Constant::from_ulong( clause.target.arguments.size() ) ), indexer ) ); 318 334 compound->push_back( makeAccStatement( acceptables, index, "monitors", new VariableExpr( monitors ) , indexer ) ); 319 compound->push_back( makeAccStatement( acceptables, index, "is_dtor" , new ConstantExpr( Constant::from_bool( true ) ), indexer ) );335 compound->push_back( makeAccStatement( acceptables, index, "is_dtor" , is_dtor , indexer ) ); 320 336 321 337 stmt->push_back( new IfStmt( -
src/Parser/StatementNode.cc
r1dcd9554 r310e5b7 250 250 delete targetExpr; 251 251 252 node->clauses. push_back(WaitForStmt::Clause{252 node->clauses.insert( node->clauses.begin(), WaitForStmt::Clause{ 253 253 std::move( target ), 254 254 maybeMoveBuild<Statement >( stmt ), -
src/Parser/parserutility.cc
r1dcd9554 r310e5b7 29 29 30 30 Expression *notZeroExpr( Expression *orig ) { 31 if( !orig ) return nullptr; 31 32 UntypedExpr *comparison = new UntypedExpr( new NameExpr( "?!=?" ) ); 32 33 comparison->get_args().push_back( orig ); -
src/libcfa/concurrency/monitor
r1dcd9554 r310e5b7 111 111 }; 112 112 113 int __ accept_internal( unsigned short count, __acceptable_t * acceptables, int duration );113 int __waitfor_internal( unsigned short count, __acceptable_t * acceptables, int duration ); 114 114 115 115 // Local Variables: // -
src/libcfa/concurrency/monitor.c
r1dcd9554 r310e5b7 398 398 //----------------------------------------------------------------------------- 399 399 // Internal scheduling 400 int __ accept_internal( unsigned short acc_count, __acceptable_t * acceptables ) {400 int __waitfor_internal( unsigned short acc_count, __acceptable_t * acceptables ) { 401 401 thread_desc * thrd = this_thread; 402 402 -
src/tests/sched-ext-parse.c
r1dcd9554 r310e5b7 16 16 //--------------------------------------- 17 17 waitfor( f1, a ) { 18 1;18 // 1; 19 19 } 20 20 … … 80 80 16; 81 81 } 82 or waitfor( f 1, a, a ) {82 or waitfor( f2, a, a ) { 83 83 17; 84 84 } -
src/tests/sched-ext.c
r1dcd9554 r310e5b7 45 45 acceptable.monitors = &a; 46 46 47 __ accept_internal( 1, &acceptable );47 __waitfor_internal( 1, &acceptable ); 48 48 49 49 sout | "Accepted" | endl;
Note: See TracChangeset
for help on using the changeset viewer.