Changeset c4497e3
- Timestamp:
- Jun 26, 2023, 10:11:03 PM (22 months ago)
- Branches:
- master
- Children:
- b9c06b98
- Parents:
- 65ef0cd (diff), 917e1fd (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. - Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified doc/theses/colby_parsons_MMAth/benchmarks/channels/plotData.py ¶
r65ef0cd rc4497e3 62 62 procCount = 0 63 63 currVariant = 0 64 experiment_duration = 10 64 65 name = "" 65 66 var_name = "" … … 107 108 108 109 lineArr = line.split() 109 tempData[count] = float(lineArr[-1]) 110 tempData[count] = float(lineArr[-1]) / experiment_duration 110 111 count += 1 111 112 if count == numTimes: -
TabularUnified doc/theses/colby_parsons_MMAth/benchmarks/mutex_stmt/plotData.py ¶
r65ef0cd rc4497e3 60 60 name = "Aggregate Lock" 61 61 var_name = "" 62 experiment_duration = 10 62 63 sendData = [0.0 for j in range(numVariants)] 63 64 data = [[0.0 for i in range(len(procs))] for j in range(numVariants)] … … 80 81 81 82 lineArr = line.split() 82 tempData[count] = float(lineArr[-1]) 83 tempData[count] = float(lineArr[-1]) / experiment_duration 83 84 count += 1 84 85 if count == numTimes: -
TabularUnified doc/theses/colby_parsons_MMAth/benchmarks/waituntil/cfa/future.cfa ¶
r65ef0cd rc4497e3 7 7 #include <string.h> 8 8 9 size_t Clients = 1, Time = 10; 9 // #define ANDOR 10 11 size_t Processors = 2, Time = 10; 10 12 11 13 size_t globalTotal = 0; 12 14 future(size_t) A, B, C; 13 volatile bool server_done_loop = false; 14 volatile bool client_done_loop = false; 15 volatile bool done_loop = false; 15 16 volatile bool client_done = false; 16 17 volatile bool server_done = false; 17 18 18 volatile size_t client_count = 0; 19 volatile size_t client_loop_count = 0; 19 static 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 49 static 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 20 129 thread Client {}; 21 130 void main( Client & this ) { 22 131 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; 45 138 } 46 139 __atomic_fetch_add( &globalTotal, i, __ATOMIC_SEQ_CST ); … … 50 143 void main( Server & this ) { 51 144 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; 66 148 } 67 149 } … … 69 151 int main( int argc, char * argv[] ) { 70 152 switch ( argc ) { 71 case 3:72 if ( strcmp( argv[2], "d" ) != 0 ) { // default ?73 Time = atoi( argv[2] );74 } // if75 153 case 2: 76 154 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; 79 157 } // if 80 158 case 1: // use defaults … … 83 161 Usage: 84 162 sout | "Usage: " | argv[0] 85 | " [ clients (> 0) | 'd' (default " | Clients 86 | ") ] [ time (>= 0) | 'd' (default " | Time 163 | "[ time (>= 0) | 'd' (default " | Time 87 164 | ") ]" ; 88 165 exit( EXIT_FAILURE ); 89 166 } // switch 90 processor p[ Clients];167 processor p[Processors - 1]; 91 168 92 169 { 93 Client c[Clients];170 Server s; 94 171 { 95 Server s;172 Client c; 96 173 97 174 sleep(Time`s); 98 server_done = true; 175 176 client_done = true; 99 177 } 100 while( available(A) || available(B) || available(C) ) {} 101 client_done = true; 102 fulfil( C, 0 ); 178 server_done = true; 179 done_loop = true; 103 180 } 104 181 printf("%zu\n", globalTotal); -
TabularUnified doc/theses/colby_parsons_MMAth/benchmarks/waituntil/cfa/sidechan.cfa ¶
r65ef0cd rc4497e3 37 37 thread Consumer {}; 38 38 void 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; 40 40 size_t val, i = 0; 41 41 try { … … 49 49 thread Producer {}; 50 50 void 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; 52 52 try { 53 53 for( size_t i = 0;; i++ ) { -
TabularUnified doc/theses/colby_parsons_MMAth/benchmarks/waituntil/run ¶
r65ef0cd rc4497e3 85 85 } 86 86 87 # numtimes=5 88 numtimes=187 numtimes=3 88 # numtimes=1 89 89 90 90 # num_threads='2 4 8 16 24 32' 91 #side_chan_threads='6 12 18 24 30' # must be mults of 691 side_chan_threads='6 12 18 24 30' # must be mults of 6 92 92 num_threads='2' 93 side_chan_threads='6'93 # side_chan_threads='6' 94 94 95 95 chan_size='10' 96 96 future_time='10' 97 future_flags=('-DOR' '-DAND3' '-DANDOR' '-DORAND') 98 future_names=('OR' 'AND' 'ANDOR' 'ORAND') 97 99 98 100 # toggle benchmarks … … 103 105 spin=${false} 104 106 contend=${false} 105 sidechan=${false}106 #future=${false}107 # sidechan=${false} 108 future=${false} 107 109 108 110 runCFA=${true} … … 164 166 165 167 run_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} 172 171 } 173 172 … … 247 246 ${cfa} ${cfa_flags} sidechan.cfa -o a.${hostname} > /dev/null 2>&1 248 247 run_side_chan 249 rm a.${hostname}248 # rm a.${hostname} 250 249 cd - > /dev/null 251 250 fi # done CFA … … 262 261 263 262 if [ ${future} -eq ${true} ] ; then 264 echo "future: "265 263 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 284 fi 285 -
TabularUnified doc/theses/colby_parsons_MMAth/benchmarks/waituntil/ucpp/future.cc ¶
r65ef0cd rc4497e3 3 3 #include <uFuture.h> 4 4 5 size_t Clients = 2, Time = 10; 5 // #define ANDOR 6 6 7 size_t Processors = 2, Time = 10; 7 8 size_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; 9 volatile bool done_loop = false; 11 10 volatile bool client_done = false; 12 11 volatile bool server_done = false; 13 12 14 volatile size_t client_count = 0; 15 volatile size_t client_loop_count = 0; 13 Future_ISM<size_t> A, B, C; 14 15 static 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 45 static 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 16 125 _Task Client { 17 126 void main() { 18 127 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; 41 134 } 42 135 __atomic_fetch_add( &globalTotal, i, __ATOMIC_SEQ_CST ); … … 47 140 void main() { 48 141 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; 63 145 } 64 146 } … … 67 149 int main( int argc, char * argv[] ) { 68 150 switch ( argc ) { 69 case 3:70 if ( strcmp( argv[2], "d" ) != 0 ) { // default ?71 Time = atoi( argv[2] );72 } // if73 151 case 2: 74 152 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; 77 155 } // if 78 156 case 1: // use defaults … … 81 159 Usage: 82 160 cerr << "Usage: " << argv[0] 83 << " [ clients (> 0) | 'd' (default " << Clients 84 << ") ] [ time (>= 0) | 'd' (default " << Time 161 << "[ time (>= 0) | 'd' (default " << Time 85 162 << ") ]" ; 86 163 exit( EXIT_FAILURE ); 87 164 } // switch 88 uProcessor p[ Clients];165 uProcessor p[Processors - 1]; 89 166 90 167 { 91 Client c[Clients];168 Server s; 92 169 { 93 Server s;170 Client c; 94 171 95 172 uBaseTask::sleep( uDuration( Time ) ); 96 173 97 server_done = true;174 client_done = true; 98 175 } 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; 102 178 } 103 179 cout << globalTotal << endl; -
TabularUnified libcfa/prelude/prelude-gen.cc ¶
r65ef0cd rc4497e3 159 159 int main() { 160 160 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; 162 162 163 163 cout << "//////////////////////////" << endl; -
TabularUnified libcfa/src/concurrency/actor.hfa ¶
r65ef0cd rc4497e3 390 390 struct actor { 391 391 size_t ticket; // executor-queue handle 392 allocation alloc ation_; // allocation action392 allocation alloc; // allocation action 393 393 inline virtual_dtor; 394 394 }; … … 398 398 // member must be called to end it 399 399 DEBUG_ABORT( __actor_executor_ == 0p, "Creating actor before calling start_actor_system() can cause undefined behaviour.\n" ); 400 alloc ation_= Nodelete;400 alloc = Nodelete; 401 401 ticket = __get_next_ticket( *__actor_executor_ ); 402 402 __atomic_fetch_add( &__num_actors_, 1, __ATOMIC_RELAXED ); … … 407 407 408 408 static inline void check_actor( actor & this ) { 409 if ( this.alloc ation_!= Nodelete ) {410 switch( this.alloc ation_) {409 if ( this.alloc != Nodelete ) { 410 switch( this.alloc ) { 411 411 case Delete: delete( &this ); break; 412 412 case Destroy: … … 427 427 428 428 struct message { 429 allocation alloc ation_; // allocation action429 allocation alloc; // allocation action 430 430 inline virtual_dtor; 431 431 }; 432 432 433 433 static inline void ?{}( message & this ) { 434 this.alloc ation_= Nodelete;434 this.alloc = Nodelete; 435 435 } 436 436 static inline void ?{}( message & this, allocation alloc ) { 437 memcpy( &this.alloc ation_, &alloc, sizeof(allocation) ); // optimization to elide ctor438 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; ) 439 439 } 440 440 static 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 ) 442 447 } 443 448 444 449 static inline void check_message( message & this ) { 445 switch ( this.alloc ation_) { // analyze message status446 case Nodelete: CFA_DEBUG( this.alloc ation_= Finished ); break;450 switch ( this.alloc ) { // analyze message status 451 case Nodelete: CFA_DEBUG( this.alloc = Finished ); break; 447 452 case Delete: delete( &this ); break; 448 453 case Destroy: ^?{}( this ); break; … … 451 456 } 452 457 static inline void set_allocation( message & this, allocation state ) { 453 this.allocation_ = state; 458 CFA_DEBUG( if ( state == Nodelete ) state = Finished; ) 459 this.alloc = state; 454 460 } 455 461 … … 459 465 message * base_msg; 460 466 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 462 468 check_message( *base_msg ); 463 469 check_actor( *base_actor ); … … 671 677 672 678 static inline void stop_actor_system() { 673 park( ); // will beunparked when actor system is finished679 park( ); // unparked when actor system is finished 674 680 675 681 if ( !__actor_executor_passed ) delete( __actor_executor_ ); … … 682 688 // Default messages to send to any actor to change status 683 689 // assigned at creation to __base_msg_finished to avoid unused message warning 684 message __base_msg_finished @= { .alloc ation_: 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 690 message __base_msg_finished @= { .alloc : Finished }; 691 struct delete_message_t { inline message; } delete_msg = __base_msg_finished; 692 struct destroy_msg_t { inline message; } destroy_msg = __base_msg_finished; 693 struct finished_msg_t { inline message; } finished_msg = __base_msg_finished; 694 695 allocation receive( actor & this, delete_message_t & msg ) { return Delete; } 696 allocation receive( actor & this, destroy_msg_t & msg ) { return Destroy; } 697 allocation receive( actor & this, finished_msg_t & msg ) { return Finished; } 698 -
TabularUnified src/AST/Decl.cpp ¶
r65ef0cd rc4497e3 115 115 static_assert( sizeof(kindNames) / sizeof(kindNames[0]) == TypeDecl::NUMBER_OF_KINDS, "typeString: kindNames is out of sync." ); 116 116 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") ]; 118 119 } 119 120 -
TabularUnified src/Validate/LinkReferenceToTypes.cpp ¶
r65ef0cd rc4497e3 264 264 265 265 ast::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 274 266 // There is some overlap with code from decayForallPointers, 275 267 // perhaps reorganization or shared helper functions are called for. 276 268 // Move assertions from type parameters into the body of the trait. 269 auto mut = ast::mutate( decl ); 277 270 for ( ast::ptr<ast::TypeDecl> const & td : decl->params ) { 278 271 auto expanded = expandAssertions( td->assertions );
Note: See TracChangeset
for help on using the changeset viewer.