Changes in / [f5478c8:3de176d]
- Location:
- src
- Files:
-
- 4 deleted
- 18 edited
-
Concurrency/Waitfor.cc (modified) (1 diff)
-
benchmark/Makefile.am (modified) (4 diffs)
-
benchmark/Makefile.in (modified) (4 diffs)
-
benchmark/bench.h (modified) (2 diffs)
-
benchmark/creation/JavaThread.java (deleted)
-
benchmark/creation/goroutine.go (deleted)
-
benchmark/ctxswitch/JavaThread.java (deleted)
-
benchmark/ctxswitch/goroutine.go (deleted)
-
libcfa/Makefile.am (modified) (1 diff)
-
libcfa/Makefile.in (modified) (2 diffs)
-
libcfa/bits/containers.h (modified) (10 diffs)
-
libcfa/bits/defs.h (modified) (2 diffs)
-
libcfa/bits/locks.h (modified) (1 diff)
-
libcfa/concurrency/invoke.h (modified) (8 diffs)
-
libcfa/concurrency/kernel (modified) (2 diffs)
-
libcfa/concurrency/kernel.c (modified) (2 diffs)
-
libcfa/concurrency/monitor (modified) (6 diffs)
-
libcfa/concurrency/monitor.c (modified) (17 diffs)
-
libcfa/exception.h (modified) (2 diffs)
-
libcfa/stdhdr/assert.h (modified) (3 diffs)
-
libcfa/virtual.h (modified) (2 diffs)
-
tests/designations.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/Concurrency/Waitfor.cc
rf5478c8 r3de176d 416 416 makeAccStatement( acceptables, index, "is_dtor", detectIsDtor( clause.target.function ) , indexer ), 417 417 makeAccStatement( acceptables, index, "func" , new CastExpr( clause.target.function, fptr_t ) , indexer ), 418 makeAccStatement( acceptables, index, " data" , new VariableExpr( monitors ) , indexer ),418 makeAccStatement( acceptables, index, "list" , new VariableExpr( monitors ) , indexer ), 419 419 makeAccStatement( acceptables, index, "size" , new ConstantExpr( Constant::from_ulong( clause.target.arguments.size() ) ), indexer ), 420 420 setter->clone() -
src/benchmark/Makefile.am
rf5478c8 r3de176d 94 94 ctxswitch-cfa_thread.run \ 95 95 ctxswitch-upp_coroutine.run \ 96 ctxswitch-upp_thread.run \ 97 ctxswitch-goroutine.run \ 98 ctxswitch-java_thread.run 96 ctxswitch-upp_thread.run 99 97 100 98 ctxswitch-cfa_coroutine$(EXEEXT): … … 112 110 ctxswitch-pthread$(EXEEXT): 113 111 @@BACKEND_CC@ ctxswitch/pthreads.c -DBENCH_N=50000000 -I. -lrt -pthread ${AM_CFLAGS} ${CFLAGS} ${ccflags} 114 115 ctxswitch-goroutine$(EXEEXT):116 @go build -o a.out ctxswitch/goroutine.go117 118 ctxswitch-java_thread$(EXEEXT):119 @javac ctxswitch/JavaThread.java120 @echo "#!/bin/sh" > a.out121 @echo "cd ctxswitch && java JavaThread" >> a.out122 @chmod a+x a.out123 112 124 113 ## ========================================================================================================= … … 194 183 creation-cfa_thread.run \ 195 184 creation-upp_coroutine.run \ 196 creation-upp_thread.run \ 197 creation-goroutine.run \ 198 creation-java_thread.run 185 creation-upp_thread.run 199 186 200 187 creation-cfa_coroutine$(EXEEXT): … … 215 202 creation-pthread$(EXEEXT): 216 203 @@BACKEND_CC@ creation/pthreads.c -DBENCH_N=250000 -I. -lrt -pthread ${AM_CFLAGS} ${CFLAGS} ${ccflags} 217 218 creation-goroutine$(EXEEXT):219 @go build -o a.out creation/goroutine.go220 221 creation-java_thread$(EXEEXT):222 @javac creation/JavaThread.java223 @echo "#!/bin/sh" > a.out224 @echo "cd creation && java JavaThread" >> a.out225 @chmod a+x a.out226 204 227 205 ## ========================================================================================================= -
src/benchmark/Makefile.in
rf5478c8 r3de176d 507 507 ctxswitch-cfa_thread.run \ 508 508 ctxswitch-upp_coroutine.run \ 509 ctxswitch-upp_thread.run \ 510 ctxswitch-goroutine.run \ 511 ctxswitch-java_thread.run 509 ctxswitch-upp_thread.run 512 510 513 511 ctxswitch-cfa_coroutine$(EXEEXT): … … 525 523 ctxswitch-pthread$(EXEEXT): 526 524 @@BACKEND_CC@ ctxswitch/pthreads.c -DBENCH_N=50000000 -I. -lrt -pthread ${AM_CFLAGS} ${CFLAGS} ${ccflags} 527 528 ctxswitch-goroutine$(EXEEXT):529 @go build -o a.out ctxswitch/goroutine.go530 531 ctxswitch-java_thread$(EXEEXT):532 @javac ctxswitch/JavaThread.java533 @echo "#!/bin/sh" > a.out534 @echo "cd ctxswitch && java JavaThread" >> a.out535 @chmod a+x a.out536 525 537 526 mutex$(EXEEXT) :\ … … 603 592 creation-cfa_thread.run \ 604 593 creation-upp_coroutine.run \ 605 creation-upp_thread.run \ 606 creation-goroutine.run \ 607 creation-java_thread.run 594 creation-upp_thread.run 608 595 609 596 creation-cfa_coroutine$(EXEEXT): … … 624 611 creation-pthread$(EXEEXT): 625 612 @@BACKEND_CC@ creation/pthreads.c -DBENCH_N=250000 -I. -lrt -pthread ${AM_CFLAGS} ${CFLAGS} ${ccflags} 626 627 creation-goroutine$(EXEEXT):628 @go build -o a.out creation/goroutine.go629 630 creation-java_thread$(EXEEXT):631 @javac creation/JavaThread.java632 @echo "#!/bin/sh" > a.out633 @echo "cd creation && java JavaThread" >> a.out634 @chmod a+x a.out635 613 636 614 compile$(EXEEXT) :\ -
src/benchmark/bench.h
rf5478c8 r3de176d 1 1 #pragma once 2 2 3 #if defined(__ cforall)3 #if defined(__CFORALL__) 4 4 extern "C" { 5 5 #endif … … 8 8 #include <sys/times.h> // times 9 9 #include <time.h> 10 #if defined(__ cforall)10 #if defined(__CFORALL__) 11 11 } 12 12 #endif -
src/libcfa/Makefile.am
rf5478c8 r3de176d 100 100 math \ 101 101 gmp \ 102 bits/containers.h \103 102 bits/defs.h \ 104 103 bits/locks.h \ -
src/libcfa/Makefile.in
rf5478c8 r3de176d 264 264 containers/result containers/vector concurrency/coroutine \ 265 265 concurrency/thread concurrency/kernel concurrency/monitor \ 266 ${shell echo stdhdr/*} math gmp bits/ containers.h bits/defs.h \267 bits/locks.hconcurrency/invoke.h libhdr.h libhdr/libalign.h \266 ${shell echo stdhdr/*} math gmp bits/defs.h bits/locks.h \ 267 concurrency/invoke.h libhdr.h libhdr/libalign.h \ 268 268 libhdr/libdebug.h libhdr/libtools.h 269 269 HEADERS = $(nobase_cfa_include_HEADERS) … … 437 437 math \ 438 438 gmp \ 439 bits/containers.h \440 439 bits/defs.h \ 441 440 bits/locks.h \ -
src/libcfa/bits/containers.h
rf5478c8 r3de176d 15 15 #pragma once 16 16 17 #include "bits/defs.h" 17 #include <stddef.h> 18 18 19 #include "libhdr.h" 19 20 //-----------------------------------------------------------------------------21 // Array22 //-----------------------------------------------------------------------------23 24 #ifdef __cforall25 forall(dtype T)26 #else27 #define T void28 #endif29 struct __small_array {30 T * data;31 __lock_size_t size;32 };33 #undef T34 35 #ifdef __cforall36 #define __small_array_t(T) __small_array(T)37 #else38 #define __small_array_t(T) struct __small_array39 #endif40 41 #ifdef __cforall42 // forall(otype T | sized(T))43 // static inline void ?{}(__small_array(T) & this) {}44 45 forall(dtype T | sized(T))46 static inline T& ?[?]( __small_array(T) & this, __lock_size_t idx) {47 return ((typeof(this.data))this.data)[idx];48 }49 50 forall(dtype T | sized(T))51 static inline T& ?[?]( const __small_array(T) & this, __lock_size_t idx) {52 return ((typeof(this.data))this.data)[idx];53 }54 55 forall(dtype T | sized(T))56 static inline T* begin( const __small_array(T) & this ) {57 return ((typeof(this.data))this.data);58 }59 60 forall(dtype T | sized(T))61 static inline T* end( const __small_array(T) & this ) {62 return ((typeof(this.data))this.data) + this.size;63 }64 #endif65 20 66 21 //----------------------------------------------------------------------------- … … 68 23 //----------------------------------------------------------------------------- 69 24 70 #ifdef __ cforall25 #ifdef __CFORALL__ 71 26 trait is_node(dtype T) { 72 27 T*& get_next( T& ); … … 77 32 // Stack 78 33 //----------------------------------------------------------------------------- 79 #ifdef __ cforall34 #ifdef __CFORALL__ 80 35 forall(dtype TYPE | is_node(TYPE)) 81 36 #define T TYPE … … 86 41 T * top; 87 42 }; 88 #undef T89 43 90 #ifdef __ cforall44 #ifdef __CFORALL__ 91 45 #define __stack_t(T) __stack(T) 92 46 #else … … 94 48 #endif 95 49 96 #ifdef __ cforall50 #ifdef __CFORALL__ 97 51 forall(dtype T | is_node(T)) 98 static inlinevoid ?{}( __stack(T) & this ) {99 (this.top){ NULL };52 void ?{}( __stack(T) & this ) { 53 this.top = NULL; 100 54 } 101 55 102 56 forall(dtype T | is_node(T) | sized(T)) 103 static inlinevoid push( __stack(T) & this, T * val ) {57 void push( __stack(T) & this, T * val ) { 104 58 verify( !get_next( *val ) ); 105 59 get_next( *val ) = this.top; … … 108 62 109 63 forall(dtype T | is_node(T) | sized(T)) 110 static inlineT * pop( __stack(T) & this ) {64 T * pop( __stack(T) & this ) { 111 65 T * top = this.top; 112 66 if( top ) { … … 121 75 // Queue 122 76 //----------------------------------------------------------------------------- 123 #ifdef __ cforall124 forall(dtype T YPE | is_node(TYPE))77 #ifdef __CFORALL__ 78 forall(dtype T | is_node(T)) 125 79 #define T TYPE 126 80 #else … … 131 85 T ** tail; 132 86 }; 133 #undef T134 87 135 #ifdef __cforall 136 #define __queue_t(T) __queue(T) 137 #else 138 #define __queue_t(T) struct __queue 139 #endif 140 141 #ifdef __cforall 88 #ifdef __CFORALL__ 142 89 forall(dtype T | is_node(T)) 143 static inlinevoid ?{}( __queue(T) & this ) {144 (this.head){ NULL };145 (this.tail){ &this.head };90 void ?{}( __queue(T) & this ) { 91 this.head = NULL; 92 this.tail = &this.head; 146 93 } 147 94 148 95 forall(dtype T | is_node(T) | sized(T)) 149 static inlinevoid append( __queue(T) & this, T * val ) {96 void append( __queue(T) & this, T * val ) { 150 97 verify(this.tail != NULL); 151 98 *this.tail = val; … … 154 101 155 102 forall(dtype T | is_node(T) | sized(T)) 156 static inlineT * pop_head( __queue(T) & this ) {103 T * pop_head( __queue(T) & this ) { 157 104 T * head = this.head; 158 105 if( head ) { … … 167 114 168 115 forall(dtype T | is_node(T) | sized(T)) 169 static inlineT * remove( __queue(T) & this, T ** it ) {116 T * remove( __queue(T) & this, T ** it ) { 170 117 T * val = *it; 171 118 verify( val ); -
src/libcfa/bits/defs.h
rf5478c8 r3de176d 17 17 18 18 #include <stdbool.h> 19 #include <stddef.h>20 19 #include <stdint.h> 21 20 … … 23 22 #define likely (x) __builtin_expect(!!(x), 1) 24 23 #define thread_local _Thread_local 25 26 typedef void (*fptr_t)();27 typedef int_fast16_t __lock_size_t;28 29 #ifdef __cforall30 #define __cfa_anonymous_object31 #else32 #define __cfa_anonymous_object __cfa_anonymous_object33 #endif -
src/libcfa/bits/locks.h
rf5478c8 r3de176d 56 56 } __ALIGN__; 57 57 58 #ifdef __ cforall58 #ifdef __CFORALL__ 59 59 extern void yield( unsigned int ); 60 60 extern thread_local struct thread_desc * volatile this_thread; -
src/libcfa/concurrency/invoke.h
rf5478c8 r3de176d 14 14 // 15 15 16 #include "bits/containers.h"17 16 #include "bits/defs.h" 18 17 #include "bits/locks.h" 19 18 20 #ifdef __ cforall19 #ifdef __CFORALL__ 21 20 extern "C" { 22 21 #endif … … 26 25 #define _INVOKE_H_ 27 26 28 #ifdef __cforall 27 typedef void (*fptr_t)(); 28 typedef int_fast16_t __lock_size_t; 29 30 struct __thread_queue_t { 31 struct thread_desc * head; 32 struct thread_desc ** tail; 33 }; 34 35 struct __condition_stack_t { 36 struct __condition_criterion_t * top; 37 }; 38 39 #ifdef __CFORALL__ 29 40 extern "Cforall" { 30 static inline struct thread_desc * & get_next( struct thread_desc & this ); 31 static inline struct __condition_criterion_t * & get_next( struct __condition_criterion_t & this ); 41 void ?{}( struct __thread_queue_t & ); 42 void append( struct __thread_queue_t &, struct thread_desc * ); 43 struct thread_desc * pop_head( struct __thread_queue_t & ); 44 struct thread_desc * remove( struct __thread_queue_t &, struct thread_desc ** ); 45 46 void ?{}( struct __condition_stack_t & ); 47 void push( struct __condition_stack_t &, struct __condition_criterion_t * ); 48 struct __condition_criterion_t * pop( struct __condition_stack_t & ); 32 49 } 33 50 #endif … … 83 100 84 101 // list of acceptable functions, null if any 85 __small_array_t(struct __acceptable_t) __cfa_anonymous_object; 102 struct __acceptable_t * clauses; 103 104 // number of acceptable functions 105 __lock_size_t size; 86 106 }; 87 107 … … 94 114 95 115 // queue of threads that are blocked waiting for the monitor 96 __queue_t(struct thread_desc)entry_queue;116 struct __thread_queue_t entry_queue; 97 117 98 118 // stack of conditions to run next once we exit the monitor 99 __stack_t(struct __condition_criterion_t)signal_stack;119 struct __condition_stack_t signal_stack; 100 120 101 121 // monitor routines can be called recursively, we need to keep track of that … … 111 131 struct __monitor_group_t { 112 132 // currently held monitors 113 __small_array_t(monitor_desc*) __cfa_anonymous_object; 133 struct monitor_desc ** list; 134 135 // number of currently held monitors 136 __lock_size_t size; 114 137 115 138 // last function that acquired monitors … … 136 159 }; 137 160 138 #ifdef __ cforall161 #ifdef __CFORALL__ 139 162 extern "Cforall" { 140 static inline thread_desc * & get_next( thread_desc & this) {141 return this. next;163 static inline monitor_desc * ?[?]( const __monitor_group_t & this, ptrdiff_t index ) { 164 return this.list[index]; 142 165 } 143 166 144 static inline struct __condition_criterion_t * & get_next( struct __condition_criterion_t & this );145 146 static inline void ?{}(__monitor_group_t & this) {147 (this.data){NULL};148 (this.size){0};149 (this.func){NULL};150 }151 152 static inline void ?{}(__monitor_group_t & this, struct monitor_desc ** data, __lock_size_t size, fptr_t func) {153 (this.data){data};154 (this.size){size};155 (this.func){func};156 }157 158 167 static inline bool ?==?( const __monitor_group_t & lhs, const __monitor_group_t & rhs ) { 159 if( (lhs. data != 0) != (rhs.data!= 0) ) return false;168 if( (lhs.list != 0) != (rhs.list != 0) ) return false; 160 169 if( lhs.size != rhs.size ) return false; 161 170 if( lhs.func != rhs.func ) return false; … … 168 177 169 178 return true; 170 }171 172 static inline void ?=?(__monitor_group_t & lhs, const __monitor_group_t & rhs) {173 lhs.data = rhs.data;174 lhs.size = rhs.size;175 lhs.func = rhs.func;176 179 } 177 180 } … … 207 210 #endif //_INVOKE_PRIVATE_H_ 208 211 #endif //! defined(__CFA_INVOKE_PRIVATE__) 209 #ifdef __ cforall212 #ifdef __CFORALL__ 210 213 } 211 214 #endif -
src/libcfa/concurrency/kernel
rf5478c8 r3de176d 26 26 //----------------------------------------------------------------------------- 27 27 // Locks 28 // // Lock the spinlock, spin if already acquired 29 // void lock ( spinlock * DEBUG_CTX_PARAM2 ); 30 31 // // Lock the spinlock, yield repeatedly if already acquired 32 // void lock_yield( spinlock * DEBUG_CTX_PARAM2 ); 33 34 // // Lock the spinlock, return false if already acquired 35 // bool try_lock ( spinlock * DEBUG_CTX_PARAM2 ); 36 37 // // Unlock the spinlock 38 // void unlock ( spinlock * ); 39 28 40 struct semaphore { 29 41 __spinlock_t lock; 30 42 int count; 31 __ queue_t(thread_desc)waiting;43 __thread_queue_t waiting; 32 44 }; 33 45 … … 45 57 46 58 // Ready queue for threads 47 __ queue_t(thread_desc)ready_queue;59 __thread_queue_t ready_queue; 48 60 49 61 // Preemption rate on this cluster -
src/libcfa/concurrency/kernel.c
rf5478c8 r3de176d 164 164 165 165 void ?{}(cluster & this) { 166 ( this.ready_queue){};166 ( this.ready_queue ){}; 167 167 ( this.ready_queue_lock ){}; 168 168 … … 611 611 } 612 612 613 //----------------------------------------------------------------------------- 614 // Queues 615 void ?{}( __thread_queue_t & this ) { 616 this.head = NULL; 617 this.tail = &this.head; 618 } 619 620 void append( __thread_queue_t & this, thread_desc * t ) { 621 verify(this.tail != NULL); 622 *this.tail = t; 623 this.tail = &t->next; 624 } 625 626 thread_desc * pop_head( __thread_queue_t & this ) { 627 thread_desc * head = this.head; 628 if( head ) { 629 this.head = head->next; 630 if( !head->next ) { 631 this.tail = &this.head; 632 } 633 head->next = NULL; 634 } 635 return head; 636 } 637 638 thread_desc * remove( __thread_queue_t & this, thread_desc ** it ) { 639 thread_desc * thrd = *it; 640 verify( thrd ); 641 642 (*it) = thrd->next; 643 644 if( this.tail == &thrd->next ) { 645 this.tail = it; 646 } 647 648 thrd->next = NULL; 649 650 verify( (this.head == NULL) == (&this.head == this.tail) ); 651 verify( *this.tail == NULL ); 652 return thrd; 653 } 654 655 void ?{}( __condition_stack_t & this ) { 656 this.top = NULL; 657 } 658 659 void push( __condition_stack_t & this, __condition_criterion_t * t ) { 660 verify( !t->next ); 661 t->next = this.top; 662 this.top = t; 663 } 664 665 __condition_criterion_t * pop( __condition_stack_t & this ) { 666 __condition_criterion_t * top = this.top; 667 if( top ) { 668 this.top = top->next; 669 top->next = NULL; 670 } 671 return top; 672 } 673 613 674 // Local Variables: // 614 675 // mode: c // -
src/libcfa/concurrency/monitor
rf5478c8 r3de176d 34 34 this.recursion = 0; 35 35 this.mask.accepted = NULL; 36 this.mask. data= NULL;36 this.mask.clauses = NULL; 37 37 this.mask.size = 0; 38 38 this.dtor_node = NULL; … … 40 40 41 41 struct monitor_guard_t { 42 monitor_desc ** m; 43 __lock_size_t count; 44 __monitor_group_t prev; 42 monitor_desc ** m; 43 __lock_size_t count; 44 monitor_desc ** prev_mntrs; 45 __lock_size_t prev_count; 46 fptr_t prev_func; 45 47 }; 46 48 … … 49 51 50 52 struct monitor_dtor_guard_t { 51 monitor_desc * m; 52 __monitor_group_t prev; 53 monitor_desc * m; 54 monitor_desc ** prev_mntrs; 55 __lock_size_t prev_count; 56 fptr_t prev_func; 53 57 }; 54 58 … … 79 83 }; 80 84 81 static inline __condition_criterion_t * & get_next( __condition_criterion_t & this ) {82 return this.next;83 }84 85 85 struct __condition_node_t { 86 86 // Thread that needs to be woken when all criteria are met … … 100 100 }; 101 101 102 static inline __condition_node_t * & get_next( __condition_node_t & this ) { 103 return this.next; 104 } 102 struct __condition_blocked_queue_t { 103 __condition_node_t * head; 104 __condition_node_t ** tail; 105 }; 105 106 106 107 void ?{}(__condition_node_t & this, thread_desc * waiting_thread, __lock_size_t count, uintptr_t user_info ); … … 108 109 void ?{}(__condition_criterion_t & this, monitor_desc * target, __condition_node_t * owner ); 109 110 111 void ?{}( __condition_blocked_queue_t & ); 112 void append( __condition_blocked_queue_t &, __condition_node_t * ); 113 __condition_node_t * pop_head( __condition_blocked_queue_t & ); 114 110 115 struct condition { 111 116 // Link list which contains the blocked threads as-well as the information needed to unblock them 112 __ queue_t(__condition_node_t)blocked;117 __condition_blocked_queue_t blocked; 113 118 114 119 // Array of monitor pointers (Monitors are NOT contiguous in memory) -
src/libcfa/concurrency/monitor.c
rf5478c8 r3de176d 280 280 static inline void enter( __monitor_group_t monitors ) { 281 281 for( __lock_size_t i = 0; i < monitors.size; i++) { 282 __enter_monitor_desc( monitors [i], monitors );282 __enter_monitor_desc( monitors.list[i], monitors ); 283 283 } 284 284 } … … 303 303 304 304 // Save previous thread context 305 this. prev = this_thread->monitors;305 this.[prev_mntrs, prev_count, prev_func] = this_thread->monitors.[list, size, func]; 306 306 307 307 // Update thread context (needed for conditions) 308 (this_thread->monitors){m, count, func};308 this_thread->monitors.[list, size, func] = [m, count, func]; 309 309 310 310 // LIB_DEBUG_PRINT_SAFE("MGUARD : enter %d\n", count); … … 328 328 329 329 // Restore thread context 330 this_thread->monitors = this.prev;330 this_thread->monitors.[list, size, func] = this.[prev_mntrs, prev_count, prev_func]; 331 331 } 332 332 … … 338 338 339 339 // Save previous thread context 340 this. prev = this_thread->monitors;340 this.[prev_mntrs, prev_count, prev_func] = this_thread->monitors.[list, size, func]; 341 341 342 342 // Update thread context (needed for conditions) 343 (this_thread->monitors){m, 1, func};343 this_thread->monitors.[list, size, func] = [m, 1, func]; 344 344 345 345 __enter_monitor_dtor( this.m, func ); … … 352 352 353 353 // Restore thread context 354 this_thread->monitors = this.prev;354 this_thread->monitors.[list, size, func] = this.[prev_mntrs, prev_count, prev_func]; 355 355 } 356 356 … … 437 437 438 438 for(int i = 0; i < this.monitor_count; i++) { 439 if ( this.monitors[i] != this_thrd->monitors [i] ) {440 abortf( "Signal on condition %p made with different monitor, expected %p got %i", &this, this.monitors[i], this_thrd->monitors [i] );439 if ( this.monitors[i] != this_thrd->monitors.list[i] ) { 440 abortf( "Signal on condition %p made with different monitor, expected %p got %i", &this, this.monitors[i], this_thrd->monitors.list[i] ); 441 441 } 442 442 } … … 510 510 "Possible cause is not checking if the condition is empty before reading stored data." 511 511 ); 512 return ((typeof(this.blocked.head))this.blocked.head)->user_info;512 return this.blocked.head->user_info; 513 513 } 514 514 … … 554 554 if( next ) { 555 555 *mask.accepted = index; 556 __acceptable_t& accepted = mask[index]; 557 if( accepted.is_dtor ) { 556 if( mask.clauses[index].is_dtor ) { 558 557 LIB_DEBUG_PRINT_BUFFER_LOCAL( "Kernel : dtor already there\n"); 559 verifyf( accepted.size == 1,"ERROR: Accepted dtor has more than 1 mutex parameter." );560 561 monitor_desc * mon2dtor = accepted[0];558 verifyf( mask.clauses[index].size == 1 , "ERROR: Accepted dtor has more than 1 mutex parameter." ); 559 560 monitor_desc * mon2dtor = mask.clauses[index].list[0]; 562 561 verifyf( mon2dtor->dtor_node, "ERROR: Accepted monitor has no dtor_node." ); 563 562 … … 597 596 598 597 LIB_DEBUG_PRINT_BUFFER_LOCAL( "Kernel : accepted %d\n", *mask.accepted); 598 599 599 return; 600 600 } … … 671 671 static inline void reset_mask( monitor_desc * this ) { 672 672 this->mask.accepted = NULL; 673 this->mask. data= NULL;673 this->mask.clauses = NULL; 674 674 this->mask.size = 0; 675 675 } … … 697 697 698 698 static inline bool is_accepted( monitor_desc * this, const __monitor_group_t & group ) { 699 __acceptable_t * it = this->mask. data; // Optim699 __acceptable_t * it = this->mask.clauses; // Optim 700 700 __lock_size_t count = this->mask.size; 701 701 … … 820 820 if( !this.monitors ) { 821 821 // LIB_DEBUG_PRINT_SAFE("Branding\n"); 822 assertf( thrd->monitors. data != NULL, "No current monitor to brand condition %p", thrd->monitors.data);822 assertf( thrd->monitors.list != NULL, "No current monitor to brand condition %p", thrd->monitors.list ); 823 823 this.monitor_count = thrd->monitors.size; 824 824 825 825 this.monitors = (monitor_desc **)malloc( this.monitor_count * sizeof( *this.monitors ) ); 826 826 for( int i = 0; i < this.monitor_count; i++ ) { 827 this.monitors[i] = thrd->monitors [i];827 this.monitors[i] = thrd->monitors.list[i]; 828 828 } 829 829 } … … 832 832 static inline [thread_desc *, int] search_entry_queue( const __waitfor_mask_t & mask, monitor_desc * monitors [], __lock_size_t count ) { 833 833 834 __ queue_t(thread_desc)& entry_queue = monitors[0]->entry_queue;834 __thread_queue_t & entry_queue = monitors[0]->entry_queue; 835 835 836 836 // For each thread in the entry-queue … … 841 841 // For each acceptable check if it matches 842 842 int i = 0; 843 __acceptable_t * end = end (mask); 844 __acceptable_t * begin = begin(mask); 845 for( __acceptable_t * it = begin; it != end; it++, i++ ) { 843 __acceptable_t * end = mask.clauses + mask.size; 844 for( __acceptable_t * it = mask.clauses; it != end; it++, i++ ) { 846 845 // Check if we have a match 847 846 if( *it == (*thrd_it)->monitors ) { … … 873 872 __lock_size_t max = 0; 874 873 for( __lock_size_t i = 0; i < mask.size; i++ ) { 875 __acceptable_t & accepted = mask[i]; 876 max += accepted.size; 874 max += mask.clauses[i].size; 877 875 } 878 876 return max; … … 882 880 __lock_size_t size = 0; 883 881 for( __lock_size_t i = 0; i < mask.size; i++ ) { 884 __acceptable_t & accepted = mask[i]; 885 __libcfa_small_sort( accepted.data, accepted.size ); 886 for( __lock_size_t j = 0; j < accepted.size; j++) { 887 insert_unique( storage, size, accepted[j] ); 882 __libcfa_small_sort( mask.clauses[i].list, mask.clauses[i].size ); 883 for( __lock_size_t j = 0; j < mask.clauses[i].size; j++) { 884 insert_unique( storage, size, mask.clauses[i].list[j] ); 888 885 } 889 886 } … … 891 888 __libcfa_small_sort( storage, size ); 892 889 return size; 890 } 891 892 void ?{}( __condition_blocked_queue_t & this ) { 893 this.head = NULL; 894 this.tail = &this.head; 895 } 896 897 void append( __condition_blocked_queue_t & this, __condition_node_t * c ) { 898 verify(this.tail != NULL); 899 *this.tail = c; 900 this.tail = &c->next; 901 } 902 903 __condition_node_t * pop_head( __condition_blocked_queue_t & this ) { 904 __condition_node_t * head = this.head; 905 if( head ) { 906 this.head = head->next; 907 if( !head->next ) { 908 this.tail = &this.head; 909 } 910 head->next = NULL; 911 } 912 return head; 893 913 } 894 914 -
src/libcfa/exception.h
rf5478c8 r3de176d 17 17 18 18 19 #ifdef __ cforall19 #ifdef __CFORALL__ 20 20 extern "C" { 21 21 #endif … … 68 68 struct __cfaehm__cleanup_hook {}; 69 69 70 #ifdef __ cforall70 #ifdef __CFORALL__ 71 71 } 72 72 #endif -
src/libcfa/stdhdr/assert.h
rf5478c8 r3de176d 4 4 // The contents of this file are covered under the licence agreement in the 5 5 // file "LICENCE" distributed with Cforall. 6 // 7 // assert.h -- 8 // 6 // 7 // assert.h -- 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Mon Jul 4 23:25:26 2016 … … 12 12 // Last Modified On : Mon Jul 31 23:09:32 2017 13 13 // Update Count : 13 14 // 14 // 15 15 16 #ifdef __ cforall16 #ifdef __CFORALL__ 17 17 extern "C" { 18 #endif //__ cforall18 #endif //__CFORALL__ 19 19 20 20 #include_next <assert.h> … … 30 30 #endif 31 31 32 #ifdef __ cforall32 #ifdef __CFORALL__ 33 33 } // extern "C" 34 #endif //__ cforall34 #endif //__CFORALL__ 35 35 36 36 // Local Variables: // -
src/libcfa/virtual.h
rf5478c8 r3de176d 16 16 #pragma once 17 17 18 #ifdef __ cforall18 #ifdef __CFORALL__ 19 19 extern "C" { 20 20 #endif … … 35 35 struct __cfa__parent_vtable const * const * child ); 36 36 37 #ifdef __ cforall37 #ifdef __CFORALL__ 38 38 } 39 39 #endif -
src/tests/designations.c
rf5478c8 r3de176d 17 17 // In particular, since the syntax for designations in Cforall differs from that of C, preprocessor substitution 18 18 // is used for the designation syntax 19 #ifdef __ cforall19 #ifdef __CFORALL__ 20 20 #define DES : 21 21 #else
Note:
See TracChangeset
for help on using the changeset viewer.