Changeset 9d6e1b8a
- Timestamp:
- Nov 17, 2020, 4:29:51 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 3ea8ad1
- Parents:
- 1e208ea
- Location:
- libcfa/src/concurrency
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel.cfa
r1e208ea r9d6e1b8a 251 251 /* paranoid */ verify( ! __preemption_enabled() ); 252 252 /* paranoid */ verify( kernelTLS().this_thread == thrd_dst ); 253 /* paranoid */ verify( thrd_dst->curr_cluster == this->cltr ); 253 254 /* paranoid */ verify( thrd_dst->context.SP ); 254 255 /* paranoid */ verify( thrd_dst->state != Halted ); … … 267 268 /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) < ((uintptr_t)__get_stack(thrd_dst->curr_cor)->base ), "ERROR : Destination $thread %p has been corrupted.\n StackPointer too small.\n", thrd_dst ); 268 269 /* paranoid */ verify( thrd_dst->context.SP ); 270 /* paranoid */ verify( thrd_dst->curr_cluster == this->cltr ); 269 271 /* paranoid */ verify( kernelTLS().this_thread == thrd_dst ); 270 272 /* paranoid */ verify( ! __preemption_enabled() ); … … 360 362 void __schedule_thread( $thread * thrd ) { 361 363 /* paranoid */ verify( ! __preemption_enabled() ); 364 /* paranoid */ verify( kernelTLS().this_proc_id ); 362 365 /* paranoid */ verify( thrd ); 363 366 /* paranoid */ verify( thrd->state != Halted ); 364 /* paranoid */ verify( kernelTLS().this_proc_id);367 /* paranoid */ verify( thrd->curr_cluster ); 365 368 /* paranoid */ #if defined( __CFA_WITH_VERIFY__ ) 366 369 /* paranoid */ if( thrd->state == Blocked || thrd->state == Start ) assertf( thrd->preempted == __NO_PREEMPTION, … … 473 476 disable_interrupts(); 474 477 478 /* paranoid */ verify( ! __preemption_enabled() ); 479 /* paranoid */ verify( thrd->state == Active ); 480 /* paranoid */ verify( 0x0D15EA5E0D15EA5Ep == thrd->canary ); 481 /* paranoid */ verify( kernelTLS().this_thread == thrd ); 482 /* paranoid */ verify( thrd->context.SP ); 483 /* paranoid */ verifyf( ((uintptr_t)thrd->context.SP) > ((uintptr_t)__get_stack(thrd->curr_cor)->limit), "ERROR : $thread %p has been corrupted.\n StackPointer too large.\n", thrd ); 484 /* paranoid */ verifyf( ((uintptr_t)thrd->context.SP) < ((uintptr_t)__get_stack(thrd->curr_cor)->base ), "ERROR : $thread %p has been corrupted.\n StackPointer too small.\n", thrd ); 485 475 486 thrd->state = Halted; 476 487 if( TICKET_RUNNING != thrd->ticket ) { abort( "Thread terminated with pending unpark" ); } 477 if( thrd != this->owner || this->recursion != 1) { abort( "Thread internal monitor has unbalanced recursion" ); } 488 if( thrd != this->owner ) { abort( "Thread internal monitor has incorrect owner" ); } 489 if( this->recursion != 1) { abort( "Thread internal monitor has unbalanced recursion" ); } 478 490 479 491 // Leave the thread 480 /* paranoid */ verify( ! __preemption_enabled() );481 492 returnToKernel(); 493 494 // Control flow should never reach here! 482 495 abort(); 483 484 // Control flow should never reach here!485 496 } 486 497 } -
libcfa/src/concurrency/monitor.cfa
r1e208ea r9d6e1b8a 166 166 } 167 167 // SKULLDUGGERY: join will act as a dtor so it would normally trigger to above check 168 // because join will not release the monitor after it executed. 168 169 // to avoid that it sets the owner to the special value thrd | 1p before exiting 169 170 else if( this->owner == ($thread*)(1 | (uintptr_t)thrd) ) { … … 172 173 173 174 // No one has the monitor, just take it 174 this->owner = thrd;175 __set_owner( this, thrd ); 175 176 176 177 verifyf( active_thread() == this->owner, "Expected owner to be %p, got %p (r: %i, m: %p)", active_thread(), this->owner, this->recursion, this ); … … 285 286 286 287 // Lock the monitor now 288 /* paranoid */ verify( 0x0D15EA5E0D15EA5Ep == thrd->canary ); 287 289 /* paranoid */ verify( this->lock.lock ); 290 /* paranoid */ verify( thrd->context.SP ); 291 /* paranoid */ verifyf( ((uintptr_t)thrd->context.SP) > ((uintptr_t)__get_stack(thrd->curr_cor)->limit), "ERROR : $thread %p has been corrupted.\n StackPointer too large.\n", thrd ); 292 /* paranoid */ verifyf( ((uintptr_t)thrd->context.SP) < ((uintptr_t)__get_stack(thrd->curr_cor)->base ), "ERROR : $thread %p has been corrupted.\n StackPointer too small.\n", thrd ); 293 /* paranoid */ verify( ! __preemption_enabled() ); 294 288 295 /* paranoid */ verifyf( thrd == this->owner, "Expected owner to be %p, got %p (r: %i, m: %p)", thrd, this->owner, this->recursion, this ); 289 /* paranoid */ verify( ! __preemption_enabled() );290 296 /* paranoid */ verify( thrd->state == Halted ); 291 297 /* paranoid */ verify( this->recursion == 1 );
Note: See TracChangeset
for help on using the changeset viewer.