Skip to content

openjdk 1.8 分层编译功能验证

分层编译简介

Image title

1.JVM 分层编译参数测试

测试JVM使用不同控制参数影响编译器开启情况,未出现异常。 Image title

Graal编译器 不支持,jdk10 引入,jdk1.8 没有 Image title

jdk 1.8 c1,c2编译器监控确认没有生效。 Image title

2.x86环境 情况对比

[root@njatwx-j08-03 javatest]# java -version
openjdk version "1.8.0_302"
OpenJDK Runtime Environment (build 1.8.0_302-b08)
OpenJDK 64-Bit Server VM (build 25.302-b08, mixed mode)
[root@njatwx-j08-03 javatest]# java -Xmixed -XX:+CITime   -XX:+PrintCompilation -Xmx100m -Xms10m fannkuchredux 10
     31    1       3       java.lang.Object::<init> (1 bytes)
     31    2       3       java.lang.String::hashCode (55 bytes)
     31    3       3       java.lang.String::indexOf (70 bytes)
     32    4       3       java.lang.String::charAt (29 bytes)
     32    5       3       java.lang.String::length (6 bytes)
     32    6     n 0       java.lang.System::arraycopy (native)   (static)
     32    7       3       java.lang.Math::min (11 bytes)
     32    8       3       java.lang.AbstractStringBuilder::ensureCapacityInternal (27 bytes)
     32    9       1       java.lang.Object::<init> (1 bytes)
     32    1       3       java.lang.Object::<init> (1 bytes)   made not entrant
     33   10       3       java.lang.String::equals (81 bytes)
     35   11       1       java.lang.ref.Reference::get (5 bytes)
     36   12       1       java.lang.ThreadLocal::access$400 (5 bytes)
     36   13       3       java.util.Arrays::copyOfRange (63 bytes)
     37   14       3       java.lang.System::getSecurityManager (4 bytes)
     37   15       3       fannkuchredux::countFlips (118 bytes)
     37   17       3       fannkuchredux::nextPermutation (112 bytes)
     37   16       3       java.lang.Math::max (11 bytes)
     39   18       3       java.lang.String::getChars (62 bytes)
     59   20       4       fannkuchredux::nextPermutation (112 bytes)
     60   19       4       fannkuchredux::countFlips (118 bytes)
     63   17       3       fannkuchredux::nextPermutation (112 bytes)   made not entrant
     64   21       4       java.lang.Math::max (11 bytes)
     64   16       3       java.lang.Math::max (11 bytes)   made not entrant
     75   15       3       fannkuchredux::countFlips (118 bytes)   made not entrant
     97   22 %     3       fannkuchredux::runTask @ 36 (115 bytes)
     98   23       3       fannkuchredux::runTask (115 bytes)
    170   24 %     4       fannkuchredux::runTask @ 36 (115 bytes)
    175   22 %     3       fannkuchredux::runTask @ -2 (115 bytes)   made not entrant
    181   25       4       fannkuchredux::runTask (115 bytes)
    187   23       3       fannkuchredux::runTask (115 bytes)   made not entrant
    196   26       3       fannkuchredux::firstPermutation (137 bytes)
73196
Pfannkuchen(10) = 38
Accumulated compiler times (for compiled methods only)
------------------------------------------------
  Total compilation time   :  0.035 s
    Standard compilation   :  0.029 s, Average : 0.001
    On stack replacement   :  0.006 s, Average : 0.003
    Detailed C1 Timings
       Setup time:         0.000 s ( 0.0%)
       Build IR:           0.002 s (37.2%)
         Optimize:            0.000 s ( 2.0%)
         RCE:                 0.000 s ( 1.1%)
       Emit LIR:           0.002 s (37.8%)
         LIR Gen:           0.000 s ( 9.4%)
         Linear Scan:       0.001 s (27.8%)
       LIR Schedule:       0.000 s ( 0.0%)
       Code Emission:      0.001 s (14.9%)
       Code Installation:  0.000 s (10.1%)
       Instruction Nodes:    878 nodes
  Total compiled methods   :     25 methods
    Standard compilation   :     23 methods
    On stack replacement   :      2 methods
  Total compiled bytecodes :   2138 bytes
    Standard compilation   :   1645 bytes
    On stack replacement   :    493 bytes
  Average compilation speed:  61702 bytes/s
  nmethod code size        :  20704 bytes
  nmethod total size       :  37448 bytes
[root@njatwx-j08-03 javatest]# java -Xint -XX:+CITime   -XX:+PrintCompilation -Xmx100m -Xms10m fannkuchredux 10
73196
Pfannkuchen(10) = 38
Accumulated compiler times (for compiled methods only)
------------------------------------------------
  Total compilation time   :  0.000 s
    Standard compilation   :  0.000 s, Average : -nan
    On stack replacement   :  0.000 s, Average : -nan
  Total compiled methods   :      0 methods
    Standard compilation   :      0 methods
    On stack replacement   :      0 methods
  Total compiled bytecodes :      0 bytes
    Standard compilation   :      0 bytes
    On stack replacement   :      0 bytes
  Average compilation speed: -2147483648 bytes/s
  nmethod code size        :      0 bytes
  nmethod total size       :      0 bytes
另外specjbb测试发下jdk1.8运行时间很长,初步结论当前测试jdk 1.8的 c1,c2编译器有问题,需要跟踪社区进展。