Changeset 69a61d2


Ignore:
Timestamp:
Apr 9, 2019, 10:15:34 AM (3 years ago)
Author:
tdelisle <tdelisle@…>
Branches:
arm-eh, cleanup-dtors, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
e8e457e
Parents:
e3a5a73
Message:

coroutine and thread no longer store stack size

Location:
libcfa/src/concurrency
Files:
4 edited

Legend:

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

    re3a5a73 r69a61d2  
    8484
    8585void ?{}( coroutine_desc & this, const char * name, void * storage, size_t storageSize ) with( this ) {
     86        (this.context){NULL, NULL};
    8687        (this.stack){storage, storageSize};
    8788        this.name = name;
     
    137138
    138139        // context switch to specified coroutine
     140        verify( src->context.SP );
     141        verify( dst->context.SP );
    139142        CtxSwitch( &src->context, &dst->context );
    140143        // when CtxSwitch returns we are back in the src coroutine
     
    187190        } else {
    188191                userStack = true;
    189                 __cfaabi_dbg_print_safe("Kernel : stack obj %p using user stack %p(%zu bytes)\n", this, this->storage, this->storage->size);
     192                __cfaabi_dbg_print_safe("Kernel : stack obj %p using user stack %p(%zd bytes)\n", this, this->storage, (intptr_t)this->storage->limit - (intptr_t)this->storage->base);
    190193
    191194                // The stack must be aligned, advance the pointer to the next align data
     
    199202
    200203        this->storage = (__stack_t *)((intptr_t)storage + size);
    201         this->storage->size  = size;
    202204        this->storage->limit = storage;
    203205        this->storage->base  = (void*)((intptr_t)storage + size);
  • libcfa/src/concurrency/invoke.h

    re3a5a73 r69a61d2  
    8484
    8585        struct __stack_t {
    86                 // size of stack
    87                 size_t size;
    88 
    8986                // stack grows towards stack limit
    9087                void * limit;
  • libcfa/src/concurrency/kernel.cfa

    re3a5a73 r69a61d2  
    6969struct current_stack_info_t {
    7070        __stack_t * storage;            // pointer to stack object
    71         unsigned int size;              // size of stack
    7271        void *base;                             // base of stack
    7372        void *limit;                    // stack grows towards stack limit
     
    8281        rlimit r;
    8382        getrlimit( RLIMIT_STACK, &r);
    84         this.size = r.rlim_cur;
    85 
    86         this.limit = (void *)(((intptr_t)this.base) - this.size);
     83        size_t size = r.rlim_cur;
     84
     85        this.limit = (void *)(((intptr_t)this.base) - size);
    8786        this.context = &storage_mainThreadCtx;
    8887}
     
    9594        stack.storage = info->storage;
    9695        with(*stack.storage) {
    97                 size      = info->size;
    9896                limit     = info->limit;
    9997                base      = info->base;
     
    370368
    371369        // context switch to specified coroutine
     370        verify( dst->context.SP );
    372371        CtxSwitch( &src->context, &dst->context );
    373372        // when CtxSwitch returns we are back in the src coroutine
  • libcfa/src/concurrency/thread.cfa

    re3a5a73 r69a61d2  
    8282        assert( thrd_c->stack.storage );
    8383        CtxStart(&this, CtxInvokeThread);
     84        verify( thrd_c->last->context.SP );
     85        verify( thrd_c->      context.SP );
    8486        CtxSwitch( &thrd_c->last->context, &thrd_c->context );
    8587
     
    117119        // set new coroutine that the processor is executing
    118120        // and context switch to it
     121        verify( dst->context.SP );
    119122        CtxSwitch( &src->context, &dst->context );
    120123
Note: See TracChangeset for help on using the changeset viewer.