Ignore:
Timestamp:
Apr 4, 2019, 5:28:47 PM (3 years ago)
Author:
tdelisle <tdelisle@…>
Branches:
arm-eh, cleanup-dtors, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
211228e0
Parents:
b2f6113
Message:

UserStack? flag on coroutines is now folded into the storage pointer

Location:
libcfa/src/concurrency
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/coroutine.cfa

    rb2f6113 r8c01e1b  
    6868
    6969void ^?{}(__stack_info_t & this) {
    70         if ( ! this.userStack && this.storage ) {
    71                 void * storage = (char*)(this.storage) - this.storage->size;
     70        bool userStack = ((intptr_t)this.storage & 0x1) != 0;
     71        if ( ! userStack && this.storage ) {
     72                *((intptr_t*)&this.storage) &= (intptr_t)-1;
     73                void * storage = this.storage->limit;
    7274                __cfaabi_dbg_debug_do(
    7375                        storage = (char*)(storage) - __page_size;
     
    200202        this->storage->limit = storage;
    201203        this->storage->base  = (void*)((intptr_t)storage + size);
    202         this->userStack = userStack;
     204        *((intptr_t*)&this->storage) |= userStack ? 0x1 : 0x0;
    203205}
    204206
  • libcfa/src/concurrency/coroutine.hfa

    rb2f6113 r8c01e1b  
    102102        coroutine_desc * dst = get_coroutine(cor);
    103103
    104         if( unlikely(!dst->stack.storage || !dst->stack.storage->base) ) {
     104        if( unlikely(dst->context.SP == NULL) ) {
    105105                __stack_prepare(&dst->stack, 65000);
    106106                CtxStart(&cor, CtxInvokeCoroutine);
  • libcfa/src/concurrency/invoke.h

    rb2f6113 r8c01e1b  
    9797                // pointer to stack
    9898                struct __stack_t * storage;
    99 
    100                 // whether or not the user allocated the stack
    101                 bool userStack;
    10299        };
    103100
  • libcfa/src/concurrency/kernel.cfa

    rb2f6113 r8c01e1b  
    9494        context.errno_ = 0;
    9595        stack.storage = info->storage;
    96         stack.userStack = true;
    9796        with(*stack.storage) {
    9897                size      = info->size;
     
    10099                base      = info->base;
    101100        }
     101        *((intptr_t*)&stack.storage) |= 0x1;
    102102        name = "Main Thread";
    103103        state = Start;
Note: See TracChangeset for help on using the changeset viewer.