JDK-8313262 : C2: Sinking node may cause required cast to be dropped
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 17,17.0.9,21,22
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2023-07-27
  • Updated: 2024-01-25
  • Resolved: 2023-08-23
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 21 JDK 22
17.0.10-oracleFixed 21.0.1Fixed 22 b12Fixed
Related Reports
Relates :  
Relates :  
Description
Recent regression, bisected to JDK-8303279.

There are plenty of tier1 tests failing with TEST_VM_OPTS="-XX:+UseShenandoahGC".

A sample failure is:

$ CONF=linux-x86_64-server-fastdebug make reconfigure clean test TEST=java/lang/reflect/PublicMethods/PublicMethodsTest.java TEST_VM_OPTS="-XX:+UseShenandoahGC"

#  Internal Error (/home/shipilev/shipilev-jdk/src/hotspot/share/opto/subtypenode.cpp:37), pid=10644, tid=10672
#  assert(sub_t != Type::TOP && !TypePtr::NULL_PTR->higher_equal(sub_t)) failed: should be not null
#
# JRE version: OpenJDK Runtime Environment (22.0) (fastdebug build 22-internal-adhoc.shipilev.shipilev-jdk)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 22-internal-adhoc.shipilev.shipilev-jdk, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, shenandoah gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x168c4c1]  SubTypeCheckNode::sub(Type const*, Type const*) const+0x191

Comments
The fix is not specific to Shenandoah but there is no clear way to reproduce it without it.
25-01-2024

Have been running Fuzzer tests on mainline with different GCs for a while now after this commit, and there seem to be no new issues.
30-08-2023

Fix Request (17u, 21u) Fixes the regressions for the fix backported to 17.0.9 and 21.0.1 (JDK-8303279). Applies cleanly. New regression test passes, other tests pass, see relevant PRs.
25-08-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk17u-dev/pull/1690 Date: 2023-08-24 08:25:40 +0000
24-08-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk21u/pull/99 Date: 2023-08-24 07:13:09 +0000
24-08-2023

Changeset: 1cee3b9f Author: Roland Westrelin <roland@openjdk.org> Date: 2023-08-23 08:59:36 +0000 URL: https://git.openjdk.org/jdk/commit/1cee3b9fd9720e7938029a6992460b9053e65e57
23-08-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/15380 Date: 2023-08-22 07:29:13 +0000
22-08-2023

[~shade] I was away. I will most likely create the PR tomorrow.
21-08-2023

Since the original fix that causes the regression is in 17.0.9, we need to get to this as soon as possible.
21-08-2023

I think Roland is still on vacation, right?
10-08-2023

Hey Roland! Any progress on this one?
10-08-2023

ILW = Assert in C2 because Cast is incorrectly removed, reproduces with targeted test and Shenandoah GC, disable compilation of affected method or -XX:-SplitIfBlocks = HMM = P2
02-08-2023

Prototype fix seems to be specific to code added already by JDK-8252372. Are we sure that JDK-8303279 caused this? Update: Ah, JDK-8303279 just added the assert but the actual bug is in there since JDK-8252372.
02-08-2023

Thanks! I'll keep an eye on it. Given the JDK-8303279 is backported to 17.0.9 already, would be good to get this into 17u backport this month.
01-08-2023

test case and tentative fix: https://github.com/rwestrel/jdk/tree/JDK-8313262 The issue is not specific to shenandoah but I don't see how to reproduce it without it. I will be out for a while. I'll test it and create a PR when I'm back.
28-07-2023

Roland, could you please take a look? Might be something simple missing in Shenandoah?
27-07-2023