Module: | Core Architecture, Basics & Control Flow
Q5: Consider the following statements regarding the Just-In-Time (JIT) Compiler in Java:
1. The JIT compiler improves application performance by compiling bytecode sequences into native machine code during program execution.
2. The JIT compiler persistently saves the newly generated native machine code directly to the computer's hard disk to optimize future program launches.
3. The Java Virtual Machine automatically invokes the JIT compiler to heavily optimize frequently executed code blocks known as HotSpots.
Which of the above statements is/are correct?
2. The JIT compiler persistently saves the newly generated native machine code directly to the computer's hard disk to optimize future program launches.
3. The Java Virtual Machine automatically invokes the JIT compiler to heavily optimize frequently executed code blocks known as HotSpots.
Which of the above statements is/are correct?
✅ Correct Answer: B
🎯 Quick Answer:
The correct combination is 1 and 3. Statement 2 is incorrect because the JIT compiler compiles bytecode directly into executable memory (RAM), not to the hard disk, to maintain cross-platform integrity and prevent security vulnerabilities.Structural Breakdown: The execution engine utilizes both an Interpreter and the JIT compiler simultaneously.
The JIT compiler architecture includes a Profiler (to identify HotSpots), intermediate code generators, and an optimizer (performing dead code elimination, constant folding, and method inlining). Historical/Related Context: Early versions of Java relied solely on a line-by-line interpreter, leading to a reputation for being slow compared to C++. The introduction of the HotSpot JVM revolutionized Java's speed by dynamically identifying and natively compiling code paths that were executed most frequently.
Causal Reasoning: Storing JIT-compiled code on a physical disk would defeat the Write Once Run Anywhere principle, as the resulting binary file would become tightly coupled to the specific operating system and CPU architecture it was generated on.