Why does Unsafe.fullFence() not ensuring visibility in my example?
问题 I am trying to dive deep into volatile keyword in Java and setup 2 testing environments. I believe both of them are with x86_64 and use hotspot. Java version: 1.8.0_232 CPU: AMD Ryzen 7 8Core Java version: 1.8.0_231 CPU: Intel I7 Code is here: import java.lang.reflect.Field; import sun.misc.Unsafe; public class Test { private boolean flag = true; //left non-volatile intentionally private volatile int dummyVolatile = 1; public static void main(String[] args) throws Exception { Test t = new