RFR (XS): CR 8004330: Add missing Unsafe entry points for addAndGet() family
aleksey.shipilev at oracle.com
Wed Jan 9 12:42:28 UTC 2013
On 01/09/2013 03:36 PM, Doug Lea wrote:
> 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.
Sorry, this confuses me even more. This  seems to be the version
which does not take that flag into the consideration, and instead calls
the plain Unsafe against the field. This seems to be the exact thing
AtomicLong is doing, even the one dated back to the same change .
What's wrong with that construction?
More information about the core-libs-dev