Changeset 21184e3 for libcfa/src
- Timestamp:
- Nov 18, 2019, 11:11:24 AM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 57c764c, 7768b8d
- Parents:
- 6559a9d
- Location:
- libcfa/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/bits/defs.hfa
r6559a9d r21184e3 47 47 #define OPTIONAL_THREAD __attribute__((weak)) 48 48 #endif 49 50 static inline long long rdtscl(void) { 51 unsigned int lo, hi; 52 __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi)); 53 return ( (unsigned long long)lo)|( ((unsigned long long)hi)<<32 ); 54 } -
libcfa/src/concurrency/invoke.h
r6559a9d r21184e3 46 46 #ifdef __cforall 47 47 extern "Cforall" { 48 extern thread_local struct KernelThreadData {48 extern __attribute__((aligned(128))) thread_local struct KernelThreadData { 49 49 struct thread_desc * volatile this_thread; 50 50 struct processor * volatile this_processor; … … 55 55 volatile bool in_progress; 56 56 } preemption_state; 57 58 uint32_t rand_seed; 57 59 } kernelTLS __attribute__ ((tls_model ( "initial-exec" ))); 58 60 } -
libcfa/src/concurrency/kernel.cfa
r6559a9d r21184e3 133 133 NULL, 134 134 NULL, 135 { 1, false, false } 135 { 1, false, false }, 136 6u //this should be seeded better but due to a bug calling rdtsc doesn't work 136 137 }; 137 138 … … 260 261 //Main of the processor contexts 261 262 void main(processorCtx_t & runner) { 263 // Because of a bug, we couldn't initialized the seed on construction 264 // Do it here 265 kernelTLS.rand_seed ^= rdtsc(); 266 262 267 processor * this = runner.proc; 263 268 verify(this); -
libcfa/src/concurrency/kernel_private.hfa
r6559a9d r21184e3 101 101 #define KERNEL_STORAGE(T,X) static char storage_##X[sizeof(T)] 102 102 103 static inline uint32_t tls_rand() { 104 kernelTLS.rand_seed ^= kernelTLS.rand_seed << 6; 105 kernelTLS.rand_seed ^= kernelTLS.rand_seed >> 21; 106 kernelTLS.rand_seed ^= kernelTLS.rand_seed << 7; 107 return kernelTLS.rand_seed; 108 } 109 103 110 104 111 void doregister( struct cluster & cltr );
Note: See TracChangeset
for help on using the changeset viewer.