RFR: 8361449: RISC-V: Code cleanup for native call [v2]

Dingli Zhang dzhang at openjdk.org
Mon Jul 14 07:28:35 UTC 2025


On Mon, 14 Jul 2025 04:47:01 GMT, Dingli Zhang <dzhang at openjdk.org> wrote:

>> src/hotspot/cpu/riscv/nativeInst_riscv.cpp line 104:
>> 
>>> 102: 
>>> 103:   CodeBlob *code = CodeCache::find_blob(call_addr);
>>> 104:   assert(code != nullptr && code->is_nmethod(), "nmethod expected");
>> 
>> The `if (code != nullptr && code->is_nmethod())` statement indicates that `code->is_nmethod()` may not always be true. Do you think we should use assert here? Looks like the new assert logic is inconsistent with the original code.
>
> Following up on 6 [here](https://github.com/openjdk/jdk/pull/19796#issuecomment-2188094970), we also added a fast path in `Relocation::pd_call_destination` , which for ARM64 has the same assertion in `destination()`: 
> https://github.com/openjdk/jdk/blob/73e3e0edeb20c6f701b213423476f92fb05dd262/src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp#L53-L64

I will only keep the clean up part and revert the rest of the changes.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26150#discussion_r2204031907


More information about the hotspot-compiler-dev mailing list