# HG changeset patch # User jiefu # Date 1565168419 -28800 # Node ID 775e2bf92114e41365cc6baf1480c818454256a4 # Parent 14b0d7d60628c21ae8e9dc6f6f06cfd381f244a5 8229169: False failure of GenericTaskQueue::pop_local on architectures with weak memory model Reviewed-by: mdoerr, kbarrett, tschatzl diff -r 14b0d7d60628 -r 775e2bf92114 src/share/vm/utilities/taskqueue.hpp --- 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()); } }