Changeset bd21af5
- Timestamp:
- Jul 23, 2018, 11:08:45 AM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- c4f68dc
- Parents:
- 460bd3a (diff), c29c342 (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:
- src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/kernel.c
r460bd3a rbd21af5 37 37 38 38 //Start and stop routine for the kernel, declared first to make sure they run first 39 void kernel_startup(void) __attribute__(( constructor( STARTUP_PRIORITY_KERNEL ) ));40 void kernel_shutdown(void) __attribute__(( destructor ( STARTUP_PRIORITY_KERNEL ) ));39 static void kernel_startup(void) __attribute__(( constructor( STARTUP_PRIORITY_KERNEL ) )); 40 static void kernel_shutdown(void) __attribute__(( destructor ( STARTUP_PRIORITY_KERNEL ) )); 41 41 42 42 //----------------------------------------------------------------------------- … … 133 133 134 134 // Construct the processor context of non-main processors 135 void ?{}(processorCtx_t & this, processor * proc, current_stack_info_t * info) {135 static void ?{}(processorCtx_t & this, processor * proc, current_stack_info_t * info) { 136 136 (this.__cor){ info }; 137 137 this.proc = proc; 138 138 } 139 139 140 static void start(processor * this); 140 141 void ?{}(processor & this, const char * name, cluster & cltr) with( this ) { 141 142 this.name = name; … … 186 187 // Kernel Scheduling logic 187 188 //============================================================================================= 189 static void runThread(processor * this, thread_desc * dst); 190 static void finishRunning(processor * this); 191 static void halt(processor * this); 192 188 193 //Main of the processor contexts 189 194 void main(processorCtx_t & runner) { … … 239 244 // runThread runs a thread by context switching 240 245 // from the processor coroutine to the target thread 241 void runThread(processor * this, thread_desc * dst) {246 static void runThread(processor * this, thread_desc * dst) { 242 247 assert(dst->curr_cor); 243 248 coroutine_desc * proc_cor = get_coroutine(this->runner); … … 256 261 257 262 // KERNEL_ONLY 258 void returnToKernel() {263 static void returnToKernel() { 259 264 coroutine_desc * proc_cor = get_coroutine(kernelTLS.this_processor->runner); 260 265 coroutine_desc * thrd_cor = kernelTLS.this_thread->curr_cor = kernelTLS.this_coroutine; … … 265 270 // Once a thread has finished running, some of 266 271 // its final actions must be executed from the kernel 267 void finishRunning(processor * this) with( this->finish ) {272 static void finishRunning(processor * this) with( this->finish ) { 268 273 verify( ! kernelTLS.preemption_state.enabled ); 269 274 choose( action_code ) { … … 299 304 // This is the entry point for processors (kernel threads) 300 305 // It effectively constructs a coroutine by stealing the pthread stack 301 void * CtxInvokeProcessor(void * arg) {306 static void * CtxInvokeProcessor(void * arg) { 302 307 processor * proc = (processor *) arg; 303 308 kernelTLS.this_processor = proc; … … 336 341 } 337 342 338 void start(processor * this) {343 static void start(processor * this) { 339 344 __cfaabi_dbg_print_safe("Kernel : Starting core %p\n", this); 340 345 … … 542 547 //----------------------------------------------------------------------------- 543 548 // Kernel boot procedures 544 void kernel_startup(void) {549 static void kernel_startup(void) { 545 550 verify( ! kernelTLS.preemption_state.enabled ); 546 551 __cfaabi_dbg_print_safe("Kernel : Starting\n"); … … 618 623 } 619 624 620 void kernel_shutdown(void) {625 static void kernel_shutdown(void) { 621 626 __cfaabi_dbg_print_safe("\n--------------------------------------------------\nKernel : Shutting down\n"); 622 627 … … 655 660 // Kernel Quiescing 656 661 //============================================================================================= 657 658 void halt(processor * this) with( *this ) { 662 static void halt(processor * this) with( *this ) { 659 663 // verify( ! __atomic_load_n(&do_terminate, __ATOMIC_SEQ_CST) ); 660 664 … … 683 687 // Unexpected Terminating logic 684 688 //============================================================================================= 685 686 687 689 static __spinlock_t kernel_abort_lock; 688 690 static bool kernel_abort_called = false; -
src/libcfa/concurrency/kernel_private.h
r460bd3a rbd21af5 54 54 // Processor 55 55 void main(processorCtx_t *); 56 void start(processor * this);57 void runThread(processor * this, thread_desc * dst);58 void finishRunning(processor * this);59 void halt(processor * this);60 56 61 57 static inline void wake_fast(processor * this) { -
src/libcfa/concurrency/preemption.c
r460bd3a rbd21af5 39 39 40 40 // FwdDeclarations : Signal handlers 41 void sigHandler_ctxSwitch( __CFA_SIGPARMS__ );42 void sigHandler_segv ( __CFA_SIGPARMS__ );43 void sigHandler_ill ( __CFA_SIGPARMS__ );44 void sigHandler_fpe ( __CFA_SIGPARMS__ );45 void sigHandler_abort ( __CFA_SIGPARMS__ );41 static void sigHandler_ctxSwitch( __CFA_SIGPARMS__ ); 42 static void sigHandler_segv ( __CFA_SIGPARMS__ ); 43 static void sigHandler_ill ( __CFA_SIGPARMS__ ); 44 static void sigHandler_fpe ( __CFA_SIGPARMS__ ); 45 static void sigHandler_abort ( __CFA_SIGPARMS__ ); 46 46 47 47 // FwdDeclarations : alarm thread main 48 void * alarm_loop( __attribute__((unused)) void * args );48 static void * alarm_loop( __attribute__((unused)) void * args ); 49 49 50 50 // Machine specific register name … … 63 63 static pthread_t alarm_thread; // pthread handle to alarm thread 64 64 65 void ?{}(event_kernel_t & this) with( this ) {65 static void ?{}(event_kernel_t & this) with( this ) { 66 66 alarms{}; 67 67 lock{}; … … 85 85 86 86 // Tick one frame of the Discrete Event Simulation for alarms 87 void tick_preemption() {87 static void tick_preemption() { 88 88 alarm_node_t * node = NULL; // Used in the while loop but cannot be declared in the while condition 89 89 alarm_list_t * alarms = &event_kernel->alarms; // Local copy for ease of reading … … 350 350 // Context switch signal handler 351 351 // Receives SIGUSR1 signal and causes the current thread to yield 352 void sigHandler_ctxSwitch( __CFA_SIGPARMS__ ) {352 static void sigHandler_ctxSwitch( __CFA_SIGPARMS__ ) { 353 353 __cfaabi_dbg_debug_do( last_interrupt = (void *)(cxt->uc_mcontext.CFA_REG_IP); ) 354 354 … … 393 393 // Main of the alarm thread 394 394 // Waits on SIGALRM and send SIGUSR1 to whom ever needs it 395 void * alarm_loop( __attribute__((unused)) void * args ) {395 static void * alarm_loop( __attribute__((unused)) void * args ) { 396 396 // Block sigalrms to control when they arrive 397 397 sigset_t mask; -
src/libcfa/concurrency/preemption.h
r460bd3a rbd21af5 22 22 void kernel_stop_preemption(); 23 23 void update_preemption( processor * this, Duration duration ); 24 void tick_preemption();25 24 26 25 struct preemption_scope { -
src/tests/.expect/attributes.x86.txt
r460bd3a rbd21af5 367 367 signed int __apd7__Fi_Fi_i_Fi_i___1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object23)(__attribute__ ((unused)) signed int __anonymous_object24), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object25)(__attribute__ ((unused)) signed int __anonymous_object26)); 368 368 struct Vad { 369 __attribute__ ((unused)) signed int __anonymous_object27 ;369 __attribute__ ((unused)) signed int __anonymous_object27:4; 370 370 __attribute__ ((unused)) signed int __anonymous_object28:4; 371 __attribute__ ((unused)) signed int __anonymous_object29:4; 372 __attribute__ ((unused,unused)) signed int __anonymous_object30:6; 371 __attribute__ ((unused,unused)) signed int __anonymous_object29:6; 373 372 }; 374 373 static inline void ___constructor__F_4sVad_autogen___1(struct Vad *___dst__4sVad_1); … … 376 375 static inline void ___destructor__F_4sVad_autogen___1(struct Vad *___dst__4sVad_1); 377 376 static inline struct Vad ___operator_assign__F4sVad_4sVad4sVad_autogen___1(struct Vad *___dst__4sVad_1, struct Vad ___src__4sVad_1); 378 static inline void ___constructor__F_4sVadi_autogen___1(struct Vad *___dst__4sVad_1, __attribute__ ((unused)) signed int __anonymous_object31);379 377 static inline void ___constructor__F_4sVad_autogen___1(struct Vad *___dst__4sVad_1){ 380 ((void)((*___dst__4sVad_1).__anonymous_object27) /* ?{} */);381 378 } 382 379 static inline void ___constructor__F_4sVad4sVad_autogen___1(struct Vad *___dst__4sVad_1, struct Vad ___src__4sVad_1){ 383 ((void)((*___dst__4sVad_1).__anonymous_object27=___src__4sVad_1.__anonymous_object27) /* ?{} */);384 380 } 385 381 static inline void ___destructor__F_4sVad_autogen___1(struct Vad *___dst__4sVad_1){ 386 ((void)((*___dst__4sVad_1).__anonymous_object27) /* ^?{} */);387 382 } 388 383 static inline struct Vad ___operator_assign__F4sVad_4sVad4sVad_autogen___1(struct Vad *___dst__4sVad_1, struct Vad ___src__4sVad_1){ 389 384 struct Vad ___ret__4sVad_1; 390 ((void)((*___dst__4sVad_1).__anonymous_object27=___src__4sVad_1.__anonymous_object27));391 385 ((void)___constructor__F_4sVad4sVad_autogen___1((&___ret__4sVad_1), (*___dst__4sVad_1))); 392 386 return ___ret__4sVad_1; 393 387 } 394 static inline void ___constructor__F_4sVadi_autogen___1(struct Vad *___dst__4sVad_1, __attribute__ ((unused)) signed int __anonymous_object32){395 ((void)((*___dst__4sVad_1).__anonymous_object27=__anonymous_object32) /* ?{} */);396 }
Note: See TracChangeset
for help on using the changeset viewer.