RFR: JDK-8293676: riscv: Trampoline not created for far runtime targets outside small CodeCache

Dingli Zhang dzhang at openjdk.org
Tue Sep 13 06:45:53 UTC 2022


On Tue, 13 Sep 2022 03:12:12 GMT, Yadong Wang <yadongwang at openjdk.org> wrote:

>> Follow up [JDK-8286314](https://bugs.openjdk.org/browse/JDK-8286314), this case also exists in riscv.
>> 
>> `relocInfo::runtime_call_type` calls can have targets inside or outside CodeCache. If offsets to the targets are not in range, trampoline calls must be used. Currently trampolines for calls are generated based on the size of CodeCache and the maximum possible branch range. If the size of CodeCache is smaller than the range, no trampoline is generated. This works well if a target is inside CodeCache. It does not work if a target is outside CodeCache and CodeCache size is smaller than the maximum possible branch range.
>> 
>> ## Testing:
>> 
>> - hotspot/jdk tier1 on unmatched board
>
> src/hotspot/cpu/riscv/macroAssembler_riscv.cpp line 2831:
> 
>> 2829:     address longest_branch_start = (target < CodeCache::low_bound()) ? CodeCache::high_bound() - NativeInstruction::instruction_size
>> 2830:                                                                      : CodeCache::low_bound();
>> 2831:     need_trampoline = !reachable_from_branch_at(longest_branch_start, target);
> 
> We have only +/-1Mb range in the riscv architecture, which is not enough for CodeCache in most case. In contrast, the branch range is 128 Mb in AArch64. So, is this modification necessary for the rv port?

Hi @yadongw , thanks for reviewing.
Indeed in riscv64 CodeCache is basically not smaller than branch range (CodeCache initial size is usually 48M by default and the reserved size is usually 240M by default), in riscv64 this optimization seems to be not too meaningful, I apologize for my oversight and I will close this PR.
Thanks again.

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

PR: https://git.openjdk.org/jdk/pull/10246


More information about the hotspot-dev mailing list