RFR: 7903461: JMH: perfasm profiler misses some jump edges

Aleksey Shipilev shade at openjdk.org
Fri Apr 21 12:24:19 UTC 2023


On some platforms, JMH perfasm does not render the jump edges properly, because it fails to parse the address lines correctly in the presence of oddly formatted disassembly output. This happens almost reliably on AArch64 hosts:


....[Hottest Region 1]..............................................................................
c2, level 4, org.openjdk.jmh.samples.jmh_generated.EnumBench_testMethod_jmhTest::testMethod_avgt_jmhStub, version 6, compile id 778
   
             0x0000ffff9c5c7fd4:   nop                                 ;   {other}
             0x0000ffff9c5c7fd8:   movk xzr, #0x2c4
             0x0000ffff9c5c7fdc:   movk xzr, #0x0
             0x0000ffff9c5c7fe0:   mov  x19, x29
             0x0000ffff9c5c7fe4:   ldr  x14, [sp, #64]
             0x0000ffff9c5c7fe8:   ldp  x13, x12, [sp]
             0x0000ffff9c5c7fec:   ldp  x20, x15, [sp, #16]         ;*invokespecial hashCode {reexecute=0 rethrow=0 return_oop=0}
                                                                       ; - java.lang.Enum::hashCode at 1 (line 175)
                                                                       ; - org.openjdk.jmh.samples.EnumBench::testMethod at 3 (line 52)
                                                                       ; - org.openjdk.jmh.samples.jmh_generated.EnumBench_testMethod_jmhTest::testMethod_avgt_jmhStub at 17 (line 186)
   3.10%     0x0000ffff9c5c7ff0:   ldarb        w11, [x15]                  ;*getfield isDone {reexecute=0 rethrow=0 return_oop=0}
                                                                       ; - org.openjdk.jmh.samples.jmh_generated.EnumBench_testMethod_jmhTest::testMethod_avgt_jmhStub at 30 (line 188)
             0x0000ffff9c5c7ff4:   ldr  x10, [x28, #896]
             0x0000ffff9c5c7ff8:   add  x20, x20, #0x1              ; ImmutableOopMap {r12=Oop r13=Oop r15=Derived_oop_r13 r14=Oop r19=Oop }
                                                                       ;*ifeq {reexecute=1 rethrow=0 return_oop=0}
                                                                       ; - (reexecute) org.openjdk.jmh.samples.jmh_generated.EnumBench_testMethod_jmhTest::testMethod_avgt_jmhStub at 33 (line 188)
             0x0000ffff9c5c7ffc:   ldr  wzr, [x10]                  ;   {poll}
   1.47%  ╭  0x0000ffff9c5c8000:   cbnz w11, 0x0000ffff9c5c8034     ;*aload_1 {reexecute=0 rethrow=0 return_oop=0}
          │                                                            ; - org.openjdk.jmh.samples.jmh_generated.EnumBench_testMethod_jmhTest::testMethod_avgt_jmhStub at 36 (line 189)
  10.53%  │  0x0000ffff9c5c8004:   mov  x10, #0xcce0                    // #52448
          │                                                            ;   {oop(a 'org/openjdk/jmh/samples/EnumBench$E'{0x0000000465dfcce0})}
          │  0x0000ffff9c5c8008:   movk x10, #0x65df, lsl #16
  12.19%  │  0x0000ffff9c5c800c:   movk x10, #0x4, lsl #32
          │  0x0000ffff9c5c8010:   ldr  x10, [x10]
   6.97%  │  0x0000ffff9c5c8014:   and  x11, x10, #0x3
          │  0x0000ffff9c5c8018:   cmp  x11, #0x1
          │  0x0000ffff9c5c801c:   b.ne 0x0000ffff9c5c7fb4  // b.any
  38.49%  │  0x0000ffff9c5c8020:   lsr  x10, x10, #8
          │  0x0000ffff9c5c8024:   and  w0, w10, #0x7fffffff
          │  0x0000ffff9c5c8028:   cbz  w0, 0x0000ffff9c5c7fb4      ;*invokespecial hashCode {reexecute=0 rethrow=0 return_oop=0}
          │                                                            ; - java.lang.Enum::hashCode at 1 (line 175)
          │                                                            ; - org.openjdk.jmh.samples.EnumBench::testMethod at 3 (line 52)
          │                                                            ; - org.openjdk.jmh.samples.jmh_generated.EnumBench_testMethod_jmhTest::testMethod_avgt_jmhStub at 17 (line 186)
  23.96%  │  0x0000ffff9c5c802c:   b    0x0000ffff9c5c7ff0
          │  0x0000ffff9c5c8030:   orr  x20, xzr, #0x1              ;*aload_1 {reexecute=0 rethrow=0 return_oop=0}
          │                                                            ; - org.openjdk.jmh.samples.jmh_generated.EnumBench_testMethod_jmhTest::testMethod_avgt_jmhStub at 36 (line 189)
          ↘  0x0000ffff9c5c8034:   adr  x9, 0x0000ffff9c5c804c
             0x0000ffff9c5c8038:   mov  x8, #0xb4c8                     // #46280
                                                                       ;   {runtime_call os::javaTimeNanos()}
             0x0000ffff9c5c803c:   movk x8, #0xb487, lsl #16
             0x0000ffff9c5c8040:   movk x8, #0xffff, lsl #32
....................................................................................................



Back branch to `0x0000ffff9c5c7ff0` is missing, for example.

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

Commit messages:
 - Fixes

Changes: https://git.openjdk.org/jmh/pull/100/files
 Webrev: https://webrevs.openjdk.org/?repo=jmh&pr=100&range=00
  Issue: https://bugs.openjdk.org/browse/CODETOOLS-7903461
  Stats: 167 lines in 2 files changed: 124 ins; 20 del; 23 mod
  Patch: https://git.openjdk.org/jmh/pull/100.diff
  Fetch: git fetch https://git.openjdk.org/jmh.git pull/100/head:pull/100

PR: https://git.openjdk.org/jmh/pull/100


More information about the jmh-dev mailing list