Compiler control [JEP 165]
Controlling Java Virtual Machine compilers might seem like an unnecessary task, but for many developers, this is an important aspect of testing. Java Enhancement Proposal 165 detailed a plan to implement runtime management of JVM compilers. This is accomplished with method-dependent compiler flags.
In this section, we will start with a look at JVM compilation modes, then look at the compiler that can be controlled using the Java 9 platform.
Compilation modes
The changes in the Java 9 platform include granular control of both the c1 and c2 JVM compliers. As you can see in the following illustration, the Java HotSpot JVM has two Just-in-Time (JIT) compilation modes--c1 and c2:
The C1 and C2 compilation modes use different compilation techniques and, if used on the same code base, can produce different sets of machine code.
C1 compilation mode
The C1 compilation mode inside Java HotSpot VM is typically used for applications that have the following characteristics:
- Quick...