Changeset b7d6a36 for tests/concurrent


Ignore:
Timestamp:
Feb 20, 2020, 4:15:51 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
6a490b2
Parents:
dca5802 (diff), 2cbfe92 (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.
Message:

Merge branch 'master' into relaxed_ready

Location:
tests/concurrent
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • tests/concurrent/examples/boundedBufferEXT.cfa

    rdca5802 rb7d6a36  
    1010// Created On       : Wed Apr 18 22:52:12 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jun 21 08:19:20 2019
    13 // Update Count     : 14
     12// Last Modified On : Thu Jan 16 22:36:34 2020
     13// Update Count     : 15
    1414//
    1515
     
    3737
    3838        void insert( Buffer(T) & mutex buffer, T elem ) with( buffer ) {
    39                 if ( count == BufferSize ) waitfor( remove, buffer );
     39                if ( count == BufferSize ) waitfor( remove : buffer );
    4040                elements[back] = elem;
    4141                back = ( back + 1 ) % BufferSize;
     
    4444
    4545        T remove( Buffer(T) & mutex buffer ) with( buffer ) {
    46                 if ( count == 0 ) waitfor( insert, buffer );
     46                if ( count == 0 ) waitfor( insert : buffer );
    4747                T elem = elements[front];
    4848                front = ( front + 1 ) % BufferSize;
  • tests/concurrent/examples/boundedBufferTHREAD.cfa

    rdca5802 rb7d6a36  
    1010// Created On       : Wed Apr 18 22:52:12 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jun 21 11:50:12 2019
    13 // Update Count     : 24
     12// Last Modified On : Thu Jan 16 23:09:43 2020
     13// Update Count     : 25
    1414//
    1515
     
    4444        void main( Buffer & buffer ) with( buffer ) {
    4545                for () {
    46                         waitfor( ^?{}, buffer ) {
     46                        waitfor( ^?{} : buffer ) {
    4747                                break;
    48                         } or when ( count != 20 ) waitfor( insert, buffer ) {
     48                        } or when ( count != 20 ) waitfor( insert : buffer ) {
    4949                                back = (back + 1) % 20;
    5050                                count += 1;
    51                         } or when ( count != 0 ) waitfor( remove, buffer ) {
     51                        } or when ( count != 0 ) waitfor( remove : buffer ) {
    5252                                front = (front + 1) % 20;
    5353                                count -= 1;
  • tests/concurrent/examples/gortn.cfa

    rdca5802 rb7d6a36  
    1010// Created On       : Wed Feb 20 08:02:37 2019
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jun 21 08:25:03 2019
    13 // Update Count     : 4
     12// Last Modified On : Thu Jan 16 22:43:40 2020
     13// Update Count     : 5
    1414//
    1515
     
    2626void main( GoRtn & gortn ) with( gortn ) {
    2727        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;
    3232        }
    3333}
  • tests/concurrent/examples/quickSort.cfa

    rdca5802 rb7d6a36  
    1111// Created On       : Wed Dec  6 12:15:52 2017
    1212// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Thu Oct 10 13:58:18 2019
    14 // Update Count     : 176
     13// Last Modified On : Wed Feb 12 18:24:47 2020
     14// Update Count     : 177
    1515//
    1616
     
    2727
    2828void ?{}( Quicksort & qs, int values[], int size, int depth ) {
    29         qs.values = values;  qs.low = 0;  qs.high = size;  qs.depth = depth;
     29        qs.[values, low, high, depth] = [values, 0, size, depth];
    3030} // Quicksort
    3131
     
    167167                        values[counter] = size - counter;                       // descending values
    168168                } // for
    169                 for ( int i = 0; i < 200; i +=1 ) {                             // random shuffle a few values
     169                for ( i; 200 ) {                                                                // random shuffle a few values
    170170                        swap( values[rand() % size], values[rand() % size] );
    171171                } // for
  • tests/concurrent/waitfor/barge.cfa

    rdca5802 rb7d6a36  
    6565                yield(random( 10 ));
    6666                this.state = WAITFOR;
    67                 waitfor(do_call, this) {
     67                waitfor(do_call : this) {
    6868                        sout | i;
    6969                }
  • tests/concurrent/waitfor/dtor.cfa

    rdca5802 rb7d6a36  
    4747        yield(random( 10 ));
    4848        set_state( this, MAIN );
    49         waitfor( ^?{}, this ) {
     49        waitfor( ^?{} : this ) {
    5050                set_state( this, AFTER );
    5151        }
  • tests/concurrent/waitfor/else.cfa

    rdca5802 rb7d6a36  
    1414        sout | "Starting";
    1515
    16         when( false ) waitfor( notcalled, m );
     16        when( false ) waitfor( notcalled : m );
    1717
    1818        sout | "Step" | i++;
    1919
    20         waitfor( notcalled, m ); or else {
     20        waitfor( notcalled : m ); or else {
    2121                sout | "else called";
    2222        }
     
    2424        sout | "Step" | i++;
    2525
    26         when( true ) waitfor( notcalled, m ); or when( true ) else {
     26        when( true ) waitfor( notcalled : m ); or when( true ) else {
    2727                sout | "else called";
    2828        }
     
    3030        sout | "Step" | i++;
    3131
    32         when( false ) waitfor( notcalled, m ); or when( true ) else {
     32        when( false ) waitfor( notcalled : m ); or when( true ) else {
    3333                sout | "else called";
    3434        }
     
    3636        sout | "Step" | i++;
    3737
    38         when( false ) waitfor( notcalled, m ); or when( false ) else {
     38        when( false ) waitfor( notcalled : m ); or when( false ) else {
    3939                sout | "else called";
    4040        }
  • tests/concurrent/waitfor/parse.cfa

    rdca5802 rb7d6a36  
    2424
    2525        //---------------------------------------
    26         waitfor( f1, a ) {
     26        waitfor( f1 : a ) {
    2727                1;
    2828        }
    2929
    3030        //---------------------------------------
    31         waitfor( f1, a ) {
     31        waitfor( f1 : a ) {
    3232                2;
    3333        }
    34         waitfor( f2, a ) {
     34        waitfor( f2 : a ) {
    3535                3;
    3636        }
    3737
    3838        //---------------------------------------
    39         when( 1 < 3 ) waitfor( f2, a, a ) {
     39        when( 1 < 3 ) waitfor( f2 : a, a ) {
    4040                4;
    4141        }
     
    4545
    4646        //---------------------------------------
    47         when( 2 < 3 ) waitfor( f3, a ) {
     47        when( 2 < 3 ) waitfor( f3 : a ) {
    4848                5;
    4949        }
     
    5353
    5454        //---------------------------------------
    55         when( 3 < 3 ) waitfor( f3, a, a ) {
     55        when( 3 < 3 ) waitfor( f3 : a, a ) {
    5656                7;
    5757        }
     
    6464
    6565        //---------------------------------------
    66         when( 6 < 3 ) waitfor( f3, a, a, a ) {
     66        when( 6 < 3 ) waitfor( f3 : a, a, a ) {
    6767                10;
    6868        }
    69         or when( 7 < 3 ) waitfor( f1, a  ) {
     69        or when( 7 < 3 ) waitfor( f1 : a  ) {
    7070                11;
    7171        }
     
    7575
    7676        //---------------------------------------
    77         when( 8 < 3 ) waitfor( f3, a, a ) {
     77        when( 8 < 3 ) waitfor( f3 : a, a ) {
    7878                13;
    7979        }
    80         or waitfor( f1, a  ) {
     80        or waitfor( f1 : a  ) {
    8181                14;
    8282        }
     
    8686
    8787        //---------------------------------------
    88         when( 10 < 3 ) waitfor( f1, a ) {
     88        when( 10 < 3 ) waitfor( f1 : a ) {
    8989                16;
    9090        }
    91         or waitfor( f2, a, a ) {
     91        or waitfor( f2 : a, a ) {
    9292                17;
    9393        }
     
    100100}
    101101
    102 int main() {
    103 
    104 }
     102int main() {}
  • tests/concurrent/waitfor/parse2.cfa

    rdca5802 rb7d6a36  
    1010// Created On       : Wed Aug 30 17:53:29 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 22 13:42:11 2019
    13 // Update Count     : 3
     12// Last Modified On : Thu Jan 16 23:13:37 2020
     13// Update Count     : 6
    1414//
    1515
     
    2626        }
    2727
    28         waitfor( x, z ) {
     28        waitfor( x : z ) {
    2929        }
    3030
     
    3737        or waitfor( y );
    3838
    39         waitfor( x, z );
     39        waitfor( x : z );
    4040        or waitfor( y );
    4141
     
    4343        or when( true ) waitfor( y );
    4444
    45         when( true ) waitfor( x, z );
     45        when( true ) waitfor( x : z );
    4646        or when( true ) waitfor( y );
    4747
     
    5050        }
    5151
    52         waitfor( x, z ) {
     52        waitfor( x : z ) {
    5353        } or waitfor( y ) {
    5454        }
     
    8080        or else;
    8181
    82         when( true ) waitfor( x, z );
     82        when( true ) waitfor( x : z );
    8383        or else;
    8484
     
    9999        }
    100100
    101         when( true ) waitfor( x, z );
     101        when( true ) waitfor( x : z );
    102102        or else {
    103103        }
     
    115115        or when( true ) else;
    116116
    117         when( true ) waitfor( x, z );
     117        when( true ) waitfor( x : z );
    118118        or when( true ) else;
    119119
     
    134134        }
    135135
    136         when( true ) waitfor( x, z );
     136        when( true ) waitfor( x : z );
    137137        or when( true ) else {
    138138        }
     
    149149        or timeout( 3 );
    150150
    151         waitfor( x, z );
     151        waitfor( x : z );
    152152        or timeout( 3 );
    153153
     
    163163        }
    164164
    165         when( true ) waitfor( x, z ) {
     165        when( true ) waitfor( x : z ) {
    166166        } or timeout( 3 ) {
    167167        }
     
    171171        }
    172172
    173         when( true ) waitfor( x, z ) {
     173        when( true ) waitfor( x : z ) {
    174174        } or when ( true ) timeout( 3 ) {
    175175        }
     
    229229
    230230        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;
    239239
    240240        // test else selection
  • tests/concurrent/waitfor/recurse.cfa

    rdca5802 rb7d6a36  
    6666
    6767        rand_yield();
    68         waitfor( call4, this );
     68        waitfor( call4 : this );
    6969        rand_yield();
    7070
     
    7878
    7979        rand_yield();
    80         waitfor( call3, this );
     80        waitfor( call3 : this );
    8181        rand_yield();
    8282
     
    9292
    9393        rand_yield();
    94         waitfor( call2, this );
     94        waitfor( call2 : this );
    9595        rand_yield();
    9696
  • tests/concurrent/waitfor/statment.cfa

    rdca5802 rb7d6a36  
    101101
    102102        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; } }
    111111
    112112                done = true;
  • tests/concurrent/waitfor/when.cfa

    rdca5802 rb7d6a36  
    6262
    6363        for( int i = 0; i < N; i++ ) {
    64                    when( this.last_call == 6 ) waitfor( call1, this ) { if( this.last_call != 1) { serr | "Expected last_call to be 1 got" | this.last_call; } }
    65                 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; } }
    66                 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; } }
    67                 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; } }
    68                 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; } }
    69                 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; } }
     64                   when( this.last_call == 6 ) waitfor( call1 : this ) { if( this.last_call != 1) { serr | "Expected last_call to be 1 got" | this.last_call; } }
     65                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; } }
     66                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; } }
     67                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; } }
     68                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; } }
     69                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; } }
    7070
    7171                sout | this.last_call;
Note: See TracChangeset for help on using the changeset viewer.