Changeset 520145b


Ignore:
Timestamp:
Mar 6, 2018, 3:43:55 PM (6 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
79d4186
Parents:
d893266a (diff), caa649b (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.
Message:

Merge branch 'master' of plg2:software/cfa/cfa-cc

Location:
src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • src/Common/SemanticError.h

    rd893266a r520145b  
    7272}
    7373
    74 
    75 
    76 
    7774// Local Variables: //
    7875// tab-width: 4 //
  • src/libcfa/concurrency/kernel

    rd893266a r520145b  
    7979
    8080// Processor
     81coroutine processorCtx_t {
     82        struct processor * proc;
     83};
     84
    8185// Wrapper around kernel threads
    8286struct processor {
    8387        // Main state
    8488        // Coroutine ctx who does keeps the state of the processor
    85         struct processorCtx_t * runner;
     89        struct processorCtx_t runner;
    8690
    8791        // Cluster from which to get threads
  • src/libcfa/concurrency/kernel.c

    rd893266a r520145b  
    124124//-----------------------------------------------------------------------------
    125125// Processor coroutine
     126void ?{}(processorCtx_t & this) {}
    126127
    127128// Construct the processor context of the main processor
     
    130131        this.__cor.starter = NULL;
    131132        this.proc = proc;
    132         proc->runner = &this;
    133133}
    134134
     
    137137        (this.__cor){ info };
    138138        this.proc = proc;
    139         proc->runner = &this;
    140139}
    141140
     
    150149        preemption_alarm = NULL;
    151150        pending_preemption = false;
     151        runner.proc = &this;
    152152
    153153        start( &this );
     
    161161        pending_preemption = false;
    162162        kernel_thread = pthread_self();
    163 
    164         this.runner = &runner;
     163        runner.proc = &this;
     164
    165165        __cfaabi_dbg_print_safe("Kernel : constructing main processor context %p\n", &runner);
    166166        runner{ &this };
     
    196196void main(processorCtx_t & runner) {
    197197        processor * this = runner.proc;
     198        verify(this);
    198199
    199200        __cfaabi_dbg_print_safe("Kernel : core %p starting\n", this);
     
    241242void runThread(processor * this, thread_desc * dst) {
    242243        assert(dst->curr_cor);
    243         coroutine_desc * proc_cor = get_coroutine(*this->runner);
     244        coroutine_desc * proc_cor = get_coroutine(this->runner);
    244245        coroutine_desc * thrd_cor = dst->curr_cor;
    245246
     
    256257
    257258void returnToKernel() {
    258         coroutine_desc * proc_cor = get_coroutine(*this_processor->runner);
     259        coroutine_desc * proc_cor = get_coroutine(this_processor->runner);
    259260        coroutine_desc * thrd_cor = this_thread->curr_cor = this_coroutine;
    260261        ThreadCtxSwitch(thrd_cor, proc_cor);
     
    317318        machine_context_t ctx;
    318319        info.context = &ctx;
    319         processorCtx_t proc_cor_storage = { proc, &info };
    320 
    321         __cfaabi_dbg_print_safe("Coroutine : created stack %p\n", proc_cor_storage.__cor.stack.base);
     320        (proc->runner){ proc, &info };
     321
     322        __cfaabi_dbg_print_safe("Coroutine : created stack %p\n", get_coroutine(proc->runner)->stack.base);
    322323
    323324        //Set global state
    324         this_coroutine = &proc->runner->__cor;
     325        this_coroutine = get_coroutine(proc->runner);
    325326        this_thread = NULL;
    326327
    327328        //We now have a proper context from which to schedule threads
    328         __cfaabi_dbg_print_safe("Kernel : core %p created (%p, %p)\n", proc, proc->runner, &ctx);
     329        __cfaabi_dbg_print_safe("Kernel : core %p created (%p, %p)\n", proc, &proc->runner, &ctx);
    329330
    330331        // SKULLDUGGERY: Since the coroutine doesn't have its own stack, we can't
     
    332333        // back to here. Instead directly call the main since we already are on the
    333334        // appropriate stack.
    334         proc_cor_storage.__cor.state = Active;
    335         main( proc_cor_storage );
    336         proc_cor_storage.__cor.state = Halted;
     335        get_coroutine(proc->runner)->state = Active;
     336        main( proc->runner );
     337        get_coroutine(proc->runner)->state = Halted;
    337338
    338339        // Main routine of the core returned, the core is now fully terminated
    339         __cfaabi_dbg_print_safe("Kernel : core %p main ended (%p)\n", proc, proc->runner);
     340        __cfaabi_dbg_print_safe("Kernel : core %p main ended (%p)\n", proc, &proc->runner);
    340341
    341342        return NULL;
     
    352353void kernel_first_resume(processor * this) {
    353354        coroutine_desc * src = this_coroutine;
    354         coroutine_desc * dst = get_coroutine(*this->runner);
     355        coroutine_desc * dst = get_coroutine(this->runner);
    355356
    356357        verify( !preemption_state.enabled );
    357358
    358359        create_stack(&dst->stack, dst->stack.size);
    359         CtxStart(this->runner, CtxInvokeCoroutine);
     360        CtxStart(&this->runner, CtxInvokeCoroutine);
    360361
    361362        verify( !preemption_state.enabled );
     
    411412        verify( !preemption_state.enabled );
    412413        lock( ready_queue_lock __cfaabi_dbg_ctx2 );
    413         //TEMP hack to find a bug
    414         if(this_processor != mainProcessor) {
    415                 if(ready_queue.head == mainThread) {
    416                         unlock( ready_queue_lock );
    417                         return NULL;
    418                 }
    419         }
    420 
    421414        thread_desc * head = pop_head( ready_queue );
    422415        unlock( ready_queue_lock );
     
    584577        // Destroy the main processor and its context in reverse order of construction
    585578        // These were manually constructed so we need manually destroy them
    586         ^(*mainProcessor->runner){};
     579        ^(mainProcessor->runner){};
    587580        ^(mainProcessor){};
    588581
  • src/libcfa/concurrency/kernel_private.h

    rd893266a r520145b  
    5252//-----------------------------------------------------------------------------
    5353// Processor
    54 coroutine processorCtx_t {
    55         processor * proc;
    56 };
    57 
    5854void main(processorCtx_t *);
    5955void start(processor * this);
  • src/tests/Makefile.am

    rd893266a r520145b  
    123123        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
    124124
     125# Warnings
    125126warnings/self-assignment: warnings/self-assignment.c @CFA_BINDIR@/@CFA_NAME@
    126         ${CC} ${AM_CFLAGS} ${CFLAGS} ${<} -o ${@}
    127         echo > ${@}
     127        ${CC} ${AM_CFLAGS} ${CFLAGS} ${<} 2> ${@} -fsyntax-only
  • src/tests/Makefile.in

    rd893266a r520145b  
    800800        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
    801801
     802# Warnings
    802803warnings/self-assignment: warnings/self-assignment.c @CFA_BINDIR@/@CFA_NAME@
    803         ${CC} ${AM_CFLAGS} ${CFLAGS} ${<} -o ${@}
    804         echo > ${@}
     804        ${CC} ${AM_CFLAGS} ${CFLAGS} ${<} 2> ${@} -fsyntax-only
    805805
    806806# Tell versions [3.59,3.63) of GNU make to not export all variables.
  • src/tests/warnings/.expect/self-assignment.txt

    rd893266a r520145b  
     1warnings/self-assignment.c:29:1 warning: self assignment of expression: Cast of:
     2  Variable Expression: j: signed int
     3... to:
     4  reference to signed int
     5warnings/self-assignment.c:30:1 warning: self assignment of expression: Cast of:
     6  Variable Expression: s: instance of struct S with body 1
     7... to:
     8  reference to instance of struct S with body 1
     9warnings/self-assignment.c:31:1 warning: self assignment of expression: Cast of:
     10  Member Expression, with field:
     11    i: signed int
     12  ... from aggregate:
     13    Variable Expression: s: instance of struct S with body 1
     14... to:
     15  reference to signed int
     16warnings/self-assignment.c:32:1 warning: self assignment of expression: Cast of:
     17  Member Expression, with field:
     18    i: signed int
     19  ... from aggregate:
     20    Member Expression, with field:
     21      s: instance of struct S with body 1
     22    ... from aggregate:
     23      Variable Expression: t: instance of struct T with body 1
     24... to:
     25  reference to signed int
Note: See TracChangeset for help on using the changeset viewer.