JDK-8332689 : RISC-V: Use load instead of trampolines
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 23
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • CPU: riscv
  • Submitted: 2024-05-22
  • Updated: 2025-09-11
  • Resolved: 2024-07-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 24
24 b07Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
Trampolines have some issues:
- On some CPUs L1D and L1I can't contain the same cache line.
  As the address in en trampoline is just under JALR we often hit this case.
  Hence the load to the address below will first need to evict the cacheline from L1I, bring it into L1D from L2(assuming it shared), load the address.
  Then the i-fetcher need to evict the cache-line from L1D bring into L1I from L2 and then execute the JALR.
  Is is very slow.
- JAL to trampoline is slower than load and JALR.

The only case where current implementation is superior is when you have very short distances so that the JAL can do directly without the trampoline to the destination (uncommon in larger workloads). 
Comments
> https://github.com/RealFYang/jdk/commit/1e0d09bf4243b91e88d71b3e90179e8f13e96969 Yes!
01-11-2024

Since this change is baked for quite some time, maybe it's time to remove the old trampoline call. And I have a cleanup fix for that purpose: https://github.com/RealFYang/jdk/commit/1e0d09bf4243b91e88d71b3e90179e8f13e96969 [~rehn] : What do you think?
01-11-2024

Changeset: 5c612c23 Branch: master Author: Robbin Ehn <rehn@openjdk.org> Date: 2024-07-11 10:24:00 +0000 URL: https://git.openjdk.org/jdk/commit/5c612c230b0a852aed5fd36e58b82ebf2e1838af
11-07-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/19453 Date: 2024-05-29 12:40:05 +0000
09-07-2024