Changeset 69a61d2
- Timestamp:
- Apr 9, 2019, 10:15:34 AM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- e8e457e
- Parents:
- e3a5a73
- Location:
- libcfa/src/concurrency
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/coroutine.cfa
re3a5a73 r69a61d2 84 84 85 85 void ?{}( coroutine_desc & this, const char * name, void * storage, size_t storageSize ) with( this ) { 86 (this.context){NULL, NULL}; 86 87 (this.stack){storage, storageSize}; 87 88 this.name = name; … … 137 138 138 139 // context switch to specified coroutine 140 verify( src->context.SP ); 141 verify( dst->context.SP ); 139 142 CtxSwitch( &src->context, &dst->context ); 140 143 // when CtxSwitch returns we are back in the src coroutine … … 187 190 } else { 188 191 userStack = true; 189 __cfaabi_dbg_print_safe("Kernel : stack obj %p using user stack %p(%z u 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); 190 193 191 194 // The stack must be aligned, advance the pointer to the next align data … … 199 202 200 203 this->storage = (__stack_t *)((intptr_t)storage + size); 201 this->storage->size = size;202 204 this->storage->limit = storage; 203 205 this->storage->base = (void*)((intptr_t)storage + size); -
libcfa/src/concurrency/invoke.h
re3a5a73 r69a61d2 84 84 85 85 struct __stack_t { 86 // size of stack87 size_t size;88 89 86 // stack grows towards stack limit 90 87 void * limit; -
libcfa/src/concurrency/kernel.cfa
re3a5a73 r69a61d2 69 69 struct current_stack_info_t { 70 70 __stack_t * storage; // pointer to stack object 71 unsigned int size; // size of stack72 71 void *base; // base of stack 73 72 void *limit; // stack grows towards stack limit … … 82 81 rlimit r; 83 82 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); 87 86 this.context = &storage_mainThreadCtx; 88 87 } … … 95 94 stack.storage = info->storage; 96 95 with(*stack.storage) { 97 size = info->size;98 96 limit = info->limit; 99 97 base = info->base; … … 370 368 371 369 // context switch to specified coroutine 370 verify( dst->context.SP ); 372 371 CtxSwitch( &src->context, &dst->context ); 373 372 // when CtxSwitch returns we are back in the src coroutine -
libcfa/src/concurrency/thread.cfa
re3a5a73 r69a61d2 82 82 assert( thrd_c->stack.storage ); 83 83 CtxStart(&this, CtxInvokeThread); 84 verify( thrd_c->last->context.SP ); 85 verify( thrd_c-> context.SP ); 84 86 CtxSwitch( &thrd_c->last->context, &thrd_c->context ); 85 87 … … 117 119 // set new coroutine that the processor is executing 118 120 // and context switch to it 121 verify( dst->context.SP ); 119 122 CtxSwitch( &src->context, &dst->context ); 120 123
Note: See TracChangeset
for help on using the changeset viewer.