Fix Version/s: 15
Compatibility Risk Description:Internet searches its production usages and found none. Its only usage is an original work-around for a prototype version of a CPU which would also remove it (See https://bugs.openjdk.java.net/browse/JDK-8242469).
Interface Kind:add/remove/modify command line option
Obsolete the VM product option
Running application with option "-XX:+UseBarriersForVolatile" might have memory consistent issue like what mentioned in https://bugs.openjdk.java.net/browse/JDK-8241137. Besides it adds complexity to the volatile access implementation, and each usage of it needs to take more consideration of the memory consistent and tests. Since
ldar/stlr can work well stably for volatile access, and so does
ldaxr/stlxr for unsafe atomic operations, we'd better simplify things by removing this flag and the alternative implementation for volatile memory access.
Obsolete the option and remove its usages in hotspot.
Here is the discussion details about this flag:
java with option
-XX:+/-UseBarriersForVolatile will no longer enable or disable the feature. Instead, it will print the usual obsolete option warning.