RFR: JDK-8323497: On x64, use 32-bit immediate moves for narrow klass base if possible
Quan Anh Mai
qamai at openjdk.org
Tue Jan 30 11:51:50 UTC 2024
On Wed, 10 Jan 2024 09:56:07 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> I haven't changed the name of the method. `movptr` means "move something of the width of the machine pointer", like everywhere else in assembler code. That fits your case, I think?
>
> Hmm, movptr only works its magic if the input is smaller than signed int max (2gb), and it needs one byte more than my variant.
>
> base < 2g:
>
>
> 35 ;; decode_klass_not_null
> 36 0x00007efdcc9e51c4: mov $0x27000000,%r11
> 37 0x00007efdcc9e51cb: add %r11,%r10
>
>
> base > 2g:
>
>
> 35 ;; decode_klass_not_null
> 36 0x00007ff7a89e51c4: movabs $0x82000000,%r11
> 37 0x00007ff7a89e51ce: add %r11,%r10
FYI the logic for immediate matching is:
if (is_uimm32(imm)) {
movl(dst, imm);
} else if (is_simm32(imm)) {
movq(dst, imm);
} else {
mov64(dst, imm);
}
The reason is that `movl` is smaller than `movq` in code size.
Maybe we can change `movptr` to this. I hope that I do not miss anything here.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17340#discussion_r1447161579
More information about the hotspot-dev
mailing list