Skip to content

Commit

Permalink
Remove contention from HandleHistogramProfileRand (#81932)
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorBo authored Feb 10, 2023
1 parent c16c736 commit 0d95bf1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/coreclr/vm/jithelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5407,12 +5407,12 @@ void JIT_PartialCompilationPatchpoint(int* counter, int ilOffset)

static unsigned HandleHistogramProfileRand()
{
// generate a random number (xorshift32)
// Generate a random number (xorshift32)
//
// intentionally simple so we can have multithreaded
// access w/o tearing state.
// Intentionally simple for faster random. It's stored in TLS to avoid
// multithread contention.
//
static volatile unsigned s_rng = 100;
static thread_local unsigned s_rng = 100;

unsigned x = s_rng;
x ^= x << 13;
Expand Down

0 comments on commit 0d95bf1

Please sign in to comment.