# HG changeset patch # User vladidan # Date 1375833700 14400 # Node ID cd25d3be91c548a77139c0b76f924a92290bf082 # Parent 79ce055063e906476170ba23d5e7c53a9143381f 8012144: multiple SIGSEGVs fails on staxf Summary: Forward port of 7u change to add additional fence() on RMO platforms, with a load_acquire on all platforms Reviewed-by: dholmes, kvn diff -r 79ce055063e9 -r cd25d3be91c5 src/share/vm/utilities/taskqueue.hpp --- a/src/share/vm/utilities/taskqueue.hpp Fri Aug 02 03:06:19 2013 -0700 +++ b/src/share/vm/utilities/taskqueue.hpp Tue Aug 06 20:01:40 2013 -0400 @@ -395,7 +395,13 @@ template bool GenericTaskQueue::pop_global(E& t) { Age oldAge = _age.get(); - uint localBot = _bottom; + // 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) + OrderAccess::fence(); +#endif + uint localBot = OrderAccess::load_acquire((volatile juint*)&_bottom); uint n_elems = size(localBot, oldAge.top()); if (n_elems == 0) { return false; @@ -644,7 +650,7 @@ template inline bool GenericTaskQueue::push(E t) { uint localBot = _bottom; - assert((localBot >= 0) && (localBot < N), "_bottom out of range."); + assert(localBot < N, "_bottom out of range."); idx_t top = _age.top(); uint dirty_n_elems = dirty_size(localBot, top); assert(dirty_n_elems < N, "n_elems out of range.");