1. Deoptimization allows the compiler to back out previous versions of compiled
2. Code is deoptimized when previous optimizations are no longer valid (e.g., be-
cause the type of the objects in question has changed).
3. There is usually a small, momentary effect in performance when code is deoptim-
ized, but the new code usually warms up quickly again.
4. Under tiered compilation, code is deoptimized when it had previously been com-
piled by the client compiler and has now been optimized by the server compiler.
Tiered Compilation Levels
The compilation log for a program using tiered compilation prints the tier level at which each
method is compiled. In the example from the last section, code was compiled up through
level 4, even though to simplify the discussion so far, I've said there are only two compilers
(plus the interpreter).
It turns out that there are five levels of execution, because the client compiler has three dif-
ferent levels. So the level of compilation runs from:
▪ 0: Interpreted code
▪ 1: Simple C1 compiled code
▪ 2: Limited C1 compiled code
▪ 3: Full C1 compiled code
▪ 4: C2 compiled code
A typical compilation log shows that most methods are first compiled at level 3: full C1
compilation. (All methods start at level 0, of course.) If they run often enough, they will get
compiled at level 4 (and the level 3 code will be made not entrant). This is the most frequent
path: the client compiler waits to compile something until it has information about how the
code is used that it can leverage to perform optimizations.