JDK-8330853 : Add missing checks for ConnectionGraph::can_reduce_cmp() call
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 23
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-04-23
  • Updated: 2024-06-26
  • Resolved: 2024-04-24
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 23
23 b20Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
In Leyden repo we start hitting next assert after merging JDK-8316991:

#  Internal Error (/workspace/open/src/hotspot/share/opto/node.hpp:407), pid=3216007, tid=3216030
#  assert(i < _max) failed: oob: i=2, _max=2

Stack: [0x00007f20b011b000,0x00007f20b021b000],  sp=0x00007f20b02157e0,  free space=1001k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xbf5bb4]  Node::in(unsigned int) const [clone .part.0]+0x24  (node.hpp:407)
V  [libjvm.so+0xbf69ea]  ConnectionGraph::can_reduce_cmp(Node*, Node*) const+0x9a  (node.hpp:407)
V  [libjvm.so+0xbf74a6]  ConnectionGraph::can_reduce_check_users(Node*, unsigned int) const+0x996  (escape.cpp:578)
V  [libjvm.so+0xbfa481]  ConnectionGraph::can_reduce_phi(PhiNode*) const+0xa1  (escape.cpp:622)
V  [libjvm.so+0xc1114f]  ConnectionGraph::adjust_scalar_replaceable_state(JavaObjectNode*, Unique_Node_List&)+0x7bf  (escape.cpp:2912)
V  [libjvm.so+0xc15a00]  ConnectionGraph::compute_escape()+0x1e50  (escape.cpp:307)

JDK-8316991 added new code which assumes that we always have sequence : IfNode->Bool->Cmp:
https://github.com/openjdk/jdk/blob/master/src/hotspot/share/opto/escape.cpp#L569
which is not true in some cases.  In the failed cases there is additional Opaque4 node between If and Bool nodes.

Comments
Changeset: a44ac026 Author: Vladimir Kozlov <kvn@openjdk.org> Date: 2024-04-24 20:42:50 +0000 URL: https://git.openjdk.org/jdk/commit/a44ac026c599df629305588e09fbbcff9be2a5c0
24-04-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/18916 Date: 2024-04-23 14:36:36 +0000
23-04-2024

ILW = Assert during C2 compilation (regression from JDK-8316991), only reproduces in Leyden repo but affects mainline as well, disable EA or compilation of affected method = HLM = P3
23-04-2024