1.1 --- a/src/share/vm/utilities/taskqueue.hpp Fri Aug 02 03:06:19 2013 -0700 1.2 +++ b/src/share/vm/utilities/taskqueue.hpp Tue Aug 06 20:01:40 2013 -0400 1.3 @@ -395,7 +395,13 @@ 1.4 template<class E, MEMFLAGS F, unsigned int N> 1.5 bool GenericTaskQueue<E, F, N>::pop_global(E& t) { 1.6 Age oldAge = _age.get(); 1.7 - uint localBot = _bottom; 1.8 + // Architectures with weak memory model require a barrier here 1.9 + // to guarantee that bottom is not older than age, 1.10 + // which is crucial for the correctness of the algorithm. 1.11 +#if !(defined SPARC || defined IA32 || defined AMD64) 1.12 + OrderAccess::fence(); 1.13 +#endif 1.14 + uint localBot = OrderAccess::load_acquire((volatile juint*)&_bottom); 1.15 uint n_elems = size(localBot, oldAge.top()); 1.16 if (n_elems == 0) { 1.17 return false; 1.18 @@ -644,7 +650,7 @@ 1.19 template<class E, MEMFLAGS F, unsigned int N> inline bool 1.20 GenericTaskQueue<E, F, N>::push(E t) { 1.21 uint localBot = _bottom; 1.22 - assert((localBot >= 0) && (localBot < N), "_bottom out of range."); 1.23 + assert(localBot < N, "_bottom out of range."); 1.24 idx_t top = _age.top(); 1.25 uint dirty_n_elems = dirty_size(localBot, top); 1.26 assert(dirty_n_elems < N, "n_elems out of range.");