RFR 8151198: VarHandle factory-specific exceptions

Aleksey Shipilev aleksey.shipilev at oracle.com
Fri Apr 8 18:57:23 UTC 2016


On 04/08/2016 09:39 PM, Hans Boehm wrote:
> I didn't previously have the impression that get/setOpaque was analogous
> to just C/C++ volatile.  C volatile officially has nothing to do with
> threads and does not prevent undefined behavior for data races.  It does
> not in general guarantee single-copy atomicity.  

Yes, Opaque does not imply memory ordering either.

> My prior impression was that Opaque was intended to be similar to a C++
> memory_order_relaxed access to a variable that is declared as both
> atomic and volatile, with the unordered interpretation of C++
> "volatile".  

Yes, that seems to be the intended semantics; sorry for the confusion.
Let's have this discussion when Paul submits the follow-up fix for
https://bugs.openjdk.java.net/browse/JDK-8153875; I linked your reply
there. Some cross-check against what is implemented in C1 and C2 would
be required at that point.

Thanks,
-Aleksey




More information about the core-libs-dev mailing list