JDK-8268261 : C2: assert(n != __null) failed: Bad immediate dominator info.
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11-pool,14,15,16,17,18
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-06-04
  • Updated: 2023-07-26
  • Resolved: 2021-07-23
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 11 JDK 17 JDK 18
11.0.13Fixed 17.0.1Fixed 18 b08Fixed
Related Reports
Relates :  
Relates :  
Description
The attached test fails with the following assertion and seems to be unrelated to JDK-8262017:

To reproduce:
$ java -Xcomp -XX:-TieredCompilation -XX:CompileOnly=Test Test.java

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/opt/mach5/mesos/work_dir/slaves/3c846bae-ce30-4a97-93ee-9fef4497ccb6-S79226/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/0cb697b6-5006-4d18-afca-8f82d7082f5e/runs/5d51f3ad-e036-4803-805d-9e13517ddb05/workspace/open/src/hotspot/share/opto/loopnode.hpp:1092), pid=167157, tid=167170
#  assert(n != __null) failed: Bad immediate dominator info.
#
# JRE version: Java(TM) SE Runtime Environment (17.0+25) (fastdebug build 17-ea+25-LTS-2214)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 17-ea+25-LTS-2214, compiled mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x12fad4b]  PhaseIdealLoop::idom_no_update(unsigned int) const+0x16b
...........
Command Line: -Xcomp -XX:-TieredCompilation -XX:CompileOnly=Test --add-modules=ALL-DEFAULT jdk.compiler/com.sun.tools.javac.launcher.Main Test.java
...........
Current thread (0x00007f85e4235ba0):  JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=167170, stack(0x00007f85c0d37000,0x00007f85c0e38000)]


Current CompileTask:
C2:   1929   82    b        Test::test (93 bytes)

Stack: [0x00007f85c0d37000,0x00007f85c0e38000],  sp=0x00007f85c0e31e90,  free space=1003k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x12fad4b]  PhaseIdealLoop::idom_no_update(unsigned int) const+0x16b
V  [libjvm.so+0x13088f1]  PhaseIdealLoop::clone_loop_handle_data_uses(Node*, Node_List&, IdealLoopTree*, IdealLoopTree*, Node_List*&, Node_List*&, Node_List*&, Node_List&, unsigned int, PhaseIdealLoop::CloneLoopMode)+0x581
V  [libjvm.so+0x130a16f]  PhaseIdealLoop::clone_loop(IdealLoopTree*, Node_List&, int, PhaseIdealLoop::CloneLoopMode, Node*)+0x110f
V  [libjvm.so+0x12c5470]  PhaseIdealLoop::do_unroll(IdealLoopTree*, Node_List&, bool)+0x220
V  [libjvm.so+0x12cbed0]  IdealLoopTree::iteration_split_impl(PhaseIdealLoop*, Node_List&) [clone .part.0]+0x460
V  [libjvm.so+0x12cc4eb]  IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x13b
V  [libjvm.so+0x12cc3e5]  IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x35
V  [libjvm.so+0x12f8cb5]  PhaseIdealLoop::build_and_optimize(LoopOptsMode)+0xd55
V  [libjvm.so+0xa1da2a]  PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x2da
V  [libjvm.so+0xa19470]  Compile::Optimize()+0x580
V  [libjvm.so+0xa1bec5]  Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, bool, DirectiveSet*)+0x1585
V  [libjvm.so+0x841aba]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1ea
V  [libjvm.so+0xa2c889]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0xfb9
V  [libjvm.so+0xa2d5f8]  CompileBroker::compiler_thread_loop()+0x5a8
V  [libjvm.so+0x18a3a11]  JavaThread::thread_main_inner()+0x271
V  [libjvm.so+0x18ab610]  Thread::call_run()+0x100
V  [libjvm.so+0x157721e]  thread_native_entry(Thread*)+0x10e
Comments
Fix Request (11u) I would like to backport this patch for parity with Oracle 11.0.14. Backport is not clean and it has been reviewed.
02-08-2021

Fix Request for 17u Backport changes applied cleanly. Low risk fix - small changes. May add additional round of loops optimizations which may increase compilation time for some methods.
23-07-2021

Changeset: 4ed548b3 Author: Vladimir Kozlov <kvn@openjdk.org> Date: 2021-07-23 18:51:25 +0000 URL: https://git.openjdk.java.net/jdk/commit/4ed548b3eeffe8dfa601d4d0eeed2bfe359af965
23-07-2021

More details about this issue. The control for AddP node is set on N483 loop exit projection. AddP is address for Load node from following loop N426. After unswithching N483 loop its exit become nested () and does not dominate loop N426. Which cause failure during following loop N426 unroll which tries to update control for Load node by looking on controls of its inputs.
22-07-2021

I suggest to exit current round of loopopts when loop is unswitched and do an other round with recalculated idom data. It should not affect compilation speed because unswitching is rare case. I will do performance testing to make sure.
22-07-2021

The issue is that we continue optimize loops which follow a loop which is un-switched without updating idom data. Loop: N0/N0 has_call has_sfpt Loop: N410/N382 limit_check profile_predicated predicated counted [0,3),+1 (-1 iters) has_call sfpts={ 374 } Loop: N418/N417 sfpts={ 420 } Loop: N483/N212 counted [1,5),+2 (-1 iters) has_sfpt strip_mined Loop: N426/N369 limit_check profile_predicated predicated counted [0,9),+1 (-1 iters) has_sfpt sfpts={ 361 } Unswitch 1 Loop: N483/N212 counted [1,5),+2 (2147483648 iters) has_sfpt strip_mined MaxUnroll 9 Loop: N426/N369 limit_check profile_predicated predicated counted [0,9),+1 (2147483648 iters) has_sfpt sfpts={ 361 } Peel Loop: N426/N369 limit_check profile_predicated predicated counted [0,9),+1 (2147483648 iters) has_sfpt sfpts={ 361 } Unroll 2( 8) Loop: N426/N369 counted [int,9),+1 (2147483648 iters) has_sfpt sfpts={ 361 } # To suppress the following error report, specify this argument # after -XX: or in .hotspotrc: SuppressErrorAt=/loopnode.hpp:1092 # # A fatal error has been detected by the Java Runtime Environment: # # Internal Error (/jdk_git/open/src/hotspot/share/opto/loopnode.hpp:1092), pid=2327685, tid=2327712 # assert(n != __null) failed: Bad immediate dominator info.
22-07-2021

ILW = C2 assert failure during unrolling, only fails with single Java Fuzzer test, disable compilation of affected method = HLM = P3
04-06-2021