diff options
author | jiefu <unknown> | 2019-08-07 17:00:19 +0800 |
---|---|---|
committer | bell-sw <liberica@bell-sw.com> | 2020-01-19 09:12:36 +0300 |
commit | e74180badb51a85941e3eb73d1a78e1db3ce3abb (patch) | |
tree | 27d7c03465c4f8ef68ec0183f56583b22b0ecc74 | |
parent | ca6c53f82e3f186ce59a4baa84cabd4d5cb82305 (diff) | |
download | jdk8u_hotspot-e74180badb51a85941e3eb73d1a78e1db3ce3abb.tar.gz |
8229169: False failure of GenericTaskQueue::pop_local on architectures with weak memory model
Reviewed-by: mdoerr, kbarrett, tschatzl
-rw-r--r-- | src/share/vm/utilities/taskqueue.hpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/share/vm/utilities/taskqueue.hpp b/src/share/vm/utilities/taskqueue.hpp index d2b39c943..0a2af4cdb 100644 --- a/src/share/vm/utilities/taskqueue.hpp +++ b/src/share/vm/utilities/taskqueue.hpp @@ -714,6 +714,11 @@ GenericTaskQueue<E, F, N>::pop_local(volatile E& t) { } else { // Otherwise, the queue contained exactly one element; we take the slow // path. + + // The barrier is required to prevent reordering the two reads of _age: + // one is the _age.get() below, and the other is _age.top() above the if-stmt. + // The algorithm may fail if _age.get() reads an older value than _age.top(). + OrderAccess::loadload(); return pop_local_slow(localBot, _age.get()); } } |