RFR (XS): CR 8004330: Add missing Unsafe entry points for addAndGet() family

Doug Lea dl at cs.oswego.edu
Wed Jan 9 11:36:40 UTC 2013

On 01/09/13 06:04, Aleksey Shipilev wrote:

> I actually have the question about this. What is the usual pattern for
> using AtomicLong.VM_SUPPORTS_LONG_CAS? AtomicLong seems to use Unsafe
> directly without the checks. AtomicLongFieldUpdater does the checks.
> Something is fishy about this whole thing.

Here's the story: Any implementation of Long-CAS on a machine
that does not have any other way to support it is allowed to
emulate by a synchronized block on enclosing object. For the 
AtomicXFieldUpdaters classes, there was, at the time they were
introduced, no way to express the object to use, so the checks
were done explicitly. I don't think this is even necessary
anymore, but doesn't hurt. Further, I'm not sure that JDK8
is even targeted to any machines that require this kind of


More information about the core-libs-dev mailing list