At run time, the JVM JVM compiler compiles java bytecode (class format) into its own set of commands on your computer. JIT performs several optimizations at compile time. In this case, JIT probably understood the following (just guessing):
- The
f1() method has no visible side effects - call return value
f1() not stored anywhere
so JIT just missed the call to f1() from native code. Perhaps after deleting the call to f1() entire for(int i = 0; i < x; i++) loop for(int i = 0; i < x; i++) also deleted (since it also does not change the semantics of the program).
erosb source share