From b5af97426c82ead4df42f3824a32e9ee634585a4 Mon Sep 17 00:00:00 2001 From: wuyan Date: Sat, 21 Sep 2019 15:47:05 +0800 Subject: [PATCH] Backport of JDK-8229169 Summary: [Backport of JDK-8229169] False failure of GenericTaskQueue::pop_local on architectures with weak memory model LLT: Bug url: https://bugs.openjdk.java.net/browse/JDK-8229169 --- hotspot/src/share/vm/utilities/taskqueue.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hotspot/src/share/vm/utilities/taskqueue.hpp b/hotspot/src/share/vm/utilities/taskqueue.hpp index 6ebd185b76..798f9aa183 100644 --- a/hotspot/src/share/vm/utilities/taskqueue.hpp +++ b/hotspot/src/share/vm/utilities/taskqueue.hpp @@ -724,6 +724,11 @@ GenericTaskQueue::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()); } } -- 2.12.3