Bug in getPCDescNearDbg?

David Griffiths david.griffiths at gmail.com
Tue Jul 10 17:06:28 UTC 2018


I've using OpenJDK 64-Bit Server VM (build 25.71-b00, mixed mode) and
running with:

-Xcomp -XX:TieredStopAtLevel=1 -XX:+UnlockDiagnosticVMOptions
'-XX:CompileCommand=print,java/math/*.*'

and looking at the resulting ScopeDesc and PCDesc descriptors. It appears
as though the BCI calculated by getPCDescNearDbg is off by one and I just
want to check if I'm interpreting things correctly.

As an example, here are some snippets of the assembler output (some lines
removed for clarity):

  0x00007fe041783348: sub    $0x1b0,%rsp        ;*aload_1
                                                ; -
java.math.BigInteger::oddModPow at 0 (line 2682)
  0x00007fe041783377: mov    %rdi,%rsi          ;*invokevirtual equals
                                                ; -
java.math.BigInteger::oddModPow at 4 (line 2682)
  0x00007fe04178338f: jne    0x00007fe041784624  ;*ifeq
                                                ; -
java.math.BigInteger::oddModPow at 7 (line 2682)
  0x00007fe041783395: mov    0xc(%rsi),%edi     ;*getfield signum
                                                ; -
java.math.BigInteger::oddModPow at 13 (line 2686)
  0x00007fe04178339b: je     0x00007fe04178460b  ;*ifne
                                                ; -
java.math.BigInteger::oddModPow at 16 (line 2686)
  0x00007fe0417833a1: mov    0x20(%rsi),%esi    ;*getfield mag
                                                ; -
java.math.BigInteger::oddModPow at 24 (line 2689)
  0x00007fe0417833af: callq  0x00007fe041046020  ; OopMap{[176]=Oop
[168]=Oop off=148}
                                                ;*invokevirtual clone
                                                ; -
java.math.BigInteger::oddModPow at 27 (line 2689)
  0x00007fe0417833de: mov    %rax,%r11          ;*checkcast
                                                ; -
java.math.BigInteger::oddModPow at 30 (line 2689)
  0x00007fe0417833e1: mov    %r11,0xd0(%rsp)
  0x00007fe0417833e9: mov    0xa8(%rsp),%rdx
  0x00007fe0417833f1: mov    0x20(%rdx),%r13d   ;*getfield mag
                                                ; -
java.math.BigInteger::oddModPow at 35 (line 2690)
  0x00007fe0417833f5: mov    %r13,0xc8(%rsp)
  0x00007fe041783405: mov    0x20(%rcx),%r8d    ;*getfield mag
                                                ; -
java.math.BigInteger::oddModPow at 41 (line 2691)

If we take the PC 7fe0417833f1 as an example then this is part of the code
for BCI 35, line 2690. If I print out the PCDesc entries I see:

real pc = 7fe04178334f, bci = 0
real pc = 7fe04178337a, bci = 4
real pc = 7fe041783384, bci = 4
real pc = 7fe041783395, bci = 7
real pc = 7fe041783398, bci = 13
real pc = 7fe0417833a1, bci = 16
real pc = 7fe0417833a4, bci = 24
real pc = 7fe0417833b4, bci = 27
real pc = 7fe0417833e1, bci = 30
real pc = 7fe0417833f5, bci = 35
real pc = 7fe041783409, bci = 41

So it appears that the "real pc" address 7fe0417833f5 represents the _end_
of BCI 35. But getPCDescNearDbg obviously interprets these real pc
addresses as the _beginning_ of the code for that BCI and thus gets the
wrong line number.

Is this a bug in getPCDescNearDbg or am I misinterpreting things?

Cheers,

David


More information about the hotspot-dev mailing list