VarHandles on non-int-sized fields and atomic operations

Martin Buchholz martinrb at google.com
Wed May 25 18:20:23 UTC 2016


On Wed, May 25, 2016 at 12:53 AM, Paul Sandoz <paul.sandoz at oracle.com> wrote:
>
> Aleksey did some analysis to indicate we might be able to achieve access atomicity (not conflated with being able to perform an efficient CAS) by default without qualification for all types:
>
>   http://shipilev.net/blog/2014/all-accesses-are-atomic/

I don't do "mobile Java", but I suspect platforms without 64-bit
atomic instructions are still important.

> and you can even use an experimental flag -XX:+AlwaysAtomicAccesses and try it out.

We should imagine that Value Types are coming soon, and what we're
developing now will need to fit into that world.  We will have value
types that are too small and too big for machine CAS instructions.
The ones that are too big will be a bigger problem (need to use a
lock!) than the ones that are too small (need to use over-sized CAS in
a loop, or reserve more space)



More information about the core-libs-dev mailing list