JDK-8314106 : C2: assert(is_valid()) failed: must be valid after JDK-8305636
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 22
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-08-10
  • Updated: 2023-09-04
  • Resolved: 2023-08-14
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 22
22 b11Fixed
Related Reports
Relates :  
Description
The attached Fuzzer test fails:

```
cd 0001/
../build/linux-x86_64-server-fastdebug/images/jdk/bin/java -Xmx512m -XX:-TieredCompilation Test

# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/home/shipilev/shipilev-jdk/src/hotspot/share/opto/predicates.hpp:252), pid=18183, tid=18203
#  assert(is_valid()) failed: must be valid
#

Current thread (0x00007f8f6425e980):  JavaThread "C2 CompilerThread4" daemon [_thread_in_native, id=18203, stack(0x00007f8fe170c000,0x00007f8fe180d000) (1028K)]


Current CompileTask:
C2:    254   27             Test::vMeth (380 bytes)

Stack: [0x00007f8fe170c000,0x00007f8fe180d000],  sp=0x00007f8fe18076b0,  free space=1005k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x1122f5f]  PhaseIdealLoop::clone_parse_predicate_to_unswitched_loops(PredicateBlock const*, Deoptimization::DeoptReason, IfProjNode*&, IfProjNode*&)+0xaf  (predicates.hpp:252)
V  [libjvm.so+0x112322a]  PhaseIdealLoop::clone_parse_and_assertion_predicates_to_unswitched_loop(IdealLoopTree*, Node_List&, IfProjNode*&, IfProjNode*&)+0x1ea  (loopPredicate.cpp:449)
V  [libjvm.so+0x11412ae]  PhaseIdealLoop::create_slow_version_of_loop(IdealLoopTree*, Node_List&, IfNode*, PhaseIdealLoop::CloneLoopMode)+0x8ae  (loopUnswitch.cpp:255)
V  [libjvm.so+0x11424aa]  PhaseIdealLoop::do_unswitching(IdealLoopTree*, Node_List&)+0xfa  (loopUnswitch.cpp:142)
V  [libjvm.so+0x113eb58]  IdealLoopTree::iteration_split_impl(PhaseIdealLoop*, Node_List&)+0x1c8  (loopTransform.cpp:3601)
V  [libjvm.so+0x113f142]  IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x2e2  (loopTransform.cpp:3730)
V  [libjvm.so+0x113f123]  IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x2c3  (loopTransform.cpp:3742)
V  [libjvm.so+0x113f123]  IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x2c3  (loopTransform.cpp:3742
```

Bisection points to JDK-8305636.
Comments
Changeset: 1de5bf1c Author: Christian Hagedorn <chagedorn@openjdk.org> Date: 2023-08-14 08:14:42 +0000 URL: https://git.openjdk.org/jdk/commit/1de5bf1ce94c20bc2fd481cd4387f170b0d3c63d
14-08-2023

I've had a look and it looks unrelated. This one here is a bug in loop unswitching and the other one is actually an existing bug that is now triggering more often because of an accidental change in loop peeling done in JDK-8305636 which was only intended for the complete fix in JDK-8288981.
11-08-2023

Please see if JDK-8314116 is a part of this one? I tested with the first revision of the PR for this issue, and the issue still replicates.
10-08-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/15225 Date: 2023-08-10 13:35:46 +0000
10-08-2023

ILW = Assertion in Loop Unswitching, seems intermittent/single fuzzer case, possibly disable compilation of affected method or use -XX:-LoopUnswitching = HLM = P3
10-08-2023

That's great because I was not able to reproduce TestVectorAVX1.java on Linux, yet. I'll have a look.
10-08-2023

Cool. The failure on the Fuzzer test reproduces very reliably for me here.
10-08-2023

We've also just observed it once in tier2 with compiler/vectorapi/reshape/TestVectorCastAVX1.java on Windows.
10-08-2023