RFR: JDK-8323497: On x64, use 32-bit immediate moves for narrow klass base if possible
Thomas Stuefe
stuefe at openjdk.org
Tue Jan 30 11:51:50 UTC 2024
On Wed, 10 Jan 2024 18:44:57 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> @shipilev It is just the code representation of the matching, the corresponding nodes are `loadConUL32`, `loadConL32` and `loadConL` and the matcher uses node costs to sort out the priority.
>>
>> https://github.com/openjdk/jdk/blob/c1282b57f50002edd08c93aed784390cca83b9b8/src/hotspot/cpu/x86/x86_64.ad#L4807
>
> Oh, subtle. Thanks!
With the new movptr variant, things look good:
< 2g
;; decode_klass_not_null
0x00007fcb608681c4: mov $0x18000000,%r11d
0x00007fcb608681c4: 41 bb 00 00 00 18
0x00007fcb608681ca: add %r11,%r10
0x00007fcb608681ca: 4d 03 d3
< 4g
;; decode_klass_not_null
0x00007f382c8681c4: mov $0x85000000,%r11d
0x00007f382c8681c4: 41 bb 00 00 00 85
0x00007f382c8681ca: add %r11,%r10
0x00007f382c8681ca: 4d 03 d3
> 4g
;; decode_klass_not_null
0x00007fd8908681c4: movabs $0x7fd7b6000000,%r11
0x00007fd8908681c4: 49 bb 00 00 00 b6 d7 7f 00 00
0x00007fd8908681ce: add %r11,%r10
0x00007fd8908681ce: 4d 03 d3
I assume if the 32-bit mov variants were to use non-Rxx registers, the REX prefix could also be omitted? Giving us another byte back.
I'll run tests with the new variant.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17340#discussion_r1448706776
More information about the hotspot-dev
mailing list