RFR: 8359359: AArch64: share trampolines between static calls to the same method [v6]
Evgeny Astigeevich
eastigeevich at openjdk.org
Wed Oct 8 16:48:49 UTC 2025
On Wed, 8 Oct 2025 16:44:25 GMT, Evgeny Astigeevich <eastigeevich at openjdk.org> wrote:
>> Mikhail Ablakatov has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 10 commits:
>>
>> - Merge commit '41520998aa8808452ee384b213b2a77c7bad668d'
>> - remove implementation-dependent logic from emit_shared_trampolines()
>> - cleanup: update copyright headers
>> - Make the value type of the dictionary a struct instead of Pair typedef
>> - Remove share_rc_trampoline_for and share_sc_trampoline_for
>> - Merge branch 'master'
>> - Address review comments from @theRealAph and @eastig
>> - use relocInfo::relocType instead of TrampolineCallKind
>> - move rtype from keys to values; reduce the footprint of the patch
>> - Lift the vm.opt.TieredCompilation == null requirement from the tests
>> - Combine the two shared trampoline request hash tables
>> - 8359359: AArch64: share trampolines between static calls to the same method
>>
>> 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.
>
> src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp line 910:
>
>> 908: assert(CodeBuffer::supports_shared_stubs(), "must support shared stubs");
>> 909: code()->share_trampoline_for(entry.target(), entry.target(), offset());
>> 910: } else if (entry.rspec().type() == relocInfo::static_call_type && callee != nullptr) {
>
> I think we should require `callee` to non-null for `relocInfo::static_call_type`. Otherwise this will hide bugs, when it's been intended to share but forgotten to provide `callee`.
We need to convert the check `callee != nullptr` into an assert.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25954#discussion_r2414461373
More information about the hotspot-dev
mailing list