Changeset c29c342


Ignore:
Timestamp:
Jul 23, 2018, 10:24:33 AM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer
Children:
2514607d, bd21af5
Parents:
2323bb3
Message:

Reduced visibility of internal functions in runtime

Location:
src/libcfa/concurrency
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/kernel.c

    r2323bb3 rc29c342  
    3737
    3838//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 ) ));
     39static void kernel_startup(void)  __attribute__(( constructor( STARTUP_PRIORITY_KERNEL ) ));
     40static void kernel_shutdown(void) __attribute__(( destructor ( STARTUP_PRIORITY_KERNEL ) ));
    4141
    4242//-----------------------------------------------------------------------------
     
    133133
    134134// Construct the processor context of non-main processors
    135 void ?{}(processorCtx_t & this, processor * proc, current_stack_info_t * info) {
     135static void ?{}(processorCtx_t & this, processor * proc, current_stack_info_t * info) {
    136136        (this.__cor){ info };
    137137        this.proc = proc;
    138138}
    139139
     140static void start(processor * this);
    140141void ?{}(processor & this, const char * name, cluster & cltr) with( this ) {
    141142        this.name = name;
     
    186187// Kernel Scheduling logic
    187188//=============================================================================================
     189static void runThread(processor * this, thread_desc * dst);
     190static void finishRunning(processor * this);
     191static void halt(processor * this);
     192
    188193//Main of the processor contexts
    189194void main(processorCtx_t & runner) {
     
    239244// runThread runs a thread by context switching
    240245// from the processor coroutine to the target thread
    241 void runThread(processor * this, thread_desc * dst) {
     246static void runThread(processor * this, thread_desc * dst) {
    242247        assert(dst->curr_cor);
    243248        coroutine_desc * proc_cor = get_coroutine(this->runner);
     
    256261
    257262// KERNEL_ONLY
    258 void returnToKernel() {
     263static void returnToKernel() {
    259264        coroutine_desc * proc_cor = get_coroutine(kernelTLS.this_processor->runner);
    260265        coroutine_desc * thrd_cor = kernelTLS.this_thread->curr_cor = kernelTLS.this_coroutine;
     
    265270// Once a thread has finished running, some of
    266271// its final actions must be executed from the kernel
    267 void finishRunning(processor * this) with( this->finish ) {
     272static void finishRunning(processor * this) with( this->finish ) {
    268273        verify( ! kernelTLS.preemption_state.enabled );
    269274        choose( action_code ) {
     
    299304// This is the entry point for processors (kernel threads)
    300305// It effectively constructs a coroutine by stealing the pthread stack
    301 void * CtxInvokeProcessor(void * arg) {
     306static void * CtxInvokeProcessor(void * arg) {
    302307        processor * proc = (processor *) arg;
    303308        kernelTLS.this_processor = proc;
     
    336341}
    337342
    338 void start(processor * this) {
     343static void start(processor * this) {
    339344        __cfaabi_dbg_print_safe("Kernel : Starting core %p\n", this);
    340345
     
    542547//-----------------------------------------------------------------------------
    543548// Kernel boot procedures
    544 void kernel_startup(void) {
     549static void kernel_startup(void) {
    545550        verify( ! kernelTLS.preemption_state.enabled );
    546551        __cfaabi_dbg_print_safe("Kernel : Starting\n");
     
    618623}
    619624
    620 void kernel_shutdown(void) {
     625static void kernel_shutdown(void) {
    621626        __cfaabi_dbg_print_safe("\n--------------------------------------------------\nKernel : Shutting down\n");
    622627
     
    655660// Kernel Quiescing
    656661//=============================================================================================
    657 
    658 void halt(processor * this) with( *this ) {
     662static void halt(processor * this) with( *this ) {
    659663        // verify( ! __atomic_load_n(&do_terminate, __ATOMIC_SEQ_CST) );
    660664
     
    683687// Unexpected Terminating logic
    684688//=============================================================================================
    685 
    686 
    687689static __spinlock_t kernel_abort_lock;
    688690static bool kernel_abort_called = false;
  • src/libcfa/concurrency/kernel_private.h

    r2323bb3 rc29c342  
    5454// Processor
    5555void 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);
    6056
    6157static inline void wake_fast(processor * this) {
  • src/libcfa/concurrency/preemption.c

    r2323bb3 rc29c342  
    3939
    4040// 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__ );
     41static void sigHandler_ctxSwitch( __CFA_SIGPARMS__ );
     42static void sigHandler_segv     ( __CFA_SIGPARMS__ );
     43static void sigHandler_ill      ( __CFA_SIGPARMS__ );
     44static void sigHandler_fpe      ( __CFA_SIGPARMS__ );
     45static void sigHandler_abort    ( __CFA_SIGPARMS__ );
    4646
    4747// FwdDeclarations : alarm thread main
    48 void * alarm_loop( __attribute__((unused)) void * args );
     48static void * alarm_loop( __attribute__((unused)) void * args );
    4949
    5050// Machine specific register name
     
    6363static pthread_t alarm_thread;                        // pthread handle to alarm thread
    6464
    65 void ?{}(event_kernel_t & this) with( this ) {
     65static void ?{}(event_kernel_t & this) with( this ) {
    6666        alarms{};
    6767        lock{};
     
    8585
    8686// Tick one frame of the Discrete Event Simulation for alarms
    87 void tick_preemption() {
     87static void tick_preemption() {
    8888        alarm_node_t * node = NULL;                     // Used in the while loop but cannot be declared in the while condition
    8989        alarm_list_t * alarms = &event_kernel->alarms;  // Local copy for ease of reading
     
    350350// Context switch signal handler
    351351// Receives SIGUSR1 signal and causes the current thread to yield
    352 void sigHandler_ctxSwitch( __CFA_SIGPARMS__ ) {
     352static void sigHandler_ctxSwitch( __CFA_SIGPARMS__ ) {
    353353        __cfaabi_dbg_debug_do( last_interrupt = (void *)(cxt->uc_mcontext.CFA_REG_IP); )
    354354
     
    393393// Main of the alarm thread
    394394// Waits on SIGALRM and send SIGUSR1 to whom ever needs it
    395 void * alarm_loop( __attribute__((unused)) void * args ) {
     395static void * alarm_loop( __attribute__((unused)) void * args ) {
    396396        // Block sigalrms to control when they arrive
    397397        sigset_t mask;
  • src/libcfa/concurrency/preemption.h

    r2323bb3 rc29c342  
    2222void kernel_stop_preemption();
    2323void update_preemption( processor * this, Duration duration );
    24 void tick_preemption();
    2524
    2625struct preemption_scope {
Note: See TracChangeset for help on using the changeset viewer.