Mercurial > hg > truffle
changeset 11998:f5bed20f2492
Merge
author | dholmes |
---|---|
date | Thu, 08 Aug 2013 08:29:28 -0400 |
parents | 22a5aff0df0b (current diff) cd25d3be91c5 (diff) |
children | dadf62510ae4 |
files | |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/vm/utilities/taskqueue.hpp Tue Aug 06 14:28:48 2013 +0400 +++ b/src/share/vm/utilities/taskqueue.hpp Thu Aug 08 08:29:28 2013 -0400 @@ -395,7 +395,13 @@ template<class E, MEMFLAGS F, unsigned int N> bool GenericTaskQueue<E, F, N>::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<class E, MEMFLAGS F, unsigned int N> inline bool GenericTaskQueue<E, F, N>::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.");