8182554: Code for os::random() assumes long is 32 bits

And make updating the _rand_seed thread safe.

Reviewed-by: stuefe, kbarrett, stefank
This commit is contained in:
Coleen Phillimore 2017-06-28 16:14:20 -04:00
parent edb4b7df3e
commit 9edb2c5e5a
8 changed files with 71 additions and 58 deletions

View file

@ -672,8 +672,7 @@ static markOop ReadStableMark(oop obj) {
static inline intptr_t get_next_hash(Thread * Self, oop obj) {
intptr_t value = 0;
if (hashCode == 0) {
// This form uses an unguarded global Park-Miller RNG,
// so it's possible for two threads to race and generate the same RNG.
// This form uses global Park-Miller RNG.
// On MP system we'll have lots of RW access to a global, so the
// mechanism induces lots of coherency traffic.
value = os::random();