JDK-8273277 : C2: Move conditional negation into rc_predicate
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,17,18
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-09-02
  • Updated: 2022-01-26
  • Resolved: 2021-11-12
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.15-oracleFixed 17.0.3-oracleFixed 18 b24Fixed
Related Reports
Relates :  
Relates :  
Description
Executing vmTestbase/jit/t/t105/t105.java with the following arguments:

-XX:+TieredCompilation
-XX:Tier0BackedgeNotifyFreqLog=0
-XX:Tier2BackedgeNotifyFreqLog=0
-XX:Tier3BackedgeNotifyFreqLog=0
-XX:Tier2BackEdgeThreshold=1
-XX:Tier3BackEdgeThreshold=1
-XX:Tier4BackEdgeThreshold=1
-Xbatch

# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/workspace/open/src/hotspot/share/opto/loopPredicate.cpp:1254), pid=17531, tid=17559
#  assert(proj->_con && predicate_proj->_con) failed: not a range check?
#
# JRE version: Java(TM) SE Runtime Environment (18.0) (fastdebug build 18-internal+0-2021-09-02-0844081.tobias.hartmann.jdk)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 18-internal+0-2021-09-02-0844081.tobias.hartmann.jdk, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x12afc0c]  PhaseIdealLoop::insert_initial_skeleton_predicate(IfNode*, IdealLoopTree*, ProjNode*, ProjNode*, ProjNode*, int, Node*, Node*, Node*, int, Node*, bool&, Deoptimization::DeoptReason)+0x4ac
#
# Core dump will be written. Default location: Core dumps may be processed with "/opt/core.sh %p" (or dumping to /testoutput/test-support/jtreg_open_test_hotspot_jtreg_vmTestbase_vm_compiler/scratch/5/core.17531)
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp

Current CompileTask:
C2:   7266  666   !b  4       jit.t.t105.t105::main (54 bytes)

Stack: [0x00007fe39dcfd000,0x00007fe39ddfe000],  sp=0x00007fe39ddf7e70,  free space=1003k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x12afc0c]  PhaseIdealLoop::insert_initial_skeleton_predicate(IfNode*, IdealLoopTree*, ProjNode*, ProjNode*, ProjNode*, int, Node*, Node*, Node*, int, Node*, bool&, Deoptimization::DeoptReason)+0x4ac
V  [libjvm.so+0x12b1593]  PhaseIdealLoop::loop_predication_impl_helper(IdealLoopTree*, ProjNode*, ProjNode*, CountedLoopNode*, ConNode*, Invariance&, Deoptimization::DeoptReason)+0x1153
V  [libjvm.so+0x12b2428]  PhaseIdealLoop::loop_predication_impl(IdealLoopTree*) [clone .part.0]+0x548
V  [libjvm.so+0x12b3119]  IdealLoopTree::loop_predication(PhaseIdealLoop*)+0x109
V  [libjvm.so+0x12f9edf]  PhaseIdealLoop::build_and_optimize(LoopOptsMode)+0x11cf
V  [libjvm.so+0xa0aa6a]  PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x28a
V  [libjvm.so+0xa0646a]  Compile::Optimize()+0x4aa
V  [libjvm.so+0xa08f68]  Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, bool, bool, DirectiveSet*)+0x1588
V  [libjvm.so+0x81d476]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x646
V  [libjvm.so+0xa191c1]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0xd31
V  [libjvm.so+0xa19ef8]  CompileBroker::compiler_thread_loop()+0x598
V  [libjvm.so+0x188e71c]  JavaThread::thread_main_inner()+0x27c
V  [libjvm.so+0x1894d10]  Thread::call_run()+0x100
V  [libjvm.so+0x1572d34]  thread_native_entry(Thread*)+0x104

Comments
Fix request [11u] I backport this for parity with 11.0.15-oracle. A bugfix we should take. Clean backport. Test passes. SAP nightly testing passes.
25-01-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk11u-dev/pull/792 Date: 2022-01-24 14:47:00 +0000
24-01-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk17u-dev/pull/96 Date: 2022-01-14 10:50:31 +0000
14-01-2022

Fix request [17u] I backport this for parity with 17.0.3-oracle. A bugfix we should take. Clean backport. SAP nightly Testing passes.
14-01-2022

Changeset: 710f4964 Author: Nils Eliasson <neliasso@openjdk.org> Date: 2021-11-12 10:08:26 +0000 URL: https://git.openjdk.java.net/jdk/commit/710f496456d642c3e98d230270598f0b2dc75aba
12-11-2021

We have the following fix for this crash diff --git a/src/hotspot/share/opto/loopPredicate.cpp b/src/hotspot/share/opto/loopPredicate.cpp index fdb2bdb..54d8084 100644 --- a/src/hotspot/share/opto/loopPredicate.cpp +++ b/src/hotspot/share/opto/loopPredicate.cpp @@ -1251,10 +1251,13 @@ ProjNode* PhaseIdealLoop::insert_initial_skeleton_predicate(IfNode* iff, IdealLo Node* rng, bool &overflow, Deoptimization::DeoptReason reason) { // First predicate for the initial value on first loop iteration - assert(proj->_con && predicate_proj->_con, "not a range check?"); Node* opaque_init = new OpaqueLoopInitNode(C, init); register_new_node(opaque_init, upper_bound_proj); BoolNode* bol = rc_predicate(loop, upper_bound_proj, scale, offset, opaque_init, limit, stride, rng, (stride > 0) != (scale > 0), ov + if (proj->_con != predicate_proj->_con) { + bol = new BoolNode(bol->in(1), bol->_test.negate()); + register_new_node(bol, upper_bound_proj); + } Node* opaque_bol = new Opaque4Node(C, bol, _igvn.intcon(1)); // This will go away once loop opts are over C->add_skeleton_predicate_opaq(opaque_bol); register_new_node(opaque_bol, upper_bound_proj); @@ -1273,6 +1276,10 @@ ProjNode* PhaseIdealLoop::insert_initial_skeleton_predicate(IfNode* iff, IdealLo max_value = new AddINode(opaque_init, max_value); register_new_node(max_value, new_proj); bol = rc_predicate(loop, new_proj, scale, offset, max_value, limit, stride, rng, (stride > 0) != (scale > 0), overflow); + if (proj->_con != predicate_proj->_con) { + bol = new BoolNode(bol->in(1), bol->_test.negate()); + register_new_node(bol, new_proj); + } opaque_bol = new Opaque4Node(C, bol, _igvn.intcon(1)); C->add_skeleton_predicate_opaq(opaque_bol); register_new_node(opaque_bol, new_proj);
12-10-2021

ILW = Assert during C2 compilation, only reproducible with extreme threshold settings, disable loop predication = HLM = P3
02-09-2021