RFR: 8285487: Do not generate trampolines for runtime calls if they are not needed [v3]

Xin Liu xliu at openjdk.java.net
Tue May 3 00:07:24 UTC 2022


On Thu, 28 Apr 2022 21:55:25 GMT, Evgeny Astigeevich <duke at openjdk.java.net> wrote:

>> [JDK-8280872](https://bugs.openjdk.java.net/browse/JDK-8280872) put the non-nmethod segment between two others. It made trampolines for runtime calls redundant in most cases.
>> 
>> This PR uses `target_needs_far_branch()` for runtime calls to check whether they need trampolines. Trampolines are not generated if they are not needed.
>> 
>> Testing:
>> - `tier1`...`tier4`: Passed
>> - `compiler/c2/aarch64/TestTrampoline.java`: Passed
>> 
>> Note: `compiler/c2/aarch64/TestTrampoline.java` requires the release build. This is because debug builds have the branch range set to 2M which causes always generation of trampolines.
>
> Evgeny Astigeevich has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Move code of target_needs_trampoline inside trampoline_call

src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp line 562:

> 560: 
> 561: // Maybe emit a call via a trampoline.  If the code cache is small
> 562: // trampolines won't be emitted.

> "The header comment is incorrect: "If the code cache is small trampolines won't be emitted."

I feel that Vladimir's comment is still legit here. From my reading, trampoline is avoidable because of  either codecache is small (far_branches() is false) or target_needs_far_branch() is false for runtime reloc.

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

PR: https://git.openjdk.java.net/jdk/pull/8403


More information about the hotspot-dev mailing list