I4AKKS: New features of Bisheng JDK 11.0.12

This commit is contained in:
kuenking111 2021-09-17 18:51:45 +08:00
parent f82778842a
commit df1fa1401f
7 changed files with 11921 additions and 1 deletions

View File

@ -0,0 +1,127 @@
From 1c751a064538c9e80b49fd0270db034ed0dcf11f Mon Sep 17 00:00:00 2001
From: wuyan <wuyan34@huawei.com>
Date: Thu, 5 Aug 2021 17:29:26 +0800
Subject: [PATCH 2/8] 8257145: Performance regression with -XX:-ResizePLAB
after JDK-8079555
Summary: <gc>: backport of JDK-8264640, Performance regression with -XX:-ResizePLAB after JDK-8079555
LLT: NA
Patch Type: backport
Bug url: https://bugs.openjdk.java.net/browse/JDK-8257145
---
src/hotspot/share/gc/cms/parNewGeneration.cpp | 2 +-
src/hotspot/share/gc/g1/g1EvacStats.cpp | 5 +++--
src/hotspot/share/gc/g1/g1EvacStats.hpp | 2 +-
src/hotspot/share/gc/shared/plab.cpp | 3 +++
src/hotspot/share/gc/shared/plab.hpp | 6 ++++--
test/hotspot/jtreg/gc/g1/plab/TestPLABPromotion.java | 2 +-
6 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/hotspot/share/gc/cms/parNewGeneration.cpp b/src/hotspot/share/gc/cms/parNewGeneration.cpp
index 1b95cf52e..b1e8bde61 100644
--- a/src/hotspot/share/gc/cms/parNewGeneration.cpp
+++ b/src/hotspot/share/gc/cms/parNewGeneration.cpp
@@ -627,7 +627,7 @@ ParNewGeneration::ParNewGeneration(ReservedSpace rs, size_t initial_byte_size)
: DefNewGeneration(rs, initial_byte_size, "PCopy"),
_overflow_list(NULL),
_is_alive_closure(this),
- _plab_stats("Young", YoungPLABSize, PLABWeight)
+ _plab_stats("Young", YoungPLABSize, YoungPLABSize * ParallelGCThreads, PLABWeight)
{
NOT_PRODUCT(_overflow_counter = ParGCWorkQueueOverflowInterval;)
NOT_PRODUCT(_num_par_pushes = 0;)
diff --git a/src/hotspot/share/gc/g1/g1EvacStats.cpp b/src/hotspot/share/gc/g1/g1EvacStats.cpp
index 70c399691..7070e1840 100644
--- a/src/hotspot/share/gc/g1/g1EvacStats.cpp
+++ b/src/hotspot/share/gc/g1/g1EvacStats.cpp
@@ -28,6 +28,7 @@
#include "gc/shared/gcId.hpp"
#include "logging/log.hpp"
#include "memory/allocation.inline.hpp"
+#include "runtime/globals.hpp"
void G1EvacStats::log_plab_allocation() {
PLABStats::log_plab_allocation();
@@ -89,8 +90,8 @@ size_t G1EvacStats::compute_desired_plab_sz() {
return cur_plab_sz;
}
-G1EvacStats::G1EvacStats(const char* description, size_t desired_plab_sz_, unsigned wt) :
- PLABStats(description, desired_plab_sz_, wt),
+G1EvacStats::G1EvacStats(const char* description, size_t default_per_thread_plab_size, unsigned wt) :
+ PLABStats(description, default_per_thread_plab_size, default_per_thread_plab_size * ParallelGCThreads, wt),
_region_end_waste(0),
_regions_filled(0),
_direct_allocated(0),
diff --git a/src/hotspot/share/gc/g1/g1EvacStats.hpp b/src/hotspot/share/gc/g1/g1EvacStats.hpp
index 4ac6fd9f5..0baf2fc20 100644
--- a/src/hotspot/share/gc/g1/g1EvacStats.hpp
+++ b/src/hotspot/share/gc/g1/g1EvacStats.hpp
@@ -56,7 +56,7 @@ class G1EvacStats : public PLABStats {
virtual size_t compute_desired_plab_sz();
public:
- G1EvacStats(const char* description, size_t desired_plab_sz_, unsigned wt);
+ G1EvacStats(const char* description, size_t default_per_thread_plab_size, unsigned wt);
~G1EvacStats();
diff --git a/src/hotspot/share/gc/shared/plab.cpp b/src/hotspot/share/gc/shared/plab.cpp
index 29c4cc694..0ad6dda4a 100644
--- a/src/hotspot/share/gc/shared/plab.cpp
+++ b/src/hotspot/share/gc/shared/plab.cpp
@@ -136,6 +136,9 @@ void PLABStats::log_sizing(size_t calculated_words, size_t net_desired_words) {
// Calculates plab size for current number of gc worker threads.
size_t PLABStats::desired_plab_sz(uint no_of_gc_workers) {
+ if (!ResizePLAB) {
+ return _default_plab_sz;
+ }
return align_object_size(MIN2(MAX2(min_size(), _desired_net_plab_sz / no_of_gc_workers), max_size()));
}
diff --git a/src/hotspot/share/gc/shared/plab.hpp b/src/hotspot/share/gc/shared/plab.hpp
index 608dce56c..06e9cfef3 100644
--- a/src/hotspot/share/gc/shared/plab.hpp
+++ b/src/hotspot/share/gc/shared/plab.hpp
@@ -151,6 +151,7 @@ class PLABStats : public CHeapObj<mtGC> {
size_t _wasted; // of which wasted (internal fragmentation)
size_t _undo_wasted; // of which wasted on undo (is not used for calculation of PLAB size)
size_t _unused; // Unused in last buffer
+ size_t _default_plab_sz;
size_t _desired_net_plab_sz;// Output of filter (below), suitably trimmed and quantized
AdaptiveWeightedAverage
_filter; // Integrator with decay
@@ -169,13 +170,14 @@ class PLABStats : public CHeapObj<mtGC> {
virtual size_t compute_desired_plab_sz();
public:
- PLABStats(const char* description, size_t desired_net_plab_sz_, unsigned wt) :
+ PLABStats(const char* description, size_t default_per_thread_plab_size, size_t desired_net_plab_sz, unsigned wt) :
_description(description),
_allocated(0),
_wasted(0),
_undo_wasted(0),
_unused(0),
- _desired_net_plab_sz(desired_net_plab_sz_),
+ _default_plab_sz(default_per_thread_plab_size),
+ _desired_net_plab_sz(desired_net_plab_sz),
_filter(wt)
{ }
diff --git a/test/hotspot/jtreg/gc/g1/plab/TestPLABPromotion.java b/test/hotspot/jtreg/gc/g1/plab/TestPLABPromotion.java
index 97f221eeb..6be46e36b 100644
--- a/test/hotspot/jtreg/gc/g1/plab/TestPLABPromotion.java
+++ b/test/hotspot/jtreg/gc/g1/plab/TestPLABPromotion.java
@@ -73,7 +73,7 @@ public class TestPLABPromotion {
private static final int PLAB_SIZE_HIGH = 65536;
private static final int OBJECT_SIZE_SMALL = 10;
private static final int OBJECT_SIZE_MEDIUM = 100;
- private static final int OBJECT_SIZE_HIGH = 1000;
+ private static final int OBJECT_SIZE_HIGH = 3500;
private static final int GC_NUM_SMALL = 1;
private static final int GC_NUM_MEDIUM = 3;
private static final int GC_NUM_HIGH = 7;
--
2.22.0

View File

@ -0,0 +1,242 @@
From e3d9485d01941cfbbe01dc8dcea7b913c2e8469d Mon Sep 17 00:00:00 2001
From: chenshanyao <chenshanyao@huawei.com>
Date: Tue, 14 Sep 2021 11:43:18 +0800
Subject: [PATCH 8/8] 8268427: Improve AlgorithmConstraints:checkAlgorithm
performance
Summary: <java> : performance
LLT: jdk_security
Patch Type: backport
Bug url: https://bugs.openjdk.java.net/browse/JDK-8268427
---
.../util/AbstractAlgorithmConstraints.java | 39 +++++------
.../util/DisabledAlgorithmConstraints.java | 28 ++++----
.../util/LegacyAlgorithmConstraints.java | 2 +-
.../security/AlgorithmConstraintsPermits.java | 66 +++++++++++++++++++
4 files changed, 95 insertions(+), 40 deletions(-)
create mode 100644 test/micro/org/openjdk/bench/java/security/AlgorithmConstraintsPermits.java
diff --git a/src/java.base/share/classes/sun/security/util/AbstractAlgorithmConstraints.java b/src/java.base/share/classes/sun/security/util/AbstractAlgorithmConstraints.java
index 8d8c5d6fe..3f5678950 100644
--- a/src/java.base/share/classes/sun/security/util/AbstractAlgorithmConstraints.java
+++ b/src/java.base/share/classes/sun/security/util/AbstractAlgorithmConstraints.java
@@ -32,6 +32,7 @@ import java.security.Security;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.TreeSet;
import java.util.List;
import java.util.Set;
@@ -48,7 +49,7 @@ public abstract class AbstractAlgorithmConstraints
}
// Get algorithm constraints from the specified security property.
- static List<String> getAlgorithms(String propertyName) {
+ static Set<String> getAlgorithms(String propertyName) {
String property = AccessController.doPrivileged(
new PrivilegedAction<String>() {
@Override
@@ -72,38 +73,30 @@ public abstract class AbstractAlgorithmConstraints
// map the disabled algorithms
if (algorithmsInProperty == null) {
- return Collections.emptyList();
+ return Collections.emptySet();
}
- return new ArrayList<>(Arrays.asList(algorithmsInProperty));
+ Set<String> algorithmsInPropertySet = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
+ algorithmsInPropertySet.addAll(Arrays.asList(algorithmsInProperty));
+ return algorithmsInPropertySet;
}
- static boolean checkAlgorithm(List<String> algorithms, String algorithm,
+ static boolean checkAlgorithm(Set<String> algorithms, String algorithm,
AlgorithmDecomposer decomposer) {
if (algorithm == null || algorithm.isEmpty()) {
throw new IllegalArgumentException("No algorithm name specified");
}
- Set<String> elements = null;
- for (String item : algorithms) {
- if (item == null || item.isEmpty()) {
- continue;
- }
-
- // check the full name
- if (item.equalsIgnoreCase(algorithm)) {
- return false;
- }
+ if (algorithms.contains(algorithm)) {
+ return false;
+ }
- // decompose the algorithm into sub-elements
- if (elements == null) {
- elements = decomposer.decompose(algorithm);
- }
+ // decompose the algorithm into sub-elements
+ Set<String> elements = decomposer.decompose(algorithm);
- // check the items of the algorithm
- for (String element : elements) {
- if (item.equalsIgnoreCase(element)) {
- return false;
- }
+ // check the element of the elements
+ for (String element : elements) {
+ if (algorithms.contains(element)) {
+ return false;
}
}
diff --git a/src/java.base/share/classes/sun/security/util/DisabledAlgorithmConstraints.java b/src/java.base/share/classes/sun/security/util/DisabledAlgorithmConstraints.java
index 3ee431e62..efc6d339f 100644
--- a/src/java.base/share/classes/sun/security/util/DisabledAlgorithmConstraints.java
+++ b/src/java.base/share/classes/sun/security/util/DisabledAlgorithmConstraints.java
@@ -85,6 +85,9 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints {
private static final String PROPERTY_DISABLED_EC_CURVES =
"jdk.disabled.namedCurves";
+ private static final Pattern INCLUDE_PATTERN = Pattern.compile("include " +
+ PROPERTY_DISABLED_EC_CURVES, Pattern.CASE_INSENSITIVE);
+
private static class CertPathHolder {
static final DisabledAlgorithmConstraints CONSTRAINTS =
new DisabledAlgorithmConstraints(PROPERTY_CERTPATH_DISABLED_ALGS);
@@ -95,7 +98,7 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints {
new DisabledAlgorithmConstraints(PROPERTY_JAR_DISABLED_ALGS);
}
- private final List<String> disabledAlgorithms;
+ private final Set<String> disabledAlgorithms;
private final Constraints algorithmConstraints;
public static DisabledAlgorithmConstraints certPathConstraints() {
@@ -130,21 +133,14 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints {
disabledAlgorithms = getAlgorithms(propertyName);
// Check for alias
- int ecindex = -1, i = 0;
for (String s : disabledAlgorithms) {
- if (s.regionMatches(true, 0,"include ", 0, 8)) {
- if (s.regionMatches(true, 8, PROPERTY_DISABLED_EC_CURVES, 0,
- PROPERTY_DISABLED_EC_CURVES.length())) {
- ecindex = i;
- break;
- }
+ Matcher matcher = INCLUDE_PATTERN.matcher(s);
+ if (matcher.matches()) {
+ disabledAlgorithms.remove(matcher.group());
+ disabledAlgorithms.addAll(
+ getAlgorithms(PROPERTY_DISABLED_EC_CURVES));
+ break;
}
- i++;
- }
- if (ecindex > -1) {
- disabledAlgorithms.remove(ecindex);
- disabledAlgorithms.addAll(ecindex,
- getAlgorithms(PROPERTY_DISABLED_EC_CURVES));
}
algorithmConstraints = new Constraints(propertyName, disabledAlgorithms);
}
@@ -323,8 +319,8 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints {
"denyAfter\\s+(\\d{4})-(\\d{2})-(\\d{2})");
}
- public Constraints(String propertyName, List<String> constraintArray) {
- for (String constraintEntry : constraintArray) {
+ public Constraints(String propertyName, Set<String> constraintSet) {
+ for (String constraintEntry : constraintSet) {
if (constraintEntry == null || constraintEntry.isEmpty()) {
continue;
}
diff --git a/src/java.base/share/classes/sun/security/util/LegacyAlgorithmConstraints.java b/src/java.base/share/classes/sun/security/util/LegacyAlgorithmConstraints.java
index e4e5cedc1..550173080 100644
--- a/src/java.base/share/classes/sun/security/util/LegacyAlgorithmConstraints.java
+++ b/src/java.base/share/classes/sun/security/util/LegacyAlgorithmConstraints.java
@@ -40,7 +40,7 @@ public class LegacyAlgorithmConstraints extends AbstractAlgorithmConstraints {
public static final String PROPERTY_TLS_LEGACY_ALGS =
"jdk.tls.legacyAlgorithms";
- private final List<String> legacyAlgorithms;
+ private final Set<String> legacyAlgorithms;
public LegacyAlgorithmConstraints(String propertyName,
AlgorithmDecomposer decomposer) {
diff --git a/test/micro/org/openjdk/bench/java/security/AlgorithmConstraintsPermits.java b/test/micro/org/openjdk/bench/java/security/AlgorithmConstraintsPermits.java
new file mode 100644
index 000000000..3cb9567b9
--- /dev/null
+++ b/test/micro/org/openjdk/bench/java/security/AlgorithmConstraintsPermits.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2021, 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.
+ */
+package org.openjdk.bench.java.security;
+
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Param;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import sun.security.util.DisabledAlgorithmConstraints;
+
+import java.security.AlgorithmConstraints;
+import java.security.CryptoPrimitive;
+import java.util.concurrent.TimeUnit;
+import java.util.EnumSet;
+import java.util.Set;
+
+import static sun.security.util.DisabledAlgorithmConstraints.PROPERTY_TLS_DISABLED_ALGS;
+
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+@Fork(jvmArgsAppend = {"--add-exports", "java.base/sun.security.util=ALL-UNNAMED"})
+@State(Scope.Thread)
+public class AlgorithmConstraintsPermits {
+
+ AlgorithmConstraints tlsDisabledAlgConstraints;
+ Set<CryptoPrimitive> primitives = EnumSet.of(CryptoPrimitive.KEY_AGREEMENT);
+
+ @Param({"SSLv3", "DES", "NULL", "TLS1.3"})
+ String algorithm;
+
+ @Setup
+ public void setup() {
+ tlsDisabledAlgConstraints = new DisabledAlgorithmConstraints(PROPERTY_TLS_DISABLED_ALGS);
+ }
+
+ @Benchmark
+ public boolean permits() {
+ return tlsDisabledAlgConstraints.permits(primitives, algorithm, null);
+ }
+}
+
--
2.22.0

11284
Add-KAE-implementation.patch Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,65 @@
From 861eff79eafc35ac88bbeb1b0edb7269c54ac807 Mon Sep 17 00:00:00 2001
From: miaozhuojun <mouzhuojun@huawei.com>
Date: Wed, 4 Aug 2021 15:22:25 +0800
Subject: [PATCH 1/8] Update algorithm annotations for fill_words
Summary: <JDK>: update algorithm annotations for fill_words
LLT: NA
Patch Type: huawei
Bug url: NA
---
.../cpu/aarch64/macroAssembler_aarch64.cpp | 28 ++++++++++++++-----
1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
index 60dc92953..1401b8627 100644
--- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
@@ -5658,23 +5658,37 @@ void MacroAssembler::fill_words(Register base, Register cnt, Register value)
{
// Algorithm:
//
-// scratch1 = cnt & 7;
+// if (cnt == 0) {
+// return;
+// }
+// if ((p & 8) != 0) {
+// *p++ = v;
+// }
+//
+// scratch1 = cnt & 14;
// cnt -= scratch1;
// p += scratch1;
-// switch (scratch1) {
+// switch (scratch1 / 2) {
// do {
-// cnt -= 8;
-// p[-8] = v;
+// cnt -= 16;
+// p[-16] = v;
+// p[-15] = v;
// case 7:
-// p[-7] = v;
+// p[-14] = v;
+// p[-13] = v;
// case 6:
-// p[-6] = v;
+// p[-12] = v;
+// p[-11] = v;
// // ...
// case 1:
+// p[-2] = v;
// p[-1] = v;
// case 0:
-// p += 8;
+// p += 16;
// } while (cnt);
+// }
+// if ((cnt & 1) == 1) {
+// *p++ = v;
// }
assert_different_registers(base, cnt, value, rscratch1, rscratch2);
--
2.22.0

View File

@ -0,0 +1,111 @@
From fcf556744f9597ddd58c8103bf49bc992401feca Mon Sep 17 00:00:00 2001
From: hubodao <hubodao@huawei.com>
Date: Sat, 11 Sep 2021 09:47:21 +0800
Subject: [PATCH 4/8] create jfr dump file with pid or timestamp if specified
Summary: <JFR> : create jfr dump file with pid or timestamp if specified
LLT: NA
Patch Type: huawei
Bug url: NA
---
src/hotspot/share/jfr/dcmd/jfrDcmds.cpp | 16 ++++++++++++++--
src/hotspot/share/utilities/ostream.cpp | 2 +-
src/hotspot/share/utilities/ostream.hpp | 2 +-
.../jdk/jfr/jcmd/TestJcmdDumpWithFileName.java | 16 ++++++++++++++++
4 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/src/hotspot/share/jfr/dcmd/jfrDcmds.cpp b/src/hotspot/share/jfr/dcmd/jfrDcmds.cpp
index 4aa5c56f3..b1c5df029 100644
--- a/src/hotspot/share/jfr/dcmd/jfrDcmds.cpp
+++ b/src/hotspot/share/jfr/dcmd/jfrDcmds.cpp
@@ -230,7 +230,13 @@ void JfrDumpFlightRecordingDCmd::execute(DCmdSource source, TRAPS) {
jstring filepath = NULL;
if (_filename.is_set() && _filename.value() != NULL) {
- filepath = JfrJavaSupport::new_string(_filename.value(), CHECK);
+ const char* extended_path = make_log_name(_filename.value(), NULL);
+ if (extended_path != NULL) {
+ filepath = JfrJavaSupport::new_string(extended_path, CHECK);
+ FREE_C_HEAP_ARRAY(char, extended_path);
+ } else {
+ filepath = JfrJavaSupport::new_string(_filename.value(), CHECK);
+ }
}
jobject maxage = NULL;
@@ -398,7 +404,13 @@ void JfrStartFlightRecordingDCmd::execute(DCmdSource source, TRAPS) {
jstring filename = NULL;
if (_filename.is_set() && _filename.value() != NULL) {
- filename = JfrJavaSupport::new_string(_filename.value(), CHECK);
+ const char *dumpPath = make_log_name(_filename.value(), NULL);
+ if (dumpPath != NULL) {
+ filename = JfrJavaSupport::new_string(dumpPath, CHECK);
+ FREE_C_HEAP_ARRAY(char, dumpPath);
+ } else {
+ filename = JfrJavaSupport::new_string(_filename.value(), CHECK);
+ }
}
jobject maxage = NULL;
diff --git a/src/hotspot/share/utilities/ostream.cpp b/src/hotspot/share/utilities/ostream.cpp
index eb8ee4de1..0aabe8e8f 100644
--- a/src/hotspot/share/utilities/ostream.cpp
+++ b/src/hotspot/share/utilities/ostream.cpp
@@ -528,7 +528,7 @@ static const char* make_log_name_internal(const char* log_name, const char* forc
// -XX:DumpLoadedClassList=<file_name>
// in log_name, %p => pid1234 and
// %t => YYYY-MM-DD_HH-MM-SS
-static const char* make_log_name(const char* log_name, const char* force_directory) {
+const char* make_log_name(const char* log_name, const char* force_directory) {
char timestr[32];
get_datetime_string(timestr, sizeof(timestr));
return make_log_name_internal(log_name, force_directory, os::current_process_id(),
diff --git a/src/hotspot/share/utilities/ostream.hpp b/src/hotspot/share/utilities/ostream.hpp
index fe38c2f3e..e2a8a621c 100644
--- a/src/hotspot/share/utilities/ostream.hpp
+++ b/src/hotspot/share/utilities/ostream.hpp
@@ -309,5 +309,5 @@ class networkStream : public bufferedStream {
};
#endif
-
+const char* make_log_name(const char* log_name, const char* force_directory);
#endif // SHARE_VM_UTILITIES_OSTREAM_HPP
diff --git a/test/jdk/jdk/jfr/jcmd/TestJcmdDumpWithFileName.java b/test/jdk/jdk/jfr/jcmd/TestJcmdDumpWithFileName.java
index 691e53174..cead3a0e7 100644
--- a/test/jdk/jdk/jfr/jcmd/TestJcmdDumpWithFileName.java
+++ b/test/jdk/jdk/jfr/jcmd/TestJcmdDumpWithFileName.java
@@ -47,6 +47,7 @@ public class TestJcmdDumpWithFileName {
testDumpAll();
testDumpNamed();
testDumpNamedWithFilename();
+ testDumpNamedWithFilenameExpansion();
}
private static void testDumpAll() throws Exception {
@@ -96,6 +97,21 @@ public class TestJcmdDumpWithFileName {
cleanup();
}
+ private static void testDumpNamedWithFilenameExpansion() throws Exception {
+ long pid = ProcessHandle.current().pid();
+ Path dumpPath = Path.of("dumpPath-%p-%t.jfr").toAbsolutePath();
+ try (Recording r = new Recording()) {
+ r.setName("testDumpNamedWithFilenameExpansion");
+ r.setDestination(dumpPath);
+ r.start();
+ JcmdHelper.jcmd("JFR.dump", "name=testDumpNamedWithFilenameExpansion", "filename=" + dumpPath.toString());
+ Stream<Path> stream = Files.find(Path.of("."), 1, (s, a) -> s.toString()
+ .matches("^.*dumpPath-pid" + pid + ".\\d{4}.\\d{2}.\\d{2}.\\d{2}.\\d{2}.\\d{2}" + ".jfr") && (a.size() > 0L));
+ Asserts.assertTrue(stream.findAny().isPresent());
+ }
+ cleanup();
+ }
+
private static boolean namedFile(Path dumpFile) throws IOException {
return Files.exists(dumpFile) && (Files.size(dumpFile) > 0);
}
--
2.22.0

View File

@ -0,0 +1,71 @@
From f7e762f525098e19b0f0e9ea8dc2c4a31cae607a Mon Sep 17 00:00:00 2001
From: s00478819 <sunjianye@huawei.com>
Date: Sat, 11 Sep 2021 11:42:19 +0800
Subject: [PATCH 6/8] enhance the TimeZone's path solution on Euler
Summary: <JDK>: enhance the TimeZone's path solution on Euler
LLT: NA
Patch Type: huawei
Bug url: NA
---
.../unix/native/libjava/TimeZone_md.c | 33 ++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/src/java.base/unix/native/libjava/TimeZone_md.c b/src/java.base/unix/native/libjava/TimeZone_md.c
index bb3ba99d5..0780c3601 100644
--- a/src/java.base/unix/native/libjava/TimeZone_md.c
+++ b/src/java.base/unix/native/libjava/TimeZone_md.c
@@ -67,10 +67,12 @@ static char *isFileIdentical(char* buf, size_t size, char *pathname);
static const char *ETC_TIMEZONE_FILE = "/etc/timezone";
static const char *ZONEINFO_DIR = "/usr/share/zoneinfo";
static const char *DEFAULT_ZONEINFO_FILE = "/etc/localtime";
+static const char *DEFAULT_ZONEINFO_FILE_DIRNAME = "/etc";
#else
static const char *SYS_INIT_FILE = "/etc/default/init";
static const char *ZONEINFO_DIR = "/usr/share/lib/zoneinfo";
static const char *DEFAULT_ZONEINFO_FILE = "/usr/share/lib/zoneinfo/localtime";
+static const char *DEFAULT_ZONEINFO_FILE_DIRNAME = "/usr/share/lib/zoneinfo";
#endif /* defined(__linux__) || defined(_ALLBSD_SOURCE) */
static const char popularZones[][4] = {"UTC", "GMT"};
@@ -310,7 +312,36 @@ getPlatformTimeZoneID()
return NULL;
}
linkbuf[len] = '\0';
- tz = getZoneName(linkbuf);
+
+ /* linkbuf may be a relative symlink or has more than one characters, like '.' and '/' ,
+ * which will cause the function call getZoneName return to an abnormal timeZone name.
+ * For example, linkbuf is "../usr/share/zoneinfo//Asia/Shanghai", then the call of
+ * getZoneName(linkbuf) will get "/Asia/Shanghai", not "Asia/Shanghai".
+ * So we covert it to an absolute path by adding the file's (which is define by macro
+ * DEFAULT_ZONEINFO_FILE) dirname and then call glibc's realpath API to canonicalize
+ * the path.
+ */
+ char abslinkbuf[2 * (PATH_MAX + 1)];
+ if (linkbuf[0] != '/') {
+ if (sprintf(abslinkbuf, "%s/%s", DEFAULT_ZONEINFO_FILE_DIRNAME, linkbuf) < 0) {
+ jio_fprintf(stderr, (const char *) "failed to generate absolute path\n");
+ return NULL;
+ }
+ } else {
+ strncpy(abslinkbuf, linkbuf, len + 1);
+ }
+
+ /* canonicalize the path */
+ char resolvedpath[PATH_MAX + 1];
+ resolvedpath[PATH_MAX] = '\0';
+ char *path = realpath(abslinkbuf, resolvedpath);
+ if (path == NULL) {
+ jio_fprintf(stderr, (const char *) "failed to get real path, symlink is %s\n",
+ abslinkbuf);
+ return NULL;
+ }
+
+ tz = getZoneName(resolvedpath);
if (tz != NULL) {
tz = strdup(tz);
return tz;
--
2.22.0

View File

@ -740,7 +740,7 @@ Provides: java-src%{?1} = %{epoch}:%{version}-%{release}
Name: java-%{javaver}-%{origin}
Version: %{newjavaver}.%{buildver}
Release: 1
Release: 2
# 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
@ -856,6 +856,12 @@ Patch74: delete_expired_certificates.patch
# 11.0.12
Patch75: 8247691-Incorrect-handling-of-VM-exceptions-in-C1-deopt-stub.patch
Patch76: Update-algorithm-annotations-for-fill_words.patch
Patch77: 8257145-Performance-regression-with-XX-ResizePLAB-af.patch
Patch78: create-jfr-dump-file-with-pid-or-timestamp-if-specif.patch
Patch79: enhance-the-TimeZone-s-path-solution-on-Euler.patch
Patch80: Add-KAE-implementation.patch
Patch81: 8268427-Improve-AlgorithmConstraints-checkAlgorithm-.patch
BuildRequires: autoconf
BuildRequires: alsa-lib-devel
@ -1131,6 +1137,12 @@ pushd %{top_level_dir_name}
%patch73 -p1
%patch74 -p1
%patch75 -p1
%patch76 -p1
%patch77 -p1
%patch78 -p1
%patch79 -p1
%patch80 -p1
%patch81 -p1
popd # openjdk
# %patch1000
@ -1633,6 +1645,14 @@ require "copy_jdk_configs.lua"
%changelog
* Fri Sep 17 2021 kuenking111 <wangkun49@huawei.com> - 1:11.0.12.7-2
- add Update-algorithm-annotations-for-fill_words.patch
- add 8257145-Performance-regression-with-XX-ResizePLAB-af.patch
- add create-jfr-dump-file-with-pid-or-timestamp-if-specif.patch
- add enhance-the-TimeZone-s-path-solution-on-Euler.patch
- add Add-KAE-implementation.patch
- add 8268427-Improve-AlgorithmConstraints-checkAlgorithm-.patch
* Tue Aug 17 2021 eapen <zhangyipeng7@huawei.com> - 1:11.0.12.7-1
- add 8247691-Incorrect-handling-of-VM-exceptions-in-C1-deopt-stub.patch