RFR: JDK-8323497: On x64, use 32-bit immediate moves for narrow klass base if possible [v4]
Aleksey Shipilev
shade at openjdk.org
Wed Feb 21 10:49:55 UTC 2024
On Wed, 21 Feb 2024 07:47:08 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> On x64, we always use the long form of mov immediate to load the klass base into a register. If the klass base fits into 32 bits, we could use the short form and save four instruction bytes.
>>
>> Before: mov uses 10 instruction bytes:
>>
>>
>> 35 ;; decode_klass_not_null
>> 36 0x00007f8b089e51c4: movabs $0x82000000,%r11
>> 37 0x00007f8b089e51ce: add %r11,%r10
>>
>>
>> Now: mov uses 6 instruction bytes:
>>
>>
>> 35 ;; decode_klass_not_null
>> 36 0x00007fbe609e51c4: mov $0x82000000,%r11d
>> 37 0x00007fbe609e51ca: add %r11,%r10
>>
>>
>> Note that this optimization does not depend on zero-based addressing, and therefore we change class space reservation: we now always look in low-address regions first.
>>
>> ----------
>>
>> Tests: tier1 (GHA), tier 2 on x64 linux
>
> Thomas Stuefe has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
>
> - Merge branch 'openjdk:master' into use-32bit-immediate-moves-on-x64-for-klass-encoding-base
> - Merge branch 'openjdk:master' into use-32bit-immediate-moves-on-x64-for-klass-encoding-base
> - Merge branch 'openjdk:master' into use-32bit-immediate-moves-on-x64-for-klass-encoding-base
> - remove obsolete comment
> - use-32bit-immediate-moves-on-x64-for-klass-encoding-base
This looks reasonable to me, but it keeps me wondering if any code anywhere relies on compressed oops decoding path to take the exact amount of bytes. Could you please run `make test TEST=all` on at least one arch before integrating?
-------------
Marked as reviewed by shade (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/17340#pullrequestreview-1892777200
More information about the hotspot-dev
mailing list