--- old/src/share/vm/utilities/taskqueue.hpp 2013-03-05 16:57:18.616613000 +0100 +++ new/src/share/vm/utilities/taskqueue.hpp 2013-03-05 16:57:18.432612000 +0100 @@ -390,7 +390,14 @@ template bool GenericTaskQueue::pop_global(E& t) { Age oldAge = _age.get(); - uint localBot = _bottom; + // Architectures with weak memory model require a fence here. The + // fence has a cumulative effect on getting age and getting bottom. + // This way it is guaranteed that bottom is not older than age, + // what is crucial for the correctness of the algorithm. +#if (defined ARM || defined IA64 || defined PPC64) + OrderAccess::fence(); +#endif + uint localBot = OrderAccess::load_acquire((volatile juint*)&_bottom); uint n_elems = size(localBot, oldAge.top()); if (n_elems == 0) { return false; @@ -634,7 +641,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.");