Changeset 4c925cd for libcfa/src/concurrency
- Timestamp:
 - Aug 14, 2020, 11:40:04 AM (5 years ago)
 - Branches:
 - ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
 - Children:
 - 5715d43, fa5e0112
 - Parents:
 - 309d814 (diff), badd22f (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. - Location:
 - libcfa/src/concurrency
 - Files:
 - 
      
- 4 edited
 
- 
          
  invoke.h (modified) (3 diffs)
 - 
          
  kernel/startup.cfa (modified) (2 diffs)
 - 
          
  ready_queue.cfa (modified) (6 diffs)
 - 
          
  ready_subqueue.hfa (modified) (4 diffs)
 
 
Legend:
- Unmodified
 - Added
 - Removed
 
- 
      
libcfa/src/concurrency/invoke.h
r309d814 r4c925cd 26 26 #ifndef _INVOKE_H_ 27 27 #define _INVOKE_H_ 28 29 struct __cfaehm_try_resume_node; 30 struct __cfaehm_base_exception_t; 31 struct exception_context_t { 32 struct __cfaehm_try_resume_node * top_resume; 33 struct __cfaehm_base_exception_t * current_exception; 34 }; 28 35 29 36 struct __stack_context_t { … … 51 58 // base of stack 52 59 void * base; 60 61 // Information for exception handling. 62 struct exception_context_t exception_context; 53 63 }; 54 64 … … 84 94 }; 85 95 86 static inline struct __stack_t * __get_stack( struct $coroutine * cor ) { return (struct __stack_t*)(((uintptr_t)cor->stack.storage) & ((uintptr_t)-2)); } 96 static inline struct __stack_t * __get_stack( struct $coroutine * cor ) { 97 return (struct __stack_t*)(((uintptr_t)cor->stack.storage) & ((uintptr_t)-2)); 98 } 87 99 88 100 // struct which calls the monitor is accepting  - 
      
libcfa/src/concurrency/kernel/startup.cfa
r309d814 r4c925cd 516 516 ( this.terminated ){ 0 }; 517 517 ( this.runner ){}; 518 init( this, name, _cltr ); 518 519 disable_interrupts(); 520 init( this, name, _cltr ); 521 enable_interrupts( __cfaabi_dbg_ctx ); 519 522 520 523 __cfadbg_print_safe(runtime_core, "Kernel : Starting core %p\n", &this); … … 540 543 free( this.stack ); 541 544 542 deinit( this ); 545 disable_interrupts(); 546 deinit( this ); 547 enable_interrupts( __cfaabi_dbg_ctx ); 543 548 } 544 549  - 
      
libcfa/src/concurrency/ready_queue.cfa
r309d814 r4c925cd 150 150 // queues or removing them. 151 151 uint_fast32_t ready_mutate_lock( void ) with(*__scheduler_lock) { 152 /* paranoid */ verify( ! kernelTLS.preemption_state.enabled ); 153 152 154 // Step 1 : lock global lock 153 155 // It is needed to avoid processors that register mid Critical-Section … … 164 166 } 165 167 168 /* paranoid */ verify( ! kernelTLS.preemption_state.enabled ); 166 169 return s; 167 170 } 168 171 169 172 void ready_mutate_unlock( uint_fast32_t last_s ) with(*__scheduler_lock) { 173 /* paranoid */ verify( ! kernelTLS.preemption_state.enabled ); 174 170 175 // Step 1 : release local locks 171 176 // This must be done while the global lock is held to avoid … … 182 187 /*paranoid*/ assert(true == lock); 183 188 __atomic_store_n(&lock, (bool)false, __ATOMIC_RELEASE); 189 190 /* paranoid */ verify( ! kernelTLS.preemption_state.enabled ); 184 191 } 185 192 … … 419 426 // Actually pop the list 420 427 struct $thread * thrd; 421 bool emptied; 422 [thrd, emptied] = pop(lane); 428 thrd = pop(lane); 423 429 424 430 /* paranoid */ verify(thrd); … … 457 463 if(head(lane)->link.next == thrd) { 458 464 $thread * pthrd; 459 bool emptied; 460 [pthrd, emptied] = pop(lane); 465 pthrd = pop(lane); 461 466 462 467 /* paranoid */ verify( pthrd == thrd ); … … 608 613 while(!is_empty(lanes.data[idx])) { 609 614 struct $thread * thrd; 610 __attribute__((unused)) bool _; 611 [thrd, _] = pop(lanes.data[idx]); 615 thrd = pop(lanes.data[idx]); 612 616 613 617 push(cltr, thrd);  - 
      
libcfa/src/concurrency/ready_subqueue.hfa
r309d814 r4c925cd 144 144 // returns popped 145 145 // returns true of lane was empty before push, false otherwise 146 [$thread *, bool]pop(__intrusive_lane_t & this) {146 $thread * pop(__intrusive_lane_t & this) { 147 147 /* paranoid */ verify(this.lock); 148 148 /* paranoid */ verify(this.before.link.ts != 0ul); … … 162 162 head->link.next = next; 163 163 next->link.prev = head; 164 node->link.[next, prev] = 0p; 164 node->link.next = 0p; 165 node->link.prev = 0p; 165 166 166 167 // Update head time stamp … … 180 181 /* paranoid */ verify(tail(this)->link.prev == head(this)); 181 182 /* paranoid */ verify(head(this)->link.next == tail(this)); 182 return [node, true];183 return node; 183 184 } 184 185 else { … … 187 188 /* paranoid */ verify(head(this)->link.next != tail(this)); 188 189 /* paranoid */ verify(this.before.link.ts != 0); 189 return [node, false];190 return node; 190 191 } 191 192 }  
  Note:
 See   TracChangeset
 for help on using the changeset viewer.