So I have this method, written in Java:
public void myMethod(int y){
int x = 5 + y;
doSomething(x);
}
And assume my application cal
As far as I know, the The Java® Virtual Machine Specification does not specify any of that.
The only reference to JIT I can find is in Chapter 3:
[...] One example of such a translator is a just-in-time (JIT) code generator, which generates platform-specific instructions only after Java Virtual Machine code has been loaded. This chapter does not address issues associated with code generation, only those associated with compiling source code written in the Java programming language to Java Virtual Machine instructions.
So to my understanding, this can be done differently by different implementations.
However, to me it seems very unlikely that the memory containing the java bytecode is overwritten with native CPU instructions, because CPU instructions are technically executable and bytecode is just data, as it has to be interpreted. It wouldn't be impossible though, just very odd.