Java / GraalVM Interview questions
Define the Graal compiler's JIT role within HotSpot?
Inside a standard HotSpot JVM, the Graal compiler can be enabled as the top-tier JIT compiler, plugging in through HotSpot's JVMCI (JVM Compiler Interface) as a replacement for the default C2 compiler.
HotSpot still handles interpretation and lower-tier compilation the same way it always has; once a method gets hot enough, instead of handing it to C2, JVMCI hands the bytecode and profiling data to Graal, which compiles it using its graph-based IR and returns machine code back to HotSpot to install.
java -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler -jar app.jar
This is how you can get Graal's optimizations on a regular JVM deployment without touching Native Image at all - useful when you want Graal's peak throughput benefits but still need full dynamic classloading and reflection.
More Related questions...