- Timestamp:
- Feb 12, 2018, 3:49:04 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:
- 54c9000
- Parents:
- 1dcd52a3 (diff), ff2d1139 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src
- Files:
-
- 2 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/Makefile.am
r1dcd52a3 r7a052e34 10 10 ## Author : Peter A. Buhr 11 11 ## Created On : Sun May 31 08:54:01 2015 12 ## Last Modified By : Andrew Beach13 ## Last Modified On : Wed Jul 26 14:15:00 201714 ## Update Count : 22 112 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Fri Feb 9 15:51:24 2018 14 ## Update Count : 223 15 15 ############################################################################### 16 16 … … 92 92 libcfa_d_a_CFLAGS = -debug -O0 #No need for __CFA_DEBUG__ since we pass -debug 93 93 94 stdhdr = ${shell echo stdhdr/*}94 stdhdr = ${shell find stdhdr -type f -printf "%p "} 95 95 96 96 cfa_includedir = $(CFA_INCDIR) -
src/libcfa/Makefile.in
r1dcd52a3 r7a052e34 263 263 containers/result containers/vector concurrency/coroutine \ 264 264 concurrency/thread concurrency/kernel concurrency/monitor \ 265 ${shell echo stdhdr/*} math gmp bits/align.h bits/containers.h \ 266 bits/defs.h bits/debug.h bits/locks.h concurrency/invoke.h 265 ${shell find stdhdr -type f -printf "%p "} math gmp \ 266 bits/align.h bits/containers.h bits/defs.h bits/debug.h \ 267 bits/locks.h concurrency/invoke.h 267 268 HEADERS = $(nobase_cfa_include_HEADERS) 268 269 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) … … 428 429 libcfa_d_a_SOURCES = ${libsrc} 429 430 libcfa_d_a_CFLAGS = -debug -O0 #No need for __CFA_DEBUG__ since we pass -debug 430 stdhdr = ${shell echo stdhdr/*}431 stdhdr = ${shell find stdhdr -type f -printf "%p "} 431 432 cfa_includedir = $(CFA_INCDIR) 432 433 nobase_cfa_include_HEADERS = \ -
src/libcfa/concurrency/alarm.c
r1dcd52a3 r7a052e34 41 41 void ?{}( __cfa_time_t & this, zero_t zero ) { this.val = 0; } 42 42 43 void ?{}( itimerval & this, __cfa_time_t * alarm ) {44 this.it_value.tv_sec = alarm->val / one_second; // seconds45 this.it_value.tv_usec = max( (alarm->val % one_second) / one_microsecond, 1000 ); // microseconds46 this.it_interval.tv_sec = 0;47 this.it_interval.tv_usec = 0;43 void ?{}( itimerval & this, __cfa_time_t * alarm ) with( this ) { 44 it_value.tv_sec = alarm->val / one_second; // seconds 45 it_value.tv_usec = max( (alarm->val % one_second) / one_microsecond, 1000 ); // microseconds 46 it_interval.tv_sec = 0; 47 it_interval.tv_usec = 0; 48 48 } 49 49 … … 84 84 //============================================================================================= 85 85 86 void ?{}( alarm_node_t & this, thread_desc * thrd, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time ) {86 void ?{}( alarm_node_t & this, thread_desc * thrd, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time ) with( this ) { 87 87 this.thrd = thrd; 88 88 this.alarm = alarm; 89 89 this.period = period; 90 this.next = 0;91 this.set = false;92 this.kernel_alarm = false;93 } 94 95 void ?{}( alarm_node_t & this, processor * proc, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time ) {90 next = 0; 91 set = false; 92 kernel_alarm = false; 93 } 94 95 void ?{}( alarm_node_t & this, processor * proc, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time ) with( this ) { 96 96 this.proc = proc; 97 97 this.alarm = alarm; 98 98 this.period = period; 99 this.next = 0;100 this.set = false;101 this.kernel_alarm = true;99 next = 0; 100 set = false; 101 kernel_alarm = true; 102 102 } 103 103 -
src/libcfa/concurrency/alarm.h
r1dcd52a3 r7a052e34 114 114 }; 115 115 116 static inline void ?{}( alarm_list_t & this ) {117 this.head = 0;118 t his.tail = &this.head;116 static inline void ?{}( alarm_list_t & this ) with( this ) { 117 head = 0; 118 tail = &head; 119 119 } 120 120 -
src/libcfa/concurrency/coroutine.c
r1dcd52a3 r7a052e34 39 39 //----------------------------------------------------------------------------- 40 40 // Coroutine ctors and dtors 41 void ?{}(coStack_t& this) {42 this.size = 65000; // size of stack43 this.storage = NULL; // pointer to stack44 this.limit = NULL; // stack grows towards stack limit45 this.base = NULL; // base of stack46 this.context = NULL; // address of cfa_context_t47 t his.top = NULL; // address of top of storage48 this.userStack = false;41 void ?{}(coStack_t& this) with( this ) { 42 size = 65000; // size of stack 43 storage = NULL; // pointer to stack 44 limit = NULL; // stack grows towards stack limit 45 base = NULL; // base of stack 46 context = NULL; // address of cfa_context_t 47 top = NULL; // address of top of storage 48 userStack = false; 49 49 } 50 50 … … 60 60 } 61 61 62 void ?{}(coroutine_desc& this, const char * name) {62 void ?{}(coroutine_desc& this, const char * name) with( this ) { 63 63 this.name = name; 64 this.errno_ = 0;65 this.state = Start;66 this.starter = NULL;67 this.last = NULL;64 errno_ = 0; 65 state = Start; 66 starter = NULL; 67 last = NULL; 68 68 } 69 69 … … 99 99 // Wrapper for co 100 100 void CoroutineCtxSwitch(coroutine_desc* src, coroutine_desc* dst) { 101 // THREAD_GETMEM( This )->disableInterrupts();101 disable_interrupts(); 102 102 103 103 // set state of current coroutine to inactive … … 115 115 src->state = Active; 116 116 117 // THREAD_GETMEM( This )->enableInterrupts();117 enable_interrupts( __cfaabi_dbg_ctx ); 118 118 } //ctxSwitchDirect 119 119 -
src/libcfa/concurrency/invoke.c
r1dcd52a3 r7a052e34 10 10 // Created On : Tue Jan 17 12:27:26 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 8 16:18:11201813 // Update Count : 412 // Last Modified On : Fri Feb 9 16:37:42 2018 13 // Update Count : 5 14 14 // 15 15 … … 93 93 struct coStack_t* stack = &get_coroutine( this )->stack; 94 94 95 #if defined( __i386 __)95 #if defined( __i386 ) 96 96 97 97 struct FakeStack { … … 114 114 ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->fcw = 0x037F; //Vol. 1 8-7 115 115 116 #elif defined( __x86_64 __)116 #elif defined( __x86_64 ) 117 117 118 118 struct FakeStack { … … 150 150 fs->arg[0] = this; 151 151 fs->arg[1] = invoke; 152 152 153 #else 153 #error Only __i386__ and __x86_64__ is supported for threads in cfa154 #error uknown hardware architecture 154 155 #endif 155 156 } -
src/libcfa/concurrency/invoke.h
r1dcd52a3 r7a052e34 10 10 // Created On : Tue Jan 17 12:27:26 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jan 23 14:55:46201813 // Update Count : 312 // Last Modified On : Fri Feb 9 14:41:55 2018 13 // Update Count : 6 14 14 // 15 15 … … 202 202 void CtxSwitch( void * from, void * to ) asm ("CtxSwitch"); 203 203 204 #if defined( __x86_64__ ) 204 #if defined( __i386 ) 205 #define CtxGet( ctx ) __asm__ ( \ 206 "movl %%esp,%0\n" \ 207 "movl %%ebp,%1\n" \ 208 : "=rm" (ctx.SP), "=rm" (ctx.FP) ) 209 #elif defined( __x86_64 ) 205 210 #define CtxGet( ctx ) __asm__ ( \ 206 211 "movq %%rsp,%0\n" \ 207 212 "movq %%rbp,%1\n" \ 208 : "=rm" (ctx.SP), "=rm" (ctx.FP) )209 #elif defined( __i386__ )210 #define CtxGet( ctx ) __asm__ ( \211 "movl %%esp,%0\n" \212 "movl %%ebp,%1\n" \213 213 : "=rm" (ctx.SP), "=rm" (ctx.FP) ) 214 214 #elif defined( __ARM_ARCH ) … … 217 217 "mov %1,%%r11\n" \ 218 218 : "=rm" (ctx.SP), "=rm" (ctx.FP) ) 219 #else 220 #error unknown hardware architecture 219 221 #endif 220 222 -
src/libcfa/concurrency/kernel.c
r1dcd52a3 r7a052e34 10 10 // Created On : Tue Jan 17 12:27:26 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Feb 6 21:51:26201813 // Update Count : 412 // Last Modified On : Thu Feb 8 23:52:19 2018 13 // Update Count : 5 14 14 // 15 15 16 16 //C Includes 17 17 #include <stddef.h> 18 #define ftype `ftype`19 18 extern "C" { 20 19 #include <stdio.h> … … 24 23 #include <unistd.h> 25 24 } 26 #undef ftype27 25 28 26 //CFA Includes … … 144 142 } 145 143 146 void ?{}(processor & this, cluster * cltr) {144 void ?{}(processor & this, cluster * cltr) with( this ) { 147 145 this.cltr = cltr; 148 t his.terminated{ 0 };149 this.do_terminate = false;150 this.preemption_alarm = NULL;151 this.pending_preemption = false;146 terminated{ 0 }; 147 do_terminate = false; 148 preemption_alarm = NULL; 149 pending_preemption = false; 152 150 153 151 start( &this ); 154 152 } 155 153 156 void ?{}(processor & this, cluster * cltr, processorCtx_t & runner) {154 void ?{}(processor & this, cluster * cltr, processorCtx_t & runner) with( this ) { 157 155 this.cltr = cltr; 158 t his.terminated{ 0 };159 this.do_terminate = false;160 this.preemption_alarm = NULL;161 this.pending_preemption = false;162 this.kernel_thread = pthread_self();156 terminated{ 0 }; 157 do_terminate = false; 158 preemption_alarm = NULL; 159 pending_preemption = false; 160 kernel_thread = pthread_self(); 163 161 164 162 this.runner = &runner; -
src/libcfa/concurrency/monitor
r1dcd52a3 r7a052e34 27 27 }; 28 28 29 static inline void ?{}(monitor_desc & this) {30 (this.lock){};31 (this.entry_queue){};32 (this.signal_stack){};33 this.owner = NULL;34 this.recursion = 0;35 this.mask.accepted = NULL;36 this.mask.data = NULL;37 this.mask.size = 0;38 this.dtor_node = NULL;29 static inline void ?{}(monitor_desc & this) with( this ) { 30 lock{}; 31 entry_queue{}; 32 signal_stack{}; 33 owner = NULL; 34 recursion = 0; 35 mask.accepted = NULL; 36 mask.data = NULL; 37 mask.size = 0; 38 dtor_node = NULL; 39 39 } 40 40 -
src/libcfa/concurrency/monitor.c
r1dcd52a3 r7a052e34 151 151 // We already have the monitor... but where about to destroy it so the nesting will fail 152 152 // Abort! 153 abort( "Attempt to destroy monitor %p by thread \"%.256s\" (%p) in nested mutex." );153 abort( "Attempt to destroy monitor %p by thread \"%.256s\" (%p) in nested mutex.", this, thrd->self_cor.name, thrd ); 154 154 } 155 155 … … 358 358 } 359 359 360 void ?{}(__condition_criterion_t & this ) {361 this.ready = false;362 t his.target = NULL;363 this.owner = NULL;364 this.next = NULL;360 void ?{}(__condition_criterion_t & this ) with( this ) { 361 ready = false; 362 target = NULL; 363 owner = NULL; 364 next = NULL; 365 365 } 366 366 … … 427 427 thread_desc * this_thrd = this_thread; 428 428 if ( this.monitor_count != this_thrd->monitors.size ) { 429 abort( "Signal on condition %p made with different number of monitor(s), expected % i got %i", &this, this.monitor_count, this_thrd->monitors.size );429 abort( "Signal on condition %p made with different number of monitor(s), expected %li got %li", &this, this.monitor_count, this_thrd->monitors.size ); 430 430 } 431 431 432 432 for(int i = 0; i < this.monitor_count; i++) { 433 433 if ( this.monitors[i] != this_thrd->monitors[i] ) { 434 abort( "Signal on condition %p made with different monitor, expected %p got % i", &this, this.monitors[i], this_thrd->monitors[i] );434 abort( "Signal on condition %p made with different monitor, expected %p got %p", &this, this.monitors[i], this_thrd->monitors[i] ); 435 435 } 436 436 } -
src/libcfa/concurrency/preemption.c
r1dcd52a3 r7a052e34 10 10 // Created On : Mon Jun 5 14:20:42 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 8 17:01:56201813 // Update Count : 1 312 // Last Modified On : Fri Feb 9 16:38:13 2018 13 // Update Count : 14 14 14 // 15 15 16 16 #include "preemption.h" 17 17 18 #define ftype `ftype`19 18 extern "C" { 20 19 #include <errno.h> … … 23 22 #include <unistd.h> 24 23 } 25 #undef ftype26 24 27 25 #include "bits/signal.h" … … 50 48 51 49 // Machine specific register name 52 #if defined(__x86_64__) 50 #if defined( __i386 ) 51 #define CFA_REG_IP gregs[REG_EIP] 52 #elif defined( __x86_64 ) 53 53 #define CFA_REG_IP gregs[REG_RIP] 54 #elif defined(__i386__) 55 #define CFA_REG_IP gregs[REG_EIP] 56 #elif defined(__ARM_ARCH__) 54 #elif defined( __ARM_ARCH ) 57 55 #define CFA_REG_IP arm_pc 56 #else 57 #error unknown hardware architecture 58 58 #endif 59 59 -
src/libcfa/exception.c
r1dcd52a3 r7a052e34 9 9 // Author : Andrew Beach 10 10 // Created On : Mon Jun 26 15:13:00 2017 11 // Last Modified By : Andrew Beach12 // Last Modified On : Thr Aug 17 15:45:00 201713 // Update Count : 711 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Feb 9 14:41:55 2018 13 // Update Count : 8 14 14 // 15 15 … … 453 453 // match, which is no way generic. Some more works need to be done if we want to have a single call to the try routine. 454 454 455 #if defined( __ x86_64__ ) || defined( __i386__)455 #if defined( __i386 ) || defined( __x86_64 ) 456 456 asm ( 457 457 //HEADER … … 476 476 // " .section .note.GNU-stack,\"x\",@progbits\n" 477 477 ); 478 #endif // __ x86_64__ || __i386__478 #endif // __i386 || __x86_64 -
src/tests/preempt_longrun/Makefile.am
r1dcd52a3 r7a052e34 18 18 max_time=600 19 19 preempt=1_000ul 20 debug=-debug 20 21 21 22 REPEAT = ${abs_top_srcdir}/tools/repeat 22 23 TIME = /usr/bin/time -f "%E" 23 24 24 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ - debug -O2 -DPREEMPTION_RATE=${preempt}25 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -O2 -DPREEMPTION_RATE=${preempt} 25 26 CFLAGS = ${BUILD_FLAGS} 26 27 CC = @CFA_BINDIR@/@CFA_NAME@ 27 28 28 TESTS = block c reate disjoint enter enter3 processor stack wait yield29 TESTS = block coroutine create disjoint enter enter3 processor stack wait yield 29 30 30 31 .INTERMEDIATE: ${TESTS} … … 36 37 37 38 % : %.c ${CC} 38 ${AM_V_GEN}${CC} ${CFLAGS} ${<} -o ${@}39 ${AM_V_GEN}${CC} ${CFLAGS} ${<} $(debug) -o ${@} 39 40 40 41 %.run : % ${REPEAT} -
src/tests/preempt_longrun/Makefile.in
r1dcd52a3 r7a052e34 451 451 max_time = 600 452 452 preempt = 1_000ul 453 debug = -debug 453 454 REPEAT = ${abs_top_srcdir}/tools/repeat 454 455 TIME = /usr/bin/time -f "%E" 455 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ - debug -O2 -DPREEMPTION_RATE=${preempt}456 TESTS = block c reate disjoint enter enter3 processor stack wait yield456 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ -O2 -DPREEMPTION_RATE=${preempt} 457 TESTS = block coroutine create disjoint enter enter3 processor stack wait yield 457 458 all: all-am 458 459 … … 643 644 $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ 644 645 "$$tst" $(AM_TESTS_FD_REDIRECT) 646 coroutine.log: coroutine 647 @p='coroutine'; \ 648 b='coroutine'; \ 649 $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ 650 --log-file $$b.log --trs-file $$b.trs \ 651 $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ 652 "$$tst" $(AM_TESTS_FD_REDIRECT) 645 653 create.log: create 646 654 @p='create'; \ … … 873 881 874 882 % : %.c ${CC} 875 ${AM_V_GEN}${CC} ${CFLAGS} ${<} -o ${@}883 ${AM_V_GEN}${CC} ${CFLAGS} ${<} $(debug) -o ${@} 876 884 877 885 %.run : % ${REPEAT}
Note:
See TracChangeset
for help on using the changeset viewer.