changeset 9077:775e2bf92114 jdk8u242-b02

8229169: False failure of GenericTaskQueue::pop_local on architectures with weak memory model Reviewed-by: mdoerr, kbarrett, tschatzl
author jiefu
date Wed, 07 Aug 2019 17:00:19 +0800
parents 14b0d7d60628
children ee19c358e3b8 9f28a4cac6d9
files src/share/vm/utilities/taskqueue.hpp
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/utilities/taskqueue.hpp	Sat Aug 03 09:04:04 2019 +0800
+++ b/src/share/vm/utilities/taskqueue.hpp	Wed Aug 07 17:00:19 2019 +0800
@@ -714,6 +714,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());
   }
 }