JDK-8319372 : C2 compilation fails with "Bad immediate dominator info"
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 16,17,21,22
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2023-11-03
  • Updated: 2024-03-11
  • Resolved: 2023-11-30
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 17 JDK 21 JDK 22
17.0.12-oracleFixed 21.0.3-oracleFixed 22 b27Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
java -Xcomp -XX:CompileOnly=TestSimple::test  -XX:CompileCommand=quiet -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+StressIGVN -XX:RepeatCompilation=100 TestSimple.java

# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/workspace/open/src/hotspot/share/opto/loopnode.hpp:1137), pid=3339531, tid=3339546
#  assert(n != nullptr) failed: Bad immediate dominator info.
#
# JRE version: Java(TM) SE Runtime Environment (22.0+21) (fastdebug build 22-ea+21-1641)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 22-ea+21-1641, compiled mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x12babca]  PhaseIdealLoop::clone_loop_handle_data_uses(Node*, Node_List&, IdealLoopTree*, IdealLoopTree*, Node_List*&, Node_List*&, Node_List*&, Node_List&, unsigned int, PhaseIdealLoop::CloneLoopMode)+0xe7a

Current CompileTask:
C2:1896   82    b        TestSimple::test (51 bytes)

Stack: [0x00007fc7a840f000,0x00007fc7a8510000],  sp=0x00007fc7a850a770,  free space=1005k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x12babca]  PhaseIdealLoop::clone_loop_handle_data_uses(Node*, Node_List&, IdealLoopTree*, IdealLoopTree*, Node_List*&, Node_List*&, Node_List*&, Node_List&, unsigned int, PhaseIdealLoop::CloneLoopMode)+0xe7a  (loopnode.hpp:1137)
V  [libjvm.so+0x12bf566]  PhaseIdealLoop::clone_loop(IdealLoopTree*, Node_List&, int, PhaseIdealLoop::CloneLoopMode, Node*)+0x556
V  [libjvm.so+0x126e2dc]  PhaseIdealLoop::insert_post_loop(IdealLoopTree*, Node_List&, CountedLoopNode*, CountedLoopEndNode*, Node*&, Node*, CountedLoopNode*&)+0xdc
V  [libjvm.so+0x127042c]  PhaseIdealLoop::insert_pre_post_loops(IdealLoopTree*, Node_List&, bool)+0x2dc
V  [libjvm.so+0x127f7de]  IdealLoopTree::iteration_split_impl(PhaseIdealLoop*, Node_List&)+0x4be
V  [libjvm.so+0x127fa87]  IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x117
V  [libjvm.so+0x127f9a3]  IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x33
V  [libjvm.so+0x127f9a3]  IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x33
V  [libjvm.so+0x12ab88b]  PhaseIdealLoop::build_and_optimize()+0xe1b
V  [libjvm.so+0x9fdf9b]  PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x3ab
V  [libjvm.so+0x9fa8b2]  Compile::Optimize()+0x16f2
V  [libjvm.so+0x9fc681]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1bc1
V  [libjvm.so+0x849ca7]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x207
V  [libjvm.so+0xa08725]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x9f5
V  [libjvm.so+0xa09438]  CompileBroker::compiler_thread_loop()+0x508
V  [libjvm.so+0xec438c]  JavaThread::thread_main_inner()+0xcc
V  [libjvm.so+0x17a22ca]  Thread::call_run()+0xba
V  [libjvm.so+0x14a710a]  thread_native_entry(Thread*)+0x12a

In product:

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007efe7295fca6, pid=3339733, tid=3339747
#
# JRE version: Java(TM) SE Runtime Environment (22.0+22) (build 22-ea+22-1754)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (22-ea+22-1754, compiled mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0xbb8ca6]  PhaseIdealLoop::clone_loop_handle_data_uses(Node*, Node_List&, IdealLoopTree*, IdealLoopTree*, Node_List*&, Node_List*&, Node_List*&, Node_List&, unsigned int, PhaseIdealLoop::CloneLoopMode)+0x5e6
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

Comments
Fix request [17u] I backport this for parity with 17.0.12-oracle. Typical C2 risk, but acceptable as removing a wrong optimization in C2 I had to resolve as among other the code differs slightly. Tests pass but unfortunately also without the fix. SAP nightly testing passed.
11-03-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk17u-dev/pull/2274 Date: 2024-03-07 16:05:10 +0000
07-03-2024

[jdk21u-fix-request] Approval Request from Aleksey Shipilëv Clean backport to fix C2 bug and better parity.
16-01-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk21u-dev/pull/157 Date: 2024-01-10 19:04:32 +0000
10-01-2024

Changeset: 77667850 Author: Roland Westrelin <roland@openjdk.org> Date: 2023-11-30 08:09:06 +0000 URL: https://git.openjdk.org/jdk/commit/7766785098816cfcdae3479540cdc866c1ed18ad
30-11-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/16844 Date: 2023-11-28 10:55:13 +0000
28-11-2023

[~roland], would you have time to take a look?
03-11-2023

ILW = Assert / Crash during C2 compilation, with generated test, no workaround but disable compilation of affected method = HMM = P2
03-11-2023

I attached a simplified version of the generated test. This is a regression from JDK-8256730 in JDK 16 b28.
03-11-2023