< prev index next >

src/hotspot/share/gc/shared/taskqueue.inline.hpp

Print this page
rev 55920 : 8229169: False failure of GenericTaskQueue::pop_local on architectures with weak memory model
Reviewed-by: mdoerr, kbarrett

@@ -182,10 +182,15 @@
     TASKQUEUE_STATS_ONLY(stats.record_pop());
     return true;
   } 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());
   }
 }
 
 template <class E, MEMFLAGS F, unsigned int N>
< prev index next >