On 1/20/25 08:24, Peter Veentjer wrote:
> The question is the following: assuming that an opaque field is used appropriately, is there any
> risk in using opaque? Is there any chance that a JVM will go up in flames or start to take over the
> world.
Generic (scary) answer: With complex optimizing compilers, there is always a risk in using stuff you
have not touched before: if intermediate representation of the program changes, it may take compiler
to the paths it was not visiting before in the similar conditions.
Specific (non-scary) answer: ...but I would estimate the risk for additional compiler barriers
Opaque emits is slim to none. To begin with, the compiler barriers emitted around Opaque are the
subset of barriers emitted for Acquire/Release/Volatile accesses already.
-Aleksey