I7HDP4: Synchronize the 2306 code to the BiSheng JDK17 community
This commit is contained in:
parent
78de60d91e
commit
78f987aa2a
95
8275509-ModuleDescriptor.hashCode-isn-t-rep.patch
Normal file
95
8275509-ModuleDescriptor.hashCode-isn-t-rep.patch
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
Date: Sat, 27 May 2023 17:36:33 +0800
|
||||||
|
Subject: add
|
||||||
|
8275509-ModuleDescriptor.hashCode-isn-t-reproducible
|
||||||
|
|
||||||
|
---
|
||||||
|
.../module/ModuleDescriptorHashCodeTest.java | 77 +++++++++++++++++++
|
||||||
|
1 file changed, 77 insertions(+)
|
||||||
|
create mode 100644 test/jdk/java/lang/module/ModuleDescriptorHashCodeTest.java
|
||||||
|
|
||||||
|
diff --git a/test/jdk/java/lang/module/ModuleDescriptorHashCodeTest.java b/test/jdk/java/lang/module/ModuleDescriptorHashCodeTest.java
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000..ef6775e2d
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/test/jdk/java/lang/module/ModuleDescriptorHashCodeTest.java
|
||||||
|
@@ -0,0 +1,77 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
+ * Copyright (c) 2023, Huawei Technologies Co., Ltd. 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.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+import org.testng.annotations.Test;
|
||||||
|
+
|
||||||
|
+import java.io.IOException;
|
||||||
|
+import java.io.InputStream;
|
||||||
|
+import java.lang.module.ModuleDescriptor;
|
||||||
|
+import java.util.Set;
|
||||||
|
+
|
||||||
|
+import static org.testng.Assert.assertEquals;
|
||||||
|
+import static org.testng.Assert.assertNotSame;
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * @test
|
||||||
|
+ * @bug 8275509
|
||||||
|
+ * @run testng ModuleDescriptorHashCodeTest
|
||||||
|
+ * @run testng/othervm -Xshare:off ModuleDescriptorHashCodeTest
|
||||||
|
+ * @summary Tests the ModuleDescriptor.hashCode() for boot layer modules
|
||||||
|
+ */
|
||||||
|
+public class ModuleDescriptorHashCodeTest {
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * Verifies that the ModuleDescriptor.hashCode() returned by a boot layer module is
|
||||||
|
+ * the same as that returned by a ModuleDescriptor constructed from the ModuleDescriptor.Builder
|
||||||
|
+ * for the same module.
|
||||||
|
+ */
|
||||||
|
+ @Test
|
||||||
|
+ public void testBootModuleDescriptor() throws Exception {
|
||||||
|
+ Set<Module> bootModules = ModuleLayer.boot().modules();
|
||||||
|
+ for (Module bootModule : bootModules) {
|
||||||
|
+ System.out.println("Testing module descriptor of boot module " + bootModule);
|
||||||
|
+ ModuleDescriptor bootMD = bootModule.getDescriptor();
|
||||||
|
+ ModuleDescriptor mdFromBuilder = fromModuleInfoClass(bootModule);
|
||||||
|
+ // verify that this object is indeed a different object instance than the boot module descriptor
|
||||||
|
+ // to prevent any artificial passing of the test
|
||||||
|
+ assertNotSame(mdFromBuilder, bootMD, "ModuleDescriptor loaded from boot layer and " +
|
||||||
|
+ "one created from module-info.class unexpectedly returned the same instance");
|
||||||
|
+ assertEquals(mdFromBuilder.hashCode(), bootMD.hashCode(),
|
||||||
|
+ "Unexpected ModuleDescriptor.hashCode() for " + mdFromBuilder);
|
||||||
|
+ assertEquals(mdFromBuilder.compareTo(bootMD), 0,
|
||||||
|
+ "Unexpected ModuleDescriptor.compareTo() for " + mdFromBuilder);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // Returns a ModuleDescriptor parsed out of the module-info.class of the passed Module
|
||||||
|
+ private static ModuleDescriptor fromModuleInfoClass(Module module) throws IOException {
|
||||||
|
+ try (InputStream moduleInfo = module.getResourceAsStream("module-info.class")) {
|
||||||
|
+ if (moduleInfo == null) {
|
||||||
|
+ throw new RuntimeException("Could not locate module-info.class in " + module);
|
||||||
|
+ }
|
||||||
|
+ // internally calls ModuleDescriptor.Builder
|
||||||
|
+ return ModuleDescriptor.read(moduleInfo);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
--
|
||||||
|
2.22.0
|
||||||
|
|
||||||
175
8302595-use-after-free-related-to-GraphKit-.patch
Normal file
175
8302595-use-after-free-related-to-GraphKit-.patch
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
Date: Sat, 27 May 2023 17:40:53 +0800
|
||||||
|
Subject: add
|
||||||
|
8302595-use-after-free-related-to-GraphKit-clone_map.patch
|
||||||
|
|
||||||
|
---
|
||||||
|
src/hotspot/share/opto/compile.hpp | 3 ++-
|
||||||
|
src/hotspot/share/opto/graphKit.cpp | 23 +++++++++++++++++++++
|
||||||
|
src/hotspot/share/opto/graphKit.hpp | 7 ++++++-
|
||||||
|
src/hotspot/share/opto/library_call.cpp | 6 +++---
|
||||||
|
src/hotspot/share/opto/node.hpp | 5 +++++
|
||||||
|
src/hotspot/share/opto/phaseX.hpp | 5 +++++
|
||||||
|
src/hotspot/share/opto/vectorIntrinsics.cpp | 4 ++--
|
||||||
|
7 files changed, 46 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/hotspot/share/opto/compile.hpp b/src/hotspot/share/opto/compile.hpp
|
||||||
|
index 6e5f2ed23..b7c18b337 100644
|
||||||
|
--- a/src/hotspot/share/opto/compile.hpp
|
||||||
|
+++ b/src/hotspot/share/opto/compile.hpp
|
||||||
|
@@ -921,7 +921,8 @@ class Compile : public Phase {
|
||||||
|
// Parsing, optimization
|
||||||
|
PhaseGVN* initial_gvn() { return _initial_gvn; }
|
||||||
|
Unique_Node_List* for_igvn() { return _for_igvn; }
|
||||||
|
- inline void record_for_igvn(Node* n); // Body is after class Unique_Node_List.
|
||||||
|
+ inline void record_for_igvn(Node* n); // Body is after class Unique_Node_List in node.hpp.
|
||||||
|
+ inline void remove_for_igvn(Node* n); // Body is after class Unique_Node_List in node.hpp.
|
||||||
|
void set_initial_gvn(PhaseGVN *gvn) { _initial_gvn = gvn; }
|
||||||
|
void set_for_igvn(Unique_Node_List *for_igvn) { _for_igvn = for_igvn; }
|
||||||
|
|
||||||
|
diff --git a/src/hotspot/share/opto/graphKit.cpp b/src/hotspot/share/opto/graphKit.cpp
|
||||||
|
index a3df43c23..07d1999b2 100644
|
||||||
|
--- a/src/hotspot/share/opto/graphKit.cpp
|
||||||
|
+++ b/src/hotspot/share/opto/graphKit.cpp
|
||||||
|
@@ -738,6 +738,29 @@ SafePointNode* GraphKit::clone_map() {
|
||||||
|
return clonemap;
|
||||||
|
}
|
||||||
|
|
||||||
|
+// -----------------------------destruct_map_clone------------------------------
|
||||||
|
+// Order of destruct is important to increase the likelyhood that memory can be re-used. We need
|
||||||
|
+// to destruct/free/delete in the exact opposite order as clone_map().
|
||||||
|
+void GraphKit::destruct_map_clone(SafePointNode* sfp) {
|
||||||
|
+ if (sfp == nullptr) return;
|
||||||
|
+
|
||||||
|
+ Node* mem = sfp->memory();
|
||||||
|
+ JVMState* jvms = sfp->jvms();
|
||||||
|
+
|
||||||
|
+ if (jvms != nullptr) {
|
||||||
|
+ delete jvms;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ remove_for_igvn(sfp);
|
||||||
|
+ gvn().clear_type(sfp);
|
||||||
|
+ sfp->destruct(&_gvn);
|
||||||
|
+
|
||||||
|
+ if (mem != nullptr) {
|
||||||
|
+ gvn().clear_type(mem);
|
||||||
|
+ mem->destruct(&_gvn);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
|
||||||
|
//-----------------------------set_map_clone-----------------------------------
|
||||||
|
void GraphKit::set_map_clone(SafePointNode* m) {
|
||||||
|
diff --git a/src/hotspot/share/opto/graphKit.hpp b/src/hotspot/share/opto/graphKit.hpp
|
||||||
|
index d815e2195..22f868442 100644
|
||||||
|
--- a/src/hotspot/share/opto/graphKit.hpp
|
||||||
|
+++ b/src/hotspot/share/opto/graphKit.hpp
|
||||||
|
@@ -94,7 +94,7 @@ class GraphKit : public Phase {
|
||||||
|
void* barrier_set_state() const { return C->barrier_set_state(); }
|
||||||
|
|
||||||
|
void record_for_igvn(Node* n) const { C->record_for_igvn(n); } // delegate to Compile
|
||||||
|
-
|
||||||
|
+ void remove_for_igvn(Node* n) const { C->remove_for_igvn(n); }
|
||||||
|
// Handy well-known nodes:
|
||||||
|
Node* null() const { return zerocon(T_OBJECT); }
|
||||||
|
Node* top() const { return C->top(); }
|
||||||
|
@@ -170,6 +170,11 @@ class GraphKit : public Phase {
|
||||||
|
// Clone the existing map state. (Implements PreserveJVMState.)
|
||||||
|
SafePointNode* clone_map();
|
||||||
|
|
||||||
|
+ // Reverses the work done by clone_map(). Should only be used when the node returned by
|
||||||
|
+ // clone_map() is ultimately not used. Calling Node::destruct directly in the previously
|
||||||
|
+ // mentioned circumstance instead of this method may result in use-after-free.
|
||||||
|
+ void destruct_map_clone(SafePointNode* sfp);
|
||||||
|
+
|
||||||
|
// Set the map to a clone of the given one.
|
||||||
|
void set_map_clone(SafePointNode* m);
|
||||||
|
|
||||||
|
diff --git a/src/hotspot/share/opto/library_call.cpp b/src/hotspot/share/opto/library_call.cpp
|
||||||
|
index b5970545c..2dd246093 100644
|
||||||
|
--- a/src/hotspot/share/opto/library_call.cpp
|
||||||
|
+++ b/src/hotspot/share/opto/library_call.cpp
|
||||||
|
@@ -1563,7 +1563,7 @@ bool LibraryCallKit::inline_string_char_access(bool is_store) {
|
||||||
|
set_sp(old_sp);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
- old_map->destruct(&_gvn);
|
||||||
|
+ destruct_map_clone(old_map);
|
||||||
|
if (is_store) {
|
||||||
|
access_store_at(value, adr, TypeAryPtr::BYTES, ch, TypeInt::CHAR, T_CHAR, IN_HEAP | MO_UNORDERED | C2_MISMATCHED);
|
||||||
|
} else {
|
||||||
|
@@ -2346,7 +2346,7 @@ bool LibraryCallKit::inline_unsafe_access(bool is_store, const BasicType type, c
|
||||||
|
mismatched = true; // conservatively mark all "wide" on-heap accesses as mismatched
|
||||||
|
}
|
||||||
|
|
||||||
|
- old_map->destruct(&_gvn);
|
||||||
|
+ destruct_map_clone(old_map);
|
||||||
|
assert(!mismatched || alias_type->adr_type()->is_oopptr(), "off-heap access can't be mismatched");
|
||||||
|
|
||||||
|
if (mismatched) {
|
||||||
|
@@ -2597,7 +2597,7 @@ bool LibraryCallKit::inline_unsafe_load_store(const BasicType type, const LoadSt
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
- old_map->destruct(&_gvn);
|
||||||
|
+ destruct_map_clone(old_map);
|
||||||
|
|
||||||
|
// For CAS, unlike inline_unsafe_access, there seems no point in
|
||||||
|
// trying to refine types. Just use the coarse types here.
|
||||||
|
diff --git a/src/hotspot/share/opto/node.hpp b/src/hotspot/share/opto/node.hpp
|
||||||
|
index 2a78e259d..b79e7673f 100644
|
||||||
|
--- a/src/hotspot/share/opto/node.hpp
|
||||||
|
+++ b/src/hotspot/share/opto/node.hpp
|
||||||
|
@@ -1647,6 +1647,11 @@ inline void Compile::record_for_igvn(Node* n) {
|
||||||
|
_for_igvn->push(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
+// Inline definition of Compile::remove_for_igvn must be deferred to this point.
|
||||||
|
+inline void Compile::remove_for_igvn(Node* n) {
|
||||||
|
+ _for_igvn->remove(n);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
//------------------------------Node_Stack-------------------------------------
|
||||||
|
class Node_Stack {
|
||||||
|
friend class VMStructs;
|
||||||
|
diff --git a/src/hotspot/share/opto/phaseX.hpp b/src/hotspot/share/opto/phaseX.hpp
|
||||||
|
index 6d0d8ca46..252761161 100644
|
||||||
|
--- a/src/hotspot/share/opto/phaseX.hpp
|
||||||
|
+++ b/src/hotspot/share/opto/phaseX.hpp
|
||||||
|
@@ -238,6 +238,11 @@ public:
|
||||||
|
assert(t != NULL, "type must not be null");
|
||||||
|
_types.map(n->_idx, t);
|
||||||
|
}
|
||||||
|
+ void clear_type(const Node* n) {
|
||||||
|
+ if (n->_idx < _types.Size()) {
|
||||||
|
+ _types.map(n->_idx, NULL);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
// Record an initial type for a node, the node's bottom type.
|
||||||
|
void set_type_bottom(const Node* n) {
|
||||||
|
// Use this for initialization when bottom_type() (or better) is not handy.
|
||||||
|
diff --git a/src/hotspot/share/opto/vectorIntrinsics.cpp b/src/hotspot/share/opto/vectorIntrinsics.cpp
|
||||||
|
index 06f491419..92f292438 100644
|
||||||
|
--- a/src/hotspot/share/opto/vectorIntrinsics.cpp
|
||||||
|
+++ b/src/hotspot/share/opto/vectorIntrinsics.cpp
|
||||||
|
@@ -868,7 +868,7 @@ bool LibraryCallKit::inline_vector_mem_operation(bool is_store) {
|
||||||
|
set_result(box);
|
||||||
|
}
|
||||||
|
|
||||||
|
- old_map->destruct(&_gvn);
|
||||||
|
+ destruct_map_clone(old_map);
|
||||||
|
|
||||||
|
if (can_access_non_heap) {
|
||||||
|
insert_mem_bar(Op_MemBarCPUOrder);
|
||||||
|
@@ -1006,7 +1006,7 @@ bool LibraryCallKit::inline_vector_gather_scatter(bool is_scatter) {
|
||||||
|
set_result(box);
|
||||||
|
}
|
||||||
|
|
||||||
|
- old_map->destruct(&_gvn);
|
||||||
|
+ destruct_map_clone(old_map);
|
||||||
|
|
||||||
|
C->set_max_vector_size(MAX2(C->max_vector_size(), (uint)(num_elem * type2aelembytes(elem_bt))));
|
||||||
|
return true;
|
||||||
|
--
|
||||||
|
2.22.0
|
||||||
|
|
||||||
24
8303069-Memory-leak-in-CompilerOracle-parse.patch
Normal file
24
8303069-Memory-leak-in-CompilerOracle-parse.patch
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
Date: Sat, 27 May 2023 17:39:02 +0800
|
||||||
|
Subject: add
|
||||||
|
8303069-Memory-leak-in-CompilerOracle-parse_from_lin.patch
|
||||||
|
|
||||||
|
---
|
||||||
|
src/hotspot/share/compiler/compilerOracle.cpp | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/hotspot/share/compiler/compilerOracle.cpp b/src/hotspot/share/compiler/compilerOracle.cpp
|
||||||
|
index 69a327873..5149121c5 100644
|
||||||
|
--- a/src/hotspot/share/compiler/compilerOracle.cpp
|
||||||
|
+++ b/src/hotspot/share/compiler/compilerOracle.cpp
|
||||||
|
@@ -308,6 +308,8 @@ static void register_command(TypedMethodOptionMatcher* matcher,
|
||||||
|
|
||||||
|
if (option == CompileCommand::Blackhole && !UnlockExperimentalVMOptions) {
|
||||||
|
warning("Blackhole compile option is experimental and must be enabled via -XX:+UnlockExperimentalVMOptions");
|
||||||
|
+ // Delete matcher as we don't keep it
|
||||||
|
+ delete matcher;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.22.0
|
||||||
|
|
||||||
29
8304683-Memory-leak-in-WB_IsMethodCompatibl.patch
Normal file
29
8304683-Memory-leak-in-WB_IsMethodCompatibl.patch
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
Date: Sat, 27 May 2023 17:40:24 +0800
|
||||||
|
Subject: add
|
||||||
|
8304683-Memory-leak-in-WB_IsMethodCompatible.patch
|
||||||
|
|
||||||
|
---
|
||||||
|
src/hotspot/share/prims/whitebox.cpp | 7 +++----
|
||||||
|
1 file changed, 3 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/hotspot/share/prims/whitebox.cpp b/src/hotspot/share/prims/whitebox.cpp
|
||||||
|
index 296bfe9e4..f6c947f13 100644
|
||||||
|
--- a/src/hotspot/share/prims/whitebox.cpp
|
||||||
|
+++ b/src/hotspot/share/prims/whitebox.cpp
|
||||||
|
@@ -821,10 +821,9 @@ static bool is_excluded_for_compiler(AbstractCompiler* comp, methodHandle& mh) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
DirectiveSet* directive = DirectivesStack::getMatchingDirective(mh, comp);
|
||||||
|
- if (directive->ExcludeOption) {
|
||||||
|
- return true;
|
||||||
|
- }
|
||||||
|
- return false;
|
||||||
|
+ bool exclude = directive->ExcludeOption;
|
||||||
|
+ DirectivesStack::release(directive);
|
||||||
|
+ return exclude;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool can_be_compiled_at_level(methodHandle& mh, jboolean is_osr, int level) {
|
||||||
|
--
|
||||||
|
2.22.0
|
||||||
|
|
||||||
260
8305541-C2-Div-Mod-nodes-without-zero-check.patch
Normal file
260
8305541-C2-Div-Mod-nodes-without-zero-check.patch
Normal file
@ -0,0 +1,260 @@
|
|||||||
|
Date: Sat, 27 May 2023 17:38:35 +0800
|
||||||
|
Subject: add
|
||||||
|
8305541-C2-Div-Mod-nodes-without-zero-check-could-be.patch
|
||||||
|
|
||||||
|
---
|
||||||
|
src/hotspot/share/opto/loopnode.hpp | 3 +
|
||||||
|
src/hotspot/share/opto/loopopts.cpp | 42 ++++-
|
||||||
|
.../c2/TestSplitDivisionThroughPhi.java | 161 ++++++++++++++++++
|
||||||
|
3 files changed, 205 insertions(+), 1 deletion(-)
|
||||||
|
create mode 100644 test/hotspot/jtreg/compiler/c2/TestSplitDivisionThroughPhi.java
|
||||||
|
|
||||||
|
diff --git a/src/hotspot/share/opto/loopnode.hpp b/src/hotspot/share/opto/loopnode.hpp
|
||||||
|
index ebc3bd1db..0db6d0881 100644
|
||||||
|
--- a/src/hotspot/share/opto/loopnode.hpp
|
||||||
|
+++ b/src/hotspot/share/opto/loopnode.hpp
|
||||||
|
@@ -1506,6 +1506,9 @@ private:
|
||||||
|
void try_move_store_after_loop(Node* n);
|
||||||
|
bool identical_backtoback_ifs(Node *n);
|
||||||
|
bool can_split_if(Node *n_ctrl);
|
||||||
|
+ bool cannot_split_division(const Node* n, const Node* region) const;
|
||||||
|
+ static bool is_divisor_counted_loop_phi(const Node* divisor, const Node* loop);
|
||||||
|
+ bool loop_phi_backedge_type_contains_zero(const Node* phi_divisor, const Type* zero) const;
|
||||||
|
|
||||||
|
// Determine if a method is too big for a/another round of split-if, based on
|
||||||
|
// a magic (approximate) ratio derived from the equally magic constant 35000,
|
||||||
|
diff --git a/src/hotspot/share/opto/loopopts.cpp b/src/hotspot/share/opto/loopopts.cpp
|
||||||
|
index c0804ed67..9e0f1b2d2 100644
|
||||||
|
--- a/src/hotspot/share/opto/loopopts.cpp
|
||||||
|
+++ b/src/hotspot/share/opto/loopopts.cpp
|
||||||
|
@@ -1,5 +1,5 @@
|
||||||
|
/*
|
||||||
|
- * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
+ * Copyright (c) 1999, 2023, 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
|
||||||
|
@@ -61,6 +61,10 @@ Node* PhaseIdealLoop::split_thru_phi(Node* n, Node* region, int policy) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (cannot_split_division(n, region)) {
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
// Bail out if 'n' is a Div or Mod node whose zero check was removed earlier (i.e. control is NULL) and its divisor is an induction variable
|
||||||
|
// phi p of a trip-counted (integer) loop whose inputs could be zero (include zero in their type range). p could have a more precise type
|
||||||
|
// range that does not necessarily include all values of its inputs. Since each of these inputs will be a divisor of the newly cloned nodes
|
||||||
|
@@ -225,6 +229,42 @@ Node* PhaseIdealLoop::split_thru_phi(Node* n, Node* region, int policy) {
|
||||||
|
return phi;
|
||||||
|
}
|
||||||
|
|
||||||
|
+// Return true if 'n' is a Div or Mod node (without zero check If node which was removed earlier) with a loop phi divisor
|
||||||
|
+// of a trip-counted (integer or long) loop with a backedge input that could be zero (include zero in its type range). In
|
||||||
|
+// this case, we cannot split the division to the backedge as it could freely float above the loop exit check resulting in
|
||||||
|
+// a division by zero. This situation is possible because the type of an increment node of an iv phi (trip-counter) could
|
||||||
|
+// include zero while the iv phi does not (see PhiNode::Value() for trip-counted loops where we improve types of iv phis).
|
||||||
|
+// We also need to check other loop phis as they could have been created in the same split-if pass when applying
|
||||||
|
+// PhaseIdealLoop::split_thru_phi() to split nodes through an iv phi.
|
||||||
|
+bool PhaseIdealLoop::cannot_split_division(const Node* n, const Node* region) const {
|
||||||
|
+ const Type* zero;
|
||||||
|
+ switch (n->Opcode()) {
|
||||||
|
+ case Op_DivI:
|
||||||
|
+ case Op_ModI:
|
||||||
|
+ zero = TypeInt::ZERO;
|
||||||
|
+ break;
|
||||||
|
+ case Op_DivL:
|
||||||
|
+ case Op_ModL:
|
||||||
|
+ zero = TypeLong::ZERO;
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ assert(n->in(0) == NULL, "divisions with zero check should already have bailed out earlier in split-if");
|
||||||
|
+ Node* divisor = n->in(2);
|
||||||
|
+ return is_divisor_counted_loop_phi(divisor, region) &&
|
||||||
|
+ loop_phi_backedge_type_contains_zero(divisor, zero);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+bool PhaseIdealLoop::is_divisor_counted_loop_phi(const Node* divisor, const Node* loop) {
|
||||||
|
+ return loop->is_BaseCountedLoop() && divisor->is_Phi() && divisor->in(0) == loop;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+bool PhaseIdealLoop::loop_phi_backedge_type_contains_zero(const Node* phi_divisor, const Type* zero) const {
|
||||||
|
+ return _igvn.type(phi_divisor->in(LoopNode::LoopBackControl))->filter_speculative(zero) != Type::TOP;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
//------------------------------dominated_by------------------------------------
|
||||||
|
// Replace the dominated test with an obvious true or false. Place it on the
|
||||||
|
// IGVN worklist for later cleanup. Move control-dependent data Nodes on the
|
||||||
|
diff --git a/test/hotspot/jtreg/compiler/c2/TestSplitDivisionThroughPhi.java b/test/hotspot/jtreg/compiler/c2/TestSplitDivisionThroughPhi.java
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000..5a42e7d36
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/test/hotspot/jtreg/compiler/c2/TestSplitDivisionThroughPhi.java
|
||||||
|
@@ -0,0 +1,161 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
+ * Copyright (c) 2023, Huawei Technologies Co., Ltd. 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
|
||||||
|
+* @key stress randomness
|
||||||
|
+* @bug 8299259
|
||||||
|
+* @requires vm.compiler2.enabled
|
||||||
|
+* @summary Test various cases of divisions/modulo which should not be split through iv phis.
|
||||||
|
+* @run main/othervm -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:LoopUnrollLimit=0 -XX:+StressGCM -XX:StressSeed=884154126
|
||||||
|
+* -XX:CompileCommand=compileonly,compiler.splitif.TestSplitDivisionThroughPhi::*
|
||||||
|
+* compiler.splitif.TestSplitDivisionThroughPhi
|
||||||
|
+*/
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+* @test
|
||||||
|
+* @key stress randomness
|
||||||
|
+* @bug 8299259
|
||||||
|
+* @requires vm.compiler2.enabled
|
||||||
|
+* @summary Test various cases of divisions/modulo which should not be split through iv phis.
|
||||||
|
+* @run main/othervm -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:LoopUnrollLimit=0 -XX:+StressGCM
|
||||||
|
+* -XX:CompileCommand=compileonly,compiler.splitif.TestSplitDivisionThroughPhi::*
|
||||||
|
+* compiler.splitif.TestSplitDivisionThroughPhi
|
||||||
|
+*/
|
||||||
|
+
|
||||||
|
+package compiler.splitif;
|
||||||
|
+
|
||||||
|
+public class TestSplitDivisionThroughPhi {
|
||||||
|
+ static int iFld;
|
||||||
|
+ static long lFld;
|
||||||
|
+ static boolean flag;
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+ public static void main(String[] strArr) {
|
||||||
|
+ for (int i = 0; i < 5000; i++) {
|
||||||
|
+ testPushDivIThruPhi();
|
||||||
|
+ testPushDivIThruPhiInChain();
|
||||||
|
+ testPushModIThruPhi();
|
||||||
|
+ testPushModIThruPhiInChain();
|
||||||
|
+ testPushDivLThruPhi();
|
||||||
|
+ testPushDivLThruPhiInChain();
|
||||||
|
+ testPushModLThruPhi();
|
||||||
|
+ testPushModLThruPhiInChain();
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // Already fixed by JDK-8248552.
|
||||||
|
+ static void testPushDivIThruPhi() {
|
||||||
|
+ for (int i = 10; i > 1; i -= 2) {
|
||||||
|
+ // The Div node is only split in later loop opts phase because the zero divisor check is only removed
|
||||||
|
+ // in IGVN after the first loop opts phase.
|
||||||
|
+ //
|
||||||
|
+ // iv phi i type: [2..10]
|
||||||
|
+ // When splitting the DivI through the iv phi, it ends up on the back edge with the trip count decrement
|
||||||
|
+ // as input which has type [0..8]. We end up executing a division by zero on the last iteration because
|
||||||
|
+ // the DivI it is not pinned to the loop exit test and can freely float above the loop exit check.
|
||||||
|
+ iFld = 10 / i;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // Same as above but with an additional Mul node between the iv phi and the Div node. Both nodes are split through
|
||||||
|
+ // the iv phi in one pass of Split If.
|
||||||
|
+ static void testPushDivIThruPhiInChain() {
|
||||||
|
+ for (int i = 10; i > 1; i -= 2) {
|
||||||
|
+ // Empty one iteration loop which is only removed after split if in first loop opts phase. This prevents
|
||||||
|
+ // that the Mul node is already split through the iv phi while the Div node cannot be split yet due to
|
||||||
|
+ // the zero divisor check which can only be removed in the IGVN after the first loop opts pass.
|
||||||
|
+ for (int j = 0; j < 1; j++) {
|
||||||
|
+ }
|
||||||
|
+ iFld = 10 / (i * 100);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // Already fixed by JDK-8248552.
|
||||||
|
+ static void testPushModIThruPhi() {
|
||||||
|
+ for (int i = 10; i > 1; i -= 2) {
|
||||||
|
+ iFld = 10 / i;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // Same as above but with ModI.
|
||||||
|
+ static void testPushModIThruPhiInChain() {
|
||||||
|
+ for (int i = 10; i > 1; i -= 2) {
|
||||||
|
+ for (int j = 0; j < 1; j++) {
|
||||||
|
+ }
|
||||||
|
+ iFld = 10 / (i * 100);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // Long cases only trigger since JDK-8256655.
|
||||||
|
+
|
||||||
|
+ // Same as above but with DivL.
|
||||||
|
+ static void testPushDivLThruPhi() {
|
||||||
|
+ for (long i = 10; i > 1; i -= 2) {
|
||||||
|
+ lFld = 10L / i;
|
||||||
|
+
|
||||||
|
+ // Loop that is not removed such that we do not transform the outer LongCountedLoop (only done if innermost)
|
||||||
|
+ for (int j = 0; j < 10; j++) {
|
||||||
|
+ flag = !flag;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // Same as above but with DivL.
|
||||||
|
+ static void testPushDivLThruPhiInChain() {
|
||||||
|
+ for (long i = 10; i > 1; i -= 2) {
|
||||||
|
+ for (int j = 0; j < 1; j++) {
|
||||||
|
+ }
|
||||||
|
+ lFld = 10L / (i * 100L);
|
||||||
|
+
|
||||||
|
+ for (int j = 0; j < 10; j++) {
|
||||||
|
+ flag = !flag;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // Same as above but with ModL
|
||||||
|
+ static void testPushModLThruPhi() {
|
||||||
|
+ for (long i = 10; i > 1; i -= 2) {
|
||||||
|
+ lFld = 10L % i;
|
||||||
|
+
|
||||||
|
+ for (int j = 0; j < 10; j++) {
|
||||||
|
+ flag = !flag;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // Same as above but with ModL
|
||||||
|
+ static void testPushModLThruPhiInChain() {
|
||||||
|
+ for (long i = 10; i > 1; i -= 2) {
|
||||||
|
+ for (int j = 0; j < 1; j++) {
|
||||||
|
+ }
|
||||||
|
+ lFld = 10L % (i * 100L);
|
||||||
|
+
|
||||||
|
+ for (int j = 0; j < 10; j++) {
|
||||||
|
+ flag = !flag;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
--
|
||||||
|
2.22.0
|
||||||
|
|
||||||
@ -888,7 +888,7 @@ Provides: java-src%{?1} = %{epoch}:%{version}-%{release}
|
|||||||
|
|
||||||
Name: java-%{javaver}-%{origin}
|
Name: java-%{javaver}-%{origin}
|
||||||
Version: %{newjavaver}.%{buildver}
|
Version: %{newjavaver}.%{buildver}
|
||||||
Release: 5
|
Release: 6
|
||||||
|
|
||||||
# java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons
|
# 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
|
# and this change was brought into RHEL-4. java-1.5.0-ibm packages
|
||||||
@ -985,6 +985,11 @@ Patch24: 8275509-ModuleDescriptor.hashCode-isn-t-reproducible.patch
|
|||||||
|
|
||||||
# 17.0.7
|
# 17.0.7
|
||||||
Patch26: 8280872-Reorder-code-cache-segments-to-improv.patch
|
Patch26: 8280872-Reorder-code-cache-segments-to-improv.patch
|
||||||
|
Patch27: 8275509-ModuleDescriptor.hashCode-isn-t-rep.patch
|
||||||
|
Patch28: 8302595-use-after-free-related-to-GraphKit-.patch
|
||||||
|
Patch29: 8303069-Memory-leak-in-CompilerOracle-parse.patch
|
||||||
|
Patch30: 8304683-Memory-leak-in-WB_IsMethodCompatibl.patch
|
||||||
|
Patch31: 8305541-C2-Div-Mod-nodes-without-zero-check.patch
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
#
|
#
|
||||||
@ -1233,6 +1238,11 @@ pushd %{top_level_dir_name}
|
|||||||
%patch23 -p1
|
%patch23 -p1
|
||||||
%patch24 -p1
|
%patch24 -p1
|
||||||
%patch26 -p1
|
%patch26 -p1
|
||||||
|
%patch27 -p1
|
||||||
|
%patch28 -p1
|
||||||
|
%patch29 -p1
|
||||||
|
%patch30 -p1
|
||||||
|
%patch31 -p1
|
||||||
popd # openjdk
|
popd # openjdk
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
@ -1792,6 +1802,13 @@ cjc.mainProgram(arg)
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Jun 30 2023 kuenking111 <wangkun49@huawei.com> - 1:17.0.7.7-0.6
|
||||||
|
- add 8275509-ModuleDescriptor.hashCode-isn-t-rep.patch
|
||||||
|
- add 8302595-use-after-free-related-to-GraphKit-.patch
|
||||||
|
- add 8303069-Memory-leak-in-CompilerOracle-parse.patch
|
||||||
|
- add 8304683-Memory-leak-in-WB_IsMethodCompatibl.patch
|
||||||
|
- add 8305541-C2-Div-Mod-nodes-without-zero-check.patch
|
||||||
|
|
||||||
* Tue May 30 2023 wanghao_hw <wanghao564@huawei.com> - 1:17.0.7.7-0.5
|
* Tue May 30 2023 wanghao_hw <wanghao564@huawei.com> - 1:17.0.7.7-0.5
|
||||||
- del 8284336_CDS_SignedJar_java_test_fails_due__to_archived_Reference_object.patch
|
- del 8284336_CDS_SignedJar_java_test_fails_due__to_archived_Reference_object.patch
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user