RFR: 8344387: RISC-V: C2: Improve encoding of LoadNKlass for compact headers

Fei Yang fyang at openjdk.org
Tue Nov 19 10:26:43 UTC 2024


On Tue, 19 Nov 2024 09:34:33 GMT, Hamlin Li <mli at openjdk.org> wrote:

>> 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)

All right then ;-)

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/22203#discussion_r1848064450


More information about the hotspot-compiler-dev mailing list