On Tue, 7 Mar 2023 13:30:50 GMT, Coleen Phillimore <cole...@openjdk.org> wrote:

>> The current structure used to store the resolution information for 
>> invokedynamic, ConstantPoolCacheEntry, is difficult to interpret due to its 
>> ambigious fields f1 and f2. This structure can hold information for fields, 
>> methods, and invokedynamics and each of its fields can hold different types 
>> of values depending on the entry. 
>> 
>> This enhancement proposes a new structure to exclusively contain 
>> invokedynamic information in a manner that is easy to interpret and easy to 
>> extend.  Resolved invokedynamic entries will be stored in an array in the 
>> constant pool cache and the operand of the invokedynamic bytecode will be 
>> rewritten to be the index into this array.
>> 
>> Any areas that previously accessed invokedynamic data from 
>> ConstantPoolCacheEntry will be replaced with accesses to this new array and 
>> structure. Verified with tier1-9 tests.
>> 
>> The PPC was provided by @reinrich and the RISCV port was provided by 
>> @DingliZhang and @zifeihan.
>> 
>> This change supports the following platforms: x86, aarch64, PPC, and RISCV
>
> src/hotspot/cpu/ppc/templateTable_ppc_64.cpp line 53:
> 
>> 51: 
>> 52: #undef __
>> 53: #define __ Disassembler::hook<InterpreterMacroAssembler>(__FILE__, 
>> __LINE__, _masm)->
> 
> What is this?  Is this something useful for debugging the template 
> interpreter?  Probably doesn't belong with this change but might be nice to 
> have (?) @reinrich

Yes this is really useful when debugging the template interpreter. It annotates 
the disassembly with the generator source code. It helped tracking down a bug 
in the ppc part oft this pr. Other platforms have it too.

Example:

invokedynamic  186 invokedynamic  [0x00003fff80075a00, 0x00003fff80075dc8]  968 
bytes

--------------------------------------------------------------------------------
  0x00003fff80075a00:   std     r17,0(r15)                  ;;@FILE: 
src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp
                                                            ;; 2185:   aep = __ 
pc();  __ push_ptr();  __ b(L);
  0x00003fff80075a04:   addi    r15,r15,-8
  0x00003fff80075a08:   b       0x00003fff80075a40          ;; 2185:   aep = __ 
pc();  __ push_ptr();  __ b(L);
  0x00003fff80075a0c:   stfs    f15,0(r15)                  ;; 2186:   fep = __ 
pc();  __ push_f();    __ b(L);
  0x00003fff80075a10:   addi    r15,r15,-8
  0x00003fff80075a14:   b       0x00003fff80075a40          ;; 2186:   fep = __ 
pc();  __ push_f();    __ b(L);
  0x00003fff80075a18:   stfd    f15,-8(r15)                 ;; 2187:   dep = __ 
pc();  __ push_d();    __ b(L);
  0x00003fff80075a1c:   addi    r15,r15,-16
  0x00003fff80075a20:   b       0x00003fff80075a40          ;; 2187:   dep = __ 
pc();  __ push_d();    __ b(L);
  0x00003fff80075a24:   li      r0,0                        ;; 2188:   lep = __ 
pc();  __ push_l();    __ b(L);
  0x00003fff80075a28:   std     r0,0(r15)
  0x00003fff80075a2c:   std     r17,-8(r15)
  0x00003fff80075a30:   addi    r15,r15,-16
  0x00003fff80075a34:   b       0x00003fff80075a40          ;; 2188:   lep = __ 
pc();  __ push_l();    __ b(L);
  0x00003fff80075a38:   stw     r17,0(r15)                  ;; 2189:   __ 
align(32, 12, 24); // align L
                                                            ;; 2191:   iep = __ 
pc();  __ push_i();
  0x00003fff80075a3c:   addi    r15,r15,-8
  0x00003fff80075a40:   li      r21,1                       ;; 2192:   vep = __ 
pc();
                                                            ;; 2193:   __ 
bind(L);
                                                            ;;@FILE: 
src/hotspot/share/interpreter/templateInterpreterGenerator.cpp
                                                            ;;  366:   __ 
verify_FPU(1, t->tos_in());
                                                            ;;@FILE: 
src/hotspot/cpu/ppc/templateTable_ppc_64.cpp
                                                            ;; 2293:   __ 
load_resolved_indy_entry(cache, index);
  0x00003fff80075a44:   lwax    r21,r14,r21
  0x00003fff80075a48:   nand    r21,r21,r21
  0x00003fff80075a4c:   ld      r31,40(r27)
  0x00003fff80075a50:   rldicr  r21,r21,4,59
  0x00003fff80075a54:   addi    r21,r21,8
  0x00003fff80075a58:   add     r31,r31,r21
  0x00003fff80075a5c:   ld      r22,0(r31)                  ;; 2294:   __ 
ld_ptr(method, in_bytes(ResolvedIndyEntry::method_offset()), cache);
  0x00003fff80075a60:   cmpdi   r22,0                       ;; 2297:   __ 
cmpdi(CCR0, method, 0);
  0x00003fff80075a64:   bne-    0x00003fff80075b94          ;; 2298:   __ 
bne(CCR0, resolved);,bo=0b00100[no_hint]
  0x00003fff80075a68:   li      r4,186                      ;; 2304:   __ 
li(R4_ARG2, code);
  0x00003fff80075a6c:   ld      r11,0(r1)                   ;; 2305:   __ 
call_VM(noreg, entry, R4_ARG2, true);

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

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

Reply via email to