RFR: 8336042: Caller/callee param size mismatch in deoptimization causes crash

Amit Kumar amitkumar at openjdk.org
Wed Feb 12 03:48:09 UTC 2025


On Tue, 11 Feb 2025 07:59:01 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.

Hi @dean-long,

I got build failure on s390: 


# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/home/amit/jdk/src/hotspot/cpu/s390/abstractInterpreter_s390.cpp:190), pid=3885713, tid=3885721
#  assert(l2 >= locals_base) failed: bad placement
#
# JRE version: OpenJDK Runtime Environment (25.0) (fastdebug build 25-internal-adhoc.amit.jdk)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 25-internal-adhoc.amit.jdk, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-s390x)
# Problematic frame:
# V  [libjvm.so+0x22c07a]  AbstractInterpreter::layout_activation(Method*, int, int, int, int, int, int, frame*, frame*, bool, bool)+0x4b2
#

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

PR Comment: https://git.openjdk.org/jdk/pull/23557#issuecomment-2652591361


More information about the hotspot-dev mailing list