diff --git a/8210389-C2-assert-n-outcnt-0-C-top-n-n-is_Proj-faile.patch b/8210389-C2-assert-n-outcnt-0-C-top-n-n-is_Proj-faile.patch new file mode 100644 index 0000000000000000000000000000000000000000..0153509dbf2e446bcf3a3f91ecc714aee10d794f --- /dev/null +++ b/8210389-C2-assert-n-outcnt-0-C-top-n-n-is_Proj-faile.patch @@ -0,0 +1,137 @@ +From e755384fb69002c1e938e8f1d96f0ea004030b87 Mon Sep 17 00:00:00 2001 +Date: Wed, 22 Oct 2025 11:04:04 +0800 +Subject: [PATCH 1/2] 8210389: C2: assert(n->outcnt() != 0 || C->top() == n || + n->is_Proj()) failed: No dead instructions after post-alloc + +--- + hotspot/src/share/vm/opto/compile.cpp | 26 ++++++ + .../regalloc/VolatileLoadMemBarsOnlyUses.java | 80 +++++++++++++++++++ + 2 files changed, 106 insertions(+) + create mode 100644 hotspot/test/compiler/regalloc/VolatileLoadMemBarsOnlyUses.java + +diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp +index a43efe5f1..4991e9cbe 100644 +--- a/hotspot/src/share/vm/opto/compile.cpp ++++ b/hotspot/src/share/vm/opto/compile.cpp +@@ -3251,6 +3251,32 @@ void Compile::final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc) { + n->set_req(MemBarNode::Precedent, top()); + } + break; ++ case Op_MemBarAcquire: { ++ if (n->as_MemBar()->trailing_load() && n->req() > MemBarNode::Precedent) { ++ // At parse time, the trailing MemBarAcquire for a volatile load ++ // is created with an edge to the load. After optimizations, ++ // that input may be a chain of Phis. If those phis have no ++ // other use, then the MemBarAcquire keeps them alive and ++ // register allocation can be confused. ++ ResourceMark rm; ++ Unique_Node_List wq; ++ wq.push(n->in(MemBarNode::Precedent)); ++ n->set_req(MemBarNode::Precedent, top()); ++ while (wq.size() > 0) { ++ Node* m = wq.pop(); ++ if (m->outcnt() == 0) { ++ for (uint j = 0; j < m->req(); j++) { ++ Node* in = m->in(j); ++ if (in != NULL) { ++ wq.push(in); ++ } ++ } ++ m->disconnect_inputs(NULL, this); ++ } ++ } ++ } ++ break; ++ } + default: + assert( !n->is_Call(), "" ); + assert( !n->is_Mem(), "" ); +diff --git a/hotspot/test/compiler/regalloc/VolatileLoadMemBarsOnlyUses.java b/hotspot/test/compiler/regalloc/VolatileLoadMemBarsOnlyUses.java +new file mode 100644 +index 000000000..e09fb048b +--- /dev/null ++++ b/hotspot/test/compiler/regalloc/VolatileLoadMemBarsOnlyUses.java +@@ -0,0 +1,80 @@ ++/* ++ * Copyright (c) 2018, Red Hat, Inc. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ */ ++ ++/** ++ * @test ++ * @bug 8210389 ++ * @summary C2: assert(n->outcnt() != 0 || C->top() == n || n->is_Proj()) failed: No dead instructions after post-alloc ++ * ++ * @run main/othervm -Xcomp -XX:CompileOnly=VolatileLoadMemBarsOnlyUses VolatileLoadMemBarsOnlyUses ++ * ++ */ ++ ++public class VolatileLoadMemBarsOnlyUses { ++ ++ public static final int N = 400; ++ public static long instanceCount=-94L; ++ public static volatile byte byFld=-108; ++ ++ public int mainTest(String[] strArr1) { ++ ++ int i17=9, i19=1, i20=63, i21=-32916, i22=0, iArr[]=new int[N]; ++ boolean b1=false; ++ double d3=76.18241; ++ ++ for (int i : iArr) { ++ for (i17 = 2; i17 < 63; i17++) { ++ if (b1) break; ++ byFld += (byte)(0.131F + (i17 * i17)); ++ } ++ for (i19 = 1; 63 > i19; ++i19) { ++ for (i21 = 1; i21 < 2; i21++) { ++ d3 = i22; ++ if (b1) continue; ++ i20 = i21; ++ } ++ d3 -= byFld; ++ instanceCount = 46725L; ++ } ++ switch ((((i22 >>> 1) % 4) * 5) + 91) { ++ case 98: ++ break; ++ case 110: ++ break; ++ case 105: ++ break; ++ case 103: ++ break; ++ default: ++ } ++ } ++ ++ return i20; ++ } ++ public static void main(String[] strArr) { ++ VolatileLoadMemBarsOnlyUses _instance = new VolatileLoadMemBarsOnlyUses(); ++ for (int i = 0; i < 10; i++ ) { ++ _instance.mainTest(strArr); ++ } ++ } ++} +-- +2.34.1 + diff --git a/8287432-C2-assert-tn-in-0-__null-failed-must-have-li.patch b/8287432-C2-assert-tn-in-0-__null-failed-must-have-li.patch new file mode 100644 index 0000000000000000000000000000000000000000..932a34513d12f4b1da174d0003ea15d5314ab432 --- /dev/null +++ b/8287432-C2-assert-tn-in-0-__null-failed-must-have-li.patch @@ -0,0 +1,88 @@ +From f4a5e2de37e2b92ead96aa2b3e80887b809f2388 Mon Sep 17 00:00:00 2001 +Date: Wed, 22 Oct 2025 11:06:00 +0800 +Subject: [PATCH 2/2] 8287432: C2: assert(tn->in(0) != __null) failed: must + have live top node + +--- + hotspot/src/share/vm/opto/compile.cpp | 2 +- + .../compiler/c2/TestRemoveMemBarPrecEdge.java | 55 +++++++++++++++++++ + 2 files changed, 56 insertions(+), 1 deletion(-) + create mode 100644 hotspot/test/compiler/c2/TestRemoveMemBarPrecEdge.java + +diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp +index 4991e9cbe..af94d3b65 100644 +--- a/hotspot/src/share/vm/opto/compile.cpp ++++ b/hotspot/src/share/vm/opto/compile.cpp +@@ -3264,7 +3264,7 @@ void Compile::final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc) { + n->set_req(MemBarNode::Precedent, top()); + while (wq.size() > 0) { + Node* m = wq.pop(); +- if (m->outcnt() == 0) { ++ if (m->outcnt() == 0 && m != top()) { + for (uint j = 0; j < m->req(); j++) { + Node* in = m->in(j); + if (in != NULL) { +diff --git a/hotspot/test/compiler/c2/TestRemoveMemBarPrecEdge.java b/hotspot/test/compiler/c2/TestRemoveMemBarPrecEdge.java +new file mode 100644 +index 000000000..2d8168953 +--- /dev/null ++++ b/hotspot/test/compiler/c2/TestRemoveMemBarPrecEdge.java +@@ -0,0 +1,55 @@ ++/* ++ * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ */ ++ ++/* ++ * @test ++ * @bug 8287432 ++ * @summary Test removal of precedence edge of MemBarAcquire together with other now dead input nodes which visits a ++ * top node. This resulted in a crash before as it disconnected top from the graph which is unexpected. ++ * ++ * @run main/othervm -Xbatch compiler.c2.TestRemoveMemBarPrecEdge ++ */ ++package compiler.c2; ++ ++public class TestRemoveMemBarPrecEdge { ++ static boolean flag = false; ++ ++ public static void main(String[] args) { ++ for (int i = 0; i < 10000; i++) { ++ test(); ++ flag = !flag; ++ } ++ } ++ ++ public static void test() { ++ // currentThread() is intrinsified and C2 emits a special AddP node with a base that is top. ++ Thread t = Thread.currentThread(); ++ // getName() returns the volatile _name field. The method is inlined and we just emit a LoadN + DecodeN which ++ // is a precedence edge input into both MemBarAcquire nodes below for the volatile field _name. ++ if (flag) { ++ t.getName(); ++ } else { ++ t.getName(); ++ } ++ } ++} +-- +2.34.1 + diff --git a/openjdk-1.8.0.spec b/openjdk-1.8.0.spec index c1fe85f1d42eaafa0bec8795c738d896c59a204e..6d81763a05f7f5303dd3714ab2b194b419f70f9d 100644 --- a/openjdk-1.8.0.spec +++ b/openjdk-1.8.0.spec @@ -953,7 +953,7 @@ Provides: java-%{javaver}-%{origin}-accessibility%{?1} = %{epoch}:%{version}-%{r Name: java-%{javaver}-%{origin} Version: %{javaver}.%{updatever}.%{buildver} -Release: 4 +Release: 5 # java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons # and this change was brought into RHEL-4. java-1.5.0-ibm packages # also included the epoch in their virtual provides. This created a @@ -1384,6 +1384,8 @@ Patch470: Backport-8296924-C2-assert-is_valid_AArch64_address-dest.targ.patch Patch471: Fix-tests-for-OS-with-64k-page-size.patch Patch472: Add-testcase-for-jdk.Deoptimization-and-bug-fixes-fo.patch Patch473: change-jprofilecache-copyright.patch +Patch474: 8210389-C2-assert-n-outcnt-0-C-top-n-n-is_Proj-faile.patch +Patch475: 8287432-C2-assert-tn-in-0-__null-failed-must-have-li.patch ############################################# # @@ -2072,6 +2074,8 @@ pushd %{top_level_dir_name} %patch471 -p1 %patch472 -p1 %patch473 -p1 +%patch474 -p1 +%patch475 -p1 %endif %ifarch loongarch64 @@ -3056,6 +3060,10 @@ cjc.mainProgram(args) -- the returns from copy_jdk_configs.lua should not affect %endif %changelog +* Wed Oct 22 2025 Benshuai5D -1:1.8.0.462.b08-5 +- add 8287432-C2-assert-tn-in-0-__null-failed-must-have-li.patch +- add 8210389-C2-assert-n-outcnt-0-C-top-n-n-is_Proj-faile.patch + * Wed Aug 6 2025 huangjie -1:1.8.0.462.b08-4 - add change-jprofilecache-copyright.patch