JDK-8282592 : C2: assert(false) failed: graph should be schedulable
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 17,18,19
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2022-03-03
  • Updated: 2024-04-10
  • Resolved: 2022-03-22
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 18 JDK 19
17.0.4-oracleFixed 18.0.2Fixed 19 b15Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
Assert in PhaseCFG::schedule_late

To reproduce:
Run TestOverunrolling.java with additional flag -XX:+StressReflectiveCode.

With jtreg:
path-to-jtreg/jtreg -va -s -jdk:path-to-jdk/jdk/ -javaoptions:"-XX:+StressReflectiveCode" test/hotspot/jtreg/compiler/loopopts/TestOverunrolling.java

You can find hs_err file in Attachment.

# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc:  SuppressErrorAt=/gcm.cpp:1423
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/home/emanuel/Documents/closed-jdk/open/src/hotspot/share/opto/gcm.cpp:1423), pid=268648, tid=268661
#  assert(false) failed: graph should be schedulable
#
# JRE version: Java(TM) SE Runtime Environment (19.0) (slowdebug build 19-internal-2022-02-28-1116307.emanuel...)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (slowdebug 19-internal-2022-02-28-1116307.emanuel..., compiled mode, compressed oops, compressed class ptrs, parallel gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0xadfc8b]  PhaseCFG::schedule_late(VectorSet&, Node_Stack&)+0x605
#


Current CompileTask:
C2:  32296 3423    b        compiler.loopopts.TestOverunrolling::test3 (89 bytes)

Stack: [0x00007f3c5d0c6000,0x00007f3c5d1c7000],  sp=0x00007f3c5d1c1960,  free space=1006k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xadfc8b]  PhaseCFG::schedule_late(VectorSet&, Node_Stack&)+0x605
V  [libjvm.so+0xae00cd]  PhaseCFG::global_code_motion()+0x1f3
V  [libjvm.so+0xae08da]  PhaseCFG::do_global_code_motion()+0x60
V  [libjvm.so+0x85c3ea]  Compile::Code_Gen()+0x1c6
V  [libjvm.so+0x85324d]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1567
V  [libjvm.so+0x748299]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x185
V  [libjvm.so+0x87088d]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x899
V  [libjvm.so+0x86f4e7]  CompileBroker::compiler_thread_loop()+0x3df
V  [libjvm.so+0x88fc3b]  CompilerThread::thread_entry(JavaThread*, JavaThread*)+0x69
V  [libjvm.so+0x124901f]  JavaThread::thread_main_inner()+0x15d
V  [libjvm.so+0x1248ebf]  JavaThread::run()+0x167
V  [libjvm.so+0x12467d0]  Thread::call_run()+0x180
V  [libjvm.so+0x105262b]  thread_native_entry(Thread*)+0x18f
Comments
A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk17u-dev/pull/321 Date: 2022-03-31 14:02:26 +0000
31-03-2022

Fix Request (17u) Should get backported for parity with 17.0.4-oracle. (Related to JDK-8280799.) Applies cleanly. Included test has passed.
31-03-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk18u/pull/80 Date: 2022-03-30 05:43:42 +0000
30-03-2022

Fix Request (JDK 18u) Fixes an assert in C2. The fix is low risk and applies cleanly. Already tested and about to be backported to Oracle JDK 17u. Tier 1-3 testing is running for JDK 18u.
30-03-2022

Changeset: 85628a87 Author: Roland Westrelin <roland@openjdk.org> Date: 2022-03-22 10:34:33 +0000 URL: https://git.openjdk.java.net/jdk/commit/85628a871df3fdeec1b422d1c01c222abe45d0a8
22-03-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk/pull/7758 Date: 2022-03-09 13:42:01 +0000
09-03-2022

I can also add that before it used to reproduce on 5 different architectures directly. So I don't think it is anything intermittent.
03-03-2022

With JDK-8230382 backed out, I can reproduce it now. I'll investigate the failure.
03-03-2022

Ok. Well that will require some closer looking into. I'm sure that JDK-8230382 did reorder some optimizations. For example there were some cases where there were dead Int/Long type ranges (eg [0..-1]), which the code previously opened up to a valid range. My reordering replaced it with TOP. TLDR: that change may have changed the behavior, but should have been a pure refactoring.
03-03-2022

Interesting, it does not fail anymore after JDK-8230382. It might just hide this bug but hard to tell without looking closer into it.
03-03-2022

[~roland] I have just synced my repo, and now I cannot reproduce it either. Maybe someone changed related code. Could be the test does not manifest any more or is even fixed. [~chagedorn] is checking since when it works again. It used to reproduce like this: ~/Documents/jtreg/build/images/jtreg/bin/jtreg -va -s -jdk:/home/emanuel/Documents/closed-jdk/build/linux-x64-slowdebug/jdk/ -javaoptions:"-XX:-TieredCompilation -XX:+StressReflectiveCode -XX:-ReduceInitialCardMarks -XX:-ReduceBulkZeroing -XX:-ReduceFieldZeroing -XX:+UnlockDiagnosticVMOptions -XX:+ExpandSubTypeCheckAtParseTime" /home/emanuel/Documents/closed-jdk/open/test/hotspot/jtreg/compiler/loopopts/TestOverunrolling.java
03-03-2022

I can't reproduce it. Could you attach a replay file?
03-03-2022

ILW = C2 assertion failure in global code motion, single test with -XX:+StressReflectiveCode, use -XX:-StressReflectiveCode = HLM = P3
03-03-2022

For debugging, the replay file may be helpful. Generate it by running the test with jtreg once. Then use the generated replay file like this: ./java -XX:+ReplayCompiles -XX:+ReplayIgnoreInitErrors -XX:ReplayDataFile=/home/emanuel/Documents/closed-jdk/JTwork/scratch/replay_pid268648.log -cp /home/emanuel/Documents/closed-jdk/JTwork/classes/compiler/loopopts/TestOverunrolling.d -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -Xcomp -XX:-TieredCompilation -XX:-UseSwitchProfiling -XX:-UseCountedLoopSafepoints -XX:LoopUnrollLimit=250 -XX:-UseG1GC -XX:+UseParallelGC -XX:+StressReflectiveCode
03-03-2022

Starts to fail after JDK-8280799. [~roland] can you have a look at it?
03-03-2022