JDK-8319764 : C2 compilation asserts during incremental inlining because Phi input is out of bounds
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 22
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2023-11-09
  • Updated: 2023-12-11
  • Resolved: 2023-11-16
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.
JDK 22
22 b25Fixed
Related Reports
Blocks :  
Relates :  
Relates :  
Description
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/home/ent-user/ci-scripts/jdk_build/jdk_src/src/hotspot/share/opto/node.hpp:399), pid=125943, tid=126766
#  assert(i < _max) failed: oob: i=3, _max=3
#
# JRE version: OpenJDK Runtime Environment (22.0) (fastdebug build 22-internal-git-82a4d115e)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 22-internal-git-82a4d115e, mixed mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x1638c76]  ReplacedNodes::apply(Compile*, Node*)+0x1aa6
#
# Core dump will be written. Default location: /tmp/core.125943
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

Current CompileTask:
C2:48019 2079             jdk.incubator.vector.AbstractVector::convertShapeTemplate (270 bytes)

Stack: [0x00007f75f3e00000,0x00007f75f3f00000],  sp=0x00007f75f3efad10,  free space=1003k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x1638c76]  ReplacedNodes::apply(Compile*, Node*)+0x1aa6  (node.hpp:399)
V  [libjvm.so+0xde74c7]  GraphKit::replace_call(CallNode*, Node*, bool)+0x7d7  (graphKit.cpp:2017)
V  [libjvm.so+0x880db6]  CallGenerator::do_late_inline_helper()+0xad6  (callGenerator.cpp:721)
V  [libjvm.so+0xa2bc80]  Compile::inline_incrementally_one()+0xf0  (compile.cpp:2037)
V  [libjvm.so+0xa2cad9]  Compile::inline_incrementally(PhaseIterGVN&)+0x239  (compile.cpp:2120)
V  [libjvm.so+0xa2ea68]  Compile::Optimize()+0x428  (compile.cpp:2255)
V  [libjvm.so+0xa32f81]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1b01  (compile.cpp:856)
V  [libjvm.so+0x8789ea]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x20a  (c2compiler.cpp:134)
V  [libjvm.so+0xa3fa27]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0xc57  (compileBroker.cpp:2292)
V  [libjvm.so+0xa40828]  CompileBroker::compiler_thread_loop()+0x4f8  (compileBroker.cpp:1951)
V  [libjvm.so+0xf12833]  JavaThread::thread_main_inner()+0x223  (javaThread.cpp:720)
V  [libjvm.so+0x19289fe]  Thread::call_run()+0xbe  (thread.cpp:220)
V  [libjvm.so+0x151596a]  thread_native_entry(Thread*)+0x12a  (os_linux.cpp:786)
Comments
Changeset: f33c874b Author: Roland Westrelin <roland@openjdk.org> Date: 2023-11-16 12:43:50 +0000 URL: https://git.openjdk.org/jdk/commit/f33c874b6e624ad81572a2f806e198dd692a31a6
16-11-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/16648 Date: 2023-11-14 08:56:09 +0000
14-11-2023

Roland, please have a look. Thanks.
10-11-2023

Looks like a regression from JDK-8312980. We try to access a Phi input according to its region but the region has more inputs than the Phi: 458 Region === 458 433 671 516 531 [[ 441 459 460 461 462 458 470 551 163 108 ]] !jvms: ReferencePipeline$2$1::accept @ bci:8 (line 178) ReferencePipeline$3$1::accept @ bci:17 (line 197) 461 Phi === 458 399 115 [[ 441 ]] #java/lang/Object * Oop:java/lang/Object * !jvms: ReferencePipeline$2$1::accept @ bci:8 (line 178) ReferencePipeline$3$1::accept @ bci:17 (line 197) To reproduce, apply https://github.com/openjdk/jdk/pull/16597 and run testing with -XX:+StressIncrementalInlining (most tests fail right-away) or simply run: java -XX:+ReplayIgnoreInitErrors -XX:+ReplayCompiles -XX:ReplayDataFile=replay_pid66636.log -XX:+StressIncrementalInlining
10-11-2023

I think we need a stress mode that falls back to incremental inlining randomly. Update: Yes, that works and reproduces the issue -> JDK-8319879
10-11-2023

This starts to reproduce with jdk-22+23-1845 but there is no significant change in there (only JDK-6928542), so it probably highly depends on timing.
09-11-2023

ILW = Assert during C2 compilation, with vector API (experimental) and non-default flag, disable compilation of affected method = HLM = P3
09-11-2023

Also triggers with compiler/vectorapi/reshape/TestVectorCastAVX2.java and "-ea -esa -XX:CompileThreshold=100 -XX:+UnlockExperimentalVMOptions -server -XX:-TieredCompilation -XX:+UnlockExperimentalVMOptions -XX:-EnableVectorSupport" but seems to be intermittent. # A fatal error has been detected by the Java Runtime Environment: # # Internal Error (/open/src/hotspot/share/opto/node.hpp:399), pid=3477536, tid=3477551 # assert(i < _max) failed: oob: i=3, _max=3 # # JRE version: Java(TM) SE Runtime Environment (22.0+23) (fastdebug build 22-ea+23-1845) # Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 22-ea+23-1845, mixed mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64) # Problematic frame: # V [libjvm.so+0x15cb4f6] ReplacedNodes::apply(Compile*, Node*)+0x1aa6 # Current CompileTask: C2:15970 868 b jdk.internal.vm.vector.VectorSupport::convert (36 bytes) Stack: [0x00007f99675db000,0x00007f99676db000], sp=0x00007f99676d5dd0, free space=1003k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.so+0x15cb4f6] ReplacedNodes::apply(Compile*, Node*)+0x1aa6 (node.hpp:399) V [libjvm.so+0xda02f7] GraphKit::replace_call(CallNode*, Node*, bool)+0x7d7 (graphKit.cpp:2017) V [libjvm.so+0x851a96] CallGenerator::do_late_inline_helper()+0xac6 (callGenerator.cpp:721) V [libjvm.so+0x9f5dac] Compile::inline_incrementally_one()+0xec (compile.cpp:2037) V [libjvm.so+0x9f6bf9] Compile::inline_incrementally(PhaseIterGVN&)+0x239 (compile.cpp:2120) V [libjvm.so+0x9f8b68] Compile::Optimize()+0x418 (compile.cpp:2255) V [libjvm.so+0x9fd0c1] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1b41 (compile.cpp:856) V [libjvm.so+0x8496d7] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x207 (c2compiler.cpp:134) V [libjvm.so+0xa09230] CompileBroker::invoke_compiler_on_method(CompileTask*)+0x980 (compileBroker.cpp:2292) V [libjvm.so+0xa09fc8] CompileBroker::compiler_thread_loop()+0x508 (compileBroker.cpp:1951) V [libjvm.so+0xec45ec] JavaThread::thread_main_inner()+0xcc (javaThread.cpp:720) V [libjvm.so+0x17a518a] Thread::call_run()+0xba (thread.cpp:220) V [libjvm.so+0x14ace9a] thread_native_entry(Thread*)+0x12a (os_linux.cpp:787)
09-11-2023