JDK-8298176 : remove OpaqueZeroTripGuardPostLoop once main-loop disappears
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 20,21
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2022-12-06
  • Updated: 2023-09-22
  • Resolved: 2022-12-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 20 JDK 21
20 b30Fixed 21Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
The following test failed in the JDK20 CI:

applications/javafuzzer/MediumTest.java

Here's a snippet from the log file:

Summary of the JavaFuzzer run:
------------------------------
Host:     ol8-aarch64-590460
Tests:    8 x 50
Args:     -conf config.yml

Started  at: Tue Dec  6 04:36:43 UTC 2022


r1- 50: 42 passed, 0 crashes, 0 fails, 0 hangs, 0 incorrect tests, 8 Reference Java failures
r2- 50: 36 passed, 0 crashes, 0 fails, 0 hangs, 0 incorrect tests, 14 Reference Java failures
r4- 50: 33 passed, 0 crashes, 0 fails, 0 hangs, 0 incorrect tests, 17 Reference Java failures
r8- 50: 31 passed, 2 crashes, 0 fails, 0 hangs, 0 incorrect tests, 18 Reference Java failures
r3- 50: 31 passed, 0 crashes, 0 fails, 0 hangs, 0 incorrect tests, 19 Reference Java failures
r5- 50: 30 passed, 0 crashes, 0 fails, 0 hangs, 0 incorrect tests, 20 Reference Java failures
r7- 50: 31 passed, 0 crashes, 0 fails, 0 hangs, 0 incorrect tests, 19 Reference Java failures
r6- 50: 30 passed, 0 crashes, 0 fails, 0 hangs, 0 incorrect tests, 20 Reference Java failures

Finished at: Tue Dec  6 05:48:49 UTC 2022


#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/opt/mach5/mesos/work_dir/slaves/0c72054a-24ab-4dbb-944f-97f9341a1b96-S151540/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/39ad2c2e-f413-4e8e-b682-799b5d3d5239/runs/86b033bb-f00d-44c5-9f7f-ca18450e04df/workspace/open/src/hotspot/share/opto/multnode.cpp:77), pid=2551483, tid=2551499
#  assert((Opcode() != Op_If && Opcode() != Op_RangeCheck) || outcnt() == 2) failed: bad if #1
#
# JRE version: Java(TM) SE Runtime Environment (20.0+27) (fastdebug build 20-ea+27-2114)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 20-ea+27-2114, compiled mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-aarch64)
# Problematic frame:
# V  [libjvm.so+0x14443ec]  MultiNode::proj_out(unsigned int) const+0x9c
#
# Core dump will be written. Default location: Core dumps may be processed with "/opt/core.sh %p" (or dumping to /tmp/fuzzer.tmp.RxSrez9WZc/core.2551483)
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/opt/mach5/mesos/work_dir/slaves/0c72054a-24ab-4dbb-944f-97f9341a1b96-S151540/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/39ad2c2e-f413-4e8e-b682-799b5d3d5239/runs/86b033bb-f00d-44c5-9f7f-ca18450e04df/workspace/open/src/hotspot/share/opto/multnode.cpp:77), pid=2551923, tid=2551937
#  assert((Opcode() != Op_If && Opcode() != Op_RangeCheck) || outcnt() == 2) failed: bad if #1
#
# JRE version: Java(TM) SE Runtime Environment (20.0+27) (fastdebug build 20-ea+27-2114)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 20-ea+27-2114, compiled mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-aarch64)
# Problematic frame:
# V  [libjvm.so+0x14443ec]  MultiNode::proj_out(unsigned int) const+0x9c
#
# Core dump will be written. Default location: Core dumps may be processed with "/opt/core.sh %p" (or dumping to /tmp/fuzzer.tmp.RxSrez9WZc/core.2551923)
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

[2022-12-06T05:48:49.293374139Z] Waiting for completion for process 2503650
[2022-12-06T05:48:49.293578780Z] Waiting for completion finished for process 2503650
----------System.err:(13/728)----------
java.lang.RuntimeException: assertEquals: expected 1 to equal 2
	at jdk.test.lib.Asserts.fail(Asserts.java:594)
	at jdk.test.lib.Asserts.assertEquals(Asserts.java:205)
	at jdk.test.lib.Asserts.assertEquals(Asserts.java:189)
	at applications.javafuzzer.JavaFuzzerRunner.main(JavaFuzzerRunner.java:245)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:578)
	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:312)
	at java.base/java.lang.Thread.run(Thread.java:1599)

JavaTest Message: Test threw exception: java.lang.RuntimeException
JavaTest Message: shutting down test

result: Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: assertEquals: expected 1 to equal 2


Here's the crashing thread's stack:

---------------  T H R E A D  ---------------

Current thread (0x0000fffd10355010):  JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=2551499, stack(0x0000fffce91e0000,0x0000fffce93e0000)]


Current CompileTask:
C2:    195   12    b  4       Test::vMeth (369 bytes)

Stack: [0x0000fffce91e0000,0x0000fffce93e0000],  sp=0x0000fffce93d9a90,  free space=2022k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x14443ec]  MultiNode::proj_out(unsigned int) const+0x9c  (multnode.cpp:77)
V  [libjvm.so+0x128e3bc]  PhaseIdealLoop::get_skeleton_predicates(Node*, Unique_Node_List&, bool)+0x1c8  (loopPredicate.cpp:381)
V  [libjvm.so+0x12c822c]  PhaseIdealLoop::collect_potentially_useful_predicates(IdealLoopTree*, Unique_Node_List&)+0x19c  (loopnode.cpp:4056)
V  [libjvm.so+0x12c8658]  PhaseIdealLoop::eliminate_useless_predicates()+0x3c8  (loopnode.cpp:4077)
V  [libjvm.so+0x12de720]  PhaseIdealLoop::build_and_optimize()+0x8bc  (loopnode.cpp:4427)
V  [libjvm.so+0x9a8100]  PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x1e0  (loopnode.hpp:1082)
V  [libjvm.so+0x9a3ca8]  Compile::Optimize()+0xde8  (compile.cpp:2146)
V  [libjvm.so+0x9a657c]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x11cc  (compile.cpp:830)
V  [libjvm.so+0x7c5858]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1b4  (c2compiler.cpp:113)
V  [libjvm.so+0x9b2dc4]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0xa10  (compileBroker.cpp:2237)
V  [libjvm.so+0x9b3828]  CompileBroker::compiler_thread_loop()+0x5b8  (compileBroker.cpp:1916)
V  [libjvm.so+0xed3a20]  JavaThread::thread_main_inner()+0x21c  (javaThread.cpp:696)
V  [libjvm.so+0x17d48e8]  Thread::call_run()+0xf8  (thread.cpp:224)
V  [libjvm.so+0x14ed344]  thread_native_entry(Thread*)+0x100  (os_linux.cpp:739)
C  [libpthread.so.0+0x7908]  start_thread+0x188
Comments
Changeset: a0a09d56 Author: Roland Westrelin <roland@openjdk.org> Date: 2022-12-22 08:56:00 +0000 URL: https://git.openjdk.org/jdk20/commit/a0a09d56ba4fc6133b423ad29d86fc99dd6dc19b
22-12-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk20/pull/65 Date: 2022-12-20 18:47:26 +0000
20-12-2022

Thanks [~roland] for taking this on!
19-12-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk20/pull/22 Date: 2022-12-13 07:08:59 +0000
13-12-2022

Here's the crashing thread's stack from the jdk-21+1-2-tier6 sighting: applications/javafuzzer/MediumTest.java --------------- T H R E A D --------------- Current thread (0x00007fb9ec343aa0): JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=3617415, stack(0x00007fb9d0374000,0x00007fb9d0475000)] Current CompileTask: C2: 765 88 b 4 Test::vMeth (495 bytes) Stack: [0x00007fb9d0374000,0x00007fb9d0475000], sp=0x00007fb9d046efd0, free space=1003k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.so+0x1653bf4] MultiNode::proj_out(unsigned int) const+0x74 (multnode.cpp:77) V [libjvm.so+0x1457161] PhaseIdealLoop::get_skeleton_predicates(Node*, Unique_Node_List&, bool)+0x1b1 (loopPredicate.cpp:395) V [libjvm.so+0x149312c] PhaseIdealLoop::collect_potentially_useful_predicates(IdealLoopTree*, Unique_Node_List&)+0x1ac (loopnode.cpp:4066) V [libjvm.so+0x14935ab] PhaseIdealLoop::eliminate_useless_predicates()+0x3eb (loopnode.cpp:4087) V [libjvm.so+0x14ab02f] PhaseIdealLoop::build_and_optimize()+0x97f (loopnode.cpp:4432) V [libjvm.so+0xaeeee1] PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x261 (loopnode.hpp:1082) V [libjvm.so+0xae8faf] Compile::Optimize()+0xe2f (compile.cpp:2146) V [libjvm.so+0xaed10e] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x18ce (compile.cpp:830) V [libjvm.so+0x8fec67] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x4e7 (c2compiler.cpp:113) V [libjvm.so+0xafa22c] CompileBroker::invoke_compiler_on_method(CompileTask*)+0xa7c (compileBroker.cpp:2237) V [libjvm.so+0xafafe8] CompileBroker::compiler_thread_loop()+0x5d8 (compileBroker.cpp:1916) V [libjvm.so+0x1067896] JavaThread::thread_main_inner()+0x206 (javaThread.cpp:709) V [libjvm.so+0x1a6a770] Thread::call_run()+0x100 (thread.cpp:224) V [libjvm.so+0x16fef13] thread_native_entry(Thread*)+0x103 (os_linux.cpp:739)
09-12-2022

Attached reduced test case Reduced.java: $ java -Xcomp -XX:CompileOnly=Reduced Reduced.java
06-12-2022

ILW = C2 assertion due to broken graph which was not cleaned up properly (If node with 1 projection only), single Java Fuzzer test case, disable compilation of affected method = HLM = P3
06-12-2022

Starts to fail after the removal of Opaque2 nodes (JDK-8294540). We most likely just revealed an existing problem because we are not preventing optimizations anymore with Opaque2 nodes.
06-12-2022