Ignore:
Timestamp:
Jan 18, 2022, 1:16:23 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
Children:
1e8b4b49, adfd125
Parents:
21a5bfb7 (diff), 91a72ef (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/kernel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/kernel/fwd.hfa

    r21a5bfb7 r175f9f4  
    7777
    7878                static inline uint64_t __tls_rand() {
     79                        return
    7980                        #if defined(__SIZEOF_INT128__)
    80                                 return __lehmer64( kernelTLS().rand_seed );
     81                                lehmer64( kernelTLS().rand_seed );
    8182                        #else
    82                                 return __xorshift64( kernelTLS().rand_seed );
     83                                xorshift_13_7_17( kernelTLS().rand_seed );
    8384                        #endif
    8485                }
    8586
    86                 #define M  (1_l64u << 48_l64u)
    87                 #define A  (25214903917_l64u)
    88                 #define AI (18446708753438544741_l64u)
    89                 #define C  (11_l64u)
    90                 #define D  (16_l64u)
    91 
    9287                static inline unsigned __tls_rand_fwd() {
    93 
    94                         kernelTLS().ready_rng.fwd_seed = (A * kernelTLS().ready_rng.fwd_seed + C) & (M - 1);
    95                         return kernelTLS().ready_rng.fwd_seed >> D;
     88                        return LCGBI_fwd( kernelTLS().ready_rng.fwd_seed );
    9689                }
    9790
    9891                static inline unsigned __tls_rand_bck() {
    99                         unsigned int r = kernelTLS().ready_rng.bck_seed >> D;
    100                         kernelTLS().ready_rng.bck_seed = AI * (kernelTLS().ready_rng.bck_seed - C) & (M - 1);
    101                         return r;
    102                 }
    103 
    104                 #undef M
    105                 #undef A
    106                 #undef AI
    107                 #undef C
    108                 #undef D
     92                        return LCGBI_bck( kernelTLS().ready_rng.bck_seed );
     93                }
    10994
    11095                static inline void __tls_rand_advance_bck(void) {
     
    11297                }
    11398        }
    114 
    115 
    11699
    117100        extern void disable_interrupts();
     
    142125                        }
    143126                }
    144 
    145                 extern uint64_t thread_rand();
    146127
    147128                // Semaphore which only supports a single thread
  • libcfa/src/concurrency/kernel/startup.cfa

    r21a5bfb7 r175f9f4  
    3434#include "kernel_private.hfa"
    3535#include "startup.hfa"          // STARTUP_PRIORITY_XXX
     36#include "limits.hfa"
    3637#include "math.hfa"
    3738
     
    101102extern void __wake_proc(processor *);
    102103extern int cfa_main_returned;                                                   // from interpose.cfa
     104extern uint32_t __global_random_seed;
    103105
    104106//-----------------------------------------------------------------------------
     
    174176        this.context = &storage_mainThreadCtx;
    175177}
    176 
    177178
    178179
     
    489490        preferred = ready_queue_new_preferred();
    490491        last_proc = 0p;
     492        random_state = __global_random_seed;
    491493        #if defined( __CFA_WITH_VERIFY__ )
    492494                canary = 0x0D15EA5E0D15EA5Ep;
     
    513515        this.rdq.its = 0;
    514516        this.rdq.itr = 0;
    515         this.rdq.id  = -1u;
    516         this.rdq.target = -1u;
    517         this.rdq.last = -1u;
    518         this.rdq.cutoff = 0ull;
     517        this.rdq.id  = MAX;
     518        this.rdq.target = MAX;
     519        this.rdq.last = MAX;
     520        this.rdq.cpu = 0;
     521        // this.rdq.cutoff = 0ull;
    519522        do_terminate = false;
    520523        preemption_alarm = 0p;
     
    684687        uint_fast32_t last_size;
    685688        [this->unique_id, last_size] = ready_mutate_register();
     689
     690                this->rdq.cpu = __kernel_getcpu();
    686691
    687692                this->cltr->procs.total += 1u;
Note: See TracChangeset for help on using the changeset viewer.