1.JIT Working principle diagram
Working principle
When JIT compilation is enabled (enabled by default), the JVM reads the. class file after it is interpreted and sends it to the JIT compiler. The JIT compiler compiles the bytecode into the machine code of the cost machine.
Usually javac the program source code compiled, converted to Java bytecode, the JVM through the interpretation of bytecode to translate it into the corresponding machine instructions, read into each, explain the translation. It is clear that, after interpretation, it will run at a slower pace than the binary bytecode program that can be run. In order to improve the speed of operation, JIT technology is introduced.
JIT will save the translated machine code at the time of execution and is ready for the next use, so in theory, the JIT technology can be used to get close to the once pure compilation technology.
2. Related Knowledge
JIT is just in time, instant compilation technology. Using this technique, you can speed up the operation of your Java program.
The JIT doesn't always work, and you can't expect the JIT to speed up your code, and worse, it might reduce the speed of your code. It depends on the structure of your code and, of course, in very many cases we can still get it.
From above we know the reason to close JITjava.lang.Compiler.disable (); is due to speed of operation. Because the JIT compiles each byte code, it causes the compilation process to be overloaded. To avoid this situation, the current JIT compiles only the often-running bytecode, such as loops, etc.
About JIT knowledge of Java