Changeset ded018f for src/Concurrency
- Timestamp:
- Jul 7, 2023, 9:55:34 AM (13 months ago)
- Branches:
- master
- Children:
- 555c599
- Parents:
- bef2245
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Concurrency/Waituntil.cpp
rbef2245 rded018f 884 884 ) 885 885 ); 886 else // we reuse the when_cond bools later during unregister so init to false if initially unused887 body->push_back(888 new DeclStmt( cLoc,889 new ObjectDecl( cLoc,890 currClause->whenName,891 new BasicType( BasicType::Kind::Bool ),892 new SingleInit( cLoc, ConstantExpr::from_bool( cLoc, false ) )893 )894 )895 );896 886 897 887 // select_node clause1; … … 1306 1296 CompoundStmt * unregisters = new CompoundStmt( loc ); 1307 1297 1308 // Collection of optional statement executions following finally clause 1309 // for each clause: 1310 // if ( when_cond_i ) clausei->stmt; 1311 // when_cond_i is repurposed in the finally to store if any statements need to be run after unregisters 1312 // the statements need to be run outside a finally clause since they may contain non-local transfers 1313 CompoundStmt * unregisterStmts = new CompoundStmt( loc ); 1314 1315 UntypedExpr * statusExpr; // !__CFA_has_clause_run( clause_statuses[i] ) 1316 ExprStmt * assignStmt; // when_cond_i = (!__CFA_has_clause_run( clause_statuses[i] )) && unregister_select( ... , clausei ); 1298 1299 Expr * statusExpr; // !__CFA_has_clause_run( clause_statuses[i] ) 1317 1300 for ( int i = 0; i < numClauses; i++ ) { 1318 1301 const CodeLocation & cLoc = stmt->clauses.at(i)->location; … … 1332 1315 1333 1316 // Generates: 1334 // when_cond_i = (!__CFA_has_clause_run( clause_statuses[i] )) && unregister_select( ... , clausei ); 1335 assignStmt = new ExprStmt( cLoc, 1336 UntypedExpr::createAssign( cLoc, 1337 new NameExpr( cLoc, clauseData.at(i)->whenName ), 1338 new LogicalExpr( cLoc, 1339 new CastExpr( cLoc, 1340 statusExpr, 1341 new BasicType( BasicType::Kind::Bool ), GeneratedFlag::ExplicitCast 1342 ), 1343 new CastExpr( cLoc, 1344 genSelectTraitCall( stmt->clauses.at(i), clauseData.at(i), "unregister_select" ), 1345 new BasicType( BasicType::Kind::Bool ), GeneratedFlag::ExplicitCast 1346 ), 1347 LogicalFlag::AndExpr 1348 ) 1349 ) 1350 ); 1351 1352 if ( stmt->clauses.at(i)->when_cond ) // if ( when_cond_i ) assignStmt 1353 unregisters->push_back( 1354 new IfStmt( cLoc, 1355 new NameExpr( cLoc, clauseData.at(i)->whenName ), 1356 new CompoundStmt( cLoc, { assignStmt } ) 1357 ) 1317 // (!__CFA_has_clause_run( clause_statuses[i] )) && unregister_select( ... , clausei ); 1318 statusExpr = new LogicalExpr( cLoc, 1319 new CastExpr( cLoc, 1320 statusExpr, 1321 new BasicType( BasicType::Kind::Bool ), GeneratedFlag::ExplicitCast 1322 ), 1323 new CastExpr( cLoc, 1324 genSelectTraitCall( stmt->clauses.at(i), clauseData.at(i), "unregister_select" ), 1325 new BasicType( BasicType::Kind::Bool ), GeneratedFlag::ExplicitCast 1326 ), 1327 LogicalFlag::AndExpr 1328 ); 1329 1330 // if when cond defined generates: 1331 // when_cond_i && (!__CFA_has_clause_run( clause_statuses[i] )) && unregister_select( ... , clausei ); 1332 if ( stmt->clauses.at(i)->when_cond ) 1333 statusExpr = new LogicalExpr( cLoc, 1334 new CastExpr( cLoc, 1335 new NameExpr( cLoc, clauseData.at(i)->whenName ), 1336 new BasicType( BasicType::Kind::Bool ), GeneratedFlag::ExplicitCast 1337 ), 1338 new CastExpr( cLoc, 1339 statusExpr, 1340 new BasicType( BasicType::Kind::Bool ), GeneratedFlag::ExplicitCast 1341 ), 1342 LogicalFlag::AndExpr 1358 1343 ); 1359 else 1360 unregisters->push_back( assignStmt );1361 1362 unregister Stmts->push_back(1344 1345 // generates: 1346 // if ( statusExpr ) { ... clausei stmt ... } 1347 unregisters->push_back( 1363 1348 new IfStmt( cLoc, 1364 new NameExpr( cLoc, clauseData.at(i)->whenName ),1349 statusExpr, 1365 1350 genStmtBlock( stmt->clauses.at(i), clauseData.at(i) ) 1366 1351 ) … … 1376 1361 ) 1377 1362 ); 1378 1379 body->push_back( unregisterStmts );1380 1381 1363 1382 1364 for ( ClauseData * datum : clauseData )
Note: See TracChangeset
for help on using the changeset viewer.