RFR (XS): CR 8004330: Add missing Unsafe entry points for addAndGet() family (original) (raw)
Doug Lea dl at cs.oswego.edu
Wed Jan 9 13:54:09 UTC 2013
- Previous message: RFR (XS): CR 8004330: Add missing Unsafe entry points for addAndGet() family
- Next message: RFR (XS): CR 8004330: Add missing Unsafe entry points for addAndGet() family
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 01/09/13 08:04, Aleksey Shipilev wrote:
c) While existing, Java-level AtomicLong.VMSUPPORTLONGCAS is redundant, and can be eliminated. AtomicLongFieldUpdater can be rewritten to use Unsafe on all the paths.
There is one little nicety here that does rely on VM_SUPPORT_LONG_CAS. There is a disclaimer somewhere that CAS is guaranteed to atomic only wrt other CASes. But in the emulation code for updaters, we also lock unconditional writes, because not doing so would be surprising. There is other code using Unsafe that is not so careful/forgiving. A good case can be made that the fallback wrapper for putLongVolatile should itself use a lock in this case but for reasons I don't remember, this wasn't done. (and in any case wouldn't trap syntactically generated volatile writes.) So there may be some usage code that is officially wrong/surprising on these grounds.
-Doug
- Previous message: RFR (XS): CR 8004330: Add missing Unsafe entry points for addAndGet() family
- Next message: RFR (XS): CR 8004330: Add missing Unsafe entry points for addAndGet() family
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]