RFR: 8371046: Segfault in compiler/whitebox/StressNMethodRelocation.java with -XX:+UseZGC
Vladimir Kozlov
kvn at openjdk.org
Sat Nov 22 16:57:50 UTC 2025
On Sat, 22 Nov 2025 00:43:59 GMT, Chad Rakoczy <duke at openjdk.org> wrote:
>> I also assume that trampoline's code instructions can construct far distance address.
>
>> My question is how you handle 3rd case? And how you distinguish 2 and 3 cases?
>
> We should never run into the 3rd case. If a trampoline _may_ be needed it will be there.
>
> A trampoline will not be generated only if the destination is known to always be reachable. Here are some situations where this could happen:
> - no far branches (code cache size <= branch range)
> - runtime call is reachable from anywhere in code cache
> - (code cache begin - runtime call <= branch range) && (code cache end - runtime call <= branch range)
>
> Whether or not a trampoline is generated is dependent on the callee destination not the caller address. So we can't have the case where a trampoline is needed for a given call but it doesn't exist.
May be we should change the assert to guarantee in `Relocation::pd_set_call_destination()` to make sure we catch incorrect patching it product VM.
Looking on `NativeCall::set_destination_mt_safe` and `reachable` is calculated based on distance between address of call instruction and destination. Which could be different for cloned nmethod.
On x86 were have guarantee in `NativeCall::set_destination()`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28241#discussion_r2553244181
More information about the graal-dev
mailing list