JDK-8321278 : C2: Partial peeling fails with assert "last_peel <- first_not_peeled"
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 17,21,22,23
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-12-04
  • Updated: 2024-06-14
  • Resolved: 2024-03-25
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 21 JDK 23
21.0.5-oracleFixed 23 b16Fixed
Related Reports
Relates :  
Relates :  
Description
java -XX:CompileCommand=quiet -XX:CompileCommand=compileonly,*Test*::* -XX:-TieredCompilation -Xbatch -XX:+UnlockExperimentalVMOptions -XX:PerMethodSpecTrapLimit=0 -XX:PerMethodTrapLimit=0 Test.java

#  Internal Error (/workspace/open/src/hotspot/share/opto/loopopts.cpp:3773), pid=887808, tid=887834
#  assert(first_not_peeled->in(0) == last_peel) failed: last_peel <- first_not_peeled
#
# JRE version: Java(TM) SE Runtime Environment (22.0+27) (fastdebug build 22-ea+27-2172)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 22-ea+27-2172, mixed mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x12b3be1]  PhaseIdealLoop::partial_peel(IdealLoopTree*, Node_List&)+0x1f51


Current CompileTask:
C2:311    1 % !b        Test::iMeth @ 62 (1708 bytes)

Stack: [0x00007fc68c431000,0x00007fc68c531000],  sp=0x00007fc68c52ba00,  free space=1002k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x12b3be1]  PhaseIdealLoop::partial_peel(IdealLoopTree*, Node_List&)+0x1f51  (loopopts.cpp:3773)
V  [libjvm.so+0x126c5fe]  IdealLoopTree::iteration_split_impl(PhaseIdealLoop*, Node_List&)+0x18e  (loopTransform.cpp:3609)
V  [libjvm.so+0x126cbbe]  IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x17e  (loopTransform.cpp:3749)
V  [libjvm.so+0x1299628]  PhaseIdealLoop::build_and_optimize()+0xdf8  (loopnode.cpp:4621)
V  [libjvm.so+0x9f0828]  PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x388  (loopnode.hpp:1112)
V  [libjvm.so+0x9eb3d3]  Compile::Optimize()+0x4c3  (compile.cpp:2372)
V  [libjvm.so+0x9ef2c4]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1b44  (compile.cpp:857)
V  [libjvm.so+0x83dd27]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1e7  (c2compiler.cpp:134)
V  [libjvm.so+0x9fab2c]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x92c  (compileBroker.cpp:2299)
V  [libjvm.so+0x9fb7b8]  CompileBroker::compiler_thread_loop()+0x468  (compileBroker.cpp:1958)
V  [libjvm.so+0xeb2cec]  JavaThread::thread_main_inner()+0xcc  (javaThread.cpp:720)
V  [libjvm.so+0x178cbe6]  Thread::call_run()+0xb6  (thread.cpp:220)
V  [libjvm.so+0x1496e57]  thread_native_entry(Thread*)+0x127  (os_linux.cpp:787)
Comments
[jdk21u-fix-request] Approval Request from Martin Should get backported for parity with 21.0.5-oracle. Applies cleanly and tier 1-4 have passed.
14-06-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk21u-dev/pull/718 Date: 2024-06-13 15:19:07 +0000
13-06-2024

Changeset: af15c68f Author: Roland Westrelin <roland@openjdk.org> Date: 2024-03-25 13:45:16 +0000 URL: https://git.openjdk.org/jdk/commit/af15c68f3ccb72537b0a60d942f12d600f13ebb6
25-03-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/18353 Date: 2024-03-18 17:15:38 +0000
18-03-2024

I narrowed it down to JDK-8263577 in JDK 17 b14 but that one might have just triggered it.
04-12-2023

ILW = Assert / crash during C2 compilation, single JavaFuzzer generated test with non-default VM argument, no known workaround but disable compilation of affected method = HLM = P3
04-12-2023

I simplified the test and now it also reproduces before JDK-8267532 back to JDK 17: java -XX:CompileCommand=quiet -XX:CompileCommand=compileonly,TestSimple::test -XX:-TieredCompilation -Xbatch -XX:PerMethodTrapLimit=0 TestSimple.java
04-12-2023

We crash in product: # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007f0d4c5ff1ef, pid=2367098, tid=2367112 # # JRE version: Java(TM) SE Runtime Environment (22.0+26) (build 22-ea+26-2088) # Java VM: Java HotSpot(TM) 64-Bit Server VM (22-ea+26-2088, mixed mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64) # Problematic frame: # V [libjvm.so+0x7321ef] PhaseCFG::do_DFS(Tarjan*, unsigned int)+0xdf Stack: [0x00007f0d3035d000,0x00007f0d3045e000], sp=0x00007f0d3045a3c0, free space=1012k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.so+0x7321ef] PhaseCFG::do_DFS(Tarjan*, unsigned int)+0xdf V [libjvm.so+0x7326d1] PhaseCFG::build_dominator_tree()+0x91 V [libjvm.so+0x850fe1] PhaseCFG::do_global_code_motion()+0x11 V [libjvm.so+0x640649] Compile::Code_Gen()+0x1e9 V [libjvm.so+0x644025] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1405 V [libjvm.so+0x56acd1] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1f1 V [libjvm.so+0x6494b1] CompileBroker::invoke_compiler_on_method(CompileTask*)+0xae1 V [libjvm.so+0x64c558] CompileBroker::compiler_thread_loop()+0x498 V [libjvm.so+0x904868] JavaThread::thread_main_inner() [clone .part.0]+0xb8 V [libjvm.so+0xead2df] Thread::call_run()+0x9f V [libjvm.so+0xcd12d5] thread_native_entry(Thread*)+0xd5 Similar to JDK-8283244, [~dskantz].
04-12-2023

Seems like JDK-8267532 caused/triggered this ([~jvernee]).
04-12-2023