RFR: 8307352: AARCH64: Improve itable_stub [v7]

Boris Ulasevich bulasevich at openjdk.org
Fri Aug 25 05:40:16 UTC 2023


On Thu, 24 Aug 2023 13:54:16 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> Boris Ulasevich has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits:
>> 
>>  - rework loop_scan_resolved_entry cycle as proposed
>>  - 8307352: AARCH64: Improve itable_stub
>
> src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp line 1230:
> 
>> 1228:   // itableOffsetEntry[] itable = recv_klass + Klass::vtable_start_offset() + recv_klass->_vtable_len;
>> 1229:   // temp_itbl_klass = itable[0]._interface;
>> 1230:   ldr(temp_itbl_klass, Address(recv_klass, scan_temp, Address::lsl(3)));
> 
> What is `Address::lsl(3)` here? From x86_64, it seems to be related to `ioffset`? If so, this magic `3` should derive from it.

This magic actually comes from the original MacroAssembler::lookup_interface_method code.
Let me use exact_log2(vtableEntry::size_in_bytes()) value here to show that it is related to vtable entry size:

  ldrw(scan_temp, Address(recv_klass, Klass::vtable_length_offset()));
  add(recv_klass, recv_klass, vtable_start_offset + ioffset);
  // itableOffsetEntry[] itable = recv_klass + Klass::vtable_start_offset() + sizeof(vtableEntry) * recv_klass->_vtable_len;
  // temp_itbl_klass = itable[0]._interface;
  ldr(temp_itbl_klass, Address(recv_klass, scan_temp, Address::lsl(exact_log2(vtableEntry::size_in_bytes()))));

> src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp line 1233:
> 
>> 1231:   mov(holder_offset, zr);
>> 1232:   // scan_temp = &(itable[0]._interface)
>> 1233:   lea(scan_temp, Address(recv_klass, scan_temp, Address::lsl(3)));
> 
> Same here: `Address::lsl(3)`.

OK

> src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp line 1296:
> 
>> 1294:   bind(L_holder_found);
>> 1295:   ldrw(method_result, Address(scan_temp, ooffset - ioffset));
>> 1296:   add(recv_klass, recv_klass, (itable_index << 3) + in_bytes(itableMethodEntry::method_offset()) - vtable_start_offset - ioffset);
> 
> Same magic number here: `itable_index << 3`.

Let it be (itable_index << LogBytesPerWord)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13792#discussion_r1305159994
PR Review Comment: https://git.openjdk.org/jdk/pull/13792#discussion_r1305160070
PR Review Comment: https://git.openjdk.org/jdk/pull/13792#discussion_r1305160570


More information about the hotspot-dev mailing list