Changeset 794db28 for libcfa/src
- Timestamp:
- Aug 18, 2020, 11:35:50 AM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 93526ef
- Parents:
- d2b5d2d (diff), 36de20d (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:
- libcfa/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/common.hfa
rd2b5d2d r794db28 10 10 // Created On : Wed Jul 11 17:54:36 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jul 12 08:02:18 201813 // Update Count : 512 // Last Modified On : Sat Aug 15 08:51:29 2020 13 // Update Count : 14 14 14 // 15 15 … … 67 67 68 68 static inline { 69 char min( char t1, char t2 ) { return t1 < t2 ? t1 : t2; } // optimization 70 intptr_t min( intptr_t t1, intptr_t t2 ) { return t1 < t2 ? t1 : t2; } // optimization 71 uintptr_t min( uintptr_t t1, uintptr_t t2 ) { return t1 < t2 ? t1 : t2; } // optimization 69 72 forall( otype T | { int ?<?( T, T ); } ) 70 73 T min( T t1, T t2 ) { return t1 < t2 ? t1 : t2; } 71 74 75 char max( char t1, char t2 ) { return t1 > t2 ? t1 : t2; } // optimization 76 intptr_t max( intptr_t t1, intptr_t t2 ) { return t1 > t2 ? t1 : t2; } // optimization 77 uintptr_t max( uintptr_t t1, uintptr_t t2 ) { return t1 > t2 ? t1 : t2; } // optimization 72 78 forall( otype T | { int ?>?( T, T ); } ) 73 79 T max( T t1, T t2 ) { return t1 > t2 ? t1 : t2; } -
libcfa/src/concurrency/coroutine.cfa
rd2b5d2d r794db28 215 215 return cor; 216 216 } 217 218 struct $coroutine * __cfactx_cor_active(void) { 219 return active_coroutine(); 220 } 217 221 } 218 222 -
libcfa/src/concurrency/invoke.c
rd2b5d2d r794db28 29 29 // Called from the kernel when starting a coroutine or task so must switch back to user mode. 30 30 31 extern struct $coroutine * __cfactx_cor_active(void); 31 32 extern struct $coroutine * __cfactx_cor_finish(void); 32 33 extern void __cfactx_cor_leave ( struct $coroutine * ); … … 35 36 extern void disable_interrupts() OPTIONAL_THREAD; 36 37 extern void enable_interrupts( __cfaabi_dbg_ctx_param ); 38 39 struct exception_context_t * this_exception_context() { 40 return &__get_stack( __cfactx_cor_active() )->exception_context; 41 } 37 42 38 43 void __cfactx_invoke_coroutine( -
libcfa/src/concurrency/invoke.h
rd2b5d2d r794db28 98 98 } 99 99 100 struct exception_context_t * this_exception_context(); 101 100 102 // struct which calls the monitor is accepting 101 103 struct __waitfor_mask_t { -
libcfa/src/exception.c
rd2b5d2d r794db28 59 59 60 60 61 // Temperary global exception context. Does not work with concurency.62 static struct exception_context_t shared_stack = {NULL, NULL};63 64 61 // Get the current exception context. 65 62 // There can be a single global until multithreading occurs, then each stack 66 // needs its own. It will have to be updated to handle that. 67 struct exception_context_t * this_exception_context() { 63 // needs its own. We get this from libcfathreads (no weak attribute). 64 __attribute__((weak)) struct exception_context_t * this_exception_context() { 65 static struct exception_context_t shared_stack = {NULL, NULL}; 68 66 return &shared_stack; 69 67 } -
libcfa/src/heap.cfa
rd2b5d2d r794db28 10 10 // Created On : Tue Dec 19 21:58:35 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Aug 9 12:23:20202013 // Update Count : 89412 // Last Modified On : Wed Aug 12 16:43:38 2020 13 // Update Count : 902 14 14 // 15 15 … … 650 650 for ( HeapManager.Storage * p = freeLists[i].freeList; p != 0p; p = p->header.kind.real.next ) { 651 651 #else 652 for ( HeapManager.Storage * p = top( freeLists[i].freeList ); p != 0p; p = (p)`next->top ) { 652 // for ( HeapManager.Storage * p = top( freeLists[i].freeList ); p != 0p; p = (p)`next->top ) { 653 for ( HeapManager.Storage * p = top( freeLists[i].freeList ); p != 0p; /* p = getNext( p )->top */) { 654 typeof(p) temp = (( p )`next)->top; // FIX ME: direct assignent fails, initialization works 655 p = temp; 653 656 #endif // BUCKETLOCK 654 657 total += size; … … 1162 1165 choose( option ) { 1163 1166 case M_TOP_PAD: 1164 heapExpand = ceiling ( value, pageSize ); return 1;1167 heapExpand = ceiling2( value, pageSize ); return 1; 1165 1168 case M_MMAP_THRESHOLD: 1166 1169 if ( setMmapStart( value ) ) return 1; -
libcfa/src/stdlib.hfa
rd2b5d2d r794db28 10 10 // Created On : Thu Jan 28 17:12:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Aug 11 21:11:46202013 // Update Count : 49512 // Last Modified On : Fri Aug 14 23:38:50 2020 13 // Update Count : 504 14 14 // 15 15 … … 39 39 //--------------------------------------- 40 40 41 #include "common.hfa" 42 43 //--------------------------------------- 44 41 45 // Macro because of returns 42 46 #define $VAR_ALLOC( allocation, alignment ) \ … … 152 156 } // alloc_set 153 157 154 T * alloc_set( size_t dim , const T fill[]) {155 return (T *)memcpy( (T *)alloc( dim ), fill, dim* sizeof(T) ); // initialize with fill value158 T * alloc_set( size_t dimNew, const T fill[], size_t dimOld ) { 159 return (T *)memcpy( (T *)alloc( dimNew ), fill, min( dimNew, dimOld ) * sizeof(T) ); // initialize with fill value 156 160 } // alloc_set 157 161 … … 220 224 } // alloc_align_set 221 225 222 T * alloc_align_set( size_t align, size_t dim , const T fill[]) {223 return (T *)memcpy( (T *)alloc_align( align, dim ), fill, dim* sizeof(T) );226 T * alloc_align_set( size_t align, size_t dimNew, const T fill[], size_t dimOld ) { 227 return (T *)memcpy( (T *)alloc_align( align, dimNew ), fill, min( dimNew, dimOld ) * sizeof(T) ); 224 228 } // alloc_align_set 225 229 … … 374 378 //--------------------------------------- 375 379 376 #include "common.hfa"377 378 //---------------------------------------379 380 380 extern bool threading_enabled(void) OPTIONAL_THREAD; 381 381
Note: See TracChangeset
for help on using the changeset viewer.