RFR: 8336042: Caller/callee param size mismatch in deoptimization causes crash [v3]
Patricio Chilano Mateo
pchilanomate at openjdk.org
Thu Feb 27 17:49:07 UTC 2025
On Wed, 19 Feb 2025 00:37:14 GMT, Dean Long <dlong at openjdk.org> wrote:
>> When calling a MethodHandle linker, such as linkToStatic, we drop the last argument, which causes a mismatch between what the caller pushed and what the callee received. In deoptimization, we check for this in several places, but in one place we had outdated code. See the bug for the gory details.
>>
>> In this PR I add asserts and a test to reproduce the problem, plus the necessary fixes in deoptimizations. There are other inefficiencies in deoptimization that I didn't address, hoping to simplify the fix for backports.
>>
>> Some platforms align locals according to the caller during deoptimization, while some align locals according to the callee. The asserts I added compute locals both ways and check that they are still within the frame. I attempted this on all platforms, but am only able to test x64 and aarch64. I need help testing those asserts for arm32, ppc, riscv, and s390.
>
> Dean Long has updated the pull request incrementally with one additional commit since the last revision:
>
> Stricter assertion on ppc64
Marked as reviewed by pchilanomate (Reviewer).
src/hotspot/share/runtime/deoptimization.cpp line 645:
> 643: methodHandle method(current, deopt_sender.interpreter_frame_method());
> 644: Bytecode_invoke cur(method, deopt_sender.interpreter_frame_bci());
> 645: if (!cur.is_invokedynamic() && MethodHandles::has_member_arg(cur.klass(), cur.name())) {
I was confused with this new condition but I see is the same we have in `vframeArray::unpack_to_stack()`.
-------------
PR Review: https://git.openjdk.org/jdk/pull/23557#pullrequestreview-2648596315
PR Review Comment: https://git.openjdk.org/jdk/pull/23557#discussion_r1974069132
More information about the hotspot-dev
mailing list