Ignore:
Timestamp:
Nov 21, 2019, 9:38:54 PM (4 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
0a25c34, f1397d14
Parents:
1c40091 (diff), 49d3128 (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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
libcfa/src/concurrency
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/invoke.h

    r1c40091 r2909b51  
    4646        #ifdef __cforall
    4747        extern "Cforall" {
    48                 extern thread_local struct KernelThreadData {
     48                extern __attribute__((aligned(128))) thread_local struct KernelThreadData {
    4949                        struct thread_desc    * volatile this_thread;
    5050                        struct processor      * volatile this_processor;
     
    5555                                volatile bool in_progress;
    5656                        } preemption_state;
     57
     58                        uint32_t rand_seed;
    5759                } kernelTLS __attribute__ ((tls_model ( "initial-exec" )));
    5860        }
  • libcfa/src/concurrency/kernel.cfa

    r1c40091 r2909b51  
    133133        NULL,
    134134        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
    136137};
    137138
     
    260261//Main of the processor contexts
    261262void 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 ^= rdtscl();
     266
    262267        processor * this = runner.proc;
    263268        verify(this);
  • libcfa/src/concurrency/kernel_private.hfa

    r1c40091 r2909b51  
    101101#define KERNEL_STORAGE(T,X) static char storage_##X[sizeof(T)]
    102102
     103static 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
    103110
    104111void doregister( struct cluster & cltr );
Note: See TracChangeset for help on using the changeset viewer.