Search code examples
javajvmjitjstat

How to understand jstat -printcompilation output


jstat -printcompilation pid 

can get information about the last method that is compiled, like:

Compiled  Size  Type Method
     207     64    1 java/lang/CharacterDataLatin1 toUpperCase
     208      5    1 java/math/BigDecimal$StringBuilderHelper getCharArray

What's the third column mean? I can't find detail info about 'Type'. How many types inclued?

https://docs.oracle.com/javase/9/tools/jstat.htm#JSWOR734

oracle document dont' have enough info yet


Solution

  • The value in Type column corresponds to this enum:

    1 = normal_compile  // Regular JIT compilation
    2 = osr_compile     // On-stack replacement
    3 = native_compile  // Compiled wrapper for a native method
    

    However, the values other than normal_compile are available only in debug builds of the JVM when -XX:+CICountOSR or -XX:+CICountNative option is set:

      int last_compile_type = normal_compile;
      if (CICountOSR && is_osr) {
        last_compile_type = osr_compile;
      } else if (CICountNative && method->is_native()) {
        last_compile_type = native_compile;
      }
    

    In practice this means that Type is always 1 with a regular JDK.