--- a/src/hotspot/share/gc/shared/taskqueue.inline.hpp Thu Oct 17 20:27:44 2019 +0100
+++ b/src/hotspot/share/gc/shared/taskqueue.inline.hpp Thu Oct 17 20:53:35 2019 +0100
@@ -184,6 +184,11 @@
} 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());
}
}
@@ -202,7 +207,7 @@
// Architectures with weak memory model require a barrier here
// to guarantee that bottom is not older than age,
// which is crucial for the correctness of the algorithm.
-#if !(defined SPARC || defined IA32 || defined AMD64)
+#ifndef CPU_MULTI_COPY_ATOMIC
OrderAccess::fence();
#endif
uint localBot = OrderAccess::load_acquire(&_bottom);