Changes in / [65ef0cd:c4497e3]


Ignore:
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/colby_parsons_MMAth/benchmarks/channels/plotData.py

    r65ef0cd rc4497e3  
    6262procCount = 0
    6363currVariant = 0
     64experiment_duration = 10
    6465name = ""
    6566var_name = ""
     
    107108   
    108109    lineArr = line.split()
    109     tempData[count] = float(lineArr[-1])
     110    tempData[count] = float(lineArr[-1]) / experiment_duration
    110111    count += 1
    111112    if count == numTimes:
  • doc/theses/colby_parsons_MMAth/benchmarks/mutex_stmt/plotData.py

    r65ef0cd rc4497e3  
    6060name = "Aggregate Lock"
    6161var_name = ""
     62experiment_duration = 10
    6263sendData = [0.0 for j in range(numVariants)]
    6364data = [[0.0 for i in range(len(procs))] for j in range(numVariants)]
     
    8081   
    8182    lineArr = line.split()
    82     tempData[count] = float(lineArr[-1])
     83    tempData[count] = float(lineArr[-1]) / experiment_duration
    8384    count += 1
    8485    if count == numTimes:
  • doc/theses/colby_parsons_MMAth/benchmarks/waituntil/cfa/future.cfa

    r65ef0cd rc4497e3  
    77#include <string.h>
    88
    9 size_t Clients = 1, Time = 10;
     9// #define ANDOR
     10
     11size_t Processors = 2, Time = 10;
    1012
    1113size_t globalTotal = 0;
    1214future(size_t) A, B, C;
    13 volatile bool server_done_loop = false;
    14 volatile bool client_done_loop = false;
     15volatile bool done_loop = false;
    1516volatile bool client_done = false;
    1617volatile bool server_done = false;
    1718
    18 volatile size_t client_count = 0;
    19 volatile size_t client_loop_count = 0;
     19static inline void wait() {
     20    #ifdef OR
     21    waituntil( A ) { get( A ); }
     22    or waituntil( B ) { get( B ); }
     23    or waituntil( C ) { get( C ); }
     24    #endif
     25    #ifdef AND
     26    waituntil( A ) { get( A ); }
     27    and waituntil( B ) { get( B ); }
     28    #endif
     29    #ifdef AND3
     30    waituntil( A ) { get( A ); }
     31    and waituntil( B ) { get( B ); }
     32    and waituntil( C ) { get( C ); }
     33    #endif
     34    #ifdef ANDOR
     35    waituntil( A ) { get( A ); }
     36    and waituntil( B ) { get( B ); }
     37    or waituntil( C ) { get( C ); }
     38    #endif
     39    #ifdef ORAND
     40    (waituntil( A ) { get( A ); }
     41    or waituntil( B ) { get( B ); })
     42    and waituntil( C ) { get( C ); }
     43    #endif
     44    #ifdef BASIC
     45    get( A );
     46    #endif
     47}
     48
     49static inline fulfill( size_t i ) {
     50    #ifdef OR
     51    if ( i % 3 == 0 ) {
     52        fulfil(A, i);
     53    } else if ( i % 3 == 1 ) {
     54        fulfil(B, i);
     55    } else {
     56        fulfil(C, i);
     57    }
     58    #endif
     59    #ifdef AND
     60    if ( i % 2 == 0 ) {
     61        fulfil(A, i);
     62        fulfil(B, i);
     63    } else {
     64        fulfil(B, i);
     65        fulfil(A, i);
     66    }
     67    #endif
     68    #ifdef AND3
     69    if ( i % 6 == 0 ) {
     70        fulfil(A, i);
     71        fulfil(B, i);
     72        fulfil(C, i);
     73    } else if ( i % 6 == 1 ) {
     74        fulfil(A, i);
     75        fulfil(C, i);
     76        fulfil(B, i);
     77    } else if ( i % 6 == 2 ) {
     78        fulfil(B, i);
     79        fulfil(A, i);
     80        fulfil(C, i);
     81    } else if ( i % 6 == 3 ) {
     82        fulfil(B, i);
     83        fulfil(C, i);
     84        fulfil(A, i);
     85    } else if ( i % 6 == 4 ) {
     86        fulfil(C, i);
     87        fulfil(A, i);
     88        fulfil(B, i);
     89    } else if ( i % 6 == 5 ) {
     90        fulfil(C, i);
     91        fulfil(B, i);
     92        fulfil(A, i);
     93    }
     94    #endif
     95    #ifdef ANDOR
     96    if ( i % 4 == 0 ) {
     97        fulfil(A, i);
     98        fulfil(B, i);
     99    } else if ( i % 4 == 1 ) {
     100        fulfil(A, i);
     101        fulfil(C, i);
     102    } else if ( i % 4 == 2 ) {
     103        fulfil(B, i);
     104        fulfil(C, i);
     105    } else {
     106        fulfil(C, i);
     107    }
     108    #endif
     109    #ifdef ORAND
     110    if ( i % 4 == 0 ) {
     111        fulfil(A, i);
     112        fulfil(C, i);
     113    } else if ( i % 4 == 1 ) {
     114        fulfil(C, i);
     115        fulfil(A, i);
     116    } else if ( i % 4 == 2 ) {
     117        fulfil(B, i);
     118        fulfil(C, i);
     119    } else {
     120        fulfil(C, i);
     121        fulfil(B, i);
     122    }
     123    #endif
     124    #ifdef BASIC
     125    fulfil(A, i);
     126    #endif
     127}
     128
    20129thread Client {};
    21130void main( Client & this ) {
    22131    size_t i = 0;
    23     for(;; i++ ) {
    24         waituntil( A ) { get(A); }
    25         and waituntil( B ) { get(B); }
    26         or waituntil( C ) { get(C); }
    27 
    28         // needs to check after waituntil for termination synchronization
    29         if ( client_done ) break;
    30 
    31         // Barrier-like synch needed to reset futures safely
    32         if ( __atomic_add_fetch( &client_count, 1, __ATOMIC_SEQ_CST ) == Clients ) { // synchronize reset
    33             client_count = 0;
    34             reset( A );
    35             reset( B );
    36             reset( C );
    37             client_done_loop = true; // unblock clients
    38         }
    39         while( !client_done_loop ) {} // client barrier
    40         if ( __atomic_add_fetch( &client_loop_count, 1, __ATOMIC_SEQ_CST ) == Clients ) {
    41             client_done_loop = false; // reset barrier before clients can proceed past waituntil
    42             server_done_loop = true; // unblock server to restart iteration
    43             client_loop_count = 0;
    44         }
     132    for(; !client_done; i++ ) {
     133        wait();
     134        reset( A );
     135        reset( B );
     136        reset( C );
     137        done_loop = true;
    45138    }
    46139    __atomic_fetch_add( &globalTotal, i, __ATOMIC_SEQ_CST );
     
    50143void main( Server & this ) {
    51144    for( size_t i = 0; !server_done; i++ ) {
    52         if ( i % 4 == 0 ) {
    53             fulfil(A, i);
    54             fulfil(B, i);
    55         } else if ( i % 4 == 1 ) {
    56             fulfil(A, i);
    57             fulfil(C, i);
    58         } else if ( i % 4 == 2 ) {
    59             fulfil(B, i);
    60             fulfil(C, i);
    61         } else {
    62             fulfil(C, i);
    63         }
    64         while( !server_done_loop && !server_done ) {} // server barrier
    65         server_done_loop = false; // reset server barrier
     145        fulfill( i );
     146        while( !done_loop ) {}
     147        done_loop = false;
    66148    }
    67149}
     
    69151int main( int argc, char * argv[] ) {
    70152    switch ( argc ) {
    71           case 3:
    72                 if ( strcmp( argv[2], "d" ) != 0 ) {                    // default ?
    73                         Time = atoi( argv[2] );
    74                 } // if
    75153          case 2:
    76154                if ( strcmp( argv[1], "d" ) != 0 ) {                    // default ?
    77                         Clients = atoi( argv[1] );
    78                         if ( Clients < 1 ) goto Usage;
     155                        Time = atoi( argv[1] );
     156                        if ( Time < 0 ) goto Usage;
    79157                } // if
    80158          case 1:                                                                                       // use defaults
     
    83161          Usage:
    84162                sout | "Usage: " | argv[0]
    85              | " [ clients (> 0) | 'd' (default " | Clients
    86                          | ") ] [ time (>= 0) | 'd' (default " | Time
     163             | "[ time (>= 0) | 'd' (default " | Time
    87164                         | ") ]" ;
    88165                exit( EXIT_FAILURE );
    89166        } // switch
    90     processor p[Clients];
     167    processor p[Processors - 1];
    91168
    92169    {
    93         Client c[Clients];
     170        Server s;
    94171        {
    95             Server s;
     172            Client c;
    96173
    97174            sleep(Time`s);
    98             server_done = true;
     175
     176            client_done = true;
    99177        }
    100         while( available(A) || available(B) || available(C) ) {}
    101         client_done = true;
    102         fulfil( C, 0 );
     178        server_done = true;
     179        done_loop = true;
    103180    }
    104181    printf("%zu\n", globalTotal);
  • doc/theses/colby_parsons_MMAth/benchmarks/waituntil/cfa/sidechan.cfa

    r65ef0cd rc4497e3  
    3737thread Consumer {};
    3838void main( Consumer & this ) {
    39     int idx = __atomic_fetch_add( &cons_counter, 1, __ATOMIC_SEQ_CST ) % Channels;
     39    const int idx = __atomic_fetch_add( &cons_counter, 1, __ATOMIC_SEQ_CST ) % Channels;
    4040    size_t val, i = 0;
    4141    try {
     
    4949thread Producer {};
    5050void main( Producer & this ) {
    51     int idx = __atomic_fetch_add( &prod_counter, 1, __ATOMIC_SEQ_CST ) % Channels;
     51    const int idx = __atomic_fetch_add( &prod_counter, 1, __ATOMIC_SEQ_CST ) % Channels;
    5252    try {
    5353        for( size_t i = 0;; i++ ) {
  • doc/theses/colby_parsons_MMAth/benchmarks/waituntil/run

    r65ef0cd rc4497e3  
    8585}
    8686
    87 # numtimes=5
    88 numtimes=1
     87numtimes=3
     88# numtimes=1
    8989
    9090# num_threads='2 4 8 16 24 32'
    91 # side_chan_threads='6 12 18 24 30' # must be mults of 6
     91side_chan_threads='6 12 18 24 30' # must be mults of 6
    9292num_threads='2'
    93 side_chan_threads='6'
     93# side_chan_threads='6'
    9494
    9595chan_size='10'
    9696future_time='10'
     97future_flags=('-DOR' '-DAND3' '-DANDOR' '-DORAND')
     98future_names=('OR' 'AND' 'ANDOR' 'ORAND')
    9799
    98100# toggle benchmarks
     
    103105spin=${false}
    104106contend=${false}
    105 sidechan=${false}
    106 # future=${false}
     107# sidechan=${false}
     108future=${false}
    107109
    108110runCFA=${true}
     
    164166
    165167run_future() {
    166     for p in ${num_threads} ; do
    167         pre_args=$(( ${p} - 1 ))
    168         affinity ${p}
    169         preprint="${p}\t"
    170         repeat_command taskset -c ${taskset} ./a.${hostname} ${pre_args} ${post_args}
    171     done
     168    affinity 2
     169    preprint="2\t"
     170    repeat_command taskset -c ${taskset} ./a.${hostname} ${post_args}
    172171}
    173172
     
    247246        ${cfa} ${cfa_flags} sidechan.cfa -o a.${hostname} > /dev/null 2>&1
    248247        run_side_chan
    249         rm a.${hostname}
     248        # rm a.${hostname}
    250249        cd - > /dev/null
    251250    fi # done CFA
     
    262261
    263262if [ ${future} -eq ${true} ] ; then
    264     echo "future: "
    265263    post_args=${future_time}
    266     if [ ${runCFA} -eq ${true} ] ; then
    267         cd cfa # CFA RUN
    268         print_header 'CFA'
    269         ${cfa} ${cfa_flags} future.cfa -o a.${hostname} > /dev/null 2>&1
    270         run_future
    271         rm a.${hostname}
    272         cd - > /dev/null
    273     fi # done CFA
    274 
    275     if [ ${runUCPP} -eq ${true} ] ; then
    276         cd ucpp
    277         print_header 'uC++'
    278         ${UCPP} ${UCPPflags} future.cc -o a.${hostname} > /dev/null 2>&1
    279         run_future
    280         rm a.${hostname}
    281         cd - > /dev/null
    282     fi # done Go
    283 fi
    284 
     264    for i in ${!future_flags[@]}; do
     265        echo 'future '${future_names[$i]}':'
     266        if [ ${runCFA} -eq ${true} ] ; then
     267            cd cfa # CFA RUN
     268            print_header 'CFA'
     269            ${cfa} ${cfa_flags} ${future_flags[$i]} future.cfa -o a.${hostname} > /dev/null 2>&1
     270            run_future
     271            rm a.${hostname}
     272            cd - > /dev/null
     273        fi # done CFA
     274
     275        if [ ${runUCPP} -eq ${true} ] ; then
     276            cd ucpp
     277            print_header 'uC++'
     278            ${UCPP} ${UCPPflags} ${future_flags[$i]} future.cc -o a.${hostname} > /dev/null 2>&1
     279            run_future
     280            rm a.${hostname}
     281            cd - > /dev/null
     282        fi # done Go
     283    done
     284fi
     285
  • doc/theses/colby_parsons_MMAth/benchmarks/waituntil/ucpp/future.cc

    r65ef0cd rc4497e3  
    33#include <uFuture.h>
    44
    5 size_t Clients = 2, Time = 10;
     5// #define ANDOR
    66
     7size_t Processors = 2, Time = 10;
    78size_t globalTotal = 0;
    8 Future_ISM<size_t> A, B, C;
    9 volatile bool server_done_loop = false;
    10 volatile bool client_done_loop = false;
     9volatile bool done_loop = false;
    1110volatile bool client_done = false;
    1211volatile bool server_done = false;
    1312
    14 volatile size_t client_count = 0;
    15 volatile size_t client_loop_count = 0;
     13Future_ISM<size_t> A, B, C;
     14
     15static inline void wait() {
     16    #ifdef OR
     17    _Select( A ) { A(); }
     18    or _Select( B ) { B(); }
     19    or _Select( C ) { C(); }
     20    #endif
     21    #ifdef AND
     22    _Select( A ) { A(); }
     23    and _Select( B ) { B(); }
     24    #endif
     25    #ifdef AND3
     26    _Select( A ) { A(); }
     27    and _Select( B ) { B(); }
     28    and _Select( C ) { C(); }
     29    #endif
     30    #ifdef ANDOR
     31    _Select( A ) { A(); }
     32    and _Select( B ) { B(); }
     33    or _Select( C ) { C(); }
     34    #endif
     35    #ifdef ORAND
     36    (_Select( A ) { A(); }
     37    or _Select( B ) { B(); })
     38    and _Select( C ) { C(); }
     39    #endif
     40    #ifdef BASIC
     41    A();
     42    #endif
     43}
     44
     45static inline void fulfill( size_t i ) {
     46    #ifdef OR
     47    if ( i % 3 == 0 ) {
     48        A.delivery(i);
     49    } else if ( i % 3 == 1 ) {
     50        B.delivery(i);
     51    } else {
     52        C.delivery(i);
     53    }
     54    #endif
     55    #ifdef AND
     56    if ( i % 2 == 0 ) {
     57        A.delivery(i);
     58        B.delivery(i);
     59    } else {
     60        B.delivery(i);
     61        A.delivery(i);
     62    }
     63    #endif
     64    #ifdef AND3
     65    if ( i % 6 == 0 ) {
     66        A.delivery(i);
     67        B.delivery(i);
     68        C.delivery(i);
     69    } else if ( i % 6 == 1 ) {
     70        A.delivery(i);
     71        C.delivery(i);
     72        B.delivery(i);
     73    } else if ( i % 6 == 2 ) {
     74        B.delivery(i);
     75        A.delivery(i);
     76        C.delivery(i);
     77    } else if ( i % 6 == 3 ) {
     78        B.delivery(i);
     79        C.delivery(i);
     80        A.delivery(i);
     81    } else if ( i % 6 == 4 ) {
     82        C.delivery(i);
     83        A.delivery(i);
     84        B.delivery(i);
     85    } else if ( i % 6 == 5 ) {
     86        C.delivery(i);
     87        B.delivery(i);
     88        A.delivery(i);
     89    }
     90    #endif
     91    #ifdef ANDOR
     92    if ( i % 4 == 0 ) {
     93        A.delivery(i);
     94        B.delivery(i);
     95    } else if ( i % 4 == 1 ) {
     96        A.delivery(i);
     97        C.delivery(i);
     98    } else if ( i % 4 == 2 ) {
     99        B.delivery(i);
     100        C.delivery(i);
     101    } else {
     102        C.delivery(i);
     103    }
     104    #endif
     105    #ifdef ORAND
     106    if ( i % 4 == 0 ) {
     107        A.delivery(i);
     108        C.delivery(i);
     109    } else if ( i % 4 == 1 ) {
     110        C.delivery(i);
     111        A.delivery(i);
     112    } else if ( i % 4 == 2 ) {
     113        B.delivery(i);
     114        C.delivery(i);
     115    } else {
     116        C.delivery(i);
     117        B.delivery(i);
     118    }
     119    #endif
     120    #ifdef BASIC
     121    A.delivery(i);
     122    #endif
     123}
     124
    16125_Task Client {
    17126        void main() {
    18127                size_t i = 0;
    19         for(;; i++ ) {
    20             _Select( A ) { A(); }
    21             and _Select( B ) { B(); }
    22             or _Select( C ) { C(); }
    23 
    24             // needs to check after waituntil for termination synchronization
    25             if ( client_done ) break;
    26            
    27             // Barrier-like synch needed to reset futures safely
    28             if ( __atomic_add_fetch(&client_count, 1, __ATOMIC_SEQ_CST) == Clients ) {
    29                 client_count = 0;
    30                 A.reset();
    31                 B.reset();
    32                 C.reset();
    33                 client_done_loop = true;
    34             }
    35             while( !client_done_loop ) {} // client barrier
    36             if ( __atomic_add_fetch( &client_loop_count, 1, __ATOMIC_SEQ_CST ) == Clients ) {
    37                 client_done_loop = false; // reset barrier before clients can proceed past waituntil
    38                 server_done_loop = true; // unblock server to restart iteration
    39                 client_loop_count = 0;
    40             }
     128        for(; !client_done; i++ ) {
     129            wait();
     130            A.reset();
     131            B.reset();
     132            C.reset();
     133            done_loop = true;
    41134        }
    42135        __atomic_fetch_add( &globalTotal, i, __ATOMIC_SEQ_CST );
     
    47140        void main() {
    48141                for( size_t i = 0; !server_done; i++ ) {
    49             if ( i % 4 == 0 ) {
    50                 A.delivery(i);
    51                 B.delivery(i);
    52             } else if ( i % 4 == 1 ) {
    53                 A.delivery(i);
    54                 C.delivery(i);
    55             } else if ( i % 4 == 2 ) {
    56                 B.delivery(i);
    57                 C.delivery(i);
    58             } else {
    59                 C.delivery(i);
    60             }
    61             while( !server_done_loop && !server_done ) {} // server barrier
    62             server_done_loop = false; // reset server barrier
     142            fulfill( i );
     143            while( !done_loop ) {}
     144            done_loop = false;
    63145        }
    64146        }
     
    67149int main( int argc, char * argv[] ) {
    68150        switch ( argc ) {
    69           case 3:
    70                 if ( strcmp( argv[2], "d" ) != 0 ) {                    // default ?
    71                         Time = atoi( argv[2] );
    72                 } // if
    73151          case 2:
    74152                if ( strcmp( argv[1], "d" ) != 0 ) {                    // default ?
    75                         Clients = atoi( argv[1] );
    76                         if ( Clients < 1 ) goto Usage;
     153                        Time = atoi( argv[1] );
     154                        if ( Time < 0 ) goto Usage;
    77155                } // if
    78156          case 1:                                                                                       // use defaults
     
    81159          Usage:
    82160                cerr << "Usage: " << argv[0]
    83              << " [ clients (> 0) | 'd' (default " << Clients
    84                          << ") ] [ time (>= 0) | 'd' (default " << Time
     161             << "[ time (>= 0) | 'd' (default " << Time
    85162                         << ") ]" ;
    86163                exit( EXIT_FAILURE );
    87164        } // switch
    88     uProcessor p[Clients];
     165    uProcessor p[Processors - 1];
    89166
    90167    {
    91         Client c[Clients];
     168        Server s;
    92169        {
    93             Server s;
     170            Client c;
    94171
    95172            uBaseTask::sleep( uDuration( Time ) );
    96173
    97             server_done = true;
     174            client_done = true;
    98175        }
    99         while( A.available() || B.available() || C.available() ) {}
    100         client_done = true;
    101         C.delivery(1); // can't deliver 0 since it causes ambiguity
     176        server_done = true;
     177        done_loop = true;
    102178    }
    103179    cout << globalTotal << endl;
  • libcfa/prelude/prelude-gen.cc

    r65ef0cd rc4497e3  
    159159int main() {
    160160        cout << "# 2 \"prelude.cfa\"  // needed for error messages from this file" << endl;
    161         cout << "forall( T & ) trait sized {};" << endl;
     161        cout << "forall( T * ) trait sized {};" << endl;
    162162
    163163        cout << "//////////////////////////" << endl;
  • libcfa/src/concurrency/actor.hfa

    r65ef0cd rc4497e3  
    390390struct actor {
    391391    size_t ticket;                                          // executor-queue handle
    392     allocation allocation_;                                         // allocation action
     392    allocation alloc;                                       // allocation action
    393393    inline virtual_dtor;
    394394};
     
    398398    // member must be called to end it
    399399    DEBUG_ABORT( __actor_executor_ == 0p, "Creating actor before calling start_actor_system() can cause undefined behaviour.\n" );
    400     allocation_ = Nodelete;
     400    alloc = Nodelete;
    401401    ticket = __get_next_ticket( *__actor_executor_ );
    402402    __atomic_fetch_add( &__num_actors_, 1, __ATOMIC_RELAXED );
     
    407407
    408408static inline void check_actor( actor & this ) {
    409     if ( this.allocation_ != Nodelete ) {
    410         switch( this.allocation_ ) {
     409    if ( this.alloc != Nodelete ) {
     410        switch( this.alloc ) {
    411411            case Delete: delete( &this ); break;
    412412            case Destroy:
     
    427427
    428428struct message {
    429     allocation allocation_;                     // allocation action
     429    allocation alloc;                   // allocation action
    430430    inline virtual_dtor;
    431431};
    432432
    433433static inline void ?{}( message & this ) {
    434     this.allocation_ = Nodelete;
     434    this.alloc = Nodelete;
    435435}
    436436static inline void ?{}( message & this, allocation alloc ) {
    437     memcpy( &this.allocation_, &alloc, sizeof(allocation) ); // optimization to elide ctor
    438     DEBUG_ABORT( this.allocation_ == Finished, "The Finished allocation status is not supported for message types.\n" );
     437    memcpy( &this.alloc, &alloc, sizeof(allocation) ); // optimization to elide ctor
     438    CFA_DEBUG( if( this.alloc == Finished ) this.alloc = Nodelete; )
    439439}
    440440static inline void ^?{}( message & this ) with(this) {
    441     CFA_DEBUG( if ( allocation_ == Nodelete ) printf("A message at location %p was allocated but never sent.\n", &this); )
     441    CFA_DEBUG(
     442                if ( alloc == Nodelete ) {
     443                        printf( "CFA warning (UNIX pid:%ld) : program terminating with message %p allocated but never sent.\n",
     444                                        (long int)getpid(), &this );
     445                }
     446        )
    442447}
    443448
    444449static inline void check_message( message & this ) {
    445     switch ( this.allocation_ ) {                                               // analyze message status
    446         case Nodelete: CFA_DEBUG( this.allocation_ = Finished ); break;
     450    switch ( this.alloc ) {                                             // analyze message status
     451        case Nodelete: CFA_DEBUG( this.alloc = Finished ); break;
    447452        case Delete: delete( &this ); break;
    448453        case Destroy: ^?{}( this ); break;
     
    451456}
    452457static inline void set_allocation( message & this, allocation state ) {
    453     this.allocation_ = state;
     458    CFA_DEBUG( if ( state == Nodelete ) state = Finished; )
     459    this.alloc = state;
    454460}
    455461
     
    459465    message * base_msg;
    460466    allocation temp = this.fn( *this.receiver, *this.msg, &base_actor, &base_msg );
    461     base_actor->allocation_ = temp;
     467    memcpy( &base_actor->alloc, &temp, sizeof(allocation) ); // optimization to elide ctor
    462468    check_message( *base_msg );
    463469    check_actor( *base_actor );
     
    671677
    672678static inline void stop_actor_system() {
    673     park( ); // will be unparked when actor system is finished
     679    park( ); // unparked when actor system is finished
    674680
    675681    if ( !__actor_executor_passed ) delete( __actor_executor_ );
     
    682688// Default messages to send to any actor to change status
    683689// assigned at creation to __base_msg_finished to avoid unused message warning
    684 message __base_msg_finished @= { .allocation_ : Finished };
    685 struct __delete_msg_t { inline message; } delete_msg = __base_msg_finished;
    686 struct __destroy_msg_t { inline message; } destroy_msg = __base_msg_finished;
    687 struct __finished_msg_t { inline message; } finished_msg = __base_msg_finished;
    688 
    689 allocation receive( actor & this, __delete_msg_t & msg ) { return Delete; }
    690 allocation receive( actor & this, __destroy_msg_t & msg ) { return Destroy; }
    691 allocation receive( actor & this, __finished_msg_t & msg ) { return Finished; }
    692 
     690message __base_msg_finished @= { .alloc : Finished };
     691struct delete_message_t { inline message; } delete_msg = __base_msg_finished;
     692struct destroy_msg_t { inline message; } destroy_msg = __base_msg_finished;
     693struct finished_msg_t { inline message; } finished_msg = __base_msg_finished;
     694
     695allocation receive( actor & this, delete_message_t & msg ) { return Delete; }
     696allocation receive( actor & this, destroy_msg_t & msg ) { return Destroy; }
     697allocation receive( actor & this, finished_msg_t & msg ) { return Finished; }
     698
  • src/AST/Decl.cpp

    r65ef0cd rc4497e3  
    115115        static_assert( sizeof(kindNames) / sizeof(kindNames[0]) == TypeDecl::NUMBER_OF_KINDS, "typeString: kindNames is out of sync." );
    116116        assertf( kind < TypeDecl::NUMBER_OF_KINDS, "TypeDecl kind is out of bounds." );
    117         return sized ? kindNames[ kind ] : &kindNames[ kind ][ sizeof("sized") ]; // sizeof includes '\0'
     117        // sizeof("sized") includes '\0' and gives the offset to remove "sized ".
     118        return sized ? kindNames[ kind ] : &kindNames[ kind ][ sizeof("sized") ];
    118119}
    119120
  • src/Validate/LinkReferenceToTypes.cpp

    r65ef0cd rc4497e3  
    264264
    265265ast::TraitDecl const * LinkTypesCore::postvisit( ast::TraitDecl const * decl ) {
    266         auto mut = ast::mutate( decl );
    267         if ( mut->name == "sized" ) {
    268                 // "sized" is a special trait - flick the sized status on for the type variable.
    269                 assertf( mut->params.size() == 1, "Built-in trait 'sized' has incorrect number of parameters: %zd", decl->params.size() );
    270                 ast::TypeDecl * td = mut->params.front().get_and_mutate();
    271                 td->sized = true;
    272         }
    273 
    274266        // There is some overlap with code from decayForallPointers,
    275267        // perhaps reorganization or shared helper functions are called for.
    276268        // Move assertions from type parameters into the body of the trait.
     269        auto mut = ast::mutate( decl );
    277270        for ( ast::ptr<ast::TypeDecl> const & td : decl->params ) {
    278271                auto expanded = expandAssertions( td->assertions );
Note: See TracChangeset for help on using the changeset viewer.