Translating JVM Code to MIPS Code - Campbell, Bill; Iyer, Swami; Akbal-Delibas, Bahar (Introduction to Compiler Construction in a Java World, 2013)
Compilation is not necessarily over with after the class file is constructed. At “execution,” the class is loaded into the JVM and then interpreted. In the Oracle HotSpotTMVM, once a method has been executed several times, it is compiled to native code-code that can be directly executed by the underlying computer. Once these hotspots in the code are compiled, the native code is cached so that it may be re-used in subsequent invocations of the method. So at run-time, control shifts back and forth between JVM code and native code. Of course, the native code runs much faster than the interpreted JVM code. This regimen takes advantage of the fact that nearly all programs spend most of their time executing small regions of code.