RFR: 8344387: RISC-V: C2: Improve encoding of LoadNKlass for compact headers
Hamlin Li
mli at openjdk.org
Tue Nov 19 09:36:53 UTC 2024
On Mon, 18 Nov 2024 12:53:52 GMT, Fei Yang <fyang at openjdk.org> wrote:
>> Hi,
>> Can you help to review this patch? This is a follow-up of 8340453 on riscv.
>> Thanks!
>
> src/hotspot/cpu/riscv/riscv.ad line 4824:
>
>> 4822: ins_encode %{
>> 4823: __ lwu(as_Register($dst$$reg), Address(as_Register($mem$$base), $mem$$disp));
>> 4824: __ srli(as_Register($dst$$reg), as_Register($dst$$reg), (unsigned) markWord::klass_shift_at_offset);
>
> Do we need this explicit unsigned type conversion?
> (PS: I didn't see any issue when building without this type conversion)
Yes, you're right here, the `int` will be converted to `unsigned int` implicitly.
I added the explicit conversion because it makes the code more clear, and in `riscv.ad` similar conversions are explicit (e.g. `LShiftI` and so on)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22203#discussion_r1847985329
More information about the hotspot-compiler-dev
mailing list