Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's this new column in -XX:+PrintCompilation output?

While using -XX:+PrintCompilation recently (JDK 8r111) to examine method compilation, I noticed a new column which doesn't appear in the documentation I can find on the topic:

          this column
               |
               |
               v
600    1  s    3       java.util.Hashtable::get (69 bytes)
601    4       3       java.lang.Character::toLowerCase (6 bytes)
601    8       3       java.io.UnixFileSystem::normalize (75 bytes)
602   12       3       java.lang.ThreadLocal::get (38 bytes)
602   14       3       java.lang.ThreadLocal$ThreadLocalMap::getEntry (42 bytes)
602   18       2       java.lang.String::startsWith (72 bytes)
602   10       4       java.lang.String::equals (81 bytes)
602    2 %     4       java.lang.String::hashCode @ 24 (55 bytes)
602   16  s!   3       sun.misc.URLClassPath::getLoader (197 bytes)
603   23     n 0       java.lang.System::arraycopy (native)   (static)
604   27     n 0       sun.misc.Unsafe::getObjectVolatile (native)   

Any clue what it means? It seems to vary between 0 and 3, with native methods always 0, and other methods always non-zero.

like image 532
BeeOnRope Avatar asked Dec 14 '16 02:12

BeeOnRope


1 Answers

This is a tier in Tiered Compilation mode.

  • At tiers 1, 2, 3 the code is compiled by C1 with different amount of extra profiling. It may sound counterintuitive, but the most optimized of them is tier 1 since it has no profiling overhead (and no chance to be further optimized).
  • At tier 4 the code is compiled by C2. To produce highly optimized code C2 requires execution statistics gathered at tier 3 or during interpretation.

Here is how Tiered Compilation flow looks like. You may find the explanation in this answer.

HotSpot Tiered Compilation

More details can be found in the HotSpot source code comments, which defines the levels as follows:

  • level 0 - interpreter
  • level 1 - C1 with full optimization (no profiling)
  • level 2 - C1 with invocation and backedge counters
  • level 3 - C1 with full profiling (level 2 + MDO)
  • level 4 - C2
like image 152
apangin Avatar answered Nov 02 '22 10:11

apangin