I was told that the volatile keyword can add a memory barrier before writing a variable operation. Therefore, I am writing code:
public class Test { private Object o; public Test() { this.o = new Object(); } private volatile static Test t; public static void createInstance() { t = new Test();
And then decompile it:
Compiled from "Test.java" public class Test extends java.lang.Object{ public Test(); Code: 0: aload_0 1: invokespecial
I donβt see anything related to the memory barrier, and then I remove volatile and decompile it again, the bytecode does not change at all.
How can I find anything in bytecode?
MrROY source share