From: Simon Marlow Date: Fri, 6 Feb 2009 13:08:04 +0000 (+0000) Subject: crucial bugfix: add a store/load memory barrier to popWSDeque() X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=fbc3fc411a2b619f638612dcaf322983c7a403c3;p=ghc-hetmet.git crucial bugfix: add a store/load memory barrier to popWSDeque() --- diff --git a/rts/parallel/WSDeque.c b/rts/parallel/WSDeque.c index 75ff919..4ae9417 100644 --- a/rts/parallel/WSDeque.c +++ b/rts/parallel/WSDeque.c @@ -130,7 +130,14 @@ popWSDeque (WSDeque *q) b = q->bottom; /* "decrement b as a test, see what happens" */ - q->bottom = --b; + + b--; + q->bottom = b; + + // very important that the following read of q->top does not occur + // before the earlier write to q->bottom. + store_load_barrier(); + pos = (q->elements) + (b & (q->moduloSize)); t = q->top; /* using topBound would give an *upper* bound, we need a lower bound. We use the real top here, but