JDK-8268672 : C2: assert(!loop->is_member(u_loop)) failed: can be in outer loop or out of both loops only
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,17
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2021-06-14
  • Updated: 2021-09-15
  • Resolved: 2021-06-21
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.14-oracleFixed 17 b28Fixed 18Fixed
Related Reports
Relates :  
Description
The attached fuzzer test starts to fail after JDK-8263303 withi the following assertion:

To reproduce:
$ java -Xcomp -XX:-TieredCompilation -XX:CompileOnly=Test Test.java
$ java -Xcomp -XX:-TieredCompilation -XX:CompileOnly=Reduced Reduced.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-S79067/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/be546687-12db-4ded-a96b-86062b189919/runs/56ca4e2d-638a-4f38-8b25-3d968f5f0d09/workspace/open/src/hotspot/share/opto/loopopts.cpp:1982), pid=27153, tid=27166
#  assert(!loop->is_member(u_loop)) failed: can be in outer loop or out of both loops only
#
# JRE version: Java(TM) SE Runtime Environment (17.0+26) (fastdebug build 17-ea+26-LTS-2439)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 17-ea+26-LTS-2439, compiled mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x130772c]  clone_outer_loop_helper(Node*, IdealLoopTree const*, IdealLoopTree const*, Node_List const&, Unique_Node_List&, PhaseIdealLoop*, bool) [clone .constprop.0]+0x28c
............
Command Line: -Xmx1G -Xcomp -Xbatch -XX:-TieredCompilation -XX:CompileOnly=Test -XX:CompileCommand=quiet Test
............
Current thread (0x00007f817847fc30):  JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=27166, stack(0x00007f814bbfc000,0x00007f814bcfd000)]


Current CompileTask:
C2:   2977   10 %  b        Test::mainTest @ 167 (714 bytes)

Stack: [0x00007f814bbfc000,0x00007f814bcfd000],  sp=0x00007f814bcf6cb0,  free space=1003k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x130772c]  clone_outer_loop_helper(Node*, IdealLoopTree const*, IdealLoopTree const*, Node_List const&, Unique_Node_List&, PhaseIdealLoop*, bool) [clone .constprop.0]+0x28c
V  [libjvm.so+0x1308a3f]  PhaseIdealLoop::clone_outer_loop(LoopNode*, PhaseIdealLoop::CloneLoopMode, IdealLoopTree*, IdealLoopTree*, int, Node_List&, Node_List&) [clone .part.0]+0x73f
V  [libjvm.so+0x1314318]  PhaseIdealLoop::clone_loop(IdealLoopTree*, Node_List&, int, PhaseIdealLoop::CloneLoopMode, Node*)+0x4d8
V  [libjvm.so+0x12d44f9]  PhaseIdealLoop::insert_post_loop(IdealLoopTree*, Node_List&, CountedLoopNode*, CountedLoopEndNode*, Node*, Node*, CountedLoopNode*&)+0xe9
V  [libjvm.so+0x12d5350]  PhaseIdealLoop::insert_vector_post_loop(IdealLoopTree*, Node_List&)+0x180
V  [libjvm.so+0x12d77cf]  IdealLoopTree::iteration_split_impl(PhaseIdealLoop*, Node_List&) [clone .part.0]+0x8af
V  [libjvm.so+0x12d799b]  IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x13b
V  [libjvm.so+0x12d7895]  IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x35
V  [libjvm.so+0x1303e65]  PhaseIdealLoop::build_and_optimize(LoopOptsMode)+0xd55
V  [libjvm.so+0xa29c2a]  PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x2da
V  [libjvm.so+0xa265d2]  Compile::Optimize()+0x14e2
V  [libjvm.so+0xa280c5]  Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, bool, DirectiveSet*)+0x1585
V  [libjvm.so+0x84959a]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1ea
V  [libjvm.so+0xa38a89]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0xfb9
V  [libjvm.so+0xa397f8]  CompileBroker::compiler_thread_loop()+0x5a8
V  [libjvm.so+0x18b2e91]  JavaThread::thread_main_inner()+0x271
V  [libjvm.so+0x18baa90]  Thread::call_run()+0x100
V  [libjvm.so+0x15872b4]  thread_native_entry(Thread*)+0x104
Comments
Fix Request (11u): Should get backported for parity with 11.0.14-oracle. Follow-up fix for JDK-8263303. Applies cleanly.
14-09-2021

[~roland], FYI test/hotspot/jtreg/compiler/loopstripmining/TestPinnedNodeInInnerLoop.java didn't fail in my fix verification run w/ jdk-17+27
06-08-2021

Changeset: d3ad8cd3 Author: Roland Westrelin <roland@openjdk.org> Date: 2021-06-21 14:16:54 +0000 URL: https://git.openjdk.java.net/jdk17/commit/d3ad8cd344681fe8442f821f97f05996bb972abe
21-06-2021

ILW = Assert during C2 compilation (recent regression in JDK 17 b26), with JavaFuzzer generated tests, no known workaround but disable C2 compilation of affected method = HMM = P2 [~roland] Can you take a look at it?
14-06-2021