RFR: 8359359: AArch64: share trampolines between static calls to the same method [v8]
Evgeny Astigeevich
eastigeevich at openjdk.org
Mon Nov 10 22:04:30 UTC 2025
On Thu, 6 Nov 2025 17:59:41 GMT, Mikhail Ablakatov <mablakatov at openjdk.org> wrote:
>> Modify the C2 compiler to share trampoline stubs between static calls that resolve to the same callee method. Since the relocation target for all static calls is initially set to the static call resolver stub, the call's target alone cannot be used to distinguish between different static method calls. Instead, trampoline stubs should be shared based on the actual callee.
>>
>> The `SharedTrampolineTest.java` was designed to verify the sharing of trampolines among static calls. However, due to imprecise log analysis, the test currently passes even when trampolines are not shared. Additionally, comments within the test suggest ambiguity regarding whether it was intended to assess trampoline sharing for static calls or runtime calls. To address these issues and eliminate ambiguity, this patch renames and updates the existing test. Furthermore, a new test is introduced, using the existing one as a foundation, to accurately evaluate trampoline sharing for both static and runtime calls.
>>
>> This has passed tier1-3 and jcstress testing on AArch64.
>
> Mikhail Ablakatov has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 18 commits:
>
> - Merge commit 'f6f87bb6759c86d941453a1776e8abfdffc48183' into 8359359
> - the only trampoline in ArrayCopyStub is never shared
> - fixup: a shared trampoline must branch to a statically bound method
> - share static call trampolines generated by C1 as well
> - assert callee is nullptr for runtime calls
> - assert that call sites offsets aren't missing
> - cleanup: rephrase comments in macroAssembler_aarch64.hpp
> - Merge commit 'fd29677479797956e0d205b5ce6e7cb9ad407bd1' into 8359359
> - Merge commit '41520998aa8808452ee384b213b2a77c7bad668d'
> - remove implementation-dependent logic from emit_shared_trampolines()
> - ... and 8 more: https://git.openjdk.org/jdk/compare/f6f87bb6...871903f4
test/hotspot/jtreg/compiler/sharedstubs/SharedRuntimeCallTrampolineTest.java line 87:
> 85:
> 86: private static void checkOutput(OutputAnalyzer output) {
> 87: String testMethodStdout = getTestMethodStdout(output);
Can you add a description what output format is expected? Adding an example will help a lot.
test/hotspot/jtreg/compiler/sharedstubs/SharedRuntimeCallTrampolineTest.java line 107:
> 105: .map(reloc -> new String(reloc.addr()))
> 106: .collect(Collectors.toList());
> 107: if (trampolineAddrs.stream().distinct().count() >= trampolineAddrs.size()) {
For better readability, could you please create a meaningful variable for `trampolineAddrs.stream().distinct().count()`? You can reuse it in the exception message as well.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25954#discussion_r2512100636
PR Review Comment: https://git.openjdk.org/jdk/pull/25954#discussion_r2512094448
More information about the hotspot-dev
mailing list