Changes in src/Concurrency/Waituntil.cpp [bccd70a:fc0996a]
- File:
-
- 1 edited
-
src/Concurrency/Waituntil.cpp (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Concurrency/Waituntil.cpp
rbccd70a rfc0996a 95 95 case 0: 96 96 try { 97 if (on_selected( A, clause1 ))97 on_selected( A, clause1 ); 98 98 doA(); 99 99 } … … 122 122 // the unregister and on_selected calls are needed to support primitives where the acquire has side effects 123 123 // so the corresponding block MUST be run for those primitives to not lose state (example is channels) 124 if ( ! has_run(clause_statuses[0]) && whenA && unregister_select(A, clause1) && on_selected( A, clause1 ) ) 124 if ( !has_run(clause_statuses[0]) && whenA && unregister_select(A, clause1) ) 125 on_selected( A, clause1 ) 125 126 doA(); 126 127 ... repeat if above for B and C ... … … 619 620 620 621 // Generates: 621 /* if ( on_selected( target_1, node_1 ))... corresponding body of target_1 ...622 /* on_selected( target_1, node_1 ); ... corresponding body of target_1 ... 622 623 */ 623 624 CompoundStmt * GenerateWaitUntilCore::genStmtBlock( const WhenClause * clause, const ClauseData * data ) { … … 625 626 return new CompoundStmt( cLoc, 626 627 { 627 new IfStmt( cLoc, 628 genSelectTraitCall( clause, data, "on_selected" ), 629 new CompoundStmt( cLoc, 630 { 631 ast::deepCopy( clause->stmt ) 632 } 633 ) 634 ) 628 new ExprStmt( cLoc, 629 genSelectTraitCall( clause, data, "on_selected" ) 630 ), 631 ast::deepCopy( clause->stmt ) 635 632 } 636 633 ); … … 644 641 case 0: 645 642 try { 646 if (on_selected( target1, clause1 ))647 dotarget1stmt();643 on_selected( target1, clause1 ); 644 dotarget1stmt(); 648 645 } 649 646 finally { clause_statuses[i] = __SELECT_RUN; unregister_select(target1, clause1); } … … 664 661 case 0: 665 662 try { 666 if (on_selected( target1, clause1 ))667 dotarget1stmt();663 on_selected( target1, clause1 ); 664 dotarget1stmt(); 668 665 } 669 666 finally { clause_statuses[i] = __SELECT_RUN; unregister_select(target1, clause1); } … … 940 937 } 941 938 942 // C_TODO: will remove this commented code later. Currently it isn't needed but may switch to a modified version of this later if it has better performance943 // std::vector<ptr<CaseClause>> switchCases;944 945 // int idx = 0;946 // for ( const auto & clause: stmt->clauses ) {947 // const CodeLocation & cLoc = clause->location;948 // switchCases.push_back(949 // new CaseClause( cLoc,950 // new CastExpr( cLoc,951 // new AddressExpr( cLoc, new NameExpr( cLoc, data.at(idx)->targetName ) ),952 // new BasicType( BasicType::Kind::LongUnsignedInt ), GeneratedFlag::ExplicitCast953 // ),954 // {955 // new CompoundStmt( cLoc,956 // {957 // ast::deepCopy( clause->stmt ),958 // new BranchStmt( cLoc, BranchStmt::Kind::Break, Label( cLoc ) )959 // }960 // )961 // }962 // )963 // );964 // idx++;965 // }966 967 939 return new CompoundStmt( loc, 968 940 { 969 941 new ExprStmt( loc, new UntypedExpr( loc, new NameExpr( loc, "park" ) ) ), 970 942 outerIf 971 // new SwitchStmt( loc,972 // new NameExpr( loc, statusName ),973 // std::move( switchCases )974 // )975 943 } 976 944 ); … … 1015 983 const CodeLocation & cLoc = stmt->clauses.at(idx)->location; 1016 984 985 Expr * baseCond = genSelectTraitCall( stmt->clauses.at(idx), data.at(idx), "register_select" ); 1017 986 Expr * ifCond; 1018 987 … … 1025 994 ), 1026 995 new CastExpr( cLoc, 1027 genSelectTraitCall( stmt->clauses.at(idx), data.at(idx), "register_select" ),996 baseCond, 1028 997 new BasicType( BasicType::Kind::Bool ), GeneratedFlag::ExplicitCast 1029 998 ), 1030 999 LogicalFlag::AndExpr 1031 1000 ); 1032 } else ifCond = genSelectTraitCall( stmt->clauses.at(idx), data.at(idx), "register_select" );1001 } else ifCond = baseCond; 1033 1002 1034 1003 return new CompoundStmt( cLoc, … … 1048 1017 ifCond, 1049 1018 genStmtBlock( stmt->clauses.at(idx), data.at(idx) ), 1050 // ast::deepCopy( stmt->clauses.at(idx)->stmt ),1051 1019 recursiveOrIfGen( stmt, data, idx + 1, elseWhenName ) 1052 1020 )
Note:
See TracChangeset
for help on using the changeset viewer.