So, I have this method written in Java:
public void myMethod(int y){ int x = 5 + y; doSomething(x); }
And suppose my application calls this many times.
When you run the compiled code for this method on the Java virtual machine, the JVM first interprets this method. Then after a while he decides to compile it into machine language, if I understand correctly.
In this moment
Will it be overwritten by machine code in memory? If it is overwritten, how will the difference in size problem be solved? If it is written to another location in memory, will the bytecode be freed, loaded into memory, or not? And also, if both the bytes and jit compiled code are in memory when the application calls this method again, how does the JVM decide to execute the compiled jit code instead of the byte code?
java jvm jit
Koray tugay
source share