> On 10 Aug 2016, at 10:31, Hans Boehm <[email protected]> wrote:
> 
> 
> 
> On Wed, Aug 10, 2016 at 9:41 AM, Aleksey Shipilev <[email protected] 
> <mailto:[email protected]>> wrote:
> > ...
> 
> >  *) I wonder if weakCASAcquire is redundant in cases like these, and
> > relaxed weakCAS can be used instead? You definitely need
> > weakCAS{Volatile|Release} for *{Volatile|Release} methods, but *Acquire
> > seems special -- we would only exit with the value "acquired" by the
> > get*Acquire read inside the loop:
> >
> >    @ForceInline
> >    public final int getAndAddIntAcquire(Object o, long offset, int delta) {
> >        int v;
> >        do {
> >             v = getIntAcquire(o, offset);
> >        } while (!weakCompareAndSwapIntAcquire(o, offset, v, v +
> >        return v;
> >    }
> >
> I would have written this with a plain initial get and acquire CAS. I always 
> think of the get as only providing a hint, and the CAS as doing the work.
> 

That makes sense to me. I will update and include a comment noting the hint 
(memo to self: we need jcstress tests for these).

Thanks,
Paul.

Reply via email to