Why JIT compilers can't be used to produce binary?
java, jit
Solution
The JIT compiler, compiles the code dynamically.
- It generates different code for different flavours of CPU.
- It generates different code for different memory models, e.g. For tyhe 64-bit JVM, if the maximum heap size is < 4 GB, < 24 GB, < 32 GB or more, you will produce different code in each case.
- It will re-compile code as classes are loaded and unloaded.
- It will re-optimise code based on how it is used. e.g. if a flag which used to be off is not on and visa-versa.
A static compiler cannot do these things.
Problem
JIT compilers are used to convert java byte-code into native machine language. And as far as I know, there is no program which can directly convert java byte-code into binary file such as .exe files. So why JIT compilers can't be used to produce binary from the byte-code?