Changeset 3c06bba
- Timestamp:
- Apr 15, 2019, 4:06:40 PM (6 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:
- deca0f5
- Parents:
- 5c1a531
- Location:
- libcfa/src/concurrency
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/CtxSwitch-i386.S
r5c1a531 r3c06bba 41 41 #define PC_OFFSET ( 2 * PTR_BYTE ) 42 42 43 .text43 .text 44 44 .align 2 45 .globl CtxSwitch 45 .globl CtxSwitch 46 .type CtxSwitch, @function 46 47 CtxSwitch: 47 48 … … 94 95 95 96 ret 97 .size CtxSwitch, .-CtxSwitch 96 98 97 99 // Local Variables: // -
libcfa/src/concurrency/CtxSwitch-x86_64.S
r5c1a531 r3c06bba 40 40 #define FP_OFFSET ( 1 * PTR_BYTE ) 41 41 42 .text42 .text 43 43 .align 2 44 .globl CtxSwitch 44 .globl CtxSwitch 45 .type CtxSwitch, @function 45 46 CtxSwitch: 46 47 … … 86 87 87 88 ret 89 .size CtxSwitch, .-CtxSwitch 90 88 91 89 92 //.text -
libcfa/src/concurrency/coroutine.cfa
r5c1a531 r3c06bba 124 124 } 125 125 126 // Wrapper for co127 void CoroutineCtxSwitch(coroutine_desc* src, coroutine_desc* dst) {128 // set state of current coroutine to inactive129 src->state = src->state == Halted ? Halted : Inactive;130 131 // set new coroutine that task is executing132 TL_GET( this_thread )->curr_cor = dst;133 134 // context switch to specified coroutine135 verify( dst->context.SP );136 CtxSwitch( &src->context, &dst->context );137 // when CtxSwitch returns we are back in the src coroutine138 139 // set state of new coroutine to active140 src->state = Active;141 142 if( unlikely(src->cancellation != NULL) ) {143 _CtxCoroutine_Unwind(src->cancellation, src);144 }145 }146 147 126 [void *, size_t] __stack_alloc( size_t storageSize ) { 148 127 static const size_t stack_data_size = libCeiling( sizeof(__stack_t), 16 ); // minimum alignment -
libcfa/src/concurrency/coroutine.hfa
r5c1a531 r3c06bba 64 64 forall(dtype T | is_coroutine(T)) 65 65 void CtxStart(T * this, void ( *invoke)(T *)); 66 67 extern void _CtxCoroutine_Unwind(struct _Unwind_Exception * storage, struct coroutine_desc *) __attribute__ ((__noreturn__)); 68 69 extern void CtxSwitch( struct __stack_context_t * from, struct __stack_context_t * to ) asm ("CtxSwitch"); 70 // void CtxStore ( void * this ) asm ("CtxStore"); 71 // void CtxRet ( void * dst ) asm ("CtxRet"); 66 72 } 67 73 68 74 // Private wrappers for context switch and stack creation 69 extern void CoroutineCtxSwitch(coroutine_desc * src, coroutine_desc * dst); 75 // Wrapper for co 76 static inline void CoroutineCtxSwitch(coroutine_desc* src, coroutine_desc* dst) { 77 // set state of current coroutine to inactive 78 src->state = src->state == Halted ? Halted : Inactive; 79 80 // set new coroutine that task is executing 81 TL_GET( this_thread )->curr_cor = dst; 82 83 // context switch to specified coroutine 84 verify( dst->context.SP ); 85 CtxSwitch( &src->context, &dst->context ); 86 // when CtxSwitch returns we are back in the src coroutine 87 88 // set state of new coroutine to active 89 src->state = Active; 90 91 if( unlikely(src->cancellation != NULL) ) { 92 _CtxCoroutine_Unwind(src->cancellation, src); 93 } 94 } 95 70 96 extern void __stack_prepare ( __stack_info_t * this, size_t size /* ignored if storage already allocated */); 71 97 -
libcfa/src/concurrency/invoke.h
r5c1a531 r3c06bba 260 260 // assembler routines that performs the context switch 261 261 extern void CtxInvokeStub( void ); 262 void CtxSwitch( struct __stack_context_t * from, struct __stack_context_t * to ) asm ("CtxSwitch");262 extern void CtxSwitch( struct __stack_context_t * from, struct __stack_context_t * to ) asm ("CtxSwitch"); 263 263 // void CtxStore ( void * this ) asm ("CtxStore"); 264 264 // void CtxRet ( void * dst ) asm ("CtxRet");
Note: See TracChangeset
for help on using the changeset viewer.