RFR: 8296301: Interpreter(RISC-V): Implement -XX:+PrintBytecodeHistogram and -XX:+PrintBytecodePairHistogram options

Yanhong Zhu yzhu at openjdk.org
Wed Nov 9 03:20:04 UTC 2022


In this patch, count_bytecode() is modified by using "x7" as temporary register. Also implement histogram_bytecode() and histogram_bytecode_pair(), which can be enabled on debug mode by setting the options PrintBytecodeHistogram and PrintBytecodePairHistogram.

The following is the output when PrintBytecodeHistogram or PrintBytecodePairHistogram is TRUE.

$ java -XX:+PrintBytecodeHistogram --version|head -n 20
openjdk 20 2022-11-09
OpenJDK Runtime Environment (fastdebug build 20)
OpenJDK 64-Bit Server VM (fastdebug build 20, mixed mode)

Histogram of 8101142 executed bytecodes:

  absolute  relative  code    name
----------------------------------------------------------------------
    634592     7.83%    dc    fast_aload_0
    471840     5.82%    b6    invokevirtual
    376275     4.64%    2b    aload_1
    358520     4.43%    e0    fast_iload
    332267     4.10%    de    fast_aaccess_0
    270189     3.34%    a7    goto
    249831     3.08%    19    aload
    223361     2.76%    b9    invokeinterface
    215666     2.66%    1c    iload_2
    194877     2.41%    b8    invokestatic
    192212     2.37%    2c    aload_2
    185826     2.29%    1b    iload_1

$ java -XX:+PrintBytecodePairHistogram --version|head -n 20
openjdk 20 2022-11-09
OpenJDK Runtime Environment (fastdebug build 20)
OpenJDK 64-Bit Server VM (fastdebug build 20, mixed mode)

Histogram of 7627721 executed bytecode pairs:

  absolute  relative    codes    1st bytecode        2nd bytecode
----------------------------------------------------------------------
    102673    1.346%    84 a7    iinc                goto
     85429    1.120%    dc 2b    fast_aload_0        aload_1
     84394    1.106%    dc b6    fast_aload_0        invokevirtual
     73131    0.959%    b7 dc    invokespecial       fast_aload_0
     64605    0.847%    2b b6    aload_1             invokevirtual
     64086    0.840%    dc b9    fast_aload_0        invokeinterface
     63663    0.835%    b6 dc    invokevirtual       fast_aload_0
     59946    0.786%    b6 de    invokevirtual       fast_aaccess_0
     56631    0.742%    36 e0    istore              fast_iload
     51261    0.672%    b9 de    invokeinterface     fast_aaccess_0
     49556    0.650%    3a 19    astore              aload
     49106    0.644%    a7 e0    goto                fast_iload

-------------

Commit messages:
 - Implement -XX:+PrintBytecodeHistogram and -XX:+PrintBytecodePairHistogram options

Changes: https://git.openjdk.org/jdk/pull/11051/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11051&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8296301
  Stats: 31 lines in 1 file changed: 22 ins; 5 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/11051.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11051/head:pull/11051

PR: https://git.openjdk.org/jdk/pull/11051


More information about the hotspot-dev mailing list