RFR: 8323497: On x64, use 32-bit immediate moves for narrow klass base if possible [v6]
Thomas Stuefe
stuefe at openjdk.org
Fri May 23 08:12:53 UTC 2025
On Thu, 22 May 2025 16:59:50 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> src/hotspot/cpu/x86/compressedKlass_x86.cpp line 41:
>>
>>> 39: result = reserve_address_space_X(0, nth_bit(32), size, Metaspace::reserve_alignment(), aslr);
>>> 40:
>>> 41: if (result == 0 && optimize_for_zero_base) {
>>
>> Should be `result == nullptr`.
>
> Plus, should we really drop `reserve_address_space_for_unscaled_encoding`? Looks to me we are trying additional things for `+COH` there.
Functionally, its all the same. See updated comment.
The thing with this coding and the similar ones for other platforms is that I tried to stay away from hard-coded assumptions as much as possible. Getting rid of the many hard-coded assumptions for "narrow Klass is 32Bit" for Lilliput was a royal pain. However, the whole class space reservation and decoding thing is difficult to abstract away while still wanting to have the best per-arch strategy.
So here I essentially gave up and hardcoded the assumptions about narrow Klass size (32 or 22 bits for now). I assert them at least, so that if that ever changes one trips over this code and knows to adjust it.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17340#discussion_r2104057179
More information about the hotspot-dev
mailing list