- Timestamp:
- Dec 8, 2016, 5:50:39 PM (8 years ago)
- 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:
- 164d036
- Parents:
- fda7e90
- Location:
- src/libcfa/concurrency
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/CtxSwitch-x86_64.S
rfda7e90 rb58a5772 79 79 .text 80 80 .align 2 81 .globl coInvokeStub82 coInvokeStub:81 .globl CtxInvokeStub 82 CtxInvokeStub: 83 83 movq %rbx, %rdi 84 84 jmp *%r12 -
src/libcfa/concurrency/invoke.c
rfda7e90 rb58a5772 15 15 extern void __suspend__F___1(void); 16 16 17 void invokeCoroutine(17 void CtxInvokeCoroutine( 18 18 void (*main)(void *), 19 19 struct coroutine *(*get_coroutine)(void *), … … 34 34 35 35 36 void startCoroutine(36 void CtxStart( 37 37 void (*main)(void *), 38 38 struct coroutine *(*get_coroutine)(void *), … … 73 73 74 74 ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->dummyReturn = NULL; 75 ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->rturn = coInvokeStub;75 ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->rturn = CtxInvokeStub; 76 76 ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->fixedRegisters[0] = this; 77 77 ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->fixedRegisters[1] = invoke; -
src/libcfa/concurrency/invoke.h
rfda7e90 rb58a5772 45 45 46 46 // assembler routines that performs the context switch 47 extern void coInvokeStub( void );47 extern void CtxInvokeStub( void ); 48 48 void CtxSwitch( void *from, void *to ) asm ("CtxSwitch"); 49 49 -
src/libcfa/concurrency/threads.c
rfda7e90 rb58a5772 44 44 } 45 45 46 void c txSwitchDirect(coroutine* src, coroutine* dst);46 void corCxtSw(coroutine* src, coroutine* dst); 47 47 void create_stack( coStack_t* this, unsigned int storageSize ); // used by all constructors 48 48 49 49 extern "C" { 50 50 forall(dtype T | is_coroutine(T)) 51 void invokeCoroutine(T* this);51 void CtxInvokeCoroutine(T* this); 52 52 53 53 forall(dtype T | is_coroutine(T)) 54 void startCoroutine(T* this, void (*invoke)(T*));54 void CtxStart(T* this, void (*invoke)(T*)); 55 55 } 56 56 … … 100 100 src->name, src, src->last->name, src->last ); 101 101 102 c txSwitchDirect( src, src->last );102 corCxtSw( src, src->last ); 103 103 } 104 104 … … 108 108 coroutine* dst = get_coroutine(cor); 109 109 110 if( ((intptr_t)dst->stack.base) == 0) {110 if( dst->stack.base == NULL ) { 111 111 create_stack(&dst->stack, dst->stack.size); 112 startCoroutine(cor, invokeCoroutine);112 CtxStart(cor, CtxInvokeCoroutine); 113 113 } 114 114 … … 120 120 dst->last = src; // set last resumer 121 121 } // if 122 c txSwitchDirect( src, dst ); // always done for performance testing122 corCxtSw( src, dst ); // always done for performance testing 123 123 } 124 124 … … 132 132 } 133 133 134 void c txSwitchDirect(coroutine* src, coroutine* dst) {134 void corCxtSw(coroutine* src, coroutine* dst) { 135 135 // THREAD_GETMEM( This )->disableInterrupts(); 136 136
Note: See TracChangeset
for help on using the changeset viewer.