Search code examples
javajvmclassloaderjit

Why is JIT part of Execution engine of JVM?


Following is the flow of a java program execution:

Bytecode (Javac) -> ClassLoader -> Execution Engine (JIT).

When the source code is compiled and classloader feeds the bytecode to execution engine to interpret and run the program, why the Just-In-Time (JIT) compiler present in an execution engine when there is nothing to compile?


Solution

  • The bytecode contains abstract instructions for the Java virtual machine. The instructions are not directly executable by conventional machines. The JIT step compiles this abstract bytecode into concrete machine code that can be executed by the machine's CPU.