Changeset dd46fd3 for libcfa/src/concurrency/kernel
- Timestamp:
- Nov 30, 2022, 10:36:25 PM (3 years ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 5657de9, c8238c0
- Parents:
- be1d00c
- Location:
- libcfa/src/concurrency/kernel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel/fwd.hfa
rbe1d00c rdd46fd3 46 46 } preemption_state; 47 47 48 #if defined(__SIZEOF_INT128__) 49 __uint128_t rand_seed; 50 #else 51 uint64_t rand_seed; 52 #endif 48 PRNG_STATE_T random_state; 49 53 50 struct { 54 51 uint64_t fwd_seed; … … 57 54 58 55 struct __stats_t * volatile this_stats; 59 60 56 61 57 #ifdef __CFA_WITH_VERIFY__ … … 76 72 #define publicTLS_get( member ) ((typeof(__cfaabi_tls.member))__cfatls_get( __builtin_offsetof(KernelThreadData, member) )) 77 73 78 static inline uint64_t __tls_rand() { 79 return 80 #if defined(__SIZEOF_INT128__) 81 lehmer64( kernelTLS().rand_seed ); 82 #else 83 xorshift_13_7_17( kernelTLS().rand_seed ); 84 #endif 74 static inline 75 #ifdef __x86_64__ // 64-bit architecture 76 uint64_t 77 #else // 32-bit architecture 78 uint32_t 79 #endif // __x86_64__ 80 __tls_rand() { 81 return PRNG_NAME( kernelTLS().random_state ); 85 82 } 86 83 -
libcfa/src/concurrency/kernel/startup.cfa
rbe1d00c rdd46fd3 108 108 extern void __wake_proc(processor *); 109 109 extern int cfa_main_returned; // from interpose.cfa 110 PRNG_ARG_T__global_random_prime = 4_294_967_291u;110 size_t __global_random_prime = 4_294_967_291u; 111 111 bool __global_random_mask = false; 112 112 … … 135 135 // Global state 136 136 __thread struct KernelThreadData __cfaabi_tls __attribute__ ((tls_model ( "initial-exec" ))) @= { 137 NULL,// cannot use 0p138 NULL,139 false,140 { 1, false,false },141 0,142 { 0,0 },143 NULL,137 .this_thread : NULL, // cannot use 0p 138 .this_processor : NULL, 139 .sched_lock : false, 140 .preemption_state : { .disable_count : 1, .enabled : false, .in_progress : false }, 141 // random_state uninitialized 142 .ready_rng : { .fwd_seed : 0, .bck_seed : 0 }, 143 .this_stats : NULL, 144 144 #ifdef __CFA_WITH_VERIFY__ 145 false,146 0,145 .in_sched_lock : false, 146 .sched_id : 0, 147 147 #endif 148 148 }; … … 521 521 preferred = ready_queue_new_preferred(); 522 522 last_proc = 0p; 523 random_state = __global_random_mask ? __global_random_prime : __global_random_prime ^ rdtscl();523 PRNG_SET_SEED( random_state, __global_random_mask ? __global_random_prime : __global_random_prime ^ rdtscl() ); 524 524 #if defined( __CFA_WITH_VERIFY__ ) 525 525 executing = 0p;
Note:
See TracChangeset
for help on using the changeset viewer.