JDK-8325632 : [lworld] C2 compilation fails with "matching stack sizes"
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: repo-valhalla
  • Priority: P4
  • Status: In Progress
  • Resolution: Unresolved
  • Submitted: 2024-02-12
  • Updated: 2025-05-26
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
repo-valhallaUnresolved
Related Reports
Relates :  
Relates :  
Description
TestNullableArrays.java '-DScenarios=5 -XX:TypeProfileLevel=222' or TestNullableInlineTypes.java with '-DScenarios=5 -DTest=test81 -XX:+UnlockExperimentalVMOptions -XX:PerMethodSpecTrapLimit=0 -XX:PerMethodTrapLimit=0':

# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/oracle/valhalla/open/src/hotspot/share/opto/graphKit.cpp:359), pid=1089365, tid=1089380
#  assert(ex_jvms->sp() == phi_map->_jvms->sp()) failed: matching stack sizes
#
# JRE version: Java(TM) SE Runtime Environment (22.0) (fastdebug build 22-lworld4ea-2024-02-06-1232159.tobias...)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 22-lworld4ea-2024-02-06-1232159.tobias..., mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0xdbb562]  GraphKit::combine_exception_states(SafePointNode*, SafePointNode*) [clone .part.0]+0x1dd2

Current CompileTask:
C2:5686 1548    b  4       compiler.valhalla.inlinetypes.TestNullableArrays::test107 (89 bytes)

Stack: [0x00007f44e19fa000,0x00007f44e1afb000],  sp=0x00007f44e1af5f20,  free space=1007k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xdbb562]  GraphKit::combine_exception_states(SafePointNode*, SafePointNode*) [clone .part.0]+0x1dd2  (graphKit.cpp:359)
V  [libjvm.so+0xdc43e8]  GraphKit::replace_call(CallNode*, Node*, bool)+0x5c8  (compile.hpp:834)
V  [libjvm.so+0x87cdc8]  CallGenerator::do_late_inline_helper()+0xb08  (callGenerator.cpp:850)
V  [libjvm.so+0xa328e9]  Compile::inline_incrementally_one()+0xe9  (compile.cpp:2519)
V  [libjvm.so+0xa3372e]  Compile::inline_incrementally(PhaseIterGVN&)+0x23e  (compile.cpp:2602)
V  [libjvm.so+0xa351d8]  Compile::Optimize()+0x318  (compile.cpp:2741)
V  [libjvm.so+0xa396b1]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1b81  (compile.cpp:869)
V  [libjvm.so+0x873667]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x207  (c2compiler.cpp:134)
V  [libjvm.so+0xa45190]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x980  (compileBroker.cpp:2292)
V  [libjvm.so+0xa45ec8]  CompileBroker::compiler_thread_loop()+0x4a8  (compileBroker.cpp:1951)
V  [libjvm.so+0xf09d4c]  JavaThread::thread_main_inner()+0xcc  (javaThread.cpp:721)
V  [libjvm.so+0x180d22a]  Thread::call_run()+0xba  (thread.cpp:220)
V  [libjvm.so+0x14fdfca]  thread_native_entry(Thread*)+0x12a  (os_linux.cpp:787)

Current CompileTask:
C2:9063 1030    b  4       compiler.valhalla.inlinetypes.TestNullableInlineTypes::test81 (82 bytes)

Stack: [0x00007fe2ef576000,0x00007fe2ef676000],  sp=0x00007fe2ef670f20,  free space=1003k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xdbb562]  GraphKit::combine_exception_states(SafePointNode*, SafePointNode*) [clone .part.0]+0x1dd2  (graphKit.cpp:359)
V  [libjvm.so+0xdc43e8]  GraphKit::replace_call(CallNode*, Node*, bool)+0x5c8  (compile.hpp:834)
V  [libjvm.so+0x87cdc8]  CallGenerator::do_late_inline_helper()+0xb08  (callGenerator.cpp:850)
V  [libjvm.so+0xa328e9]  Compile::inline_incrementally_one()+0xe9  (compile.cpp:2519)
V  [libjvm.so+0xa3372e]  Compile::inline_incrementally(PhaseIterGVN&)+0x23e  (compile.cpp:2602)
V  [libjvm.so+0xa351d8]  Compile::Optimize()+0x318  (compile.cpp:2741)
V  [libjvm.so+0xa396b1]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1b81  (compile.cpp:869)
V  [libjvm.so+0x873667]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x207  (c2compiler.cpp:134)
V  [libjvm.so+0xa45190]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x980  (compileBroker.cpp:2292)
V  [libjvm.so+0xa45ec8]  CompileBroker::compiler_thread_loop()+0x4a8  (compileBroker.cpp:1951)
V  [libjvm.so+0xf09d4c]  JavaThread::thread_main_inner()+0xcc  (javaThread.cpp:721)
V  [libjvm.so+0x180d22a]  Thread::call_run()+0xba  (thread.cpp:220)
V  [libjvm.so+0x14fdfca]  thread_native_entry(Thread*)+0x12a  (os_linux.cpp:787)

TestNullableArrays::test107 was disabled by JDK-8324949.

Might be similar to JDK-8278873 (and linked bugs).
Comments
I temporarily disabled the assert with https://github.com/openjdk/valhalla/pull/1477 to reduce noise in testing.
26-05-2025

Could be related to JDK-8349068.
30-01-2025

The TestNullableArrays::test107 failure does not reproduce anymore but TestNullableInlineTypes::test81 does.
16-05-2024