Understanding Graal compiler optimizations
The Graal compiler performs some of the most advanced optimizations on the code just in time. The most critical ones are discussed in the following subsections.
Before getting into this session, please refer to the Understanding the optimizations performed by JIT section of Chapter 2, JIT, HotSpot, and GraalJIT.
Speculative optimization
JIT compilation relies heavily on the runtime profiling of the code. As we have seen, the graphs are optimized based on the HotSpots. HotSpots, as we covered in Chapter 2, JIT, HotSpot, and GraalJIT, are the control flows that the program goes through most frequently. There is no point in trying to optimize the whole code; instead, the JIT compiler tries to optimize the hot control paths/flows. This is based on speculation and assumption. When an assumption is proven wrong during execution, the compiler quickly deoptimizes and waits for another opportunity to optimize based on new HotSpots. We covered...