Changes in / [095b99a:9e63a2b]
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/schedext/cfa1.cfa
r095b99a r9e63a2b 16 16 go = 1; 17 17 for ( i; times ) { 18 waitfor(call ,a1);18 waitfor(call : a1); 19 19 } 20 20 go = 0; -
benchmark/schedext/cfa2.cfa
r095b99a r9e63a2b 16 16 go = 1; 17 17 for ( i; times ) { 18 waitfor(call ,a1, a2);18 waitfor(call : a1, a2); 19 19 } 20 20 go = 0; -
benchmark/schedext/cfa4.cfa
r095b99a r9e63a2b 16 16 go = 1; 17 17 for ( i; times ) { 18 waitfor( call ,a1, a2, a3, a4 );18 waitfor( call : a1, a2, a3, a4 ); 19 19 } 20 20 go = 0; -
libcfa/src/executor.cfa
r095b99a r9e63a2b 8 8 #include <stdio.h> 9 9 10 forall( otype T | is_node(T) | is_monitor(T) ) {11 12 13 14 15 10 forall( dtype T ) 11 monitor Buffer { // unbounded buffer 12 __queue_t( T ) queue; // unbounded list of work requests 13 condition delay; 14 }; // Buffer 15 forall( dtype T | is_node(T) ) { 16 16 void insert( Buffer( T ) & mutex buf, T * elem ) with(buf) { 17 17 append( queue, elem ); // insert element into buffer … … 20 20 21 21 T * remove( Buffer( T ) & mutex buf ) with(buf) { 22 if ( ! queue) wait( delay ); // no request to process ? => wait23 return pop_head( queue );22 if ( queue.head != 0 ) wait( delay ); // no request to process ? => wait 23 // return pop_head( queue ); 24 24 } // remove 25 25 } // distribution -
src/Concurrency/Waitfor.cc
r095b99a r9e63a2b 11 11 // Last Modified By : 12 12 // Last Modified On : 13 // Update Count : 1 113 // Update Count : 12 14 14 // 15 15 … … 42 42 void foo() { 43 43 while( true ) { 44 when( a < 1 ) waitfor( f ,a ) { bar(); }44 when( a < 1 ) waitfor( f : a ) { bar(); } 45 45 or timeout( swagl() ); 46 or waitfor( g ,a ) { baz(); }47 or waitfor( ^?{} ,a ) { break; }46 or waitfor( g : a ) { baz(); } 47 or waitfor( ^?{} : a ) { break; } 48 48 or waitfor( ^?{} ) { break; } 49 49 } -
src/Parser/parser.yy
r095b99a r9e63a2b 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Dec 16 15:32:58 201913 // Update Count : 44 0912 // Last Modified On : Fri Jan 17 14:54:55 2020 13 // Update Count : 4426 14 14 // 15 15 … … 323 323 %type<op> ptrref_operator unary_operator assignment_operator 324 324 %type<en> primary_expression postfix_expression unary_expression 325 %type<en> cast_expression exponential_expression multiplicative_expression additive_expression325 %type<en> cast_expression_list cast_expression exponential_expression multiplicative_expression additive_expression 326 326 %type<en> shift_expression relational_expression equality_expression 327 327 %type<en> AND_expression exclusive_OR_expression inclusive_OR_expression … … 679 679 | argument_expression 680 680 | argument_expression_list ',' argument_expression 681 { $$ = (ExpressionNode *)( 681 { $$ = (ExpressionNode *)($1->set_last( $3 )); } 682 682 ; 683 683 … … 691 691 field_name_list: // CFA, tuple field selector 692 692 field 693 | field_name_list ',' field { $$ = (ExpressionNode *) $1->set_last( $3); }693 | field_name_list ',' field { $$ = (ExpressionNode *)($1->set_last( $3 )); } 694 694 ; 695 695 … … 960 960 { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)(new ExpressionNode( nullptr ) )->set_last( $3 ) ) ); } 961 961 | '[' push assignment_expression pop ',' tuple_expression_list ']' 962 { $$ = new ExpressionNode( build_tuple( (ExpressionNode *) $3->set_last( $6 ) )); }962 { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)($3->set_last( $6 ) ) )); } 963 963 ; 964 964 … … 966 966 assignment_expression_opt 967 967 | tuple_expression_list ',' assignment_expression_opt 968 { $$ = (ExpressionNode *) $1->set_last( $3); }968 { $$ = (ExpressionNode *)($1->set_last( $3 )); } 969 969 ; 970 970 … … 1307 1307 WAITFOR '(' cast_expression ')' 1308 1308 { $$ = $3; } 1309 | WAITFOR '(' cast_expression ',' argument_expression_list ')' 1310 { $$ = (ExpressionNode *)$3->set_last( $5 ); } 1309 // | WAITFOR '(' cast_expression ',' argument_expression_list ')' 1310 // { $$ = (ExpressionNode *)$3->set_last( $5 ); } 1311 | WAITFOR '(' cast_expression_list ':' argument_expression_list ')' 1312 { $$ = (ExpressionNode *)($3->set_last( $5 )); } 1313 ; 1314 1315 cast_expression_list: 1316 cast_expression 1317 | cast_expression_list ',' cast_expression 1318 { $$ = (ExpressionNode *)($1->set_last( $3 )); } 1311 1319 ; 1312 1320 … … 1419 1427 asm_operand 1420 1428 | asm_operands_list ',' asm_operand 1421 { $$ = (ExpressionNode *) $1->set_last( $3); }1429 { $$ = (ExpressionNode *)($1->set_last( $3 )); } 1422 1430 ; 1423 1431 … … 1435 1443 { $$ = new ExpressionNode( $1 ); } 1436 1444 | asm_clobbers_list_opt ',' string_literal 1437 // set_last returns ParseNode * 1438 { $$ = (ExpressionNode *)$1->set_last( new ExpressionNode( $3 ) ); } 1445 { $$ = (ExpressionNode *)($1->set_last( new ExpressionNode( $3 ) )); } 1439 1446 ; 1440 1447 … … 2359 2366 | initializer_list_opt ',' initializer { $$ = (InitializerNode *)( $1->set_last( $3 ) ); } 2360 2367 | initializer_list_opt ',' designation initializer 2361 { $$ = (InitializerNode *)( $1->set_last( $4->set_designators( $3 ) )); }2368 { $$ = (InitializerNode *)($1->set_last( $4->set_designators( $3 ) )); } 2362 2369 ; 2363 2370 … … 2381 2388 designator 2382 2389 | designator_list designator 2383 { $$ = (ExpressionNode *)( $1->set_last( $2 )); }2390 { $$ = (ExpressionNode *)($1->set_last( $2 )); } 2384 2391 //| designator_list designator { $$ = new ExpressionNode( $1, $2 ); } 2385 2392 ; … … 2478 2485 { SemanticError( yylloc, toString("Expression generic parameters are currently unimplemented: ", $1->build()) ); $$ = nullptr; } 2479 2486 | type_list ',' type 2480 { $$ = (ExpressionNode *)( $1->set_last( new ExpressionNode( new TypeExpr( maybeMoveBuildType( $3 ) ) ) )); }2487 { $$ = (ExpressionNode *)($1->set_last( new ExpressionNode( new TypeExpr( maybeMoveBuildType( $3 ) ) ) )); } 2481 2488 | type_list ',' assignment_expression 2482 2489 { SemanticError( yylloc, toString("Expression generic parameters are currently unimplemented: ", $3->build()) ); $$ = nullptr; } -
tests/concurrent/examples/boundedBufferEXT.cfa
r095b99a r9e63a2b 10 10 // Created On : Wed Apr 18 22:52:12 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jun 21 08:19:20 201913 // Update Count : 1 412 // Last Modified On : Thu Jan 16 22:36:34 2020 13 // Update Count : 15 14 14 // 15 15 … … 37 37 38 38 void insert( Buffer(T) & mutex buffer, T elem ) with( buffer ) { 39 if ( count == BufferSize ) waitfor( remove ,buffer );39 if ( count == BufferSize ) waitfor( remove : buffer ); 40 40 elements[back] = elem; 41 41 back = ( back + 1 ) % BufferSize; … … 44 44 45 45 T remove( Buffer(T) & mutex buffer ) with( buffer ) { 46 if ( count == 0 ) waitfor( insert ,buffer );46 if ( count == 0 ) waitfor( insert : buffer ); 47 47 T elem = elements[front]; 48 48 front = ( front + 1 ) % BufferSize; -
tests/concurrent/examples/boundedBufferTHREAD.cfa
r095b99a r9e63a2b 10 10 // Created On : Wed Apr 18 22:52:12 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jun 21 11:50:12 201913 // Update Count : 2 412 // Last Modified On : Thu Jan 16 23:09:43 2020 13 // Update Count : 25 14 14 // 15 15 … … 44 44 void main( Buffer & buffer ) with( buffer ) { 45 45 for () { 46 waitfor( ^?{} ,buffer ) {46 waitfor( ^?{} : buffer ) { 47 47 break; 48 } or when ( count != 20 ) waitfor( insert ,buffer ) {48 } or when ( count != 20 ) waitfor( insert : buffer ) { 49 49 back = (back + 1) % 20; 50 50 count += 1; 51 } or when ( count != 0 ) waitfor( remove ,buffer ) {51 } or when ( count != 0 ) waitfor( remove : buffer ) { 52 52 front = (front + 1) % 20; 53 53 count -= 1; -
tests/concurrent/examples/gortn.cfa
r095b99a r9e63a2b 10 10 // Created On : Wed Feb 20 08:02:37 2019 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jun 21 08:25:03 201913 // Update Count : 412 // Last Modified On : Thu Jan 16 22:43:40 2020 13 // Update Count : 5 14 14 // 15 15 … … 26 26 void main( GoRtn & gortn ) with( gortn ) { 27 27 for () { 28 waitfor( mem1 ,gortn ) sout | i;29 or waitfor( mem2 ,gortn ) sout | f;30 or waitfor( mem3 ,gortn ) sout | m.i | m.j;31 or waitfor( ^?{} ,gortn ) break;28 waitfor( mem1 : gortn ) sout | i; 29 or waitfor( mem2 : gortn ) sout | f; 30 or waitfor( mem3 : gortn ) sout | m.i | m.j; 31 or waitfor( ^?{} : gortn ) break; 32 32 } 33 33 } -
tests/concurrent/waitfor/barge.cfa
r095b99a r9e63a2b 65 65 yield(random( 10 )); 66 66 this.state = WAITFOR; 67 waitfor(do_call ,this) {67 waitfor(do_call : this) { 68 68 sout | i; 69 69 } -
tests/concurrent/waitfor/dtor.cfa
r095b99a r9e63a2b 47 47 yield(random( 10 )); 48 48 set_state( this, MAIN ); 49 waitfor( ^?{} ,this ) {49 waitfor( ^?{} : this ) { 50 50 set_state( this, AFTER ); 51 51 } -
tests/concurrent/waitfor/else.cfa
r095b99a r9e63a2b 14 14 sout | "Starting"; 15 15 16 when( false ) waitfor( notcalled ,m );16 when( false ) waitfor( notcalled : m ); 17 17 18 18 sout | "Step" | i++; 19 19 20 waitfor( notcalled ,m ); or else {20 waitfor( notcalled : m ); or else { 21 21 sout | "else called"; 22 22 } … … 24 24 sout | "Step" | i++; 25 25 26 when( true ) waitfor( notcalled ,m ); or when( true ) else {26 when( true ) waitfor( notcalled : m ); or when( true ) else { 27 27 sout | "else called"; 28 28 } … … 30 30 sout | "Step" | i++; 31 31 32 when( false ) waitfor( notcalled ,m ); or when( true ) else {32 when( false ) waitfor( notcalled : m ); or when( true ) else { 33 33 sout | "else called"; 34 34 } … … 36 36 sout | "Step" | i++; 37 37 38 when( false ) waitfor( notcalled ,m ); or when( false ) else {38 when( false ) waitfor( notcalled : m ); or when( false ) else { 39 39 sout | "else called"; 40 40 } -
tests/concurrent/waitfor/parse.cfa
r095b99a r9e63a2b 24 24 25 25 //--------------------------------------- 26 waitfor( f1 ,a ) {26 waitfor( f1 : a ) { 27 27 1; 28 28 } 29 29 30 30 //--------------------------------------- 31 waitfor( f1 ,a ) {31 waitfor( f1 : a ) { 32 32 2; 33 33 } 34 waitfor( f2 ,a ) {34 waitfor( f2 : a ) { 35 35 3; 36 36 } 37 37 38 38 //--------------------------------------- 39 when( 1 < 3 ) waitfor( f2 ,a, a ) {39 when( 1 < 3 ) waitfor( f2 : a, a ) { 40 40 4; 41 41 } … … 45 45 46 46 //--------------------------------------- 47 when( 2 < 3 ) waitfor( f3 ,a ) {47 when( 2 < 3 ) waitfor( f3 : a ) { 48 48 5; 49 49 } … … 53 53 54 54 //--------------------------------------- 55 when( 3 < 3 ) waitfor( f3 ,a, a ) {55 when( 3 < 3 ) waitfor( f3 : a, a ) { 56 56 7; 57 57 } … … 64 64 65 65 //--------------------------------------- 66 when( 6 < 3 ) waitfor( f3 ,a, a, a ) {66 when( 6 < 3 ) waitfor( f3 : a, a, a ) { 67 67 10; 68 68 } 69 or when( 7 < 3 ) waitfor( f1 ,a ) {69 or when( 7 < 3 ) waitfor( f1 : a ) { 70 70 11; 71 71 } … … 75 75 76 76 //--------------------------------------- 77 when( 8 < 3 ) waitfor( f3 ,a, a ) {77 when( 8 < 3 ) waitfor( f3 : a, a ) { 78 78 13; 79 79 } 80 or waitfor( f1 ,a ) {80 or waitfor( f1 : a ) { 81 81 14; 82 82 } … … 86 86 87 87 //--------------------------------------- 88 when( 10 < 3 ) waitfor( f1 ,a ) {88 when( 10 < 3 ) waitfor( f1 : a ) { 89 89 16; 90 90 } 91 or waitfor( f2 ,a, a ) {91 or waitfor( f2 : a, a ) { 92 92 17; 93 93 } … … 100 100 } 101 101 102 int main() { 103 104 } 102 int main() {} -
tests/concurrent/waitfor/parse2.cfa
r095b99a r9e63a2b 10 10 // Created On : Wed Aug 30 17:53:29 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Mar 22 13:42:11 201913 // Update Count : 312 // Last Modified On : Thu Jan 16 23:13:37 2020 13 // Update Count : 6 14 14 // 15 15 … … 26 26 } 27 27 28 waitfor( x ,z ) {28 waitfor( x : z ) { 29 29 } 30 30 … … 37 37 or waitfor( y ); 38 38 39 waitfor( x ,z );39 waitfor( x : z ); 40 40 or waitfor( y ); 41 41 … … 43 43 or when( true ) waitfor( y ); 44 44 45 when( true ) waitfor( x ,z );45 when( true ) waitfor( x : z ); 46 46 or when( true ) waitfor( y ); 47 47 … … 50 50 } 51 51 52 waitfor( x ,z ) {52 waitfor( x : z ) { 53 53 } or waitfor( y ) { 54 54 } … … 80 80 or else; 81 81 82 when( true ) waitfor( x ,z );82 when( true ) waitfor( x : z ); 83 83 or else; 84 84 … … 99 99 } 100 100 101 when( true ) waitfor( x ,z );101 when( true ) waitfor( x : z ); 102 102 or else { 103 103 } … … 115 115 or when( true ) else; 116 116 117 when( true ) waitfor( x ,z );117 when( true ) waitfor( x : z ); 118 118 or when( true ) else; 119 119 … … 134 134 } 135 135 136 when( true ) waitfor( x ,z );136 when( true ) waitfor( x : z ); 137 137 or when( true ) else { 138 138 } … … 149 149 or timeout( 3 ); 150 150 151 waitfor( x ,z );151 waitfor( x : z ); 152 152 or timeout( 3 ); 153 153 … … 163 163 } 164 164 165 when( true ) waitfor( x ,z ) {165 when( true ) waitfor( x : z ) { 166 166 } or timeout( 3 ) { 167 167 } … … 171 171 } 172 172 173 when( true ) waitfor( x ,z ) {173 when( true ) waitfor( x : z ) { 174 174 } or when ( true ) timeout( 3 ) { 175 175 } … … 229 229 230 230 int or, timeout; 231 waitfor( timeout ,7 ) 3;232 waitfor( timeout , 7 ) 3; or waitfor( timeout,7 ) 3;233 when( or ) waitfor( or ,) { 4; } or timeout( 1 ) 3;234 when( 3 ) waitfor( or ,2 ) 4; or else 4;235 when( 3 ) waitfor( or ,3 ) 4; or when( or ) timeout( or ) 4; or when( or ) else timeout;236 when( 3 ) waitfor( or , or ) 3; or when( or ) waitfor( or,timeout ) 4; or else 4;237 when( 3 ) waitfor( or , or ) 3; or waitfor( or,9 ) 4; or when( or ) timeout( timeout ) 4;238 when( 3 ) waitfor( or , 3 ) 3; or waitfor( or,7 ) or; or timeout( 1 ) or; or when( 3 ) else or;231 waitfor( timeout : 7 ) 3; 232 waitfor( timeout : 7 ) 3; or waitfor( timeout : 7 ) 3; 233 when( or ) waitfor( or : ) { 4; } or timeout( 1 ) 3; 234 when( 3 ) waitfor( or : 2 ) 4; or else 4; 235 when( 3 ) waitfor( or : 3 ) 4; or when( or ) timeout( or ) 4; or when( or ) else timeout; 236 when( 3 ) waitfor( or : or ) 3; or when( or ) waitfor( or : timeout ) 4; or else 4; 237 when( 3 ) waitfor( or : or ) 3; or waitfor( or : 9 ) 4; or when( or ) timeout( timeout ) 4; 238 when( 3 ) waitfor( or : 3 ) 3; or waitfor( or : 7 ) or; or timeout( 1 ) or; or when( 3 ) else or; 239 239 240 240 // test else selection -
tests/concurrent/waitfor/recurse.cfa
r095b99a r9e63a2b 66 66 67 67 rand_yield(); 68 waitfor( call4 ,this );68 waitfor( call4 : this ); 69 69 rand_yield(); 70 70 … … 78 78 79 79 rand_yield(); 80 waitfor( call3 ,this );80 waitfor( call3 : this ); 81 81 rand_yield(); 82 82 … … 92 92 93 93 rand_yield(); 94 waitfor( call2 ,this );94 waitfor( call2 : this ); 95 95 rand_yield(); 96 96 -
tests/concurrent/waitfor/statment.cfa
r095b99a r9e63a2b 101 101 102 102 while( !done ) { 103 waitfor( get_index ,this );104 or waitfor( call1 ,this ) { sout | "Statement"; if( this.last_val != 1 ) { serr | "Incorrect index: expected" | 1 | "got" | this.last_val; } }105 or waitfor( call2 ,this ) { sout | "Statement"; if( this.last_val != 2 ) { serr | "Incorrect index: expected" | 2 | "got" | this.last_val; } }106 or waitfor( call3 ,this ) { sout | "Statement"; if( this.last_val != 3 ) { serr | "Incorrect index: expected" | 3 | "got" | this.last_val; } }107 or waitfor( call4 ,this ) { sout | "Statement"; if( this.last_val != 4 ) { serr | "Incorrect index: expected" | 4 | "got" | this.last_val; } }108 or waitfor( call5 ,this ) { sout | "Statement"; if( this.last_val != 5 ) { serr | "Incorrect index: expected" | 5 | "got" | this.last_val; } }109 or waitfor( call6 ,this ) { sout | "Statement"; if( this.last_val != 6 ) { serr | "Incorrect index: expected" | 6 | "got" | this.last_val; } }110 or waitfor( call7 ,this ) { sout | "Statement"; if( this.last_val != 7 ) { serr | "Incorrect index: expected" | 7 | "got" | this.last_val; } }103 waitfor( get_index : this ); 104 or waitfor( call1 : this ) { sout | "Statement"; if( this.last_val != 1 ) { serr | "Incorrect index: expected" | 1 | "got" | this.last_val; } } 105 or waitfor( call2 : this ) { sout | "Statement"; if( this.last_val != 2 ) { serr | "Incorrect index: expected" | 2 | "got" | this.last_val; } } 106 or waitfor( call3 : this ) { sout | "Statement"; if( this.last_val != 3 ) { serr | "Incorrect index: expected" | 3 | "got" | this.last_val; } } 107 or waitfor( call4 : this ) { sout | "Statement"; if( this.last_val != 4 ) { serr | "Incorrect index: expected" | 4 | "got" | this.last_val; } } 108 or waitfor( call5 : this ) { sout | "Statement"; if( this.last_val != 5 ) { serr | "Incorrect index: expected" | 5 | "got" | this.last_val; } } 109 or waitfor( call6 : this ) { sout | "Statement"; if( this.last_val != 6 ) { serr | "Incorrect index: expected" | 6 | "got" | this.last_val; } } 110 or waitfor( call7 : this ) { sout | "Statement"; if( this.last_val != 7 ) { serr | "Incorrect index: expected" | 7 | "got" | this.last_val; } } 111 111 112 112 done = true; -
tests/concurrent/waitfor/when.cfa
r095b99a r9e63a2b 58 58 void arbiter( global_t & mutex this ) { 59 59 for( int i = 0; i < N; i++ ) { 60 when( this.last_call == 6 ) waitfor( call1 ,this ) { if( this.last_call != 1) { serr | "Expected last_call to be 1 got" | this.last_call; } }61 or when( this.last_call == 1 ) waitfor( call2 ,this ) { if( this.last_call != 2) { serr | "Expected last_call to be 2 got" | this.last_call; } }62 or when( this.last_call == 2 ) waitfor( call3 ,this ) { if( this.last_call != 3) { serr | "Expected last_call to be 3 got" | this.last_call; } }63 or when( this.last_call == 3 ) waitfor( call4 ,this ) { if( this.last_call != 4) { serr | "Expected last_call to be 4 got" | this.last_call; } }64 or when( this.last_call == 4 ) waitfor( call5 ,this ) { if( this.last_call != 5) { serr | "Expected last_call to be 5 got" | this.last_call; } }65 or when( this.last_call == 5 ) waitfor( call6 ,this ) { if( this.last_call != 6) { serr | "Expected last_call to be 6 got" | this.last_call; } }60 when( this.last_call == 6 ) waitfor( call1 : this ) { if( this.last_call != 1) { serr | "Expected last_call to be 1 got" | this.last_call; } } 61 or when( this.last_call == 1 ) waitfor( call2 : this ) { if( this.last_call != 2) { serr | "Expected last_call to be 2 got" | this.last_call; } } 62 or when( this.last_call == 2 ) waitfor( call3 : this ) { if( this.last_call != 3) { serr | "Expected last_call to be 3 got" | this.last_call; } } 63 or when( this.last_call == 3 ) waitfor( call4 : this ) { if( this.last_call != 4) { serr | "Expected last_call to be 4 got" | this.last_call; } } 64 or when( this.last_call == 4 ) waitfor( call5 : this ) { if( this.last_call != 5) { serr | "Expected last_call to be 5 got" | this.last_call; } } 65 or when( this.last_call == 5 ) waitfor( call6 : this ) { if( this.last_call != 6) { serr | "Expected last_call to be 6 got" | this.last_call; } } 66 66 67 67 sout | this.last_call;
Note: See TracChangeset
for help on using the changeset viewer.