RFR: 8307352: AARCH64: Improve itable_stub [v8]

Andrew Haley aph at openjdk.org
Sat Aug 26 20:42:14 UTC 2023


On Sat, 26 Aug 2023 20:10:49 GMT, Evgeny Astigeevich <eastigeevich at openjdk.org> wrote:

>> Boris Ulasevich has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Comments applied: get rid of temp_reg3; replace the magic constants
>
> src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp line 1231:
> 
>> 1229:   // itableOffsetEntry[] itable = recv_klass + Klass::vtable_start_offset() + sizeof(vtableEntry) * recv_klass->_vtable_len;
>> 1230:   // temp_itbl_klass = itable[0]._interface;
>> 1231:   ldr(temp_itbl_klass, Address(recv_klass, scan_temp, Address::lsl(exact_log2(vtableEntry::size_in_bytes()))));
> 
> The lsl shift in `ldr` must be 3.
> Can we have a static assert checking that? There is an assert in `Address::encode` which will catch the issue in debug builds. As `vtableEntry::size_in_bytes()` is statically known we can catch the issue during compilation.

I'm very surprised that isn't a guarantee. I had to look to be sure. I'd simply change `assert(ext().shift() <= 0 || ext().shift() == (int)size, "bad shift");` to a `guarantee`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13792#discussion_r1306563213


More information about the hotspot-dev mailing list