jdk.internal.misc.Unsafe.weakCompareAndSwapObject

Aleksey Shipilev aleksey.shipilev at oracle.com
Wed Feb 24 18:42:44 UTC 2016


On 02/24/2016 09:31 PM, Andrew Haley wrote:
> Well, we certainly have all of the machinery to do that.  However, I
> was rather hoping that in the long run we could do it the other way
> around: get rid of most of these memory barriers in the compiler.
> Instead we could have LoadAcquire, StoreRelease, and so on.  The back
> ends could then expand them into whatever instructions were necessary.
> Of course, the optimizers would have to respect the barrier effects of
> these nodes.
> 
> That would be much cleaner and simpler -- not to mention easier to get
> right -- than what we have today.

I agree. But I also shudder at a thought about the size of such a change
at this point.

BTW, answering your original question. Even without Unsafe docs, these
are the clear hints on targeted semantics:

http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/file/8b9fdaeb8c57/src/share/vm/opto/library_call.cpp#l671

-Aleksey




More information about the hotspot-dev mailing list