JDK-8254887 : C2: assert(cl->trip_count() > 0) failed: peeling a fully unrolled loop
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,15,16
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-10-16
  • Updated: 2022-04-05
  • Resolved: 2020-11-13
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 16
11.0.16-oracleFixed 16 b25Fixed
Related Reports
Relates :  
Description
The attached fuzzer test fails with the following assertion:

To reproduce:
$ java -Xbatch -Xmx1G Test.java 

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/home/christian/jdk/open/src/hotspot/share/opto/loopTransform.cpp:692), pid=6413, tid=6425
#  assert(cl->trip_count() > 0) failed: peeling a fully unrolled loop
#
# JRE version: Java(TM) SE Runtime Environment (16.0) (slowdebug build 16-internal+0-2020-10-16-0945385.christian...)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (slowdebug 16-internal+0-2020-10-16-0945385.christian..., mixed mode, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0xde6d8f]  PhaseIdealLoop::do_peeling(IdealLoopTree*, Node_List&)+0xe5
..........
Command Line: -Xbatch -Xmx1G --add-modules=ALL-DEFAULT jdk.compiler/com.sun.tools.javac.launcher.Main Test.java
..........
Current thread (0x00007f9700341550):  JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=6425, stack(0x00007f96e0fcb000,0x00007f96e10cc000)]


Current CompileTask:
C2:  30156 2168    b  4       Test::lMeth (242 bytes)

Stack: [0x00007f96e0fcb000,0x00007f96e10cc000],  sp=0x00007f96e10c5f10,  free space=1003k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xde6d8f]  PhaseIdealLoop::do_peeling(IdealLoopTree*, Node_List&)+0xe5
V  [libjvm.so+0xdf2bbf]  IdealLoopTree::iteration_split_impl(PhaseIdealLoop*, Node_List&)+0x4f5
V  [libjvm.so+0xdf2ce7]  IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x10b
V  [libjvm.so+0xdf2c18]  IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x3c
V  [libjvm.so+0xdf2d85]  IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x1a9
V  [libjvm.so+0xdf2d85]  IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x1a9
V  [libjvm.so+0xdf2c18]  IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x3c
V  [libjvm.so+0xe06455]  PhaseIdealLoop::build_and_optimize(LoopOptsMode)+0x1517
V  [libjvm.so+0x7a9ef5]  PhaseIdealLoop::PhaseIdealLoop(PhaseIterGVN&, LoopOptsMode)+0xb3
V  [libjvm.so+0x7a9fee]  PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x46
V  [libjvm.so+0x79d5d7]  Compile::optimize_loops(PhaseIterGVN&, LoopOptsMode)+0xf7
V  [libjvm.so+0x79e4e2]  Compile::Optimize()+0xd68
V  [libjvm.so+0x79761f]  Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, bool, DirectiveSet*)+0x11d9
V  [libjvm.so+0x68f3a3]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x15b
V  [libjvm.so+0x7b2d0b]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x895
V  [libjvm.so+0x7b1997]  CompileBroker::compiler_thread_loop()+0x3df
V  [libjvm.so+0x11abafe]  compiler_thread_entry(JavaThread*, Thread*)+0x69
V  [libjvm.so+0x11a7974]  JavaThread::thread_main_inner()+0x14c
V  [libjvm.so+0x11a7820]  JavaThread::run()+0x11e
V  [libjvm.so+0x11a3a30]  Thread::call_run()+0x180
V  [libjvm.so+0xfa1d88]  thread_native_entry(Thread*)+0x1e4
Comments
A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk11u-dev/pull/980 Date: 2022-04-01 10:19:25 +0000
01-04-2022

Fix request [11u] I backport this for parity with 11.0.16-oracle. Small risk, compiler change, but we should take this isolated fix. Clean backport. Test passes.
01-04-2022

Changeset: ea576ddb Author: Roland Westrelin <roland@openjdk.org> Date: 2020-11-13 08:19:33 +0000 URL: https://github.com/openjdk/jdk/commit/ea576ddb
13-11-2020

Starts to fail after JDK-8240335. Could you take a look at it [~roland]?
16-10-2020

ILW = C2 assertion failure in loop peeling, only fails with single Java Fuzzer test, disable compilation of affected method = HLM = P3
16-10-2020