!146 sync master to openEuler-24.03-LTS
From: @Autistic_boyya Reviewed-by: @kuenking111 Signed-off-by: @kuenking111
This commit is contained in:
commit
53cace2b5e
@ -616,13 +616,6 @@ diff --git a/make/RunTests.gmk b/make/RunTests.gmk
|
|||||||
index 57a282bfd..9fad1ed43 100644
|
index 57a282bfd..9fad1ed43 100644
|
||||||
--- a/make/RunTests.gmk
|
--- a/make/RunTests.gmk
|
||||||
+++ b/make/RunTests.gmk
|
+++ b/make/RunTests.gmk
|
||||||
@@ -1,5 +1,5 @@
|
|
||||||
#
|
|
||||||
-# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
|
|
||||||
+# Copyright (c) 2016, 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
|
|
||||||
@@ -46,7 +46,7 @@ endif
|
@@ -46,7 +46,7 @@ endif
|
||||||
|
|
||||||
$(eval $(call ParseKeywordVariable, TEST_OPTS, \
|
$(eval $(call ParseKeywordVariable, TEST_OPTS, \
|
||||||
@ -739,14 +732,14 @@ index 57a282bfd..9fad1ed43 100644
|
|||||||
$(eval $(call SetTestOpt,TIMEOUT_FACTOR,JTREG))
|
$(eval $(call SetTestOpt,TIMEOUT_FACTOR,JTREG))
|
||||||
@@ -202,7 +293,7 @@ $(eval $(call ParseKeywordVariable, JTREG, \
|
@@ -202,7 +293,7 @@ $(eval $(call ParseKeywordVariable, JTREG, \
|
||||||
TEST_MODE ASSERT VERBOSE RETAIN MAX_MEM RUN_PROBLEM_LISTS \
|
TEST_MODE ASSERT VERBOSE RETAIN MAX_MEM RUN_PROBLEM_LISTS \
|
||||||
RETRY_COUNT REPEAT_COUNT MAX_OUTPUT, \
|
RETRY_COUNT REPEAT_COUNT MAX_OUTPUT $(CUSTOM_JTREG_SINGLE_KEYWORDS), \
|
||||||
STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS KEYWORDS \
|
STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS KEYWORDS \
|
||||||
- EXTRA_PROBLEM_LISTS LAUNCHER_OPTIONS, \
|
- EXTRA_PROBLEM_LISTS LAUNCHER_OPTIONS\
|
||||||
+ EXTRA_PROBLEM_LISTS AOT_MODULES LAUNCHER_OPTIONS, \
|
+ EXTRA_PROBLEM_LISTS AOT_MODULES LAUNCHER_OPTIONS\
|
||||||
|
$(CUSTOM_JTREG_STRING_KEYWORDS), \
|
||||||
))
|
))
|
||||||
|
|
||||||
ifneq ($(JTREG), )
|
@@ -306,10 +306,11 @@ endif
|
||||||
@@ -214,10 +305,11 @@ endif
|
|
||||||
|
|
||||||
$(eval $(call SetTestOpt,VM_OPTIONS,GTEST))
|
$(eval $(call SetTestOpt,VM_OPTIONS,GTEST))
|
||||||
$(eval $(call SetTestOpt,JAVA_OPTIONS,GTEST))
|
$(eval $(call SetTestOpt,JAVA_OPTIONS,GTEST))
|
||||||
@ -759,7 +752,7 @@ index 57a282bfd..9fad1ed43 100644
|
|||||||
))
|
))
|
||||||
|
|
||||||
ifneq ($(GTEST), )
|
ifneq ($(GTEST), )
|
||||||
@@ -498,7 +590,14 @@ define SetupRunGtestTestBody
|
@@ -499,7 +590,14 @@ define SetupRunGtestTestBody
|
||||||
$1_GTEST_REPEAT :=--gtest_repeat=$$(GTEST_REPEAT)
|
$1_GTEST_REPEAT :=--gtest_repeat=$$(GTEST_REPEAT)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -775,7 +768,7 @@ index 57a282bfd..9fad1ed43 100644
|
|||||||
$$(call LogWarn)
|
$$(call LogWarn)
|
||||||
$$(call LogWarn, Running test '$$($1_TEST)')
|
$$(call LogWarn, Running test '$$($1_TEST)')
|
||||||
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
|
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
|
||||||
@@ -509,7 +608,7 @@ define SetupRunGtestTestBody
|
@@ -510,7 +608,7 @@ define SetupRunGtestTestBody
|
||||||
--gtest_output=xml:$$($1_TEST_RESULTS_DIR)/gtest.xml \
|
--gtest_output=xml:$$($1_TEST_RESULTS_DIR)/gtest.xml \
|
||||||
--gtest_catch_exceptions=0 \
|
--gtest_catch_exceptions=0 \
|
||||||
$$($1_GTEST_REPEAT) $$(GTEST_OPTIONS) $$(GTEST_VM_OPTIONS) \
|
$$($1_GTEST_REPEAT) $$(GTEST_OPTIONS) $$(GTEST_VM_OPTIONS) \
|
||||||
@ -784,9 +777,9 @@ index 57a282bfd..9fad1ed43 100644
|
|||||||
> >($(TEE) $$($1_TEST_RESULTS_DIR)/gtest.txt) \
|
> >($(TEE) $$($1_TEST_RESULTS_DIR)/gtest.txt) \
|
||||||
&& $$(ECHO) $$$$? > $$($1_EXITCODE) \
|
&& $$(ECHO) $$$$? > $$($1_EXITCODE) \
|
||||||
|| $$(ECHO) $$$$? > $$($1_EXITCODE) \
|
|| $$(ECHO) $$$$? > $$($1_EXITCODE) \
|
||||||
@@ -844,6 +943,17 @@ define SetupRunJtregTestBody
|
@@ -874,6 +972,17 @@ define SetupRunJtregTestBody
|
||||||
endif
|
|
||||||
endif
|
JTREG_TIMEOUT_FACTOR ?= $$(JTREG_AUTO_TIMEOUT_FACTOR)
|
||||||
|
|
||||||
+ ifneq ($$(JTREG_AOT_MODULES), )
|
+ ifneq ($$(JTREG_AOT_MODULES), )
|
||||||
+ $$(eval $$(call SetupAot, $1, \
|
+ $$(eval $$(call SetupAot, $1, \
|
||||||
@ -802,7 +795,7 @@ index 57a282bfd..9fad1ed43 100644
|
|||||||
clean-outputdirs-$1:
|
clean-outputdirs-$1:
|
||||||
$$(RM) -r $$($1_TEST_SUPPORT_DIR)
|
$$(RM) -r $$($1_TEST_SUPPORT_DIR)
|
||||||
$$(RM) -r $$($1_TEST_RESULTS_DIR)
|
$$(RM) -r $$($1_TEST_RESULTS_DIR)
|
||||||
@@ -891,7 +1001,7 @@ define SetupRunJtregTestBody
|
@@ -921,7 +1030,7 @@ define SetupRunJtregTestBody
|
||||||
done
|
done
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -3717,7 +3710,7 @@ index 000000000..40c187ec7
|
|||||||
+
|
+
|
||||||
+#include "aot/aotCompiledMethod.hpp"
|
+#include "aot/aotCompiledMethod.hpp"
|
||||||
+#include "classfile/symbolTable.hpp"
|
+#include "classfile/symbolTable.hpp"
|
||||||
+#include "metaprogramming/integralConstant.hpp"
|
+//#include "metaprogramming/integralConstant.hpp"
|
||||||
+#include "oops/metadata.hpp"
|
+#include "oops/metadata.hpp"
|
||||||
+#include "oops/method.hpp"
|
+#include "oops/method.hpp"
|
||||||
+
|
+
|
||||||
@ -32837,13 +32830,6 @@ diff --git a/test/hotspot/jtreg/vmTestbase/vm/compiler/CodeCacheInfo/Test.java b
|
|||||||
index 118d6c8f8..a3cc54cfd 100644
|
index 118d6c8f8..a3cc54cfd 100644
|
||||||
--- a/test/hotspot/jtreg/vmTestbase/vm/compiler/CodeCacheInfo/Test.java
|
--- a/test/hotspot/jtreg/vmTestbase/vm/compiler/CodeCacheInfo/Test.java
|
||||||
+++ b/test/hotspot/jtreg/vmTestbase/vm/compiler/CodeCacheInfo/Test.java
|
+++ b/test/hotspot/jtreg/vmTestbase/vm/compiler/CodeCacheInfo/Test.java
|
||||||
@@ -1,5 +1,5 @@
|
|
||||||
/*
|
|
||||||
- * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved.
|
|
||||||
+ * Copyright (c) 2017, 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
|
|
||||||
@@ -62,6 +62,15 @@ public class Test {
|
@@ -62,6 +62,15 @@ public class Test {
|
||||||
String segPrefix = "^(CodeHeap '[^']+':" + p1 + p2 + ")+";
|
String segPrefix = "^(CodeHeap '[^']+':" + p1 + p2 + ")+";
|
||||||
String nosegPrefix = "^CodeCache:" + p1 + p2;
|
String nosegPrefix = "^CodeCache:" + p1 + p2;
|
||||||
@ -32904,24 +32890,17 @@ diff --git a/test/jdk/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.ja
|
|||||||
index 12cab1f5d..7c647d6d4 100644
|
index 12cab1f5d..7c647d6d4 100644
|
||||||
--- a/test/jdk/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java
|
--- a/test/jdk/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java
|
||||||
+++ b/test/jdk/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java
|
+++ b/test/jdk/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java
|
||||||
@@ -1,5 +1,5 @@
|
@@ -312,8 +312,8 @@ public class FieldSetAccessibleTest {
|
||||||
/*
|
|
||||||
- * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
|
Set<String> mods = Set.of(
|
||||||
+ * Copyright (c) 2014, 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
|
|
||||||
@@ -288,8 +288,8 @@ public class FieldSetAccessibleTest {
|
|
||||||
static Set<String> systemModules() {
|
|
||||||
Set<String> mods = Set.of("javafx.deploy", "jdk.deploy", "jdk.plugin", "jdk.javaws",
|
|
||||||
// All JVMCI packages other than jdk.vm.ci.services are dynamically
|
// All JVMCI packages other than jdk.vm.ci.services are dynamically
|
||||||
- // exported to jdk.internal.vm.compiler
|
- // exported to jdk.internal.vm.compiler
|
||||||
- "jdk.internal.vm.compiler"
|
- "jdk.internal.vm.compiler", "jdk.internal.vm.compiler.management"
|
||||||
+ // exported to jdk.internal.vm.compiler and jdk.aot
|
+ // exported to jdk.internal.vm.compiler and jdk.aot
|
||||||
+ "jdk.internal.vm.compiler", "jdk.aot"
|
+ "jdk.internal.vm.compiler", "jdk.internal.vm.compiler.management", "jdk.aot"
|
||||||
);
|
);
|
||||||
return ModuleFinder.ofSystem().findAll().stream()
|
// Filters all modules that directly or indirectly require jdk.internal.vm.compiler
|
||||||
.map(mref -> mref.descriptor().name())
|
// and jdk.internal.vm.compiler.management, as these are upgradeable and
|
||||||
diff --git a/test/jdk/jdk/modules/etc/UpgradeableModules.java b/test/jdk/jdk/modules/etc/UpgradeableModules.java
|
diff --git a/test/jdk/jdk/modules/etc/UpgradeableModules.java b/test/jdk/jdk/modules/etc/UpgradeableModules.java
|
||||||
index 59ff5aa6b..a7e467b50 100644
|
index 59ff5aa6b..a7e467b50 100644
|
||||||
--- a/test/jdk/jdk/modules/etc/UpgradeableModules.java
|
--- a/test/jdk/jdk/modules/etc/UpgradeableModules.java
|
||||||
|
|||||||
@ -305,7 +305,7 @@ index f47331a6d..000000000
|
|||||||
- "-XX:CompileCommand=option," + className + "::main,bool,PrintAssembly,true",
|
- "-XX:CompileCommand=option," + className + "::main,bool,PrintAssembly,true",
|
||||||
- className};
|
- className};
|
||||||
-
|
-
|
||||||
- ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(procArgs);
|
- ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(procArgs);
|
||||||
- OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
- OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||||
- List<String> lines = output.asLines();
|
- List<String> lines = output.asLines();
|
||||||
-
|
-
|
||||||
|
|||||||
24
8323066-TestSkipRebuildRemsetPhase.java-fails-with-S.patch
Normal file
24
8323066-TestSkipRebuildRemsetPhase.java-fails-with-S.patch
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
From 4c0d9de31c79d6e8e71fda0d8bc67c7352451dc0 Mon Sep 17 00:00:00 2001
|
||||||
|
Date: Fri, 29 Nov 2024 16:48:18 +0800
|
||||||
|
Subject: 8323066 TestSkipRebuildRemsetPhase.java fails with Skipping Remembered Set Rebuild
|
||||||
|
|
||||||
|
---
|
||||||
|
test/hotspot/jtreg/gc/g1/TestSkipRebuildRemsetPhase.java | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/test/hotspot/jtreg/gc/g1/TestSkipRebuildRemsetPhase.java b/test/hotspot/jtreg/gc/g1/TestSkipRebuildRemsetPhase.java
|
||||||
|
index 860d3ce48..1a4c13132 100644
|
||||||
|
--- a/test/hotspot/jtreg/gc/g1/TestSkipRebuildRemsetPhase.java
|
||||||
|
+++ b/test/hotspot/jtreg/gc/g1/TestSkipRebuildRemsetPhase.java
|
||||||
|
@@ -45,7 +45,7 @@ public class TestSkipRebuildRemsetPhase {
|
||||||
|
"-XX:+UnlockExperimentalVMOptions",
|
||||||
|
"-XX:+UnlockDiagnosticVMOptions",
|
||||||
|
"-XX:+WhiteBoxAPI",
|
||||||
|
- "-XX:G1MixedGCLiveThresholdPercent=20",
|
||||||
|
+ "-XX:G1MixedGCLiveThresholdPercent=0",
|
||||||
|
"-Xlog:gc+marking=debug,gc+phases=debug,gc+remset+tracking=trace",
|
||||||
|
"-Xms10M",
|
||||||
|
"-Xmx10M",
|
||||||
|
--
|
||||||
|
2.22.0
|
||||||
|
|
||||||
24
Add-Fix-clear-mark-for-NativeGotJump.patch
Normal file
24
Add-Fix-clear-mark-for-NativeGotJump.patch
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
From 530c07c5f332d2bce540acb181652f64457ec6c6 Mon Sep 17 00:00:00 2001
|
||||||
|
Date: Fri, 29 Nov 2024 16:00:40 +0800
|
||||||
|
Subject: Add Fix clear mark for NativeGotJump
|
||||||
|
|
||||||
|
---
|
||||||
|
src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp b/src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp
|
||||||
|
index fe7461964..f9438c235 100644
|
||||||
|
--- a/src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp
|
||||||
|
+++ b/src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp
|
||||||
|
@@ -131,7 +131,7 @@ void NativePltCall::set_stub_to_clean() {
|
||||||
|
NativeLoadGot* method_loader = nativeLoadGot_at(plt_c2i_stub());
|
||||||
|
NativeGotJump* jump = nativeGotJump_at(method_loader->next_instruction_address());
|
||||||
|
method_loader->set_data(0);
|
||||||
|
- jump->set_jump_destination((address)-1);
|
||||||
|
+ jump->set_jump_destination((address)Universe::non_oop_word());
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativePltCall::verify() const {
|
||||||
|
--
|
||||||
|
2.22.0
|
||||||
|
|
||||||
@ -11597,7 +11597,7 @@ new file mode 100644
|
|||||||
index 000000000..9c4e58ec4
|
index 000000000..9c4e58ec4
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/hotspot/share/jbooster/utilities/debugUtils.inline.hpp
|
+++ b/src/hotspot/share/jbooster/utilities/debugUtils.inline.hpp
|
||||||
@@ -0,0 +1,67 @@
|
@@ -0,0 +1,66 @@
|
||||||
+/*
|
+/*
|
||||||
+ * Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved.
|
+ * Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved.
|
||||||
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
@ -11637,7 +11637,7 @@ index 000000000..9c4e58ec4
|
|||||||
+ * Attention: the type name string is allocated on the heap!
|
+ * Attention: the type name string is allocated on the heap!
|
||||||
+ */
|
+ */
|
||||||
+template <typename T>
|
+template <typename T>
|
||||||
+const char* DebugUtils::type_name() {
|
+ const char* DebugUtils::type_name() {
|
||||||
+ const char* sig = PLATFORM_FUNC_SIG;
|
+ const char* sig = PLATFORM_FUNC_SIG;
|
||||||
+ const int sig_len = strlen(sig);
|
+ const int sig_len = strlen(sig);
|
||||||
+ const int res_len = sig_len - _func_sig_prefix_len - _func_sig_suffix_len;
|
+ const int res_len = sig_len - _func_sig_prefix_len - _func_sig_suffix_len;
|
||||||
@ -11647,9 +11647,8 @@ index 000000000..9c4e58ec4
|
|||||||
+ return res;
|
+ return res;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+template <LogLevelType level, LogTagType T0, LogTagType T1 = LogTag::__NO_TAG, LogTagType T2 = LogTag::__NO_TAG,
|
+template <LogLevelType level, LogTagType T0, LogTagType T1, LogTagType T2, LogTagType T3, LogTagType T4, LogTagType GuardTag>
|
||||||
+ LogTagType T3 = LogTag::__NO_TAG, LogTagType T4 = LogTag::__NO_TAG, LogTagType GuardTag = LogTag::__NO_TAG>
|
+ void DebugUtils::clear_java_exception_and_print_stack_trace(LogTargetImpl<level, T0, T1, T2, T3, T4, GuardTag>& lt, TRAPS) {
|
||||||
+void DebugUtils::clear_java_exception_and_print_stack_trace(LogTargetImpl<level, T0, T1, T2, T3, T4, GuardTag>& lt, TRAPS) {
|
|
||||||
+ if (!HAS_PENDING_EXCEPTION) return;
|
+ if (!HAS_PENDING_EXCEPTION) return;
|
||||||
+
|
+
|
||||||
+ if (lt.is_enabled()) {
|
+ if (lt.is_enabled()) {
|
||||||
|
|||||||
121
Add-KAE-zip-GzipKAEBenchmark-Benchmark.patch
Normal file
121
Add-KAE-zip-GzipKAEBenchmark-Benchmark.patch
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
From e2fd78d2cb7771f7cbc884e8c36d9a91fa0f8696 Mon Sep 17 00:00:00 2001
|
||||||
|
Date: Fri, 29 Nov 2024 15:40:37 +0800
|
||||||
|
Subject: Add KAE-zip GzipKAEBenchmark Benchmark
|
||||||
|
|
||||||
|
---
|
||||||
|
test/jdk/java/util/zip/GzipKAEBenchmark.java | 102 +++++++++++++++++++
|
||||||
|
1 file changed, 102 insertions(+)
|
||||||
|
create mode 100644 test/jdk/java/util/zip/GzipKAEBenchmark.java
|
||||||
|
|
||||||
|
diff --git a/test/jdk/java/util/zip/GzipKAEBenchmark.java b/test/jdk/java/util/zip/GzipKAEBenchmark.java
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000..6d753e14e
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/test/jdk/java/util/zip/GzipKAEBenchmark.java
|
||||||
|
@@ -0,0 +1,102 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2024, 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.openjdk.jmh.annotations.BenchmarkMode;
|
||||||
|
+import org.openjdk.jmh.annotations.Benchmark;
|
||||||
|
+import org.openjdk.jmh.annotations.Fork;
|
||||||
|
+import org.openjdk.jmh.annotations.Measurement;
|
||||||
|
+import org.openjdk.jmh.annotations.Mode;
|
||||||
|
+import org.openjdk.jmh.annotations.OutputTimeUnit;
|
||||||
|
+import org.openjdk.jmh.annotations.Scope;
|
||||||
|
+import org.openjdk.jmh.annotations.Param;
|
||||||
|
+import org.openjdk.jmh.annotations.Setup;
|
||||||
|
+import org.openjdk.jmh.annotations.State;
|
||||||
|
+import org.openjdk.jmh.annotations.Threads;
|
||||||
|
+import org.openjdk.jmh.annotations.Warmup;
|
||||||
|
+import java.io.ByteArrayInputStream;
|
||||||
|
+import java.io.ByteArrayOutputStream;
|
||||||
|
+import java.io.IOException;
|
||||||
|
+import java.util.zip.GZIPInputStream;
|
||||||
|
+import java.util.zip.GZIPOutputStream;
|
||||||
|
+import java.util.concurrent.TimeUnit;
|
||||||
|
+import java.util.Random;
|
||||||
|
+
|
||||||
|
+@BenchmarkMode(Mode.SampleTime)
|
||||||
|
+@OutputTimeUnit(TimeUnit.MILLISECONDS)
|
||||||
|
+@Warmup(iterations = 5, time = 5, timeUnit = TimeUnit.MILLISECONDS)
|
||||||
|
+@Measurement(iterations = 5, time = 10, timeUnit = TimeUnit.MILLISECONDS)
|
||||||
|
+@Fork(jvmArgsPrepend = {"-Xms1G", "-Xmx1G", "-XX:+AlwaysPreTouch"}, value = 1)
|
||||||
|
+@Threads(1)
|
||||||
|
+@State(Scope.Benchmark)
|
||||||
|
+public class GzipKAEBenchmark {
|
||||||
|
+
|
||||||
|
+ private byte[] srcBytes;
|
||||||
|
+ private byte[] dstBytes;
|
||||||
|
+
|
||||||
|
+ Random rnd = new Random(8192);
|
||||||
|
+ ByteArrayOutputStream srcBAOS = new ByteArrayOutputStream();
|
||||||
|
+ ByteArrayOutputStream dstBAOS = new ByteArrayOutputStream();
|
||||||
|
+
|
||||||
|
+ @Setup
|
||||||
|
+ public void setup() throws IOException {
|
||||||
|
+ Random rnd = new Random(8192);
|
||||||
|
+ ByteArrayOutputStream srcBAOS = new ByteArrayOutputStream();
|
||||||
|
+ ByteArrayOutputStream dstBAOS = new ByteArrayOutputStream();
|
||||||
|
+ for (int j = 0; j < 8192; j++) {
|
||||||
|
+ byte[] src = new byte[rnd.nextInt(8192) + 1];
|
||||||
|
+ rnd.nextBytes(src);
|
||||||
|
+ srcBAOS.write(src);
|
||||||
|
+ }
|
||||||
|
+ srcBytes = srcBAOS.toByteArray();
|
||||||
|
+ try (GZIPOutputStream gzos = new GZIPOutputStream(dstBAOS)) {
|
||||||
|
+ gzos.write(srcBytes);
|
||||||
|
+ }
|
||||||
|
+ dstBytes = dstBAOS.toByteArray();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Param({"512", "2048", "10240", "51200", "204800"})
|
||||||
|
+ private int BuffSize;
|
||||||
|
+
|
||||||
|
+ @Benchmark
|
||||||
|
+ public void GzipDeflateTest() throws IOException{
|
||||||
|
+ ByteArrayOutputStream byteArrayInputStream = new ByteArrayOutputStream();
|
||||||
|
+ try (GZIPOutputStream gzipOutputStream = new GZIPOutputStream(byteArrayInputStream, BuffSize)) {
|
||||||
|
+ gzipOutputStream.write(srcBytes);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Benchmark
|
||||||
|
+ public void GzipInflateTest() {
|
||||||
|
+ ByteArrayInputStream bais = new ByteArrayInputStream(dstBytes);
|
||||||
|
+ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||||
|
+ try (GZIPInputStream gzipInputStream = new GZIPInputStream(bais, BuffSize)) {
|
||||||
|
+ byte[] buffer = new byte[1024*1024];
|
||||||
|
+ int len;
|
||||||
|
+ while ((len = gzipInputStream.read(buffer)) > 0) {
|
||||||
|
+ byteArrayOutputStream.write(buffer, 0, len);
|
||||||
|
+ }
|
||||||
|
+ } catch (IOException e) {
|
||||||
|
+ e.printStackTrace();
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
\ No newline at end of file
|
||||||
|
--
|
||||||
|
2.22.0
|
||||||
|
|
||||||
5263
Add-jbolt-feature.patch
Normal file
5263
Add-jbolt-feature.patch
Normal file
File diff suppressed because it is too large
Load Diff
4915
Add-specialized-hashmap-version-of-the-long-type.patch
Normal file
4915
Add-specialized-hashmap-version-of-the-long-type.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -13,17 +13,14 @@
|
|||||||
src/hotspot/share/opto/loopopts.cpp | 6 +-
|
src/hotspot/share/opto/loopopts.cpp | 6 +-
|
||||||
src/hotspot/share/opto/macroArrayCopy.cpp | 4 +-
|
src/hotspot/share/opto/macroArrayCopy.cpp | 4 +-
|
||||||
src/hotspot/share/utilities/exceptions.cpp | 4 +-
|
src/hotspot/share/utilities/exceptions.cpp | 4 +-
|
||||||
.../classes/java/nio/charset/Charset.java | 8 +-
|
|
||||||
.../sun/security/jca/ProviderList.java | 8 +-
|
.../sun/security/jca/ProviderList.java | 8 +-
|
||||||
.../classes/sun/security/provider/SHA3.java | 14 +-
|
.../classes/sun/security/provider/SHA3.java | 14 +-
|
||||||
.../sun/security/provider/SHAKE128.java | 49 ++++
|
.../sun/security/provider/SHAKE128.java | 49 ++++
|
||||||
.../media/sound/StandardMidiFileReader.java | 10 +-
|
.../media/sound/StandardMidiFileReader.java | 10 +-
|
||||||
.../classes/java/awt/image/BufferedImage.java | 28 +--
|
.../classes/java/awt/image/BufferedImage.java | 28 +--
|
||||||
.../java/awt/image/WritableRaster.java | 37 +--
|
.../java/awt/image/WritableRaster.java | 37 +--
|
||||||
.../swing/plaf/basic/BasicComboPopup.java | 4 +-
|
|
||||||
.../swing/plaf/basic/BasicDirectoryModel.java | 103 ++++-----
|
.../swing/plaf/basic/BasicDirectoryModel.java | 103 ++++-----
|
||||||
.../classes/javax/swing/text/html/CSS.java | 6 +-
|
.../classes/javax/swing/text/html/CSS.java | 6 +-
|
||||||
.../sun/jndi/ldap/sasl/SaslInputStream.java | 4 +-
|
|
||||||
.../jdk/internal/net/http/common/Utils.java | 10 +-
|
.../jdk/internal/net/http/common/Utils.java | 10 +-
|
||||||
.../share/native/libj2gss/GSSLibStub.c | 10 +-
|
.../share/native/libj2gss/GSSLibStub.c | 10 +-
|
||||||
.../com/sun/tools/javac/comp/Annotate.java | 7 +-
|
.../com/sun/tools/javac/comp/Annotate.java | 7 +-
|
||||||
@ -36,9 +33,7 @@
|
|||||||
.../containers/docker/TestContainerInfo.java | 97 ++++++++
|
.../containers/docker/TestContainerInfo.java | 97 ++++++++
|
||||||
.../java/awt/image/BufferedImage/SetData.java | 114 ++++++++++
|
.../java/awt/image/BufferedImage/SetData.java | 114 ++++++++++
|
||||||
.../net/httpclient/HttpClientBuilderTest.java | 19 +-
|
.../net/httpclient/HttpClientBuilderTest.java | 19 +-
|
||||||
.../java/nio/charset/Charset/AliasesCopy.java | 69 ++++++
|
|
||||||
.../File/SMFInterruptedRunningStatus.java | 143 ++++++++++++
|
.../File/SMFInterruptedRunningStatus.java | 143 ++++++++++++
|
||||||
.../javax/swing/JComboBox/ComboPopupBug.java | 91 ++++++++
|
|
||||||
.../jfr/api/consumer/TestRecordedClass.java | 115 ++++++++++
|
.../jfr/api/consumer/TestRecordedClass.java | 115 ++++++++++
|
||||||
.../ConcurrentGetMonitoredHost.java | 90 ++++++++
|
.../ConcurrentGetMonitoredHost.java | 90 ++++++++
|
||||||
.../sun/security/jca/NullPreferredList.java | 41 ++++
|
.../sun/security/jca/NullPreferredList.java | 41 ++++
|
||||||
@ -54,9 +49,7 @@
|
|||||||
create mode 100644 test/hotspot/jtreg/compiler/splitif/TestSplitDivThroughPhiWithControl.java
|
create mode 100644 test/hotspot/jtreg/compiler/splitif/TestSplitDivThroughPhiWithControl.java
|
||||||
create mode 100644 test/hotspot/jtreg/containers/docker/TestContainerInfo.java
|
create mode 100644 test/hotspot/jtreg/containers/docker/TestContainerInfo.java
|
||||||
create mode 100644 test/jdk/java/awt/image/BufferedImage/SetData.java
|
create mode 100644 test/jdk/java/awt/image/BufferedImage/SetData.java
|
||||||
create mode 100644 test/jdk/java/nio/charset/Charset/AliasesCopy.java
|
|
||||||
create mode 100644 test/jdk/javax/sound/midi/File/SMFInterruptedRunningStatus.java
|
create mode 100644 test/jdk/javax/sound/midi/File/SMFInterruptedRunningStatus.java
|
||||||
create mode 100644 test/jdk/javax/swing/JComboBox/ComboPopupBug.java
|
|
||||||
create mode 100644 test/jdk/jdk/jfr/api/consumer/TestRecordedClass.java
|
create mode 100644 test/jdk/jdk/jfr/api/consumer/TestRecordedClass.java
|
||||||
create mode 100644 test/jdk/sun/jvmstat/monitor/MonitoredVm/ConcurrentGetMonitoredHost.java
|
create mode 100644 test/jdk/sun/jvmstat/monitor/MonitoredVm/ConcurrentGetMonitoredHost.java
|
||||||
create mode 100644 test/jdk/sun/security/jca/NullPreferredList.java
|
create mode 100644 test/jdk/sun/security/jca/NullPreferredList.java
|
||||||
@ -336,32 +329,6 @@ index cf9291f6d..499542235 100644
|
|||||||
ls->print_cr("%s throws BSME for " INTPTR_FORMAT, is_indy ? "invokedynamic" : "dynamic constant", p2i((void *)exception));
|
ls->print_cr("%s throws BSME for " INTPTR_FORMAT, is_indy ? "invokedynamic" : "dynamic constant", p2i((void *)exception));
|
||||||
exception->print_on(ls);
|
exception->print_on(ls);
|
||||||
}
|
}
|
||||||
diff --git a/src/java.base/share/classes/java/nio/charset/Charset.java b/src/java.base/share/classes/java/nio/charset/Charset.java
|
|
||||||
index 0ac18a23b..2b1942122 100644
|
|
||||||
--- a/src/java.base/share/classes/java/nio/charset/Charset.java
|
|
||||||
+++ b/src/java.base/share/classes/java/nio/charset/Charset.java
|
|
||||||
@@ -41,7 +41,6 @@ import java.util.Iterator;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.NoSuchElementException;
|
|
||||||
-import java.util.Objects;
|
|
||||||
import java.util.ServiceConfigurationError;
|
|
||||||
import java.util.ServiceLoader;
|
|
||||||
import java.util.Set;
|
|
||||||
@@ -636,7 +635,12 @@ public abstract class Charset
|
|
||||||
* If the canonical name or any of the aliases are illegal
|
|
||||||
*/
|
|
||||||
protected Charset(String canonicalName, String[] aliases) {
|
|
||||||
- String[] as = Objects.requireNonNullElse(aliases, zeroAliases);
|
|
||||||
+ String[] as =
|
|
||||||
+ aliases == null ?
|
|
||||||
+ zeroAliases :
|
|
||||||
+ VM.isSystemDomainLoader(getClass().getClassLoader()) ?
|
|
||||||
+ aliases :
|
|
||||||
+ Arrays.copyOf(aliases, aliases.length);
|
|
||||||
|
|
||||||
// Skip checks for the standard, built-in Charsets we always load
|
|
||||||
// during initialization.
|
|
||||||
diff --git a/src/java.base/share/classes/sun/security/jca/ProviderList.java b/src/java.base/share/classes/sun/security/jca/ProviderList.java
|
diff --git a/src/java.base/share/classes/sun/security/jca/ProviderList.java b/src/java.base/share/classes/sun/security/jca/ProviderList.java
|
||||||
index 9b41172c0..4b30c76cf 100644
|
index 9b41172c0..4b30c76cf 100644
|
||||||
--- a/src/java.base/share/classes/sun/security/jca/ProviderList.java
|
--- a/src/java.base/share/classes/sun/security/jca/ProviderList.java
|
||||||
@ -615,26 +582,6 @@ index 0e345026c..bcca029c1 100644
|
|||||||
|
|
||||||
switch (srcRaster.getSampleModel().getDataType()) {
|
switch (srcRaster.getSampleModel().getDataType()) {
|
||||||
case DataBuffer.TYPE_BYTE:
|
case DataBuffer.TYPE_BYTE:
|
||||||
diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java
|
|
||||||
index 050f27e72..197f3238b 100644
|
|
||||||
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java
|
|
||||||
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java
|
|
||||||
@@ -1,5 +1,5 @@
|
|
||||||
/*
|
|
||||||
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
|
|
||||||
+ * Copyright (c) 1998, 2024, 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
|
|
||||||
@@ -921,7 +921,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup {
|
|
||||||
if (e.getSource() == list) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
- if (!SwingUtilities.isLeftMouseButton(e) || !comboBox.isEnabled())
|
|
||||||
+ if (!SwingUtilities.isLeftMouseButton(e) || !comboBox.isEnabled() || !comboBox.isShowing())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ( comboBox.isEditable() ) {
|
|
||||||
diff --git a/src/java.desktop/share/classes/javax/swing/text/html/CSS.java b/src/java.desktop/share/classes/javax/swing/text/html/CSS.java
|
diff --git a/src/java.desktop/share/classes/javax/swing/text/html/CSS.java b/src/java.desktop/share/classes/javax/swing/text/html/CSS.java
|
||||||
index c14b5a126..311f172b8 100644
|
index c14b5a126..311f172b8 100644
|
||||||
--- a/src/java.desktop/share/classes/javax/swing/text/html/CSS.java
|
--- a/src/java.desktop/share/classes/javax/swing/text/html/CSS.java
|
||||||
@ -666,26 +613,6 @@ index c14b5a126..311f172b8 100644
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/SaslInputStream.java b/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/SaslInputStream.java
|
|
||||||
index f0746c103..534f7dac7 100644
|
|
||||||
--- a/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/SaslInputStream.java
|
|
||||||
+++ b/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/SaslInputStream.java
|
|
||||||
@@ -1,5 +1,5 @@
|
|
||||||
/*
|
|
||||||
- * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
|
|
||||||
+ * Copyright (c) 2001, 2024, 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
|
|
||||||
@@ -78,7 +78,7 @@ public class SaslInputStream extends InputStream {
|
|
||||||
byte[] inBuf = new byte[1];
|
|
||||||
int count = read(inBuf, 0, 1);
|
|
||||||
if (count > 0) {
|
|
||||||
- return inBuf[0];
|
|
||||||
+ return inBuf[0] & 0xff;
|
|
||||||
} else {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java b/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java
|
diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java b/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java
|
||||||
index a3f6a11aa..0955bdffe 100644
|
index a3f6a11aa..0955bdffe 100644
|
||||||
--- a/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java
|
--- a/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java
|
||||||
@ -1488,81 +1415,6 @@ index 121793014..ef43ec8b9 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
diff --git a/test/jdk/java/nio/charset/Charset/AliasesCopy.java b/test/jdk/java/nio/charset/Charset/AliasesCopy.java
|
|
||||||
new file mode 100644
|
|
||||||
index 000000000..66ee830c5
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/test/jdk/java/nio/charset/Charset/AliasesCopy.java
|
|
||||||
@@ -0,0 +1,69 @@
|
|
||||||
+/*
|
|
||||||
+ * Copyright (c) 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
|
|
||||||
+ * 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 8319817
|
|
||||||
+ * @summary Check that aliases cannot be mutated
|
|
||||||
+ * @run junit AliasesCopy
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+import java.nio.charset.Charset;
|
|
||||||
+import java.nio.charset.CharsetDecoder;
|
|
||||||
+import java.nio.charset.CharsetEncoder;
|
|
||||||
+import java.util.Set;
|
|
||||||
+
|
|
||||||
+import org.junit.jupiter.api.Test;
|
|
||||||
+import static org.junit.jupiter.api.Assertions.assertIterableEquals;
|
|
||||||
+
|
|
||||||
+public class AliasesCopy {
|
|
||||||
+ private static final Set<String> ALIASES_SET = Set.of("foo-alias");
|
|
||||||
+ private static final String[] ALIASES_ARRAY = ALIASES_SET.toArray(String[]::new);
|
|
||||||
+
|
|
||||||
+ @Test
|
|
||||||
+ public void aliasesCopy() {
|
|
||||||
+ final FooCharset cs = new FooCharset(ALIASES_ARRAY);
|
|
||||||
+ ALIASES_ARRAY[0] = "bar-alias";
|
|
||||||
+ assertIterableEquals(ALIASES_SET, cs.aliases());
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ private static final class FooCharset extends Charset {
|
|
||||||
+ private FooCharset(String[] aliases) {
|
|
||||||
+ super("foo", aliases);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public CharsetEncoder newEncoder() {
|
|
||||||
+ throw new RuntimeException("not implemented");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public CharsetDecoder newDecoder() {
|
|
||||||
+ throw new RuntimeException("not implemented");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public boolean contains(Charset cs) {
|
|
||||||
+ throw new RuntimeException("not implemented");
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
diff --git a/test/jdk/javax/sound/midi/File/SMFInterruptedRunningStatus.java b/test/jdk/javax/sound/midi/File/SMFInterruptedRunningStatus.java
|
diff --git a/test/jdk/javax/sound/midi/File/SMFInterruptedRunningStatus.java b/test/jdk/javax/sound/midi/File/SMFInterruptedRunningStatus.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 000000000..1b82e2f73
|
index 000000000..1b82e2f73
|
||||||
@ -1712,103 +1564,6 @@ index 000000000..1b82e2f73
|
|||||||
+ (byte) 0xFF, 0x2F, 0x00 // META (end of track)
|
+ (byte) 0xFF, 0x2F, 0x00 // META (end of track)
|
||||||
+ };
|
+ };
|
||||||
+}
|
+}
|
||||||
diff --git a/test/jdk/javax/swing/JComboBox/ComboPopupBug.java b/test/jdk/javax/swing/JComboBox/ComboPopupBug.java
|
|
||||||
new file mode 100644
|
|
||||||
index 000000000..830216f0d
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/test/jdk/javax/swing/JComboBox/ComboPopupBug.java
|
|
||||||
@@ -0,0 +1,91 @@
|
|
||||||
+/*
|
|
||||||
+ * Copyright (c) 2024, 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.
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+import javax.swing.JButton;
|
|
||||||
+import javax.swing.JComboBox;
|
|
||||||
+import javax.swing.JFrame;
|
|
||||||
+import javax.swing.SwingUtilities;
|
|
||||||
+
|
|
||||||
+/*
|
|
||||||
+ * @test
|
|
||||||
+ * @bug 8322754
|
|
||||||
+ * @summary Verifies clicking JComboBox during frame closure causes Exception
|
|
||||||
+ * @library /java/awt/regtesthelpers
|
|
||||||
+ * @build PassFailJFrame
|
|
||||||
+ * @run main/manual ComboPopupBug
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+public class ComboPopupBug {
|
|
||||||
+ private static final String instructionsText = """
|
|
||||||
+ This test is used to verify that clicking on JComboBox
|
|
||||||
+ when frame containing it is about to close should not
|
|
||||||
+ cause IllegalStateException.
|
|
||||||
+ A JComboBox is shown with Close button at the bottom.
|
|
||||||
+ Click on Close and then click on JComboBox arrow button
|
|
||||||
+ to try to show combobox popup.
|
|
||||||
+ If IllegalStateException is thrown, test will automatically Fail
|
|
||||||
+ otherwise click Pass. """;
|
|
||||||
+
|
|
||||||
+ public static void main(String[] args) throws Exception {
|
|
||||||
+ PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
|
|
||||||
+ .title("ComboPopup Instructions")
|
|
||||||
+ .instructions(instructionsText)
|
|
||||||
+ .testTimeOut(5)
|
|
||||||
+ .rows(10)
|
|
||||||
+ .columns(35)
|
|
||||||
+ .build();
|
|
||||||
+
|
|
||||||
+ SwingUtilities.invokeAndWait(() -> {
|
|
||||||
+ JFrame frame = new JFrame("ComboPopup");
|
|
||||||
+
|
|
||||||
+ JComboBox cb = new JComboBox();
|
|
||||||
+ cb.setEditable(true);
|
|
||||||
+ cb.addItem("test");
|
|
||||||
+ cb.addItem("test2");
|
|
||||||
+ cb.addItem("test3");
|
|
||||||
+ frame.getContentPane().add(cb, "North");
|
|
||||||
+
|
|
||||||
+ JButton b = new JButton("Close");
|
|
||||||
+ b.addActionListener(
|
|
||||||
+ (e)->{
|
|
||||||
+ try {
|
|
||||||
+ Thread.sleep(3000);
|
|
||||||
+ }
|
|
||||||
+ catch (Exception ex) {
|
|
||||||
+ }
|
|
||||||
+ frame.setVisible(false);
|
|
||||||
+
|
|
||||||
+ });
|
|
||||||
+ frame.getContentPane().add(b, "South");
|
|
||||||
+ frame.setSize(200, 200);
|
|
||||||
+
|
|
||||||
+ PassFailJFrame.addTestWindow(frame);
|
|
||||||
+ PassFailJFrame.positionTestWindow(frame,
|
|
||||||
+ PassFailJFrame.Position.HORIZONTAL);
|
|
||||||
+
|
|
||||||
+ frame.setVisible(true);
|
|
||||||
+ });
|
|
||||||
+
|
|
||||||
+ passFailJFrame.awaitAndCheck();
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
diff --git a/test/jdk/sun/jvmstat/monitor/MonitoredVm/ConcurrentGetMonitoredHost.java b/test/jdk/sun/jvmstat/monitor/MonitoredVm/ConcurrentGetMonitoredHost.java
|
diff --git a/test/jdk/sun/jvmstat/monitor/MonitoredVm/ConcurrentGetMonitoredHost.java b/test/jdk/sun/jvmstat/monitor/MonitoredVm/ConcurrentGetMonitoredHost.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 000000000..a6049f6a0
|
index 000000000..a6049f6a0
|
||||||
|
|||||||
2690
Enable-TLS-to-communciation-between-JBooster-Server-.patch
Normal file
2690
Enable-TLS-to-communciation-between-JBooster-Server-.patch
Normal file
File diff suppressed because it is too large
Load Diff
363
Fix-a-concurrent-issue-of-program-data-ref-cnt.patch
Normal file
363
Fix-a-concurrent-issue-of-program-data-ref-cnt.patch
Normal file
@ -0,0 +1,363 @@
|
|||||||
|
From b084e0e23535cb7e46802c3bf471ee8cafbe8a74 Mon Sep 17 00:00:00 2001
|
||||||
|
Subject: Fix a concurrent issue of program data ref cnt
|
||||||
|
|
||||||
|
---
|
||||||
|
.../share/jbooster/jClientArguments.hpp | 4 +
|
||||||
|
.../jbooster/server/serverDataManager.hpp | 4 +
|
||||||
|
.../utilities/concurrentHashMap.inline.hpp | 20 +---
|
||||||
|
test/hotspot/gtest/jbooster/test_net.cpp | 1 +
|
||||||
|
test/hotspot/gtest/jbooster/test_server.cpp | 107 ++++++++++++++++++
|
||||||
|
test/hotspot/gtest/jbooster/test_util.cpp | 3 +-
|
||||||
|
.../jbooster/JBoosterConcurrentTest.java | 106 +++++++++++++++++
|
||||||
|
test/jdk/tools/jbooster/TEST.properties | 1 +
|
||||||
|
8 files changed, 231 insertions(+), 15 deletions(-)
|
||||||
|
create mode 100644 test/hotspot/gtest/jbooster/test_server.cpp
|
||||||
|
create mode 100644 test/jdk/tools/jbooster/JBoosterConcurrentTest.java
|
||||||
|
create mode 100644 test/jdk/tools/jbooster/TEST.properties
|
||||||
|
|
||||||
|
diff --git a/src/hotspot/share/jbooster/jClientArguments.hpp b/src/hotspot/share/jbooster/jClientArguments.hpp
|
||||||
|
index 491ac3159..dd56ddc36 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/jClientArguments.hpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/jClientArguments.hpp
|
||||||
|
@@ -60,6 +60,9 @@ DECLARE_SERIALIZER_INTRUSIVE(JClientBoostLevel);
|
||||||
|
* Arguments that identify a program.
|
||||||
|
*/
|
||||||
|
class JClientArguments final: public CHeapObj<mtJBooster> {
|
||||||
|
+ // @see test/hotspot/gtest/jbooster/test_server.cpp
|
||||||
|
+ friend class Gtest_JBoosterServer;
|
||||||
|
+
|
||||||
|
enum InitState {
|
||||||
|
NOT_INITIALIZED_FOR_SEREVR,
|
||||||
|
INITIALIZED_FOR_SEREVR,
|
||||||
|
@@ -103,6 +106,7 @@ private:
|
||||||
|
|
||||||
|
public:
|
||||||
|
JClientArguments(bool is_client);
|
||||||
|
+ JClientArguments(DebugUtils* ignored) {} // for GTEST only
|
||||||
|
~JClientArguments();
|
||||||
|
|
||||||
|
int serialize(MessageBuffer& buf) const;
|
||||||
|
diff --git a/src/hotspot/share/jbooster/server/serverDataManager.hpp b/src/hotspot/share/jbooster/server/serverDataManager.hpp
|
||||||
|
index c6ef4c99a..a53af341c 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/server/serverDataManager.hpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/server/serverDataManager.hpp
|
||||||
|
@@ -173,6 +173,9 @@ public:
|
||||||
|
* The data of the program (usually a .class or .jar file) executed by the client.
|
||||||
|
*/
|
||||||
|
class JClientProgramData final: public CHeapObj<mtJBooster> {
|
||||||
|
+ // @see test/hotspot/gtest/jbooster/test_server.cpp
|
||||||
|
+ friend class Gtest_JBoosterServer;
|
||||||
|
+
|
||||||
|
public:
|
||||||
|
using ClassLoaderTable = ConcurrentHashMap<ClassLoaderKey, ClassLoaderData*, mtJBooster>;
|
||||||
|
|
||||||
|
@@ -195,6 +198,7 @@ private:
|
||||||
|
|
||||||
|
public:
|
||||||
|
JClientProgramData(uint32_t program_id, JClientArguments* program_args);
|
||||||
|
+ JClientProgramData(DebugUtils* ignored) {} // for GTEST only
|
||||||
|
~JClientProgramData();
|
||||||
|
|
||||||
|
uint32_t program_id() const { return _program_id; }
|
||||||
|
diff --git a/src/hotspot/share/jbooster/utilities/concurrentHashMap.inline.hpp b/src/hotspot/share/jbooster/utilities/concurrentHashMap.inline.hpp
|
||||||
|
index e69da290f..8abb853b7 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/utilities/concurrentHashMap.inline.hpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/utilities/concurrentHashMap.inline.hpp
|
||||||
|
@@ -168,8 +168,8 @@ inline V* ConcurrentHashMap<K, V, F, Events>::get(const K& key, Thread* thread)
|
||||||
|
V* res = nullptr;
|
||||||
|
|
||||||
|
if (_table.get(thread, lookup, get, &grow_hint)) {
|
||||||
|
- KVNode& kv_node = *get.res();
|
||||||
|
- res = &kv_node.value();
|
||||||
|
+ assert(get.res() != nullptr, "sanity");
|
||||||
|
+ res = &(get.res()->value());
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
@@ -184,18 +184,10 @@ inline V* ConcurrentHashMap<K, V, F, Events>::put_if_absent(const K& key, V& val
|
||||||
|
|
||||||
|
V* res = nullptr;
|
||||||
|
|
||||||
|
- do {
|
||||||
|
- if (_table.insert(thread, lookup, KVNode(key, value), &grow_hint, &clean_hint)) {
|
||||||
|
- res = &value;
|
||||||
|
- break;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- if (_table.get(thread, lookup, get, &grow_hint)) {
|
||||||
|
- KVNode& kv_node = *get.res();
|
||||||
|
- res = &kv_node.value();
|
||||||
|
- break;
|
||||||
|
- }
|
||||||
|
- } while (true);
|
||||||
|
+ KVNode kv_node(key, value);
|
||||||
|
+ bool success = _table.insert_get(thread, lookup, kv_node, get, &grow_hint, &clean_hint);
|
||||||
|
+ assert(get.res() != nullptr, "sanity");
|
||||||
|
+ res = &(get.res()->value());
|
||||||
|
|
||||||
|
if (grow_hint) {
|
||||||
|
grow_if_needed(thread);
|
||||||
|
diff --git a/test/hotspot/gtest/jbooster/test_net.cpp b/test/hotspot/gtest/jbooster/test_net.cpp
|
||||||
|
index dd45dd65a..336418cf4 100644
|
||||||
|
--- a/test/hotspot/gtest/jbooster/test_net.cpp
|
||||||
|
+++ b/test/hotspot/gtest/jbooster/test_net.cpp
|
||||||
|
@@ -37,6 +37,7 @@
|
||||||
|
#include "runtime/os.inline.hpp"
|
||||||
|
#include "utilities/globalDefinitions.hpp"
|
||||||
|
#include "utilities/growableArray.hpp"
|
||||||
|
+
|
||||||
|
#include "unittest.hpp"
|
||||||
|
|
||||||
|
static int try_catch_func(int i) {
|
||||||
|
diff --git a/test/hotspot/gtest/jbooster/test_server.cpp b/test/hotspot/gtest/jbooster/test_server.cpp
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000..322b947fd
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/test/hotspot/gtest/jbooster/test_server.cpp
|
||||||
|
@@ -0,0 +1,107 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2020, 2024, 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.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include "precompiled.hpp"
|
||||||
|
+#include "utilities/macros.hpp"
|
||||||
|
+
|
||||||
|
+#if INCLUDE_JBOOSTER
|
||||||
|
+
|
||||||
|
+#include "common.hpp"
|
||||||
|
+
|
||||||
|
+#include "jbooster/jClientArguments.hpp"
|
||||||
|
+#include "jbooster/server/serverDataManager.hpp"
|
||||||
|
+#include "jbooster/utilities/concurrentHashMap.inline.hpp"
|
||||||
|
+#include "jbooster/utilities/debugUtils.inline.hpp"
|
||||||
|
+#include "utilities/stringUtils.hpp"
|
||||||
|
+
|
||||||
|
+#include "unittest.hpp"
|
||||||
|
+
|
||||||
|
+struct Gtest_JBoosterServer {
|
||||||
|
+ static JClientArguments* create_mock_JClientArguments(uint32_t id) {
|
||||||
|
+ JClientArguments* mock = new JClientArguments((DebugUtils*) nullptr);
|
||||||
|
+
|
||||||
|
+ // [FOR EACH ARG]
|
||||||
|
+ mock->_cpu_arch = JClientArguments::CpuArch::CPU_UNKOWN;
|
||||||
|
+ mock->_jvm_version = id;
|
||||||
|
+ mock->_internal_jvm_info = StringUtils::copy_to_heap("internaljvminfo", mtJBooster);
|
||||||
|
+ mock->_program_name = StringUtils::copy_to_heap("programname", mtJBooster);
|
||||||
|
+ mock->_program_entry = StringUtils::copy_to_heap("programentry", mtJBooster);
|
||||||
|
+ mock->_is_jar = true;
|
||||||
|
+ mock->_classpath_name_hash = 1u;
|
||||||
|
+ mock->_classpath_timestamp_hash = 2u;
|
||||||
|
+ mock->_agent_name_hash = 3u;
|
||||||
|
+ mock->_cds_file_size = 456;
|
||||||
|
+ mock->_java_commands = StringUtils::copy_to_heap("javacommands", mtJBooster);
|
||||||
|
+ mock->_related_flags = new JClientVMFlags(true);
|
||||||
|
+
|
||||||
|
+ mock->_hash = mock->calc_hash();
|
||||||
|
+ mock->_state = JClientArguments::INITIALIZED_FOR_SEREVR;
|
||||||
|
+
|
||||||
|
+ return mock;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ static JClientProgramData* create_mock_JClientProgramData(uint32_t program_id, JClientArguments* program_args) {
|
||||||
|
+ JClientProgramData* mock = new JClientProgramData((DebugUtils*) nullptr);
|
||||||
|
+
|
||||||
|
+ mock->_program_id = program_id;
|
||||||
|
+ mock->_program_args = program_args->move();
|
||||||
|
+ mock->_ref_cnt.inc();
|
||||||
|
+ mock->_program_str_id = StringUtils::copy_to_heap("programstrid", mtJBooster);
|
||||||
|
+ mock->clr_cache_state().init(StringUtils::copy_to_heap("gtestclr", mtJBooster));
|
||||||
|
+ mock->dy_cds_cache_state().init(StringUtils::copy_to_heap("gtestdycds", mtJBooster));
|
||||||
|
+ mock->agg_cds_cache_state().init(StringUtils::copy_to_heap("gtestaggcds", mtJBooster));
|
||||||
|
+ mock->aot_static_cache_state().init(StringUtils::copy_to_heap("gtestaotstatic", mtJBooster));
|
||||||
|
+ mock->aot_pgo_cache_state().init(StringUtils::copy_to_heap("gtestaotpgo", mtJBooster));
|
||||||
|
+
|
||||||
|
+ return mock;
|
||||||
|
+ }
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+TEST_VM(JBoosterServer, program_data_ref_cnt) {
|
||||||
|
+ JavaThread* THREAD = JavaThread::current();
|
||||||
|
+ ServerDataManager::JClientProgramDataMap programs;
|
||||||
|
+ JClientArguments* program_args1 = Gtest_JBoosterServer::create_mock_JClientArguments(11);
|
||||||
|
+ JClientProgramData* new_pd1 = Gtest_JBoosterServer::create_mock_JClientProgramData(1u, program_args1);
|
||||||
|
+ delete program_args1;
|
||||||
|
+ JClientProgramData** res1 = programs.put_if_absent(new_pd1->program_args(), new_pd1, THREAD);
|
||||||
|
+ EXPECT_NE(res1, (JClientProgramData**) nullptr);
|
||||||
|
+ EXPECT_EQ(*res1, new_pd1);
|
||||||
|
+ EXPECT_EQ(new_pd1->ref_cnt().get(), 1);
|
||||||
|
+
|
||||||
|
+ JClientArguments* program_args2 = Gtest_JBoosterServer::create_mock_JClientArguments(11);
|
||||||
|
+ JClientProgramData* new_pd2 = Gtest_JBoosterServer::create_mock_JClientProgramData(2u, program_args2);
|
||||||
|
+ delete program_args2;
|
||||||
|
+ JClientProgramData** res2 = programs.put_if_absent(new_pd2->program_args(), new_pd2, THREAD);
|
||||||
|
+ EXPECT_NE(res2, (JClientProgramData**) nullptr);
|
||||||
|
+ EXPECT_EQ(*res2, new_pd1);
|
||||||
|
+ EXPECT_EQ(new_pd1->ref_cnt().get(), 2);
|
||||||
|
+ EXPECT_EQ(new_pd2->ref_cnt().get(), 1);
|
||||||
|
+
|
||||||
|
+ new_pd2->ref_cnt().dec_and_update_time();
|
||||||
|
+ delete new_pd2;
|
||||||
|
+
|
||||||
|
+ new_pd1->ref_cnt().dec_and_update_time();
|
||||||
|
+ new_pd1->ref_cnt().dec_and_update_time();
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+#endif // INCLUDE_JBOOSTER
|
||||||
|
diff --git a/test/hotspot/gtest/jbooster/test_util.cpp b/test/hotspot/gtest/jbooster/test_util.cpp
|
||||||
|
index 461e3faa7..178998189 100644
|
||||||
|
--- a/test/hotspot/gtest/jbooster/test_util.cpp
|
||||||
|
+++ b/test/hotspot/gtest/jbooster/test_util.cpp
|
||||||
|
@@ -35,10 +35,11 @@
|
||||||
|
#include "jbooster/utilities/scalarHashMap.inline.hpp"
|
||||||
|
#include "runtime/os.inline.hpp"
|
||||||
|
#include "runtime/thread.hpp"
|
||||||
|
-#include "unittest.hpp"
|
||||||
|
#include "utilities/exceptions.hpp"
|
||||||
|
#include "utilities/stringUtils.hpp"
|
||||||
|
|
||||||
|
+#include "unittest.hpp"
|
||||||
|
+
|
||||||
|
class ATestClass {};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
diff --git a/test/jdk/tools/jbooster/JBoosterConcurrentTest.java b/test/jdk/tools/jbooster/JBoosterConcurrentTest.java
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000..56423ba82
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/test/jdk/tools/jbooster/JBoosterConcurrentTest.java
|
||||||
|
@@ -0,0 +1,106 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2020, 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 java.net.ServerSocket;
|
||||||
|
+import java.util.concurrent.TimeUnit;
|
||||||
|
+import java.util.stream.Collectors;
|
||||||
|
+import java.util.stream.Stream;
|
||||||
|
+import java.util.ArrayList;
|
||||||
|
+import java.util.List;
|
||||||
|
+
|
||||||
|
+import jdk.test.lib.process.OutputAnalyzer;
|
||||||
|
+
|
||||||
|
+import static jdk.test.lib.Asserts.*;
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * jbooster testing.
|
||||||
|
+ * @test
|
||||||
|
+ * @summary Test jbooster server
|
||||||
|
+ * @library ../lib
|
||||||
|
+ * /test/lib
|
||||||
|
+ * @modules jdk.jbooster
|
||||||
|
+ * @build SimpleClient
|
||||||
|
+ * @run main/othervm/timeout=5000 JBoosterConcurrentTest
|
||||||
|
+ */
|
||||||
|
+public class JBoosterConcurrentTest extends JBoosterTestBase {
|
||||||
|
+ public static final List<String> SERVER_FAST_CLEANUP_ARGS = Stream.concat(SERVER_STANDARD_ARGS.stream(), Stream.of(
|
||||||
|
+ "--unused-cleanup-timeout=1"
|
||||||
|
+ )).collect(Collectors.toList());
|
||||||
|
+
|
||||||
|
+ private static void testProgramDataCleanup(TestContext ctx) throws Exception {
|
||||||
|
+ Process server = jbooster(ctx, List.of(), SERVER_FAST_CLEANUP_ARGS);
|
||||||
|
+ OutputAnalyzer out = new OutputAnalyzer(server);
|
||||||
|
+ server.waitFor(WAIT_START_TIME, TimeUnit.SECONDS);
|
||||||
|
+
|
||||||
|
+ List<Process> apps = new ArrayList<>();
|
||||||
|
+ final int rounds = 100;
|
||||||
|
+ final int concurrent = 5;
|
||||||
|
+ for (int r = 0; r < rounds; ++r) {
|
||||||
|
+ if (r % 10 == 0) {
|
||||||
|
+ System.out.println("Try " + (r + 1) + "round:");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ ArrayList<String> clientArgs = new ArrayList<>(CLIENT_STANDARD_ARGS);
|
||||||
|
+ clientArgs.add(clientArgs.size() - 1, "-XX:JBoosterProgramName=simple-" + r);
|
||||||
|
+
|
||||||
|
+ for (int j = 0; j < concurrent; ++j) {
|
||||||
|
+ Process p = java(ctx, clientArgs);
|
||||||
|
+ apps.add(p);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (r % 10 == 0) {
|
||||||
|
+ for (Process p : apps) {
|
||||||
|
+ p.waitFor(WAIT_EXIT_TIME, TimeUnit.SECONDS);
|
||||||
|
+ assertEquals(p.exitValue(), 0, "good");
|
||||||
|
+ }
|
||||||
|
+ apps.clear();
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ System.out.println("Get data 1:");
|
||||||
|
+ writeToStdin(server, "d\n");
|
||||||
|
+
|
||||||
|
+ for (Process p : apps) {
|
||||||
|
+ p.waitFor(WAIT_EXIT_TIME, TimeUnit.SECONDS);
|
||||||
|
+ assertEquals(p.exitValue(), 0, "good");
|
||||||
|
+ }
|
||||||
|
+ apps.clear();
|
||||||
|
+
|
||||||
|
+ System.out.println("Get data 2:");
|
||||||
|
+ writeToStdin(server, "d\n");
|
||||||
|
+
|
||||||
|
+ Thread.sleep(5 * 60 * 1000);
|
||||||
|
+
|
||||||
|
+ System.out.println("Get data 3:");
|
||||||
|
+ writeToStdin(server, "d\n");
|
||||||
|
+ writeToStdin(server, "d\n");
|
||||||
|
+ writeToStdin(server, "d\n");
|
||||||
|
+ exitNormallyByCommandQ(server);
|
||||||
|
+ out.shouldContain("JClientProgramData:\n -");
|
||||||
|
+ out.shouldContain("JClientSessionData:\n\nJClientProgramData:\n\n".repeat(4));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static void main(String[] args) throws Exception {
|
||||||
|
+ testCases(JBoosterConcurrentTest.class);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
diff --git a/test/jdk/tools/jbooster/TEST.properties b/test/jdk/tools/jbooster/TEST.properties
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000..e11b8706b
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/test/jdk/tools/jbooster/TEST.properties
|
||||||
|
@@ -0,0 +1 @@
|
||||||
|
+maxOutputSize = 2500000
|
||||||
|
--
|
||||||
|
2.22.0
|
||||||
|
|
||||||
699
Implement-JBooster-RPC-byte-alignment.patch
Normal file
699
Implement-JBooster-RPC-byte-alignment.patch
Normal file
@ -0,0 +1,699 @@
|
|||||||
|
From bcc1964f3ac7ffe6995f6734bc14cbbe07a09363 Mon Sep 17 00:00:00 2001
|
||||||
|
Date: Fri, 29 Nov 2024 15:38:42 +0800
|
||||||
|
Subject: Implement JBooster RPC byte alignment
|
||||||
|
|
||||||
|
---
|
||||||
|
.../share/jbooster/jClientArguments.cpp | 21 +++
|
||||||
|
.../share/jbooster/jClientArguments.hpp | 5 +
|
||||||
|
.../share/jbooster/net/messageBuffer.cpp | 34 ++++-
|
||||||
|
.../share/jbooster/net/messageBuffer.hpp | 19 ++-
|
||||||
|
.../jbooster/net/messageBuffer.inline.hpp | 44 +++++-
|
||||||
|
.../share/jbooster/net/rpcCompatibility.cpp | 43 ++++--
|
||||||
|
.../share/jbooster/net/serialization.hpp | 13 +-
|
||||||
|
.../jbooster/server/serverDataManager.cpp | 22 +--
|
||||||
|
.../jbooster/server/serverDataManager.hpp | 4 +-
|
||||||
|
.../jbooster/server/serverMessageHandler.cpp | 6 +-
|
||||||
|
test/hotspot/gtest/jbooster/test_net.cpp | 129 ++++++++++++++----
|
||||||
|
11 files changed, 272 insertions(+), 68 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/hotspot/share/jbooster/jClientArguments.cpp b/src/hotspot/share/jbooster/jClientArguments.cpp
|
||||||
|
index 37093d031..b215913ea 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/jClientArguments.cpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/jClientArguments.cpp
|
||||||
|
@@ -34,6 +34,27 @@
|
||||||
|
#include "runtime/arguments.hpp"
|
||||||
|
#include "utilities/stringUtils.hpp"
|
||||||
|
|
||||||
|
+int JClientBoostLevel::serialize(MessageBuffer& buf) const {
|
||||||
|
+ uint8_t v = (_allow_clr ? (1 << 0) : 0)
|
||||||
|
+ | (_allow_cds ? (1 << 1) : 0)
|
||||||
|
+ | (_allow_aot ? (1 << 2) : 0)
|
||||||
|
+ | (_enable_aot_pgo ? (1 << 3) : 0)
|
||||||
|
+ | (_enable_cds_agg ? (1 << 4) : 0);
|
||||||
|
+ return buf.serialize_no_meta(v);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+int JClientBoostLevel::deserialize(MessageBuffer& buf) {
|
||||||
|
+ uint8_t v = 0b10000000;
|
||||||
|
+ JB_RETURN(buf.deserialize_ref_no_meta(v));
|
||||||
|
+ assert((v & 0b10000000) == 0, "sanity");
|
||||||
|
+ _allow_clr = (v & (1 << 0));
|
||||||
|
+ _allow_cds = (v & (1 << 1));
|
||||||
|
+ _allow_aot = (v & (1 << 2));
|
||||||
|
+ _enable_aot_pgo = (v & (1 << 3));
|
||||||
|
+ _enable_cds_agg = (v & (1 << 4));
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static JClientArguments::CpuArch calc_cpu() {
|
||||||
|
#ifdef X86
|
||||||
|
return JClientArguments::CpuArch::CPU_X86;
|
||||||
|
diff --git a/src/hotspot/share/jbooster/jClientArguments.hpp b/src/hotspot/share/jbooster/jClientArguments.hpp
|
||||||
|
index be057a07d..09c5dfdc0 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/jClientArguments.hpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/jClientArguments.hpp
|
||||||
|
@@ -49,8 +49,13 @@ public:
|
||||||
|
void set_allow_aot(bool allow_aot) { _allow_aot = allow_aot; }
|
||||||
|
void set_enable_aot_pgo(bool enable_aot_pgo) { _enable_aot_pgo = enable_aot_pgo; }
|
||||||
|
void set_enable_cds_agg(bool enable_cds_agg) { _enable_cds_agg = enable_cds_agg; }
|
||||||
|
+
|
||||||
|
+ int serialize(MessageBuffer& buf) const;
|
||||||
|
+ int deserialize(MessageBuffer& buf);
|
||||||
|
};
|
||||||
|
|
||||||
|
+DECLARE_SERIALIZER_INTRUSIVE(JClientBoostLevel);
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* Arguments that identify a program.
|
||||||
|
*/
|
||||||
|
diff --git a/src/hotspot/share/jbooster/net/messageBuffer.cpp b/src/hotspot/share/jbooster/net/messageBuffer.cpp
|
||||||
|
index 4673bb784..980cfbfed 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/net/messageBuffer.cpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/net/messageBuffer.cpp
|
||||||
|
@@ -23,15 +23,34 @@
|
||||||
|
|
||||||
|
#include "jbooster/net/messageBuffer.inline.hpp"
|
||||||
|
|
||||||
|
+/**
|
||||||
|
+ * Allocate an extra eight bytes in case the array object is not 8-byte aligned.
|
||||||
|
+ */
|
||||||
|
+char* MessageBuffer::alloc_buf_obj(uint32_t new_buf_size) {
|
||||||
|
+ return NEW_C_HEAP_ARRAY(char, new_buf_size + sizeof(int64_t), mtJBooster);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void MessageBuffer::del_buf_obj(char* buf_obj) {
|
||||||
|
+ FREE_C_HEAP_ARRAY(char, buf_obj);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * Make the beginning of buf be 8-byte aligned.
|
||||||
|
+ */
|
||||||
|
+char* MessageBuffer::calc_buf_start(char* buf_obj) {
|
||||||
|
+ return buf_obj + calc_padding<int64_t>((uint32_t) reinterpret_cast<uintptr_t>(buf_obj));
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
MessageBuffer::MessageBuffer(SerializationMode smode, CommunicationStream* stream):
|
||||||
|
_smode(smode),
|
||||||
|
_buf_size(_default_buf_size),
|
||||||
|
- _buf(NEW_C_HEAP_ARRAY(char, _buf_size, mtJBooster)),
|
||||||
|
+ _buf_obj(alloc_buf_obj(_buf_size)),
|
||||||
|
+ _buf(calc_buf_start(_buf_obj)),
|
||||||
|
_cur_offset(0),
|
||||||
|
_stream(stream) {}
|
||||||
|
|
||||||
|
MessageBuffer::~MessageBuffer() {
|
||||||
|
- FREE_C_HEAP_ARRAY(char, _buf);
|
||||||
|
+ del_buf_obj(_buf_obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@@ -50,12 +69,19 @@ uint32_t MessageBuffer::calc_new_buf_size(uint32_t required_size) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void MessageBuffer::expand_buf(uint32_t required_size, uint32_t copy_size) {
|
||||||
|
+ char* old_buf_obj = _buf_obj;
|
||||||
|
char* old_buf = _buf;
|
||||||
|
+
|
||||||
|
uint32_t new_buf_size = calc_new_buf_size(required_size);
|
||||||
|
- char* new_buf = NEW_C_HEAP_ARRAY(char, new_buf_size, mtJBooster);
|
||||||
|
+ char* new_buf_obj = alloc_buf_obj(new_buf_size);
|
||||||
|
+ char* new_buf = calc_buf_start(new_buf_obj);
|
||||||
|
+ guarantee((new_buf_obj + new_buf_size + sizeof(int64_t)) >= (new_buf + copy_size), "sanity");
|
||||||
|
memcpy(new_buf, old_buf, copy_size);
|
||||||
|
|
||||||
|
+ _buf_obj = new_buf_obj;
|
||||||
|
_buf = new_buf;
|
||||||
|
_buf_size = new_buf_size;
|
||||||
|
- FREE_C_HEAP_ARRAY(char, old_buf);
|
||||||
|
+ del_buf_obj(old_buf_obj);
|
||||||
|
+
|
||||||
|
+ assert(((int) (reinterpret_cast<uintptr_t>(_buf)) & 7) == 0, "8-byte aligned");
|
||||||
|
}
|
||||||
|
diff --git a/src/hotspot/share/jbooster/net/messageBuffer.hpp b/src/hotspot/share/jbooster/net/messageBuffer.hpp
|
||||||
|
index aaa8e7c3b..04e41e9d6 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/net/messageBuffer.hpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/net/messageBuffer.hpp
|
||||||
|
@@ -56,7 +56,7 @@ public:
|
||||||
|
void assert_can_deserialize() const NOT_DEBUG_RETURN;
|
||||||
|
};
|
||||||
|
|
||||||
|
-class MessageBuffer final: public StackObj {
|
||||||
|
+class MessageBuffer: public StackObj {
|
||||||
|
friend class Message;
|
||||||
|
|
||||||
|
private:
|
||||||
|
@@ -64,14 +64,23 @@ private:
|
||||||
|
|
||||||
|
SerializationMode _smode;
|
||||||
|
uint32_t _buf_size;
|
||||||
|
- char* _buf;
|
||||||
|
+ char* _buf_obj; // malloced buf object
|
||||||
|
+ char* _buf; // 8-byte aligned buf start
|
||||||
|
uint32_t _cur_offset;
|
||||||
|
CommunicationStream* const _stream;
|
||||||
|
|
||||||
|
private:
|
||||||
|
- static uint32_t calc_new_buf_size(uint32_t required_size);
|
||||||
|
+ static char* alloc_buf_obj(uint32_t new_buf_size);
|
||||||
|
+ static void del_buf_obj(char* buf_obj);
|
||||||
|
+
|
||||||
|
void expand_buf(uint32_t required_size, uint32_t copy_size);
|
||||||
|
|
||||||
|
+protected: // for gtest
|
||||||
|
+ template <typename Arg>
|
||||||
|
+ static uint32_t calc_padding(uint32_t offset);
|
||||||
|
+ static char* calc_buf_start(char* buf_obj);
|
||||||
|
+ static uint32_t calc_new_buf_size(uint32_t required_size);
|
||||||
|
+
|
||||||
|
public:
|
||||||
|
MessageBuffer(SerializationMode smode, CommunicationStream* stream = nullptr);
|
||||||
|
~MessageBuffer();
|
||||||
|
@@ -95,6 +104,8 @@ public:
|
||||||
|
}
|
||||||
|
|
||||||
|
// serializers
|
||||||
|
+ template <typename Arg>
|
||||||
|
+ int serialize_base(Arg v);
|
||||||
|
int serialize_memcpy(const void* from, uint32_t arg_size);
|
||||||
|
template <typename Arg>
|
||||||
|
int serialize_no_meta(const Arg& arg);
|
||||||
|
@@ -102,6 +113,8 @@ public:
|
||||||
|
int serialize_with_meta(const Arg* arg_ptr);
|
||||||
|
|
||||||
|
// deserializers
|
||||||
|
+ template <typename Arg>
|
||||||
|
+ int deserialize_base(Arg& to);
|
||||||
|
int deserialize_memcpy(void* to, uint32_t arg_size);
|
||||||
|
template <typename Arg>
|
||||||
|
int deserialize_ref_no_meta(Arg& arg);
|
||||||
|
diff --git a/src/hotspot/share/jbooster/net/messageBuffer.inline.hpp b/src/hotspot/share/jbooster/net/messageBuffer.inline.hpp
|
||||||
|
index c7dc0986f..9500c1aaa 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/net/messageBuffer.inline.hpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/net/messageBuffer.inline.hpp
|
||||||
|
@@ -38,6 +38,26 @@ inline void SerializationMode::assert_can_deserialize() const {
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+template <typename Arg>
|
||||||
|
+inline uint32_t MessageBuffer::calc_padding(uint32_t offset) {
|
||||||
|
+ static_assert((sizeof(Arg) & (sizeof(Arg) - 1)) == 0, "Should be 1, 2, 4, 8!");
|
||||||
|
+ static_assert(sizeof(Arg) <= 8, "Should be 1, 2, 4, 8!");
|
||||||
|
+ return (-offset) & (sizeof(Arg) - 1);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+template <typename Arg>
|
||||||
|
+inline int MessageBuffer::serialize_base(Arg v) {
|
||||||
|
+ static_assert(std::is_arithmetic<Arg>::value || std::is_enum<Arg>::value, "Base types or enums only!");
|
||||||
|
+ _smode.assert_can_serialize();
|
||||||
|
+ uint32_t arg_size = (uint32_t) sizeof(Arg);
|
||||||
|
+ uint32_t padding = calc_padding<Arg>(_cur_offset);
|
||||||
|
+ uint32_t nxt_offset = _cur_offset + padding + arg_size;
|
||||||
|
+ expand_if_needed(nxt_offset, _cur_offset);
|
||||||
|
+ *((Arg*) (_buf + _cur_offset + padding)) = v;
|
||||||
|
+ _cur_offset = nxt_offset;
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
inline int MessageBuffer::serialize_memcpy(const void* from, uint32_t arg_size) {
|
||||||
|
_smode.assert_can_serialize();
|
||||||
|
assert(from != nullptr, "sanity");
|
||||||
|
@@ -56,11 +76,13 @@ inline int MessageBuffer::serialize_no_meta(const Arg& arg) {
|
||||||
|
|
||||||
|
template <typename Arg>
|
||||||
|
inline int MessageBuffer::serialize_with_meta(const Arg* arg_ptr) {
|
||||||
|
+ static_assert(MessageConst::arg_meta_size == sizeof(uint32_t), "Meta changed?");
|
||||||
|
_smode.assert_can_serialize();
|
||||||
|
if (arg_ptr == nullptr) {
|
||||||
|
return serialize_no_meta(MessageConst::NULL_PTR);
|
||||||
|
}
|
||||||
|
const Arg& arg = *arg_ptr;
|
||||||
|
+ skip_cur_offset(calc_padding<uint32_t >(_cur_offset));
|
||||||
|
uint32_t meta_offset = _cur_offset;
|
||||||
|
skip_cur_offset(MessageConst::arg_meta_size);
|
||||||
|
expand_if_needed(_cur_offset, _cur_offset);
|
||||||
|
@@ -68,7 +90,25 @@ inline int MessageBuffer::serialize_with_meta(const Arg* arg_ptr) {
|
||||||
|
|
||||||
|
// fill arg meta at last
|
||||||
|
uint32_t arg_size = _cur_offset - meta_offset - MessageConst::arg_meta_size;
|
||||||
|
- memcpy((void*) (_buf + meta_offset), &arg_size, sizeof(arg_size));
|
||||||
|
+ *((uint32_t*) (_buf + meta_offset)) = arg_size;
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+template <typename Arg>
|
||||||
|
+inline int MessageBuffer::deserialize_base(Arg& to) {
|
||||||
|
+ static_assert(std::is_arithmetic<Arg>::value || std::is_enum<Arg>::value, "Base types or enums only!");
|
||||||
|
+ _smode.assert_can_deserialize();
|
||||||
|
+ uint32_t arg_size = (uint32_t) sizeof(Arg);
|
||||||
|
+ uint32_t padding = calc_padding<Arg>(_cur_offset);
|
||||||
|
+ uint32_t nxt_offset = _cur_offset + padding + arg_size;
|
||||||
|
+ if (_buf_size < nxt_offset) {
|
||||||
|
+ log_warning(jbooster, rpc)("The size to parse is longer than the msg size: "
|
||||||
|
+ "arg_size=%u, cur_offset=%u, nxt_offset=%u, buf_size=%u",
|
||||||
|
+ arg_size, _cur_offset, nxt_offset, _buf_size);
|
||||||
|
+ return JBErr::BAD_MSG_DATA;
|
||||||
|
+ }
|
||||||
|
+ to = *((Arg*) (_buf + _cur_offset + padding));
|
||||||
|
+ _cur_offset = nxt_offset;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -125,7 +165,7 @@ inline int MessageBuffer::deserialize_with_meta(Arg* const& arg_ptr) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
const char* type_name = DebugUtils::type_name<Arg>();
|
||||||
|
- log_warning(jbooster, rpc)("The arg size does match the parsed size: "
|
||||||
|
+ log_warning(jbooster, rpc)("The arg size does not match the parsed size: "
|
||||||
|
"arg=%s, arg_size=%u, (cur_size - arg_begin)=%u.",
|
||||||
|
type_name, arg_size, _cur_offset - arg_begin);
|
||||||
|
FREE_C_HEAP_ARRAY(char, type_name);
|
||||||
|
diff --git a/src/hotspot/share/jbooster/net/rpcCompatibility.cpp b/src/hotspot/share/jbooster/net/rpcCompatibility.cpp
|
||||||
|
index 7f849a6fe..a48d1c2d8 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/net/rpcCompatibility.cpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/net/rpcCompatibility.cpp
|
||||||
|
@@ -21,6 +21,7 @@
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
+#include "classfile/vmSymbols.hpp"
|
||||||
|
#include "jbooster/dataTransmissionUtils.hpp"
|
||||||
|
#include "jbooster/jBoosterManager.hpp"
|
||||||
|
#include "jbooster/jClientArguments.hpp"
|
||||||
|
@@ -33,9 +34,18 @@
|
||||||
|
#include "jbooster/net/rpcCompatibility.hpp"
|
||||||
|
#include "jbooster/net/serializationWrappers.hpp"
|
||||||
|
#include "jbooster/net/serverStream.hpp"
|
||||||
|
+#include "oops/instanceKlass.hpp"
|
||||||
|
+#include "oops/method.hpp"
|
||||||
|
+#include "oops/methodData.hpp"
|
||||||
|
|
||||||
|
-static constexpr uint32_t calc_new_hash(uint32_t old_hash, uint32_t ele_hash) {
|
||||||
|
- return 31 * old_hash + ele_hash;
|
||||||
|
+static constexpr uint32_t calc_new_hash(uint32_t old_hash) {
|
||||||
|
+ return old_hash;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+template <typename... Rest>
|
||||||
|
+static constexpr uint32_t calc_new_hash(uint32_t old_hash, uint32_t ele_hash, Rest... rest_hashes) {
|
||||||
|
+ uint32_t new_hash = old_hash * 31u + ele_hash;
|
||||||
|
+ return calc_new_hash(new_hash, rest_hashes...);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
@@ -54,20 +64,35 @@ static constexpr uint32_t calc_classes_hash() {
|
||||||
|
return calc_new_hash(calc_classes_hash<Second, Rest...>(), calc_class_hash<First>());
|
||||||
|
}
|
||||||
|
|
||||||
|
-/**
|
||||||
|
- * Returns a magic number computed at compile time based on the sizes of some classes.
|
||||||
|
- * It is just an crude way to check compatibility for now. More policies can be added later.
|
||||||
|
- */
|
||||||
|
-static constexpr uint32_t calc_magic_num() {
|
||||||
|
+static constexpr uint32_t classes_hash() {
|
||||||
|
return calc_classes_hash<
|
||||||
|
JBoosterManager, JClientVMFlags, JClientArguments,
|
||||||
|
JBErr, Message, MessageBuffer,
|
||||||
|
CommunicationStream, ClientStream, ServerStream,
|
||||||
|
ArrayWrapper<int>, MemoryWrapper, StringWrapper, FileWrapper,
|
||||||
|
- ClassLoaderKey, ClassLoaderChain, ClassLoaderLocator, KlassLocator, MethodLocator, ProfileDataCollector
|
||||||
|
+ ClassLoaderKey, ClassLoaderChain, ClassLoaderLocator, KlassLocator, MethodLocator, ProfileDataCollector,
|
||||||
|
+ InstanceKlass, Method, MethodData
|
||||||
|
>();
|
||||||
|
}
|
||||||
|
|
||||||
|
+static constexpr uint32_t little_or_big_endian() {
|
||||||
|
+ return (uint32_t) LITTLE_ENDIAN_ONLY('L') BIG_ENDIAN_ONLY('B');
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * Returns a magic number computed at compile time based on the sizes of some classes.
|
||||||
|
+ * It is just an crude way to check compatibility for now. More policies can be added later.
|
||||||
|
+ */
|
||||||
|
+static constexpr uint32_t calc_magic_num() {
|
||||||
|
+ return calc_new_hash(
|
||||||
|
+ classes_hash(),
|
||||||
|
+ little_or_big_endian(),
|
||||||
|
+ static_cast<uint32_t>(vmSymbolID::SID_LIMIT)
|
||||||
|
+ );
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static constexpr uint32_t _magic_num = calc_magic_num();
|
||||||
|
+
|
||||||
|
uint32_t RpcCompatibility::magic_num() {
|
||||||
|
- return calc_magic_num();
|
||||||
|
+ return _magic_num;
|
||||||
|
}
|
||||||
|
diff --git a/src/hotspot/share/jbooster/net/serialization.hpp b/src/hotspot/share/jbooster/net/serialization.hpp
|
||||||
|
index f9a2996c5..ed8387eb6 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/net/serialization.hpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/net/serialization.hpp
|
||||||
|
@@ -72,21 +72,20 @@
|
||||||
|
// ------------------------------ Default Serializer -------------------------------
|
||||||
|
// The types it support for serialization/deserialization:
|
||||||
|
// - Base types: bool, int, long long, size_t, uint64_t, and so on.
|
||||||
|
-// - POD classes without pointers.
|
||||||
|
//
|
||||||
|
-// memcpy() is good enough in most cases. Even for base types such as char and size_t,
|
||||||
|
-// memcpy() has the similar performance as assignment (`=`) according to our tests.
|
||||||
|
-// It's also a choice to use assignment here. But if a class overloads the operator `=`
|
||||||
|
-// and allocates something on the heap, it can cause a memory leak.
|
||||||
|
+// No default serializer for classes! Implement them manually.
|
||||||
|
+//
|
||||||
|
+// Use uintptr_t instead of address (aka unsigned char*) if you want to serialize a
|
||||||
|
+// pointer.
|
||||||
|
|
||||||
|
template <typename Arg>
|
||||||
|
struct SerializationImpl {
|
||||||
|
static int serialize(MessageBuffer& buf, const Arg& arg) {
|
||||||
|
- return buf.serialize_memcpy(&arg, sizeof(Arg));
|
||||||
|
+ return buf.serialize_base(arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int deserialize_ref(MessageBuffer& buf, Arg& arg) {
|
||||||
|
- return buf.deserialize_memcpy(&arg, sizeof(Arg));
|
||||||
|
+ return buf.deserialize_base(arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
CANNOT_DESERIALIZE_POINTER(Arg);
|
||||||
|
diff --git a/src/hotspot/share/jbooster/server/serverDataManager.cpp b/src/hotspot/share/jbooster/server/serverDataManager.cpp
|
||||||
|
index b2f36c4e5..c3d5f290e 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/server/serverDataManager.cpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/server/serverDataManager.cpp
|
||||||
|
@@ -340,18 +340,18 @@ ClassLoaderData* JClientProgramData::add_class_loader_if_absent(const ClassLoade
|
||||||
|
// ------------------------------ JClientSessionData -------------------------------
|
||||||
|
|
||||||
|
class AddressMapKVArray: public StackObj {
|
||||||
|
- GrowableArray<address>* _key_array;
|
||||||
|
- GrowableArray<address>* _value_array;
|
||||||
|
+ GrowableArray<uintptr_t>* _key_array;
|
||||||
|
+ GrowableArray<uintptr_t>* _value_array;
|
||||||
|
public:
|
||||||
|
- AddressMapKVArray(GrowableArray<address>* key_array,
|
||||||
|
- GrowableArray<address>* value_array) :
|
||||||
|
+ AddressMapKVArray(GrowableArray<uintptr_t>* key_array,
|
||||||
|
+ GrowableArray<uintptr_t>* value_array) :
|
||||||
|
_key_array(key_array),
|
||||||
|
_value_array(value_array) {}
|
||||||
|
|
||||||
|
bool operator () (JClientSessionData::AddressMap::KVNode* kv_node) {
|
||||||
|
assert(kv_node->key() != nullptr && kv_node->value() != nullptr, "sanity");
|
||||||
|
- _key_array->append(kv_node->key());
|
||||||
|
- _value_array->append(kv_node->value());
|
||||||
|
+ _key_array->append(reinterpret_cast<uintptr_t>(kv_node->key()));
|
||||||
|
+ _value_array->append(reinterpret_cast<uintptr_t>(kv_node->value()));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
@@ -422,17 +422,17 @@ void JClientSessionData::add_klass_address(address client_klass_addr,
|
||||||
|
put_address(_k_c2s, client_klass_addr, server_cld_addr, thread);
|
||||||
|
}
|
||||||
|
|
||||||
|
-void JClientSessionData::klass_array(GrowableArray<address>* key_array,
|
||||||
|
- GrowableArray<address>* value_array,
|
||||||
|
+void JClientSessionData::klass_array(GrowableArray<uintptr_t>* key_array,
|
||||||
|
+ GrowableArray<uintptr_t>* value_array,
|
||||||
|
Thread* thread) {
|
||||||
|
AddressMapKVArray array(key_array, value_array);
|
||||||
|
_k_c2s.for_each(array, thread);
|
||||||
|
}
|
||||||
|
|
||||||
|
-void JClientSessionData::klass_pointer_map_to_server(GrowableArray<address>* klass_array, Thread* thread) {
|
||||||
|
- for (GrowableArrayIterator<address> iter = klass_array->begin();
|
||||||
|
+void JClientSessionData::klass_pointer_map_to_server(GrowableArray<uintptr_t>* klass_array, Thread* thread) {
|
||||||
|
+ for (GrowableArrayIterator<uintptr_t> iter = klass_array->begin();
|
||||||
|
iter != klass_array->end(); ++iter) {
|
||||||
|
- InstanceKlass* klass = (InstanceKlass*) (*iter);
|
||||||
|
+ InstanceKlass* klass = reinterpret_cast<InstanceKlass*>(*iter);
|
||||||
|
Array<Method*>* methods = klass->methods();
|
||||||
|
for (int method_index = 0; method_index < methods->length(); method_index++) {
|
||||||
|
MethodData* method_data = method_data_address((address)(methods->at(method_index)), thread);
|
||||||
|
diff --git a/src/hotspot/share/jbooster/server/serverDataManager.hpp b/src/hotspot/share/jbooster/server/serverDataManager.hpp
|
||||||
|
index 2cb7d2de0..c6ef4c99a 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/server/serverDataManager.hpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/server/serverDataManager.hpp
|
||||||
|
@@ -291,9 +291,9 @@ public:
|
||||||
|
Klass* server_klass_address(address client_klass_addr, Thread* thread);
|
||||||
|
void add_klass_address(address client_klass_addr, address server_cld_addr, Thread* thread);
|
||||||
|
|
||||||
|
- void klass_array(GrowableArray<address>* key_array, GrowableArray<address>* value_array, Thread* thread);
|
||||||
|
+ void klass_array(GrowableArray<uintptr_t>* key_array, GrowableArray<uintptr_t>* value_array, Thread* thread);
|
||||||
|
|
||||||
|
- void klass_pointer_map_to_server(GrowableArray<address>* klass_array, Thread* thread);
|
||||||
|
+ void klass_pointer_map_to_server(GrowableArray<uintptr_t>* klass_array, Thread* thread);
|
||||||
|
|
||||||
|
void add_method_data(address method, address method_data, Thread* thread);
|
||||||
|
bool remove_method_data(address method, Thread* thread);
|
||||||
|
diff --git a/src/hotspot/share/jbooster/server/serverMessageHandler.cpp b/src/hotspot/share/jbooster/server/serverMessageHandler.cpp
|
||||||
|
index 49c25efb1..f46b839bb 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/server/serverMessageHandler.cpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/server/serverMessageHandler.cpp
|
||||||
|
@@ -196,14 +196,14 @@ int ServerMessageHandler::request_missing_klasses(TRAPS) {
|
||||||
|
|
||||||
|
int ServerMessageHandler::request_method_data(TRAPS) {
|
||||||
|
ResourceMark rm(THREAD);
|
||||||
|
- GrowableArray<address> client_klass_array;
|
||||||
|
- GrowableArray<address> server_klass_array;
|
||||||
|
+ GrowableArray<uintptr_t> client_klass_array;
|
||||||
|
+ GrowableArray<uintptr_t> server_klass_array;
|
||||||
|
ss().session_data()->klass_array(&client_klass_array,
|
||||||
|
&server_klass_array,
|
||||||
|
THREAD);
|
||||||
|
|
||||||
|
{
|
||||||
|
- ArrayWrapper<address> aw(&client_klass_array);
|
||||||
|
+ ArrayWrapper<uintptr_t> aw(&client_klass_array);
|
||||||
|
JB_RETURN(ss().send_request(MessageType::Profilinginfo, &aw));
|
||||||
|
InstanceKlass** klass_array_base = NULL;
|
||||||
|
if (server_klass_array.length() > 0) {
|
||||||
|
diff --git a/test/hotspot/gtest/jbooster/test_net.cpp b/test/hotspot/gtest/jbooster/test_net.cpp
|
||||||
|
index 9eb29fc3a..bf20b0aa3 100644
|
||||||
|
--- a/test/hotspot/gtest/jbooster/test_net.cpp
|
||||||
|
+++ b/test/hotspot/gtest/jbooster/test_net.cpp
|
||||||
|
@@ -26,10 +26,12 @@
|
||||||
|
|
||||||
|
#if INCLUDE_JBOOSTER
|
||||||
|
|
||||||
|
+#include "jbooster/jClientArguments.hpp"
|
||||||
|
#include "jbooster/net/message.inline.hpp"
|
||||||
|
#include "jbooster/net/messageBuffer.inline.hpp"
|
||||||
|
#include "jbooster/net/serializationWrappers.inline.hpp"
|
||||||
|
#include "jbooster/utilities/fileUtils.hpp"
|
||||||
|
+#include "memory/resourceArea.hpp"
|
||||||
|
#include "runtime/os.inline.hpp"
|
||||||
|
#include "utilities/globalDefinitions.hpp"
|
||||||
|
#include "utilities/growableArray.hpp"
|
||||||
|
@@ -105,6 +107,47 @@ static void copy_message_buffer(MessageBuffer& to, MessageBuffer& from) {
|
||||||
|
memcpy(to.buf(), from.buf(), from.cur_offset());
|
||||||
|
}
|
||||||
|
|
||||||
|
+class MockMessageBuffer: public MessageBuffer {
|
||||||
|
+public:
|
||||||
|
+ static bool test() {
|
||||||
|
+ // calc_padding<char[6]>(0); // should not pass the compilation
|
||||||
|
+ EXPECT_EQ(calc_padding<char>(123), 0u);
|
||||||
|
+ EXPECT_EQ(calc_padding<char>(124), 0u);
|
||||||
|
+ EXPECT_EQ(calc_padding<short>(123), 1u);
|
||||||
|
+ EXPECT_EQ(calc_padding<short>(120), 0u);
|
||||||
|
+ EXPECT_EQ(calc_padding<int>(0), 0u);
|
||||||
|
+ EXPECT_EQ(calc_padding<int>(1), 3u);
|
||||||
|
+ EXPECT_EQ(calc_padding<int>(2), 2u);
|
||||||
|
+ EXPECT_EQ(calc_padding<int>(3), 1u);
|
||||||
|
+ EXPECT_EQ(calc_padding<int>(4), 0u);
|
||||||
|
+ EXPECT_EQ(calc_padding<int>(400), 0u);
|
||||||
|
+ EXPECT_EQ(calc_padding<uint64_t>(1), 7u);
|
||||||
|
+ EXPECT_EQ(calc_padding<uint64_t>(3), 5u);
|
||||||
|
+ EXPECT_EQ(calc_padding<uint64_t>(12), 4u);
|
||||||
|
+ EXPECT_EQ(calc_padding<uint64_t>(7), 1u);
|
||||||
|
+
|
||||||
|
+ EXPECT_EQ(calc_buf_start(reinterpret_cast<char*>(7)), reinterpret_cast<char*>(8));
|
||||||
|
+ EXPECT_EQ(calc_buf_start(reinterpret_cast<char*>(9)), reinterpret_cast<char*>(16));
|
||||||
|
+ EXPECT_EQ(calc_buf_start(reinterpret_cast<char*>(12)), reinterpret_cast<char*>(16));
|
||||||
|
+ EXPECT_EQ(calc_buf_start(reinterpret_cast<char*>(65535)), reinterpret_cast<char*>(65536));
|
||||||
|
+ EXPECT_EQ(calc_buf_start(reinterpret_cast<char*>(65536)), reinterpret_cast<char*>(65536));
|
||||||
|
+
|
||||||
|
+ EXPECT_EQ(calc_new_buf_size(0), 0u);
|
||||||
|
+ EXPECT_EQ(calc_new_buf_size(1), 1u);
|
||||||
|
+ EXPECT_EQ(calc_new_buf_size(2), 2u);
|
||||||
|
+ EXPECT_EQ(calc_new_buf_size(3), 4u);
|
||||||
|
+ EXPECT_EQ(calc_new_buf_size(65535), 65536u);
|
||||||
|
+ EXPECT_EQ(calc_new_buf_size(65536), 65536u);
|
||||||
|
+ EXPECT_EQ(calc_new_buf_size(65537), 131072u);
|
||||||
|
+
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+TEST(JBoosterNet, padding) {
|
||||||
|
+ ASSERT_TRUE(MockMessageBuffer::test());
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
TEST(JBoosterNet, try_catch) {
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < 9; ++i) {
|
||||||
|
@@ -145,24 +188,25 @@ TEST(JBoosterNet, serializationn_basics) {
|
||||||
|
int i1 = 1234;
|
||||||
|
int64_t l1 = 900000000000000ll;
|
||||||
|
EXPECT_EQ(buf.serialize_no_meta(c1), 0);
|
||||||
|
- EXPECT_EQ(buf.cur_offset(), 1u);
|
||||||
|
+ EXPECT_EQ(buf.cur_offset(), 1u); // 1 (char)
|
||||||
|
EXPECT_EQ(buf.serialize_no_meta(i1), 0);
|
||||||
|
- EXPECT_EQ(buf.cur_offset(), 5u);
|
||||||
|
+ EXPECT_EQ(buf.cur_offset(), 8u); // 1 (last) + 3 (padding) + 4 (int32)
|
||||||
|
EXPECT_EQ(buf.serialize_no_meta(l1), 0);
|
||||||
|
- EXPECT_EQ(buf.cur_offset(), 13u);
|
||||||
|
+ EXPECT_EQ(buf.cur_offset(), 16u); // 8 (last) + 8 (int64)
|
||||||
|
|
||||||
|
uint32_t u1 = 2468;
|
||||||
|
const char* s1 = nullptr;
|
||||||
|
const char* s2 = "hello";
|
||||||
|
const char* s3 = "world!";
|
||||||
|
EXPECT_EQ(buf.serialize_with_meta(&u1), 0);
|
||||||
|
- EXPECT_EQ(buf.cur_offset(), 21u);
|
||||||
|
+ EXPECT_EQ(buf.cur_offset(), 24u); // 16 (last) + 4 (int32) + 4 (int32)
|
||||||
|
EXPECT_EQ(buf.serialize_with_meta(&s1), 0);
|
||||||
|
- EXPECT_EQ(buf.cur_offset(), 29u);
|
||||||
|
+ EXPECT_EQ(buf.cur_offset(), 32u); // 24 (last) + 4 (int32) + 4 (int32)
|
||||||
|
EXPECT_EQ(buf.serialize_with_meta(&s2), 0);
|
||||||
|
- EXPECT_EQ(buf.cur_offset(), 42u);
|
||||||
|
+ EXPECT_EQ(buf.cur_offset(), 45u); // 32 (last) + 4 (int32) + 4 (int32) + 5 (strlen)
|
||||||
|
EXPECT_EQ(buf.serialize_with_meta(&s3), 0);
|
||||||
|
- EXPECT_EQ(buf.cur_offset(), 56u);
|
||||||
|
+ EXPECT_EQ(buf.cur_offset(), 62u); // 45 (last) + 3 (padding) + 4 (int32) + 4 (int32) + 6 (strlen)
|
||||||
|
+ EXPECT_EQ((int) (reinterpret_cast<uintptr_t>(buf.buf())) & 7, 0); // 8-byte aligned
|
||||||
|
|
||||||
|
cache_size = buf.cur_offset();
|
||||||
|
memcpy(cache, buf.buf(), cache_size);
|
||||||
|
@@ -177,9 +221,9 @@ TEST(JBoosterNet, serializationn_basics) {
|
||||||
|
EXPECT_EQ(buf.deserialize_ref_no_meta(c1), 0);
|
||||||
|
EXPECT_EQ(buf.cur_offset(), 1u);
|
||||||
|
EXPECT_EQ(buf.deserialize_ref_no_meta(i1), 0);
|
||||||
|
- EXPECT_EQ(buf.cur_offset(), 5u);
|
||||||
|
+ EXPECT_EQ(buf.cur_offset(), 8u);
|
||||||
|
EXPECT_EQ(buf.deserialize_ref_no_meta(l1), 0);
|
||||||
|
- EXPECT_EQ(buf.cur_offset(), 13u);
|
||||||
|
+ EXPECT_EQ(buf.cur_offset(), 16u);
|
||||||
|
EXPECT_EQ(c1, '6');
|
||||||
|
EXPECT_EQ(i1, 1234);
|
||||||
|
EXPECT_EQ(l1, 900000000000000ll);
|
||||||
|
@@ -189,13 +233,15 @@ TEST(JBoosterNet, serializationn_basics) {
|
||||||
|
char s2[6];
|
||||||
|
StringWrapper s3;
|
||||||
|
EXPECT_EQ(buf.deserialize_with_meta(&u1), 0);
|
||||||
|
- EXPECT_EQ(buf.cur_offset(), 21u);
|
||||||
|
+ EXPECT_EQ(buf.cur_offset(), 24u);
|
||||||
|
EXPECT_EQ(buf.deserialize_with_meta(&s1), 0);
|
||||||
|
- EXPECT_EQ(buf.cur_offset(), 29u);
|
||||||
|
+ EXPECT_EQ(buf.cur_offset(), 32u);
|
||||||
|
EXPECT_EQ(buf.deserialize_with_meta(&s2), 0);
|
||||||
|
- EXPECT_EQ(buf.cur_offset(), 42u);
|
||||||
|
+ EXPECT_EQ(buf.cur_offset(), 45u);
|
||||||
|
EXPECT_EQ(buf.deserialize_with_meta(&s3), 0);
|
||||||
|
- EXPECT_EQ(buf.cur_offset(), 56u);
|
||||||
|
+ EXPECT_EQ(buf.cur_offset(), 62u);
|
||||||
|
+ EXPECT_EQ(((int) reinterpret_cast<uintptr_t>(buf.buf())) & 7, 0);
|
||||||
|
+
|
||||||
|
EXPECT_EQ(u1, 2468u);
|
||||||
|
EXPECT_STREQ(s1, nullptr);
|
||||||
|
EXPECT_STREQ(s2, "hello");
|
||||||
|
@@ -227,18 +273,11 @@ TEST_VM(JBoosterNet, serializationn_string) {
|
||||||
|
EXPECT_STREQ(ss3, s3);
|
||||||
|
}
|
||||||
|
|
||||||
|
- { MessageBuffer buf(SerializationMode::DESERIALIZE);
|
||||||
|
- copy_message_buffer(buf, buf0);
|
||||||
|
- char s1[1];
|
||||||
|
- ASSERT_DEATH(buf.deserialize_with_meta(&s1), "");
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
{ MessageBuffer buf(SerializationMode::DESERIALIZE);
|
||||||
|
copy_message_buffer(buf, buf0);
|
||||||
|
char s1[64];
|
||||||
|
EXPECT_EQ(buf.deserialize_with_meta(&s1), 0);
|
||||||
|
EXPECT_STREQ(ss1, s1);
|
||||||
|
- ASSERT_DEATH(buf.deserialize_with_meta(&s1), "");
|
||||||
|
}
|
||||||
|
|
||||||
|
{ MessageBuffer buf(SerializationMode::DESERIALIZE);
|
||||||
|
@@ -269,8 +308,20 @@ TEST_VM(JBoosterNet, serializationn_string) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-TEST(JBoosterNet, serializationn_crash) {
|
||||||
|
- int err;
|
||||||
|
+#ifdef ASSERT
|
||||||
|
+
|
||||||
|
+TEST_VM_ASSERT_MSG(JBoosterNet, serializationn_string_crash_null, ".*cannot set array to null") {
|
||||||
|
+ MessageBuffer buf(SerializationMode::BOTH);
|
||||||
|
+ const char* s = nullptr;
|
||||||
|
+ EXPECT_EQ(buf.serialize_with_meta(&s), 0);
|
||||||
|
+
|
||||||
|
+ char s1[8];
|
||||||
|
+ buf.reset_cur_offset();
|
||||||
|
+ buf.deserialize_with_meta(&s1); // should crash here
|
||||||
|
+ ASSERT_TRUE(false);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+TEST_VM_ASSERT_MSG(JBoosterNet, serializationn_string_crash_arr_too_small, ".*array index out of bounds") {
|
||||||
|
MessageBuffer buf(SerializationMode::BOTH);
|
||||||
|
const char* s = "hello";
|
||||||
|
EXPECT_EQ(buf.serialize_with_meta(&s), 0);
|
||||||
|
@@ -282,12 +333,12 @@ TEST(JBoosterNet, serializationn_crash) {
|
||||||
|
|
||||||
|
char s2[5];
|
||||||
|
buf.reset_cur_offset();
|
||||||
|
- bool old = SuppressFatalErrorMessage;
|
||||||
|
- SuppressFatalErrorMessage = true;
|
||||||
|
- ASSERT_DEATH(buf.deserialize_with_meta(&s2), "");
|
||||||
|
- SuppressFatalErrorMessage = old;
|
||||||
|
+ buf.deserialize_with_meta(&s2); // should crash here
|
||||||
|
+ ASSERT_TRUE(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
+#endif // ASSERT
|
||||||
|
+
|
||||||
|
TEST(JBoosterNet, serializationn_wrappers) {
|
||||||
|
MessageBuffer buf(SerializationMode::BOTH);
|
||||||
|
uint32_t mem_size = 16u * 1024;
|
||||||
|
@@ -303,7 +354,7 @@ TEST(JBoosterNet, serializationn_wrappers) {
|
||||||
|
ga.append(&s4);
|
||||||
|
ArrayWrapper<StringWrapper> aw(&ga);
|
||||||
|
EXPECT_EQ(buf.serialize_with_meta(&aw), 0);
|
||||||
|
- EXPECT_EQ(buf.cur_offset(), 0u + (4 + 4) + (1 + 2 + 3 + 4 + 4 * (4 + 4)));
|
||||||
|
+ EXPECT_EQ(buf.cur_offset(), 0u + (4 + 4) + ((1 + 3) + (2 + 2) + (3 + 1) + 4 + 4 * (4 + 4)));
|
||||||
|
|
||||||
|
char* mem = NEW_C_HEAP_ARRAY(char, mem_size, mtJBooster);
|
||||||
|
memset(mem, 0x68, mem_size);
|
||||||
|
@@ -385,6 +436,30 @@ TEST(JBoosterNet, serializationn_file_wrapper) {
|
||||||
|
FileUtils::remove(file_name2);
|
||||||
|
}
|
||||||
|
|
||||||
|
+TEST(JBoosterNet, serializationn_others) {
|
||||||
|
+ MessageBuffer buf(SerializationMode::BOTH);
|
||||||
|
+
|
||||||
|
+ {
|
||||||
|
+ JClientBoostLevel lvl;
|
||||||
|
+ lvl.set_allow_clr(true);
|
||||||
|
+ lvl.set_allow_aot(true);
|
||||||
|
+ lvl.set_enable_cds_agg(true);
|
||||||
|
+ EXPECT_EQ(buf.serialize_with_meta(&lvl), 0);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ buf.reset_cur_offset();
|
||||||
|
+
|
||||||
|
+ {
|
||||||
|
+ JClientBoostLevel lvl;
|
||||||
|
+ EXPECT_EQ(buf.deserialize_with_meta(&lvl), 0);
|
||||||
|
+ EXPECT_EQ(lvl.is_clr_allowed(), true);
|
||||||
|
+ EXPECT_EQ(lvl.is_cds_allowed(), false);
|
||||||
|
+ EXPECT_EQ(lvl.is_aot_allowed(), true);
|
||||||
|
+ EXPECT_EQ(lvl.is_aot_pgo_enabled(), false);
|
||||||
|
+ EXPECT_EQ(lvl.is_cds_agg_enabled(), true);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
TEST(JBoosterNet, expansion_of_message_buffer) {
|
||||||
|
MessageBuffer buf(SerializationMode::SERIALIZE);
|
||||||
|
ASSERT_EQ(buf.buf_size(), 4096u);
|
||||||
|
--
|
||||||
|
2.22.0
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
880
Optimize-LazyAOT-klasses-sending-strategy.patch
Normal file
880
Optimize-LazyAOT-klasses-sending-strategy.patch
Normal file
@ -0,0 +1,880 @@
|
|||||||
|
From 3cc21f911715cc0112f9a2e80a199723b29262e1 Mon Sep 17 00:00:00 2001
|
||||||
|
Date: Fri, 29 Nov 2024 15:39:13 +0800
|
||||||
|
Subject: Optimize LazyAOT klasses sending strategy
|
||||||
|
|
||||||
|
---
|
||||||
|
.../jbooster/client/clientMessageHandler.cpp | 6 ++
|
||||||
|
.../jbooster/client/clientMessageHandler.hpp | 1 +
|
||||||
|
.../share/jbooster/jClientArguments.cpp | 15 +++
|
||||||
|
.../share/jbooster/jClientArguments.hpp | 1 +
|
||||||
|
.../share/jbooster/jbooster_globals.hpp | 4 +
|
||||||
|
src/hotspot/share/jbooster/lazyAot.cpp | 15 ++-
|
||||||
|
src/hotspot/share/jbooster/lazyAot.hpp | 2 +
|
||||||
|
.../jbooster/net/communicationStream.cpp | 15 ++-
|
||||||
|
.../net/communicationStream.inline.hpp | 1 +
|
||||||
|
src/hotspot/share/jbooster/net/errorCode.hpp | 1 +
|
||||||
|
src/hotspot/share/jbooster/net/message.hpp | 5 +
|
||||||
|
.../share/jbooster/net/message.inline.hpp | 2 +
|
||||||
|
.../share/jbooster/net/messageType.hpp | 1 +
|
||||||
|
src/hotspot/share/jbooster/net/netCommon.hpp | 8 +-
|
||||||
|
.../jbooster/server/serverMessageHandler.cpp | 10 +-
|
||||||
|
.../jbooster/server/serverMessageHandler.hpp | 3 +-
|
||||||
|
.../share/jbooster/utilities/fileUtils.cpp | 64 ++-----------
|
||||||
|
.../share/jbooster/utilities/fileUtils.hpp | 3 +-
|
||||||
|
.../jbooster/JBoosterCompilationContext.java | 5 +
|
||||||
|
.../graalvm/compiler/java/BytecodeParser.java | 29 ++++++
|
||||||
|
.../share/classes/jdk/jbooster/JBooster.java | 8 +-
|
||||||
|
.../JBoosterCompilationContextImpl.java | 10 +-
|
||||||
|
test/hotspot/gtest/jbooster/common.hpp | 96 +++++++++++++++++++
|
||||||
|
test/hotspot/gtest/jbooster/test_net.cpp | 4 +-
|
||||||
|
test/hotspot/gtest/jbooster/test_util.cpp | 12 ++-
|
||||||
|
test/jdk/tools/jbooster/JBoosterTestBase.java | 6 +-
|
||||||
|
26 files changed, 244 insertions(+), 83 deletions(-)
|
||||||
|
create mode 100644 test/hotspot/gtest/jbooster/common.hpp
|
||||||
|
|
||||||
|
diff --git a/src/hotspot/share/jbooster/client/clientMessageHandler.cpp b/src/hotspot/share/jbooster/client/clientMessageHandler.cpp
|
||||||
|
index 9119b897a..b8278d41c 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/client/clientMessageHandler.cpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/client/clientMessageHandler.cpp
|
||||||
|
@@ -289,6 +289,12 @@ int ClientMessageHandler::handle_ArrayKlasses() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+int ClientMessageHandler::handle_ResolveExtraKlasses() {
|
||||||
|
+ ResourceMark rm;
|
||||||
|
+ bool should_resolve_extra_Klasses = JBoosterResolveExtraKlasses;
|
||||||
|
+ JB_RETURN(cs().send_response(&should_resolve_extra_Klasses));
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
// ---------------------------------- Some Tasks -----------------------------------
|
||||||
|
|
||||||
|
int ClientMessageHandler::send_cache_file_sync_task() {
|
||||||
|
diff --git a/src/hotspot/share/jbooster/client/clientMessageHandler.hpp b/src/hotspot/share/jbooster/client/clientMessageHandler.hpp
|
||||||
|
index 66844247c..94ff7387d 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/client/clientMessageHandler.hpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/client/clientMessageHandler.hpp
|
||||||
|
@@ -38,6 +38,7 @@
|
||||||
|
F(MethodLocators ) \
|
||||||
|
F(Profilinginfo ) \
|
||||||
|
F(ArrayKlasses ) \
|
||||||
|
+ F(ResolveExtraKlasses ) \
|
||||||
|
|
||||||
|
class ArrayKlass;
|
||||||
|
class ClassLoaderData;
|
||||||
|
diff --git a/src/hotspot/share/jbooster/jClientArguments.cpp b/src/hotspot/share/jbooster/jClientArguments.cpp
|
||||||
|
index b215913ea..42aba4181 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/jClientArguments.cpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/jClientArguments.cpp
|
||||||
|
@@ -171,6 +171,14 @@ const char* calc_java_commands_by_class(const char* full_cmd, int full_cmd_len)
|
||||||
|
return StringUtils::copy_to_heap(start, mtJBooster);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static int64_t calc_cds_file_size() {
|
||||||
|
+ char* default_archive_path = Arguments::get_default_shared_archive_path();
|
||||||
|
+ if (default_archive_path == nullptr) { return -1; }
|
||||||
|
+ int64_t cds_file_size = FileUtils::file_size(default_archive_path);
|
||||||
|
+ StringUtils::free_from_heap(default_archive_path);
|
||||||
|
+ return cds_file_size;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
JClientArguments::JClientArguments(bool is_client) {
|
||||||
|
if (is_client) {
|
||||||
|
init_for_client();
|
||||||
|
@@ -224,6 +232,7 @@ void JClientArguments::init_for_client() {
|
||||||
|
_classpath_name_hash = calc_classpath_name_hash(app_cp, app_cp_len);
|
||||||
|
_classpath_timestamp_hash = calc_classpath_timestamp_hash(app_cp, app_cp_len);
|
||||||
|
_agent_name_hash = calc_agent_name_hash();
|
||||||
|
+ _cds_file_size = calc_cds_file_size();
|
||||||
|
if (JBoosterClientStrictMatch) {
|
||||||
|
_java_commands = is_jar ? calc_java_commands_by_jar(full_cmd, app_cp_len)
|
||||||
|
: calc_java_commands_by_class(full_cmd, full_cmd_len);
|
||||||
|
@@ -248,6 +257,7 @@ uint32_t JClientArguments::calc_hash() {
|
||||||
|
result = calc_new_hash(result, _classpath_name_hash);
|
||||||
|
result = calc_new_hash(result, _classpath_timestamp_hash);
|
||||||
|
result = calc_new_hash(result, _agent_name_hash);
|
||||||
|
+ result = calc_new_hash(result, _cds_file_size);
|
||||||
|
result = calc_new_hash(result, StringUtils::hash_code(_java_commands));
|
||||||
|
result = calc_new_hash(result, _related_flags->hash());
|
||||||
|
|
||||||
|
@@ -267,6 +277,7 @@ bool JClientArguments::equals(const JClientArguments* that) const {
|
||||||
|
if (this->_classpath_name_hash != that->_classpath_name_hash) return false;
|
||||||
|
if (this->_classpath_timestamp_hash != that->_classpath_timestamp_hash) return false;
|
||||||
|
if (this->_agent_name_hash != that->_agent_name_hash) return false;
|
||||||
|
+ if (this->_cds_file_size != that->_cds_file_size) return false;
|
||||||
|
if (StringUtils::compare(this->_java_commands, that->_java_commands) != 0) return false;
|
||||||
|
if (!this->_related_flags->equals(that->_related_flags)) return false;
|
||||||
|
return true;
|
||||||
|
@@ -284,6 +295,7 @@ void JClientArguments::print_args(outputStream* st) const {
|
||||||
|
st->print_cr(" classpath_name_hash: %x", _classpath_name_hash);
|
||||||
|
st->print_cr(" classpath_timestamp_hash: %x", _classpath_timestamp_hash);
|
||||||
|
st->print_cr(" agent_name_hash: %x", _agent_name_hash);
|
||||||
|
+ st->print_cr(" cds_file_size: %lu", _cds_file_size);
|
||||||
|
st->print_cr(" java_commands: \"%s\"", _java_commands);
|
||||||
|
st->print_cr(" vm_flags:");
|
||||||
|
st->print_cr(" hash: %u", _related_flags->hash());
|
||||||
|
@@ -307,6 +319,7 @@ int JClientArguments::serialize(MessageBuffer& buf) const {
|
||||||
|
JB_RETURN(buf.serialize_no_meta(_classpath_name_hash));
|
||||||
|
JB_RETURN(buf.serialize_no_meta(_classpath_timestamp_hash));
|
||||||
|
JB_RETURN(buf.serialize_no_meta(_agent_name_hash));
|
||||||
|
+ JB_RETURN(buf.serialize_no_meta(_cds_file_size));
|
||||||
|
JB_RETURN(buf.serialize_with_meta(&_java_commands));
|
||||||
|
JB_RETURN(buf.serialize_with_meta(_related_flags));
|
||||||
|
|
||||||
|
@@ -343,6 +356,8 @@ int JClientArguments::deserialize(MessageBuffer& buf) {
|
||||||
|
|
||||||
|
JB_RETURN(buf.deserialize_ref_no_meta(_agent_name_hash));
|
||||||
|
|
||||||
|
+ JB_RETURN(buf.deserialize_ref_no_meta(_cds_file_size));
|
||||||
|
+
|
||||||
|
StringWrapper sw_java_commands;
|
||||||
|
JB_RETURN(buf.deserialize_with_meta(&sw_java_commands));
|
||||||
|
_java_commands = sw_java_commands.export_string();
|
||||||
|
diff --git a/src/hotspot/share/jbooster/jClientArguments.hpp b/src/hotspot/share/jbooster/jClientArguments.hpp
|
||||||
|
index 09c5dfdc0..491ac3159 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/jClientArguments.hpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/jClientArguments.hpp
|
||||||
|
@@ -92,6 +92,7 @@ private:
|
||||||
|
uint32_t _classpath_name_hash;
|
||||||
|
uint32_t _classpath_timestamp_hash;
|
||||||
|
uint32_t _agent_name_hash;
|
||||||
|
+ int64_t _cds_file_size;
|
||||||
|
const char* _java_commands;
|
||||||
|
JClientVMFlags* _related_flags;
|
||||||
|
// ========================= end =========================
|
||||||
|
diff --git a/src/hotspot/share/jbooster/jbooster_globals.hpp b/src/hotspot/share/jbooster/jbooster_globals.hpp
|
||||||
|
index 74968af75..c3cdd71f8 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/jbooster_globals.hpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/jbooster_globals.hpp
|
||||||
|
@@ -119,6 +119,10 @@
|
||||||
|
\
|
||||||
|
product(ccstr, JBoosterServerSSLRootCerts, NULL, EXPERIMENTAL, \
|
||||||
|
"The file path to save server SSL root certificate.") \
|
||||||
|
+ \
|
||||||
|
+ product(bool, JBoosterResolveExtraKlasses, true, EXPERIMENTAL, \
|
||||||
|
+ "Whether resolve additional klasses " \
|
||||||
|
+ "while collecting klasses for AOT.") \
|
||||||
|
|
||||||
|
|
||||||
|
// end of JBOOSTER_FLAGS
|
||||||
|
diff --git a/src/hotspot/share/jbooster/lazyAot.cpp b/src/hotspot/share/jbooster/lazyAot.cpp
|
||||||
|
index 410d575e9..462b0c72b 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/lazyAot.cpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/lazyAot.cpp
|
||||||
|
@@ -199,7 +199,11 @@ void LazyAOT::collect_klasses_in_constant_pool(GrowableArray<InstanceKlass*>* ds
|
||||||
|
int len = dst->length();
|
||||||
|
for (int i = last_len; i < len; ++i) {
|
||||||
|
ThreadInVMfromNative tiv(THREAD);
|
||||||
|
- collect_klasses_in_constant_pool(dst, vis, dst->at(i), ALL_KLASSES, CHECK);
|
||||||
|
+ if (JBoosterResolveExtraKlasses) {
|
||||||
|
+ collect_klasses_in_constant_pool(dst, vis, dst->at(i), ALL_KLASSES, CHECK);
|
||||||
|
+ } else {
|
||||||
|
+ collect_klasses_in_constant_pool(dst, vis, dst->at(i), RESOLVED_KLASSES, CHECK);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
last_len = len;
|
||||||
|
}
|
||||||
|
@@ -527,6 +531,7 @@ bool LazyAOT::compile_classes_by_graal(int session_id,
|
||||||
|
const char* file_path,
|
||||||
|
GrowableArray<InstanceKlass*>* klasses,
|
||||||
|
bool use_pgo,
|
||||||
|
+ bool resolve_no_extra_klasses,
|
||||||
|
TRAPS) {
|
||||||
|
DebugUtils::assert_thread_in_vm();
|
||||||
|
|
||||||
|
@@ -541,9 +546,11 @@ bool LazyAOT::compile_classes_by_graal(int session_id,
|
||||||
|
java_args.push_int(session_id);
|
||||||
|
java_args.push_oop(file_path_h);
|
||||||
|
java_args.push_oop(hash_set_h);
|
||||||
|
+ java_args.push_int(use_pgo);
|
||||||
|
+ java_args.push_int(resolve_no_extra_klasses);
|
||||||
|
|
||||||
|
TempNewSymbol compile_classes_name = SymbolTable::new_symbol("compileClasses");
|
||||||
|
- TempNewSymbol compile_classes_signature = SymbolTable::new_symbol("(ILjava/lang/String;Ljava/util/Set;)Z");
|
||||||
|
+ TempNewSymbol compile_classes_signature = SymbolTable::new_symbol("(ILjava/lang/String;Ljava/util/Set;ZZ)Z");
|
||||||
|
JavaCalls::call_static(&result, ServerDataManager::get().main_klass(),
|
||||||
|
compile_classes_name,
|
||||||
|
compile_classes_signature,
|
||||||
|
@@ -557,6 +564,7 @@ bool LazyAOT::compile_methods_by_graal(int session_id,
|
||||||
|
GrowableArray<Method*>* methods_to_compile,
|
||||||
|
GrowableArray<Method*>* methods_not_compile,
|
||||||
|
bool use_pgo,
|
||||||
|
+ bool resolve_no_extra_klasses,
|
||||||
|
TRAPS) {
|
||||||
|
DebugUtils::assert_thread_in_vm();
|
||||||
|
|
||||||
|
@@ -580,9 +588,10 @@ bool LazyAOT::compile_methods_by_graal(int session_id,
|
||||||
|
java_args.push_oop(method_name_set_h);
|
||||||
|
java_args.push_oop(not_method_name_set_h);
|
||||||
|
java_args.push_int(use_pgo);
|
||||||
|
+ java_args.push_int(resolve_no_extra_klasses);
|
||||||
|
|
||||||
|
TempNewSymbol compile_methods_name = SymbolTable::new_symbol("compileMethods");
|
||||||
|
- TempNewSymbol compile_methods_signature = SymbolTable::new_symbol("(ILjava/lang/String;Ljava/util/Set;Ljava/util/Set;Ljava/util/Set;Z)Z");
|
||||||
|
+ TempNewSymbol compile_methods_signature = SymbolTable::new_symbol("(ILjava/lang/String;Ljava/util/Set;Ljava/util/Set;Ljava/util/Set;ZZ)Z");
|
||||||
|
JavaCalls::call_static(&result, ServerDataManager::get().main_klass(),
|
||||||
|
compile_methods_name,
|
||||||
|
compile_methods_signature,
|
||||||
|
diff --git a/src/hotspot/share/jbooster/lazyAot.hpp b/src/hotspot/share/jbooster/lazyAot.hpp
|
||||||
|
index 1d2a49351..5b4183118 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/lazyAot.hpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/lazyAot.hpp
|
||||||
|
@@ -112,6 +112,7 @@ public:
|
||||||
|
const char* file_path,
|
||||||
|
GrowableArray<InstanceKlass*>* klasses,
|
||||||
|
bool use_pgo,
|
||||||
|
+ bool resolve_extra_klasses,
|
||||||
|
TRAPS);
|
||||||
|
static bool compile_methods_by_graal(int session_id,
|
||||||
|
const char* file_path,
|
||||||
|
@@ -119,6 +120,7 @@ public:
|
||||||
|
GrowableArray<Method*>* methods_to_compile,
|
||||||
|
GrowableArray<Method*>* methods_not_compile,
|
||||||
|
bool use_pgo,
|
||||||
|
+ bool resolve_extra_klasses,
|
||||||
|
TRAPS);
|
||||||
|
};
|
||||||
|
|
||||||
|
diff --git a/src/hotspot/share/jbooster/net/communicationStream.cpp b/src/hotspot/share/jbooster/net/communicationStream.cpp
|
||||||
|
index cdb4b8fa7..37bb45032 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/net/communicationStream.cpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/net/communicationStream.cpp
|
||||||
|
@@ -145,16 +145,18 @@ int CommunicationStream::recv_message() {
|
||||||
|
Message& msg = _msg_recv;
|
||||||
|
// read once (or memmove from the overflowed buffer) to get message size
|
||||||
|
uint32_t read_size, msg_size;
|
||||||
|
+ uint16_t magic_num;
|
||||||
|
+ const uint32_t min_read_size = sizeof(msg_size) + sizeof(magic_num);
|
||||||
|
if (msg.has_overflow()) {
|
||||||
|
read_size = msg.move_overflow();
|
||||||
|
- if (read_size < sizeof(msg_size)) {
|
||||||
|
+ if (read_size < min_read_size) {
|
||||||
|
read_size += read_once_from_stream(msg.buf_beginning() + read_size, msg.buf_size() - read_size);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
read_size = read_once_from_stream(msg.buf_beginning(), msg.buf_size());
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (read_size < sizeof(msg_size)) {
|
||||||
|
+ if (read_size < min_read_size) {
|
||||||
|
if (!is_stream_closed()) {
|
||||||
|
log_warning(jbooster, rpc)("Failed to read the size of the message (read_size=%d). stream_id=%u.",
|
||||||
|
read_size, stream_id());
|
||||||
|
@@ -162,7 +164,16 @@ int CommunicationStream::recv_message() {
|
||||||
|
return return_errno_or_flag(JBErr::BAD_MSG_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ magic_num = msg.deserialize_magic_num_only();
|
||||||
|
+ if (magic_num != MessageConst::RPC_MAGIC) {
|
||||||
|
+ log_warning(jbooster, rpc)("Message not from JBooster client. stream_id=%u.", stream_id());
|
||||||
|
+ return return_errno_or_flag(JBErr::BAD_MAGIC_NUM);
|
||||||
|
+ }
|
||||||
|
msg_size = msg.deserialize_size_only();
|
||||||
|
+ if (msg_size > MessageConst::MAX_MSG_SIZE) {
|
||||||
|
+ log_warning(jbooster, rpc)("Message size should be no more than 2GB. stream_id=%u.", stream_id());
|
||||||
|
+ return return_errno_or_flag(JBErr::BAD_MSG_SIZE);
|
||||||
|
+ }
|
||||||
|
if (read_size > msg_size) { // read too much
|
||||||
|
msg.set_overflow(msg_size, read_size - msg_size);
|
||||||
|
} else if (read_size < msg_size) { // read the rest then
|
||||||
|
diff --git a/src/hotspot/share/jbooster/net/communicationStream.inline.hpp b/src/hotspot/share/jbooster/net/communicationStream.inline.hpp
|
||||||
|
index 45311c2be..bc5c0565f 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/net/communicationStream.inline.hpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/net/communicationStream.inline.hpp
|
||||||
|
@@ -58,6 +58,7 @@ inline bool CommunicationStream::check_received_message_size() {
|
||||||
|
template <typename... Args>
|
||||||
|
inline int CommunicationStream::send_request(MessageType type, const Args* const... args) {
|
||||||
|
_msg_send.set_msg_type(type);
|
||||||
|
+ _msg_send.set_magic_num(MessageConst::RPC_MAGIC);
|
||||||
|
_msg_send.set_cur_buf_offset_after_meta();
|
||||||
|
JB_RETURN(_msg_send.serialize(args...));
|
||||||
|
_msg_send.set_msg_size_based_on_cur_buf_offset();
|
||||||
|
diff --git a/src/hotspot/share/jbooster/net/errorCode.hpp b/src/hotspot/share/jbooster/net/errorCode.hpp
|
||||||
|
index 625ef6951..cbb4cc54c 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/net/errorCode.hpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/net/errorCode.hpp
|
||||||
|
@@ -30,6 +30,7 @@
|
||||||
|
f(CONN_CLOSED, "Connection has been closed" ) \
|
||||||
|
f(CONN_CLOSED_BY_PEER, "Connection is closed by the other end" ) \
|
||||||
|
f(BAD_SSL, "Unexpected SSL error during initialization" ) \
|
||||||
|
+ f(BAD_MAGIC_NUM, "Unexpected magic number of the received message" ) \
|
||||||
|
f(BAD_MSG_SIZE, "Unexpected size of the received message" ) \
|
||||||
|
f(BAD_MSG_TYPE, "Unexpected message type of the received message" ) \
|
||||||
|
f(BAD_MSG_DATA, "Unexpected payload data of the received message" ) \
|
||||||
|
diff --git a/src/hotspot/share/jbooster/net/message.hpp b/src/hotspot/share/jbooster/net/message.hpp
|
||||||
|
index 47d2634e2..413ff84a5 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/net/message.hpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/net/message.hpp
|
||||||
|
@@ -33,6 +33,7 @@ class Message: public MessageConst {
|
||||||
|
private:
|
||||||
|
struct {
|
||||||
|
uint32_t msg_size;
|
||||||
|
+ uint16_t magic_num;
|
||||||
|
MessageType msg_type;
|
||||||
|
} _meta;
|
||||||
|
|
||||||
|
@@ -58,6 +59,7 @@ public:
|
||||||
|
uint32_t msg_size() const { return _meta.msg_size; }
|
||||||
|
void set_msg_size(uint32_t size) { _meta.msg_size = size; }
|
||||||
|
void set_msg_size_based_on_cur_buf_offset() { set_msg_size(cur_buf_offset()); }
|
||||||
|
+ void set_magic_num(uint16_t magic_num) { _meta.magic_num = magic_num; }
|
||||||
|
MessageType msg_type() const { return _meta.msg_type; }
|
||||||
|
void set_msg_type(MessageType type) { _meta.msg_type = type; }
|
||||||
|
|
||||||
|
@@ -76,6 +78,9 @@ public:
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t deserialize_size_only() { return *((uint32_t*)_buf.buf()); }
|
||||||
|
+ uint16_t deserialize_magic_num_only() { return *((uint16_t*)(_buf.buf() + sizeof(_meta.msg_size))); }
|
||||||
|
+
|
||||||
|
+ bool check_magic_num(uint16_t magic_num) { return magic_num == MessageConst::RPC_MAGIC; }
|
||||||
|
|
||||||
|
template <typename... Args>
|
||||||
|
int serialize(const Args* const... args);
|
||||||
|
diff --git a/src/hotspot/share/jbooster/net/message.inline.hpp b/src/hotspot/share/jbooster/net/message.inline.hpp
|
||||||
|
index 5b5add47f..b85362efe 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/net/message.inline.hpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/net/message.inline.hpp
|
||||||
|
@@ -78,6 +78,7 @@ inline int Message::deserialize(Args* const&... args) {
|
||||||
|
inline void Message::serialize_meta() {
|
||||||
|
_buf.set_cur_offset(0);
|
||||||
|
_buf.serialize_no_meta(_meta.msg_size);
|
||||||
|
+ _buf.serialize_no_meta(_meta.magic_num);
|
||||||
|
_buf.serialize_no_meta(_meta.msg_type);
|
||||||
|
assert(cur_buf_offset() == meta_size, "sanity");
|
||||||
|
}
|
||||||
|
@@ -85,6 +86,7 @@ inline void Message::serialize_meta() {
|
||||||
|
inline void Message::deserialize_meta() {
|
||||||
|
_buf.set_cur_offset(0);
|
||||||
|
_buf.deserialize_ref_no_meta(_meta.msg_size);
|
||||||
|
+ _buf.deserialize_ref_no_meta(_meta.magic_num);
|
||||||
|
_buf.deserialize_ref_no_meta(_meta.msg_type);
|
||||||
|
assert(cur_buf_offset() == meta_size, "sanity");
|
||||||
|
}
|
||||||
|
diff --git a/src/hotspot/share/jbooster/net/messageType.hpp b/src/hotspot/share/jbooster/net/messageType.hpp
|
||||||
|
index f8cb8f3e6..dbd89c07c 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/net/messageType.hpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/net/messageType.hpp
|
||||||
|
@@ -54,6 +54,7 @@
|
||||||
|
f(ArrayKlasses, "from server" ) \
|
||||||
|
f(DataOfKlasses, "from server" ) \
|
||||||
|
f(MethodLocators, "from server" ) \
|
||||||
|
+ f(ResolveExtraKlasses, "from server" ) \
|
||||||
|
\
|
||||||
|
/* others */ \
|
||||||
|
f(FileSegment, "from both" ) \
|
||||||
|
diff --git a/src/hotspot/share/jbooster/net/netCommon.hpp b/src/hotspot/share/jbooster/net/netCommon.hpp
|
||||||
|
index 8706b7f22..2e30708cc 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/net/netCommon.hpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/net/netCommon.hpp
|
||||||
|
@@ -133,13 +133,15 @@
|
||||||
|
|
||||||
|
class MessageConst {
|
||||||
|
public:
|
||||||
|
+ static constexpr uint32_t MAX_MSG_SIZE = 0x80000000;
|
||||||
|
+ static constexpr uint16_t RPC_MAGIC = 0xB05E;
|
||||||
|
enum: uint32_t {
|
||||||
|
/**
|
||||||
|
* The layout of the message in the buffer:
|
||||||
|
- * | msg_size | msg_type | ... (all of the arguments) ... |
|
||||||
|
- * | 4 bytes | 2 bytes | msg_size - 4 - 2 bytes |
|
||||||
|
+ * | msg_size | magic_num | msg_type | ... (all of the arguments) ... |
|
||||||
|
+ * | 4 bytes | 2 bytes | 2 bytes | msg_size - 4 - 2 bytes |
|
||||||
|
*/
|
||||||
|
- meta_size = sizeof(uint32_t) + sizeof(MessageType),
|
||||||
|
+ meta_size = sizeof(uint32_t) + sizeof(uint16_t) + sizeof(MessageType),
|
||||||
|
/**
|
||||||
|
* The layout of each argument in the buffer:
|
||||||
|
* | arg_size | ... (payload of the argument) ... |
|
||||||
|
diff --git a/src/hotspot/share/jbooster/server/serverMessageHandler.cpp b/src/hotspot/share/jbooster/server/serverMessageHandler.cpp
|
||||||
|
index f46b839bb..713ea1374 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/server/serverMessageHandler.cpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/server/serverMessageHandler.cpp
|
||||||
|
@@ -319,11 +319,15 @@ int ServerMessageHandler::handle_lazy_aot_compilation_task(TRAPS) {
|
||||||
|
GrowableArray<Method*> methods_to_compile;
|
||||||
|
GrowableArray<Method*> methods_not_compile;
|
||||||
|
bool compile_in_current_thread = false;
|
||||||
|
+ bool resolve_extra_klasses = true;
|
||||||
|
|
||||||
|
JB_TRY {
|
||||||
|
compile_in_current_thread = !aot_cache_state.is_cached() && aot_cache_state.set_being_generated();
|
||||||
|
JB_THROW(ss().send_response(&compile_in_current_thread));
|
||||||
|
if (compile_in_current_thread) {
|
||||||
|
+ JB_RETURN(ss().send_request(MessageType::ResolveExtraKlasses));
|
||||||
|
+ JB_RETURN(ss().recv_response(&resolve_extra_klasses));
|
||||||
|
+
|
||||||
|
JB_THROW(request_missing_class_loaders(THREAD));
|
||||||
|
JB_THROW(request_missing_klasses(THREAD));
|
||||||
|
JB_THROW(request_methods_to_compile(&klasses_to_compile, &methods_to_compile, THREAD));
|
||||||
|
@@ -345,6 +349,7 @@ int ServerMessageHandler::handle_lazy_aot_compilation_task(TRAPS) {
|
||||||
|
&methods_to_compile,
|
||||||
|
&methods_not_compile,
|
||||||
|
enabling_aot_pgo,
|
||||||
|
+ resolve_extra_klasses,
|
||||||
|
THREAD));
|
||||||
|
} else { // not compile in current thread
|
||||||
|
if (aot_cache_state.is_being_generated()) {
|
||||||
|
@@ -365,6 +370,7 @@ int ServerMessageHandler::try_to_compile_lazy_aot(GrowableArray<InstanceKlass*>*
|
||||||
|
GrowableArray<Method*>* methods_to_compile,
|
||||||
|
GrowableArray<Method*>* methods_not_compile,
|
||||||
|
bool enabling_aot_pgo,
|
||||||
|
+ bool resolve_extra_klasses,
|
||||||
|
TRAPS) {
|
||||||
|
JClientProgramData* pd = ss().session_data()->program_data();
|
||||||
|
JClientCacheState& aot_cache_state = enabling_aot_pgo ? pd->aot_pgo_cache_state() : pd->aot_static_cache_state();
|
||||||
|
@@ -382,10 +388,10 @@ int ServerMessageHandler::try_to_compile_lazy_aot(GrowableArray<InstanceKlass*>*
|
||||||
|
|
||||||
|
ThreadInVMfromNative tiv(THREAD);
|
||||||
|
if (methods_to_compile->is_empty()) {
|
||||||
|
- successful = LazyAOT::compile_classes_by_graal(session_id, file_path, klasses_to_compile, enabling_aot_pgo, THREAD);
|
||||||
|
+ successful = LazyAOT::compile_classes_by_graal(session_id, file_path, klasses_to_compile, enabling_aot_pgo, resolve_extra_klasses, THREAD);
|
||||||
|
} else {
|
||||||
|
successful = LazyAOT::compile_methods_by_graal(session_id, file_path, klasses_to_compile,
|
||||||
|
- methods_to_compile, methods_not_compile, enabling_aot_pgo, THREAD);
|
||||||
|
+ methods_to_compile, methods_not_compile, enabling_aot_pgo, resolve_extra_klasses, THREAD);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (successful) {
|
||||||
|
diff --git a/src/hotspot/share/jbooster/server/serverMessageHandler.hpp b/src/hotspot/share/jbooster/server/serverMessageHandler.hpp
|
||||||
|
index 26926dd41..c761b9c44 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/server/serverMessageHandler.hpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/server/serverMessageHandler.hpp
|
||||||
|
@@ -59,7 +59,8 @@ private:
|
||||||
|
int try_to_compile_lazy_aot(GrowableArray<InstanceKlass*>* klasses_to_compile,
|
||||||
|
GrowableArray<Method*>* methods_to_compile,
|
||||||
|
GrowableArray<Method*>* methods_not_compile,
|
||||||
|
- bool use_pgo,
|
||||||
|
+ bool enabling_aot_pgo,
|
||||||
|
+ bool resolve_extra_klasses,
|
||||||
|
TRAPS);
|
||||||
|
public:
|
||||||
|
ServerMessageHandler(ServerStream* server_stream);
|
||||||
|
diff --git a/src/hotspot/share/jbooster/utilities/fileUtils.cpp b/src/hotspot/share/jbooster/utilities/fileUtils.cpp
|
||||||
|
index f19bf8fb3..598013523 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/utilities/fileUtils.cpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/utilities/fileUtils.cpp
|
||||||
|
@@ -75,6 +75,13 @@ bool FileUtils::is_dir(const char* path) {
|
||||||
|
return S_ISDIR(st.st_mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
+int64_t FileUtils::file_size(const char* path) {
|
||||||
|
+ struct stat st = {0};
|
||||||
|
+ if (os::stat(path, &st) != 0) return -1;
|
||||||
|
+ // We don't care if it is a regular file.
|
||||||
|
+ return st.st_size;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
uint64_t FileUtils::modify_time(const char* path) {
|
||||||
|
struct stat st = {0};
|
||||||
|
if (os::stat(path, &st) != 0) return 0;
|
||||||
|
@@ -119,60 +126,3 @@ bool FileUtils::move(const char* path_from, const char* path_to) {
|
||||||
|
bool FileUtils::remove(const char* path) {
|
||||||
|
return ::remove(path) == 0;
|
||||||
|
}
|
||||||
|
-
|
||||||
|
-bool FileUtils::is_same(const char* path1, const char* path2) {
|
||||||
|
- bool res = false;
|
||||||
|
- char* buf1 = nullptr;
|
||||||
|
- char* buf2 = nullptr;
|
||||||
|
- int fd1 = os::open(path1, O_BINARY | O_RDONLY, 0);
|
||||||
|
- int fd2 = os::open(path2, O_BINARY | O_RDONLY, 0);
|
||||||
|
- do {
|
||||||
|
- if (fd1 < 0 || fd2 < 0) break;
|
||||||
|
- int64_t size1 = os::lseek(fd1, 0, SEEK_END);
|
||||||
|
- int64_t size2 = os::lseek(fd2, 0, SEEK_END);
|
||||||
|
- if (size1 != size2) break;
|
||||||
|
- int64_t size = size1;
|
||||||
|
- os::lseek(fd1, 0, SEEK_SET);
|
||||||
|
- os::lseek(fd2, 0, SEEK_SET);
|
||||||
|
- // We don't use NEW_RESOURCE_ARRAY here as Thread::current() may
|
||||||
|
- // not be initialized yet.
|
||||||
|
- buf1 = NEW_C_HEAP_ARRAY(char, (size_t) size, mtJBooster);
|
||||||
|
- buf2 = NEW_C_HEAP_ARRAY(char, (size_t) size, mtJBooster);
|
||||||
|
- size1 = (int64_t) os::read(fd1, buf1, size);
|
||||||
|
- size2 = (int64_t) os::read(fd2, buf2, size);
|
||||||
|
- guarantee(size1 == size && size2 == size, "sanity");
|
||||||
|
- res = memcmp(buf1, buf2, size) == 0;
|
||||||
|
- } while (false);
|
||||||
|
- if (fd1 >= 0) os::close(fd1);
|
||||||
|
- if (fd2 >= 0) os::close(fd2);
|
||||||
|
- if (buf1 != nullptr) {
|
||||||
|
- FREE_C_HEAP_ARRAY(char, buf1);
|
||||||
|
- }
|
||||||
|
- if (buf2 != nullptr) {
|
||||||
|
- FREE_C_HEAP_ARRAY(char, buf2);
|
||||||
|
- }
|
||||||
|
- return res;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-bool FileUtils::is_same(const char* path, const char* content, int64_t size) {
|
||||||
|
- bool res = false;
|
||||||
|
- char* buf = nullptr;
|
||||||
|
- int fd = os::open(path, O_BINARY | O_RDONLY, 0);
|
||||||
|
- do {
|
||||||
|
- if (fd < 0) break;
|
||||||
|
- int64_t fsize = os::lseek(fd, 0, SEEK_END);
|
||||||
|
- if (fsize != size) break;
|
||||||
|
- os::lseek(fd, 0, SEEK_SET);
|
||||||
|
- // We don't use NEW_RESOURCE_ARRAY here as Thread::current() may
|
||||||
|
- // not be initialized yet.
|
||||||
|
- buf = NEW_C_HEAP_ARRAY(char, (size_t) size, mtJBooster);
|
||||||
|
- fsize = (int64_t) os::read(fd, buf, size);
|
||||||
|
- guarantee(fsize == size, "sanity");
|
||||||
|
- res = memcmp(content, buf, size) == 0;
|
||||||
|
- } while (false);
|
||||||
|
- if (fd >= 0) os::close(fd);
|
||||||
|
- if (buf != nullptr) {
|
||||||
|
- FREE_C_HEAP_ARRAY(char, buf);
|
||||||
|
- }
|
||||||
|
- return res;
|
||||||
|
-}
|
||||||
|
diff --git a/src/hotspot/share/jbooster/utilities/fileUtils.hpp b/src/hotspot/share/jbooster/utilities/fileUtils.hpp
|
||||||
|
index 2b5734754..ccc677af7 100644
|
||||||
|
--- a/src/hotspot/share/jbooster/utilities/fileUtils.hpp
|
||||||
|
+++ b/src/hotspot/share/jbooster/utilities/fileUtils.hpp
|
||||||
|
@@ -44,14 +44,13 @@ public:
|
||||||
|
static bool exists(const char* path);
|
||||||
|
static bool is_file(const char* path);
|
||||||
|
static bool is_dir(const char* path);
|
||||||
|
+ static int64_t file_size(const char* path);
|
||||||
|
static uint64_t modify_time(const char* path);
|
||||||
|
static bool mkdir(const char* path);
|
||||||
|
static bool mkdirs(const char* path);
|
||||||
|
static bool rename(const char* path_from, const char* path_to);
|
||||||
|
static bool move(const char* path_from, const char* path_to);
|
||||||
|
static bool remove(const char* path);
|
||||||
|
- static bool is_same(const char* path1, const char* path2);
|
||||||
|
- static bool is_same(const char* path, const char* content, int64_t size);
|
||||||
|
|
||||||
|
class ListDir: public StackObj {
|
||||||
|
const char* _path;
|
||||||
|
diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/jbooster/JBoosterCompilationContext.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/jbooster/JBoosterCompilationContext.java
|
||||||
|
index b26786a52..85c9bf464 100644
|
||||||
|
--- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/jbooster/JBoosterCompilationContext.java
|
||||||
|
+++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/jbooster/JBoosterCompilationContext.java
|
||||||
|
@@ -94,6 +94,11 @@ public interface JBoosterCompilationContext {
|
||||||
|
*/
|
||||||
|
boolean usePGO();
|
||||||
|
|
||||||
|
+ /**
|
||||||
|
+ * return true if compilation uses extra-resolved klasses
|
||||||
|
+ */
|
||||||
|
+ boolean resolveExtraKlasses();
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* Get methodCount of CompiledMethodInfo.
|
||||||
|
* (To support multi-task concurrent compilation of AOT)
|
||||||
|
diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/BytecodeParser.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/BytecodeParser.java
|
||||||
|
index e429e43e8..01ee855d3 100644
|
||||||
|
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/BytecodeParser.java
|
||||||
|
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/BytecodeParser.java
|
||||||
|
@@ -263,6 +263,7 @@ import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.LUDICROU
|
||||||
|
import static org.graalvm.compiler.nodes.graphbuilderconf.IntrinsicContext.CompilationContext.INLINE_DURING_PARSING;
|
||||||
|
import static org.graalvm.compiler.nodes.type.StampTool.isPointerNonNull;
|
||||||
|
|
||||||
|
+import java.lang.annotation.Target;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
@@ -4386,6 +4387,20 @@ public class BytecodeParser implements GraphBuilderContext {
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void maybeEagerlyResolve(int cpi, int bytecode) {
|
||||||
|
+ JBoosterCompilationContext ctx = JBoosterCompilationContext.get();
|
||||||
|
+ if (ctx != null && !ctx.resolveExtraKlasses()) {
|
||||||
|
+ try{
|
||||||
|
+ maybeEagerlyResolveBase(cpi, bytecode);
|
||||||
|
+ } catch (NoClassDefFoundError e) {
|
||||||
|
+ debug.log("Cannot resolve all elements in constant pool");
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ maybeEagerlyResolveBase(cpi, bytecode);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected void maybeEagerlyResolveBase(int cpi, int bytecode) {
|
||||||
|
if (intrinsicContext != null) {
|
||||||
|
constantPool.loadReferencedType(cpi, bytecode);
|
||||||
|
} else if (graphBuilderConfig.eagerResolving()) {
|
||||||
|
@@ -4420,6 +4435,20 @@ public class BytecodeParser implements GraphBuilderContext {
|
||||||
|
}
|
||||||
|
|
||||||
|
protected JavaType maybeEagerlyResolve(JavaType type, ResolvedJavaType accessingClass) {
|
||||||
|
+ JBoosterCompilationContext ctx = JBoosterCompilationContext.get();
|
||||||
|
+ if (ctx != null && !ctx.resolveExtraKlasses()) {
|
||||||
|
+ try{
|
||||||
|
+ return maybeEagerlyResolveBase(type, accessingClass);
|
||||||
|
+ } catch (NoClassDefFoundError e) {
|
||||||
|
+ debug.log("Cannot resolve all elements in constant pool");
|
||||||
|
+ return type;
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ return maybeEagerlyResolveBase(type, accessingClass);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected JavaType maybeEagerlyResolveBase(JavaType type, ResolvedJavaType accessingClass) {
|
||||||
|
if (graphBuilderConfig.eagerResolving() || parsingIntrinsic()) {
|
||||||
|
return type.resolve(accessingClass);
|
||||||
|
}
|
||||||
|
diff --git a/src/jdk.jbooster/share/classes/jdk/jbooster/JBooster.java b/src/jdk.jbooster/share/classes/jdk/jbooster/JBooster.java
|
||||||
|
index db5d916ac..76d62e9b2 100644
|
||||||
|
--- a/src/jdk.jbooster/share/classes/jdk/jbooster/JBooster.java
|
||||||
|
+++ b/src/jdk.jbooster/share/classes/jdk/jbooster/JBooster.java
|
||||||
|
@@ -175,15 +175,15 @@ public final class JBooster {
|
||||||
|
/**
|
||||||
|
* This method is invoked only in C++.
|
||||||
|
*/
|
||||||
|
- private static boolean compileClasses(int sessionId, String filePath, Set<Class<?>> classes, boolean usePGO) {
|
||||||
|
- return compileMethods(sessionId, filePath, classes, null, null, usePGO);
|
||||||
|
+ private static boolean compileClasses(int sessionId, String filePath, Set<Class<?>> classes, boolean usePGO, boolean resolveExtraKlasses) {
|
||||||
|
+ return compileMethods(sessionId, filePath, classes, null, null, usePGO, resolveExtraKlasses);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is invoked only in C++.
|
||||||
|
*/
|
||||||
|
private static boolean compileMethods(int sessionId, String filePath, Set<Class<?>> classes,
|
||||||
|
- Set<String> methodsToCompile, Set<String> methodsNotToCompile, boolean usePGO) {
|
||||||
|
+ Set<String> methodsToCompile, Set<String> methodsNotToCompile, boolean usePGO, boolean resolveExtraKlasses) {
|
||||||
|
LOGGER.log(INFO, "Compilation task received: classes_to_compile={0}, methods_to_compile={1}, methods_not_compile={2}, session_id={3}.",
|
||||||
|
classes.size(),
|
||||||
|
(methodsToCompile == null ? "all" : String.valueOf(methodsToCompile.size())),
|
||||||
|
@@ -191,7 +191,7 @@ public final class JBooster {
|
||||||
|
sessionId);
|
||||||
|
try {
|
||||||
|
JBoosterCompilationContextImpl ctx = new JBoosterCompilationContextImpl(
|
||||||
|
- sessionId, filePath, classes, methodsToCompile, methodsNotToCompile, usePGO);
|
||||||
|
+ sessionId, filePath, classes, methodsToCompile, methodsNotToCompile, usePGO, resolveExtraKlasses);
|
||||||
|
return new Main(ctx).compileForJBooster();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
diff --git a/src/jdk.jbooster/share/classes/jdk/jbooster/JBoosterCompilationContextImpl.java b/src/jdk.jbooster/share/classes/jdk/jbooster/JBoosterCompilationContextImpl.java
|
||||||
|
index 4918f8552..efdeee9e5 100644
|
||||||
|
--- a/src/jdk.jbooster/share/classes/jdk/jbooster/JBoosterCompilationContextImpl.java
|
||||||
|
+++ b/src/jdk.jbooster/share/classes/jdk/jbooster/JBoosterCompilationContextImpl.java
|
||||||
|
@@ -43,6 +43,7 @@ public class JBoosterCompilationContextImpl implements JBoosterCompilationContex
|
||||||
|
private final Set<String> methodsToCompile;
|
||||||
|
private final Set<String> methodsNotToCompile;
|
||||||
|
private final boolean usePGO;
|
||||||
|
+ private final boolean resolveExtraKlasses;
|
||||||
|
|
||||||
|
// These values are used to replace the static values in AOT classes.
|
||||||
|
private final AtomicInteger compiledMethodInfoMethodsCount = new AtomicInteger(0);
|
||||||
|
@@ -63,13 +64,15 @@ public class JBoosterCompilationContextImpl implements JBoosterCompilationContex
|
||||||
|
Set<Class<?>> classesToCompile,
|
||||||
|
Set<String> methodsToCompile,
|
||||||
|
Set<String> methodsNotCompile,
|
||||||
|
- boolean usePGO) {
|
||||||
|
+ boolean usePGO,
|
||||||
|
+ boolean resolveExtraKlasses) {
|
||||||
|
this.sessionId = sessionId;
|
||||||
|
this.filePath = filePath;
|
||||||
|
this.classesToCompile = classesToCompile;
|
||||||
|
this.methodsToCompile = methodsToCompile;
|
||||||
|
this.methodsNotToCompile = methodsNotCompile;
|
||||||
|
this.usePGO = usePGO;
|
||||||
|
+ this.resolveExtraKlasses = resolveExtraKlasses;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@@ -102,6 +105,11 @@ public class JBoosterCompilationContextImpl implements JBoosterCompilationContex
|
||||||
|
return usePGO;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ @Override
|
||||||
|
+ public boolean resolveExtraKlasses() {
|
||||||
|
+ return resolveExtraKlasses;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
@Override
|
||||||
|
public AtomicInteger getCompiledMethodInfoMethodsCount() {
|
||||||
|
return compiledMethodInfoMethodsCount;
|
||||||
|
diff --git a/test/hotspot/gtest/jbooster/common.hpp b/test/hotspot/gtest/jbooster/common.hpp
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000..15b773786
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/test/hotspot/gtest/jbooster/common.hpp
|
||||||
|
@@ -0,0 +1,96 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2020, 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.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#ifndef GTEST_JBOOSTER_COMMON
|
||||||
|
+#define GTEST_JBOOSTER_COMMON
|
||||||
|
+
|
||||||
|
+#if INCLUDE_JBOOSTER
|
||||||
|
+
|
||||||
|
+// @see src/hotspot/share/memory/filemap.cpp
|
||||||
|
+#ifndef O_BINARY // if defined (Win32) use binary files.
|
||||||
|
+#define O_BINARY 0 // otherwise do nothing.
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+class TestUtils {
|
||||||
|
+public:
|
||||||
|
+ static bool is_same(const char* path1, const char* path2) {
|
||||||
|
+ bool res = false;
|
||||||
|
+ char* buf1 = nullptr;
|
||||||
|
+ char* buf2 = nullptr;
|
||||||
|
+ int fd1 = os::open(path1, O_BINARY | O_RDONLY, 0);
|
||||||
|
+ int fd2 = os::open(path2, O_BINARY | O_RDONLY, 0);
|
||||||
|
+ do {
|
||||||
|
+ if (fd1 < 0 || fd2 < 0) break;
|
||||||
|
+ int64_t size1 = os::lseek(fd1, 0, SEEK_END);
|
||||||
|
+ int64_t size2 = os::lseek(fd2, 0, SEEK_END);
|
||||||
|
+ if (size1 != size2) break;
|
||||||
|
+ int64_t size = size1;
|
||||||
|
+ os::lseek(fd1, 0, SEEK_SET);
|
||||||
|
+ os::lseek(fd2, 0, SEEK_SET);
|
||||||
|
+ // We don't use NEW_RESOURCE_ARRAY here as Thread::current() may
|
||||||
|
+ // not be initialized yet.
|
||||||
|
+ buf1 = NEW_C_HEAP_ARRAY(char, (size_t) size, mtJBooster);
|
||||||
|
+ buf2 = NEW_C_HEAP_ARRAY(char, (size_t) size, mtJBooster);
|
||||||
|
+ size1 = (int64_t) os::read(fd1, buf1, size);
|
||||||
|
+ size2 = (int64_t) os::read(fd2, buf2, size);
|
||||||
|
+ guarantee(size1 == size && size2 == size, "sanity");
|
||||||
|
+ res = memcmp(buf1, buf2, size) == 0;
|
||||||
|
+ } while (false);
|
||||||
|
+ if (fd1 >= 0) os::close(fd1);
|
||||||
|
+ if (fd2 >= 0) os::close(fd2);
|
||||||
|
+ if (buf1 != nullptr) {
|
||||||
|
+ FREE_C_HEAP_ARRAY(char, buf1);
|
||||||
|
+ }
|
||||||
|
+ if (buf2 != nullptr) {
|
||||||
|
+ FREE_C_HEAP_ARRAY(char, buf2);
|
||||||
|
+ }
|
||||||
|
+ return res;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ static bool is_same(const char* path, const char* content, int64_t size) {
|
||||||
|
+ bool res = false;
|
||||||
|
+ char* buf = nullptr;
|
||||||
|
+ int fd = os::open(path, O_BINARY | O_RDONLY, 0);
|
||||||
|
+ do {
|
||||||
|
+ if (fd < 0) break;
|
||||||
|
+ int64_t fsize = os::lseek(fd, 0, SEEK_END);
|
||||||
|
+ if (fsize != size) break;
|
||||||
|
+ os::lseek(fd, 0, SEEK_SET);
|
||||||
|
+ // We don't use NEW_RESOURCE_ARRAY here as Thread::current() may
|
||||||
|
+ // not be initialized yet.
|
||||||
|
+ buf = NEW_C_HEAP_ARRAY(char, (size_t) size, mtJBooster);
|
||||||
|
+ fsize = (int64_t) os::read(fd, buf, size);
|
||||||
|
+ guarantee(fsize == size, "sanity");
|
||||||
|
+ res = memcmp(content, buf, size) == 0;
|
||||||
|
+ } while (false);
|
||||||
|
+ if (fd >= 0) os::close(fd);
|
||||||
|
+ if (buf != nullptr) {
|
||||||
|
+ FREE_C_HEAP_ARRAY(char, buf);
|
||||||
|
+ }
|
||||||
|
+ return res;
|
||||||
|
+ }
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+#endif // INCLUDE_JBOOSTER
|
||||||
|
+
|
||||||
|
+#endif // GTEST_JBOOSTER_COMMON
|
||||||
|
\ No newline at end of file
|
||||||
|
diff --git a/test/hotspot/gtest/jbooster/test_net.cpp b/test/hotspot/gtest/jbooster/test_net.cpp
|
||||||
|
index bf20b0aa3..dd45dd65a 100644
|
||||||
|
--- a/test/hotspot/gtest/jbooster/test_net.cpp
|
||||||
|
+++ b/test/hotspot/gtest/jbooster/test_net.cpp
|
||||||
|
@@ -26,6 +26,8 @@
|
||||||
|
|
||||||
|
#if INCLUDE_JBOOSTER
|
||||||
|
|
||||||
|
+#include "common.hpp"
|
||||||
|
+
|
||||||
|
#include "jbooster/jClientArguments.hpp"
|
||||||
|
#include "jbooster/net/message.inline.hpp"
|
||||||
|
#include "jbooster/net/messageBuffer.inline.hpp"
|
||||||
|
@@ -431,7 +433,7 @@ TEST(JBoosterNet, serializationn_file_wrapper) {
|
||||||
|
}
|
||||||
|
EXPECT_EQ(times, 3);
|
||||||
|
}
|
||||||
|
- EXPECT_TRUE(FileUtils::is_same(file_name1, file_name2));
|
||||||
|
+ EXPECT_TRUE(TestUtils::is_same(file_name1, file_name2));
|
||||||
|
FileUtils::remove(file_name1);
|
||||||
|
FileUtils::remove(file_name2);
|
||||||
|
}
|
||||||
|
diff --git a/test/hotspot/gtest/jbooster/test_util.cpp b/test/hotspot/gtest/jbooster/test_util.cpp
|
||||||
|
index cd65804be..461e3faa7 100644
|
||||||
|
--- a/test/hotspot/gtest/jbooster/test_util.cpp
|
||||||
|
+++ b/test/hotspot/gtest/jbooster/test_util.cpp
|
||||||
|
@@ -26,6 +26,8 @@
|
||||||
|
|
||||||
|
#if INCLUDE_JBOOSTER
|
||||||
|
|
||||||
|
+#include "common.hpp"
|
||||||
|
+
|
||||||
|
#include "classfile/symbolTable.hpp"
|
||||||
|
#include "jbooster/utilities/concurrentHashMap.inline.hpp"
|
||||||
|
#include "jbooster/utilities/debugUtils.inline.hpp"
|
||||||
|
@@ -95,13 +97,13 @@ TEST(JBoosterUtil, file) {
|
||||||
|
|
||||||
|
write_file("gtest-jbooster-tmp5", "12345");
|
||||||
|
write_file("gtest-jbooster-tmp6", "12345");
|
||||||
|
- EXPECT_TRUE(FileUtils::is_same("gtest-jbooster-tmp5", "gtest-jbooster-tmp6"));
|
||||||
|
+ EXPECT_TRUE(TestUtils::is_same("gtest-jbooster-tmp5", "gtest-jbooster-tmp6"));
|
||||||
|
write_file("gtest-jbooster-tmp6", "123456");
|
||||||
|
- EXPECT_FALSE(FileUtils::is_same("gtest-jbooster-tmp5", "gtest-jbooster-tmp6"));
|
||||||
|
+ EXPECT_FALSE(TestUtils::is_same("gtest-jbooster-tmp5", "gtest-jbooster-tmp6"));
|
||||||
|
|
||||||
|
- EXPECT_TRUE(FileUtils::is_same("gtest-jbooster-tmp5", "12345", 6));
|
||||||
|
- EXPECT_FALSE(FileUtils::is_same("gtest-jbooster-tmp5", "12346", 6));
|
||||||
|
- EXPECT_FALSE(FileUtils::is_same("gtest-jbooster-tmp5", "123456", 7));
|
||||||
|
+ EXPECT_TRUE(TestUtils::is_same("gtest-jbooster-tmp5", "12345", 6));
|
||||||
|
+ EXPECT_FALSE(TestUtils::is_same("gtest-jbooster-tmp5", "12346", 6));
|
||||||
|
+ EXPECT_FALSE(TestUtils::is_same("gtest-jbooster-tmp5", "123456", 7));
|
||||||
|
|
||||||
|
EXPECT_FALSE(FileUtils::is_file("gtest-jbooster-tmp4"));
|
||||||
|
EXPECT_TRUE(FileUtils::is_dir("gtest-jbooster-tmp4"));
|
||||||
|
diff --git a/test/jdk/tools/jbooster/JBoosterTestBase.java b/test/jdk/tools/jbooster/JBoosterTestBase.java
|
||||||
|
index 08792a77b..4c1dcbd4a 100644
|
||||||
|
--- a/test/jdk/tools/jbooster/JBoosterTestBase.java
|
||||||
|
+++ b/test/jdk/tools/jbooster/JBoosterTestBase.java
|
||||||
|
@@ -44,11 +44,12 @@ import jdk.test.lib.Utils;
|
||||||
|
* @see JcmdBase
|
||||||
|
*/
|
||||||
|
public class JBoosterTestBase {
|
||||||
|
- public static final int WAIT_START_TIME = 2;
|
||||||
|
+ public static final int WAIT_START_TIME = 128;
|
||||||
|
public static final int WAIT_SHORT_TIME = 8;
|
||||||
|
public static final int WAIT_EXIT_TIME = 64;
|
||||||
|
|
||||||
|
public static final int SERVER_PORT = 41567;
|
||||||
|
+ public static final int SERVER_CONNECTION_TIMEOUT = 256 * 1000;
|
||||||
|
public static final String SERVER_PORT_STR = "41567";
|
||||||
|
|
||||||
|
public static final String CLIENT_CACHE_PATH = "jbooster-cache-client";
|
||||||
|
@@ -80,7 +81,8 @@ public class JBoosterTestBase {
|
||||||
|
|
||||||
|
public static final List<String> SERVER_STANDARD_ARGS = List.of(
|
||||||
|
"--server-port=" + SERVER_PORT_STR,
|
||||||
|
- "--cache-path=" + SERVER_CACHE_PATH
|
||||||
|
+ "--cache-path=" + SERVER_CACHE_PATH,
|
||||||
|
+ "--connection-timeout=" + SERVER_CONNECTION_TIMEOUT
|
||||||
|
);
|
||||||
|
|
||||||
|
private static final ProcessBuilder processBuilder = new ProcessBuilder();
|
||||||
|
--
|
||||||
|
2.22.0
|
||||||
|
|
||||||
623
SA-redact-support-password.patch
Normal file
623
SA-redact-support-password.patch
Normal file
@ -0,0 +1,623 @@
|
|||||||
|
From fcf500b87f0ddcd1fff0b9a0040b1be1b8a37321 Mon Sep 17 00:00:00 2001
|
||||||
|
Date: Fri, 29 Nov 2024 15:36:57 +0800
|
||||||
|
Subject: SA redact support password
|
||||||
|
|
||||||
|
---
|
||||||
|
src/hotspot/share/runtime/arguments.cpp | 16 ++--
|
||||||
|
src/hotspot/share/runtime/arguments.hpp | 5 -
|
||||||
|
src/hotspot/share/runtime/globals.hpp | 2 +-
|
||||||
|
src/hotspot/share/services/heapRedactor.cpp | 7 +-
|
||||||
|
src/hotspot/share/services/heapRedactor.hpp | 1 +
|
||||||
|
.../classes/sun/jvm/hotspot/SALauncher.java | 10 +-
|
||||||
|
.../classes/sun/jvm/hotspot/tools/JMap.java | 36 +++++++
|
||||||
|
.../hotspot/utilities/HeapHprofBinWriter.java | 75 ++++++++++++++-
|
||||||
|
.../jvm/hotspot/utilities/HeapRedactor.java | 30 +++---
|
||||||
|
.../share/classes/sun/tools/jmap/JMap.java | 96 +++++++++++++++----
|
||||||
|
10 files changed, 227 insertions(+), 51 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp
|
||||||
|
index 42b4f90f1..f24cabb11 100644
|
||||||
|
--- a/src/hotspot/share/runtime/arguments.cpp
|
||||||
|
+++ b/src/hotspot/share/runtime/arguments.cpp
|
||||||
|
@@ -121,8 +121,6 @@ bool Arguments::_has_jimage = false;
|
||||||
|
|
||||||
|
char* Arguments::_ext_dirs = NULL;
|
||||||
|
|
||||||
|
-char* Arguments::_heap_dump_redact_auth = NULL;
|
||||||
|
-
|
||||||
|
bool PathString::set_value(const char *value) {
|
||||||
|
if (_value != NULL) {
|
||||||
|
FreeHeap(_value);
|
||||||
|
@@ -3743,23 +3741,23 @@ jint Arguments::match_special_option_and_act(const JavaVMInitArgs* args,
|
||||||
|
warning("Heap dump redacting did not setup properly, using wrong argument?");
|
||||||
|
vm_exit_during_initialization("Syntax error, expecting -XX:HeapDumpRedact=[off|names|basic|full|diyrules|annotation]",NULL);
|
||||||
|
}
|
||||||
|
+ continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// heapDump redact password
|
||||||
|
if(match_option(option, "-XX:RedactPassword=", &tail)) {
|
||||||
|
if(tail == NULL || strlen(tail) == 0) {
|
||||||
|
VerifyRedactPassword = false;
|
||||||
|
- jio_fprintf(defaultStream::output_stream(), "redact password is null, disable verify heap dump authority.\n");
|
||||||
|
} else {
|
||||||
|
- VerifyRedactPassword = true;
|
||||||
|
- size_t redact_password_len = strlen(tail);
|
||||||
|
- _heap_dump_redact_auth = NEW_C_HEAP_ARRAY(char, redact_password_len+1, mtArguments);
|
||||||
|
- memcpy(_heap_dump_redact_auth, tail, redact_password_len);
|
||||||
|
- _heap_dump_redact_auth[redact_password_len] = '\0';
|
||||||
|
- memset((void*)tail, '0', redact_password_len);
|
||||||
|
+ char* split_char = strstr(const_cast<char*>(tail), ",");
|
||||||
|
+ VerifyRedactPassword = !(split_char == NULL || strlen(split_char) < SALT_LEN);
|
||||||
|
+ }
|
||||||
|
+ if(!VerifyRedactPassword) {
|
||||||
|
+ jio_fprintf(defaultStream::output_stream(), "redact password is null or with bad format, disable verify heap dump authority.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+
|
||||||
|
#ifndef PRODUCT
|
||||||
|
if (match_option(option, "-XX:+PrintFlagsWithComments")) {
|
||||||
|
JVMFlag::printFlags(tty, true);
|
||||||
|
diff --git a/src/hotspot/share/runtime/arguments.hpp b/src/hotspot/share/runtime/arguments.hpp
|
||||||
|
index 6b9759906..cb2a04a2d 100644
|
||||||
|
--- a/src/hotspot/share/runtime/arguments.hpp
|
||||||
|
+++ b/src/hotspot/share/runtime/arguments.hpp
|
||||||
|
@@ -468,8 +468,6 @@ class Arguments : AllStatic {
|
||||||
|
char** base_archive_path,
|
||||||
|
char** top_archive_path) NOT_CDS_RETURN;
|
||||||
|
|
||||||
|
- static char* _heap_dump_redact_auth;
|
||||||
|
-
|
||||||
|
public:
|
||||||
|
// Parses the arguments, first phase
|
||||||
|
static jint parse(const JavaVMInitArgs* args);
|
||||||
|
@@ -555,9 +553,6 @@ class Arguments : AllStatic {
|
||||||
|
// Java launcher properties
|
||||||
|
static void process_sun_java_launcher_properties(JavaVMInitArgs* args);
|
||||||
|
|
||||||
|
- // heap dump redact password
|
||||||
|
- static const char* get_heap_dump_redact_auth() { return _heap_dump_redact_auth; }
|
||||||
|
-
|
||||||
|
// System properties
|
||||||
|
static void init_system_properties();
|
||||||
|
|
||||||
|
diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp
|
||||||
|
index b51e50ddf..680e78c04 100644
|
||||||
|
--- a/src/hotspot/share/runtime/globals.hpp
|
||||||
|
+++ b/src/hotspot/share/runtime/globals.hpp
|
||||||
|
@@ -568,7 +568,7 @@ const intx ObjectAlignmentInBytes = 8;
|
||||||
|
"verify authority for operating heapDump redact feature") \
|
||||||
|
\
|
||||||
|
product(ccstr, RedactPassword, NULL, \
|
||||||
|
- "authority for operating heapDump redact feature") \
|
||||||
|
+ "authority for operating heapDump redact feature, format {password,salt}, salt length >= 8") \
|
||||||
|
\
|
||||||
|
product(ccstr, NativeMemoryTracking, DEBUG_ONLY("summary") NOT_DEBUG("off"), \
|
||||||
|
"Native memory tracking options") \
|
||||||
|
diff --git a/src/hotspot/share/services/heapRedactor.cpp b/src/hotspot/share/services/heapRedactor.cpp
|
||||||
|
index 0e7b0a97c..cfb5b3f82 100644
|
||||||
|
--- a/src/hotspot/share/services/heapRedactor.cpp
|
||||||
|
+++ b/src/hotspot/share/services/heapRedactor.cpp
|
||||||
|
@@ -170,12 +170,15 @@ void HeapRedactor::init(outputStream* out) {
|
||||||
|
* if HeapDumpRedact is NULL , jmap operation can not open redact feature without password
|
||||||
|
* if HeapDumpRedact is not NULL, jmap operation can not change redact level without password
|
||||||
|
**/
|
||||||
|
- if(Arguments::get_heap_dump_redact_auth() == NULL) {
|
||||||
|
+ char* split_char = NULL;
|
||||||
|
+ if(RedactPassword == NULL || (split_char = strstr(const_cast<char*>(RedactPassword), ",")) == NULL || strlen(split_char) < SALT_LEN) {
|
||||||
|
VerifyRedactPassword = false;
|
||||||
|
}
|
||||||
|
if(VerifyRedactPassword && !_use_sys_params) {
|
||||||
|
+ size_t auth_len = strlen(RedactPassword);
|
||||||
|
+ size_t suffix_len = strlen(split_char);
|
||||||
|
if(_redact_params.redact_password == NULL ||
|
||||||
|
- strcmp(_redact_params.redact_password, Arguments::get_heap_dump_redact_auth()) ) {
|
||||||
|
+ strncmp(_redact_params.redact_password, RedactPassword, auth_len-suffix_len) ) {
|
||||||
|
// no password or wrong password
|
||||||
|
_use_sys_params = true;
|
||||||
|
if(out != NULL) {
|
||||||
|
diff --git a/src/hotspot/share/services/heapRedactor.hpp b/src/hotspot/share/services/heapRedactor.hpp
|
||||||
|
index 790430507..e5a5bf440 100644
|
||||||
|
--- a/src/hotspot/share/services/heapRedactor.hpp
|
||||||
|
+++ b/src/hotspot/share/services/heapRedactor.hpp
|
||||||
|
@@ -32,6 +32,7 @@
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define MAX_MAP_FILE_LENGTH 1024
|
||||||
|
+#define SALT_LEN 9
|
||||||
|
|
||||||
|
enum HeapDumpRedactLevel {
|
||||||
|
REDACT_UNKNOWN,
|
||||||
|
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java
|
||||||
|
index 291e483e0..91a432574 100644
|
||||||
|
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java
|
||||||
|
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java
|
||||||
|
@@ -322,7 +322,8 @@ public class SALauncher {
|
||||||
|
Map.entry("HeapDumpRedact=", "HeapDumpRedact"),
|
||||||
|
Map.entry("RedactMap=", "RedactMap"),
|
||||||
|
Map.entry("RedactMapFile=", "RedactMapFile"),
|
||||||
|
- Map.entry("RedactClassPath=", "RedactClassPath"));
|
||||||
|
+ Map.entry("RedactClassPath=", "RedactClassPath"),
|
||||||
|
+ Map.entry("RedactPassword", "RedactPassword"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void runJMAP(String[] oldArgs) {
|
||||||
|
@@ -337,6 +338,7 @@ public class SALauncher {
|
||||||
|
String redactMap = newArgMap.get("RedactMap");
|
||||||
|
String redactMapFile = newArgMap.get("RedactMapFile");
|
||||||
|
String redactClassPath = newArgMap.get("RedactClassPath");
|
||||||
|
+ boolean hasRedactPassword = newArgMap.containsKey("RedactPassword");
|
||||||
|
if (!requestHeapdump && (dumpfile != null)) {
|
||||||
|
throw new IllegalArgumentException("Unexpected argument: dumpfile");
|
||||||
|
}
|
||||||
|
@@ -359,6 +361,9 @@ public class SALauncher {
|
||||||
|
if (redactClassPath != null) {
|
||||||
|
command += ",RedactClassPath=" + redactClassPath;
|
||||||
|
}
|
||||||
|
+ if(hasRedactPassword) {
|
||||||
|
+ command += ",RedactPassword";
|
||||||
|
+ }
|
||||||
|
newArgMap.put(command, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -369,9 +374,12 @@ public class SALauncher {
|
||||||
|
newArgMap.remove("RedactMap");
|
||||||
|
newArgMap.remove("RedactMapFile");
|
||||||
|
newArgMap.remove("RedactClassPath");
|
||||||
|
+ newArgMap.remove("RedactPassword");
|
||||||
|
JMap.main(buildAttachArgs(newArgMap, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
+
|
||||||
|
+
|
||||||
|
private static void runJINFO(String[] oldArgs) {
|
||||||
|
Map<String, String> longOptsMap = Map.of("exe=", "exe",
|
||||||
|
"core=", "core",
|
||||||
|
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/JMap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/JMap.java
|
||||||
|
index e52cd1fb1..fbead3ce4 100644
|
||||||
|
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/JMap.java
|
||||||
|
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/JMap.java
|
||||||
|
@@ -25,6 +25,9 @@
|
||||||
|
package sun.jvm.hotspot.tools;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
+import java.nio.CharBuffer;
|
||||||
|
+import java.util.regex.Pattern;
|
||||||
|
+
|
||||||
|
import sun.jvm.hotspot.debugger.JVMDebugger;
|
||||||
|
import sun.jvm.hotspot.utilities.*;
|
||||||
|
|
||||||
|
@@ -189,6 +192,9 @@ public class JMap extends Tool {
|
||||||
|
redactParams.setRedactMapFile(keyValue[1]);
|
||||||
|
} else if (keyValue[0].equals("RedactClassPath")) {
|
||||||
|
redactParams.setRedactClassPath(keyValue[1]);
|
||||||
|
+ } else if (keyValue[0].equals("RedactPassword")) {
|
||||||
|
+ redactParams.setRedactPassword(getRedactPassword());
|
||||||
|
+
|
||||||
|
} else {
|
||||||
|
System.err.println("unknown option:" + keyValue[0]);
|
||||||
|
|
||||||
|
@@ -226,6 +232,36 @@ public class JMap extends Tool {
|
||||||
|
jmap.execute(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ private static CharBuffer getRedactPassword() {
|
||||||
|
+ CharBuffer redactPassword = CharBuffer.wrap("");
|
||||||
|
+ // heap dump may need a password
|
||||||
|
+ Console console = System.console();
|
||||||
|
+ char[] passwords = null;
|
||||||
|
+ if (console == null) {
|
||||||
|
+ return redactPassword;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ try {
|
||||||
|
+ passwords = console.readPassword("redact authority password:");
|
||||||
|
+ } catch (Exception e) {
|
||||||
|
+ }
|
||||||
|
+ if(passwords == null) {
|
||||||
|
+ return redactPassword;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ try {
|
||||||
|
+ CharBuffer cb = CharBuffer.wrap(passwords);
|
||||||
|
+ String passwordPattern = "^[0-9a-zA-Z!@#$]{1,9}$";
|
||||||
|
+ if(!Pattern.matches(passwordPattern, cb)) {
|
||||||
|
+ return redactPassword;
|
||||||
|
+ }
|
||||||
|
+ redactPassword = cb;
|
||||||
|
+ } catch (Exception e) {
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return redactPassword;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
public boolean writeHeapHprofBin(String fileName, int gzLevel) {
|
||||||
|
try {
|
||||||
|
HeapHprofBinWriter hgw;
|
||||||
|
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java
|
||||||
|
index e73b6f9a3..566d88646 100644
|
||||||
|
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java
|
||||||
|
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java
|
||||||
|
@@ -28,6 +28,10 @@ import java.io.*;
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.ByteOrder;
|
||||||
|
import java.nio.channels.*;
|
||||||
|
+import java.nio.CharBuffer;
|
||||||
|
+import java.security.NoSuchAlgorithmException;
|
||||||
|
+import java.security.spec.InvalidKeySpecException;
|
||||||
|
+import java.security.spec.KeySpec;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.zip.*;
|
||||||
|
import sun.jvm.hotspot.debugger.*;
|
||||||
|
@@ -37,6 +41,10 @@ import sun.jvm.hotspot.runtime.*;
|
||||||
|
import sun.jvm.hotspot.classfile.*;
|
||||||
|
import sun.jvm.hotspot.gc.z.ZCollectedHeap;
|
||||||
|
|
||||||
|
+import javax.crypto.SecretKey;
|
||||||
|
+import javax.crypto.SecretKeyFactory;
|
||||||
|
+import javax.crypto.spec.PBEKeySpec;
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* This class writes Java heap in hprof binary format. This format is
|
||||||
|
* used by Heap Analysis Tool (HAT). The class is heavily influenced
|
||||||
|
@@ -386,6 +394,11 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
|
||||||
|
private static final long MAX_U4_VALUE = 0xFFFFFFFFL;
|
||||||
|
int serialNum = 1;
|
||||||
|
|
||||||
|
+ // encrypt
|
||||||
|
+ private static int SALT_MIN_LENGTH = 8;
|
||||||
|
+ private static int HASH_BIT_SIZE = 256;
|
||||||
|
+ private static int HASH_ITERATIONS_COUNT = 10000;
|
||||||
|
+
|
||||||
|
// Heap Redact
|
||||||
|
private HeapRedactor heapRedactor;
|
||||||
|
|
||||||
|
@@ -404,6 +417,10 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
|
||||||
|
return heapRedactor.getHeapDumpRedactLevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public Optional<CharBuffer> getHeapDumpRedactPassword() {
|
||||||
|
+ return heapRedactor == null ? Optional.empty() : Optional.ofNullable(heapRedactor.getRedactPassword());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
private Optional<String> lookupRedactName(String name){
|
||||||
|
return heapRedactor == null ? Optional.empty() : heapRedactor.lookupRedactName(name);
|
||||||
|
}
|
||||||
|
@@ -454,10 +471,66 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
|
||||||
|
this.gzLevel = gzLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ private boolean checkPassword() {
|
||||||
|
+ Optional<String> redactAuthOption = getVMRedactParameter("RedactPassword");
|
||||||
|
+ String redactAuth = redactAuthOption.isPresent() ? redactAuthOption.get() : null;
|
||||||
|
+ boolean redactAuthFlag = true;
|
||||||
|
+ if(redactAuth != null) {
|
||||||
|
+ String[] auths = redactAuth.split(",");
|
||||||
|
+ if(auths.length != 2) {
|
||||||
|
+ return redactAuthFlag;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ Optional<CharBuffer> passwordOption = getHeapDumpRedactPassword();
|
||||||
|
+ CharBuffer password = passwordOption.isPresent() ? passwordOption.get() : CharBuffer.wrap("");
|
||||||
|
+ char[] passwordChars = null;
|
||||||
|
+ try {
|
||||||
|
+ passwordChars = password.array();
|
||||||
|
+
|
||||||
|
+ byte[] saltBytes = auths[1].getBytes("UTF-8");
|
||||||
|
+ if(saltBytes.length < SALT_MIN_LENGTH) {
|
||||||
|
+ return redactAuthFlag;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ String digestStr = getEncryptValue(passwordChars, saltBytes);
|
||||||
|
+ redactAuthFlag = auths[0].equals(digestStr);
|
||||||
|
+ } catch (Exception e) {
|
||||||
|
+ // ignore
|
||||||
|
+ redactAuthFlag = false;
|
||||||
|
+ } finally {
|
||||||
|
+ // clear all password
|
||||||
|
+ if(passwordChars != null) {
|
||||||
|
+ Arrays.fill(passwordChars, '0');
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return redactAuthFlag;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private String getEncryptValue(char[] passwordValue, byte[] saltBytes) throws InvalidKeySpecException, NoSuchAlgorithmException {
|
||||||
|
+ StringBuilder digestStrBuilder = new StringBuilder();
|
||||||
|
+
|
||||||
|
+ KeySpec spec = new PBEKeySpec(passwordValue, saltBytes, HASH_ITERATIONS_COUNT, HASH_BIT_SIZE);
|
||||||
|
+ SecretKeyFactory secretKeyFactory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256");
|
||||||
|
+ SecretKey secretKey = secretKeyFactory.generateSecret(spec);
|
||||||
|
+ byte[] digestBytes = secretKey.getEncoded();
|
||||||
|
+ for (byte b : digestBytes) {
|
||||||
|
+ String hex = Integer.toHexString(0xff & b);
|
||||||
|
+ if (hex.length() == 1) {
|
||||||
|
+ digestStrBuilder.append('0');
|
||||||
|
+ }
|
||||||
|
+ digestStrBuilder.append(hex);
|
||||||
|
+ }
|
||||||
|
+ String digestStr = digestStrBuilder.toString();
|
||||||
|
+
|
||||||
|
+ return digestStr;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
public synchronized void write(String fileName) throws IOException {
|
||||||
|
VM vm = VM.getVM();
|
||||||
|
|
||||||
|
- if(getHeapDumpRedactLevel() == HeapRedactor.HeapDumpRedactLevel.REDACT_UNKNOWN) {
|
||||||
|
+ if(getHeapDumpRedactLevel() == HeapRedactor.HeapDumpRedactLevel.REDACT_UNKNOWN || !checkPassword()) {
|
||||||
|
resetRedactParams();
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapRedactor.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapRedactor.java
|
||||||
|
index c2a916617..5c442b2bb 100644
|
||||||
|
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapRedactor.java
|
||||||
|
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapRedactor.java
|
||||||
|
@@ -30,6 +30,7 @@ import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
+import java.nio.CharBuffer;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
@@ -51,7 +52,7 @@ public class HeapRedactor {
|
||||||
|
private HeapDumpRedactLevel redactLevel;
|
||||||
|
private Map<String, String> redactNameTable;
|
||||||
|
private Map<String, Map<String, String>> redactClassTable;
|
||||||
|
- private String redactClassFullName = null;
|
||||||
|
+ private String redactClassFullName = null;
|
||||||
|
private Map<Long, String> redactValueTable;
|
||||||
|
private RedactVectorNode headerNode;
|
||||||
|
private RedactVectorNode currentNode;
|
||||||
|
@@ -62,6 +63,7 @@ public class HeapRedactor {
|
||||||
|
public static final String REDACT_MAP_PREFIX = "RedactMap=";
|
||||||
|
public static final String REDACT_MAP_FILE_PREFIX = "RedactMapFile=";
|
||||||
|
public static final String REDACT_CLASS_PATH_PREFIX = "RedactClassPath=";
|
||||||
|
+ public static final String REDACT_PASSWORD_PREFIX = "RedactPassword=";
|
||||||
|
|
||||||
|
public static final String REDACT_UNKNOWN_STR = "UNKNOWN";
|
||||||
|
public static final String REDACT_OFF_STR = "OFF";
|
||||||
|
@@ -82,14 +84,6 @@ public class HeapRedactor {
|
||||||
|
public static final int PATH_MAX = 4096;
|
||||||
|
public static final int REDACT_VECTOR_SIZE = 1024;
|
||||||
|
|
||||||
|
- public HeapRedactor(String options) {
|
||||||
|
- redactLevel = HeapDumpRedactLevel.REDACT_UNKNOWN;
|
||||||
|
- redactNameTable = null;
|
||||||
|
- redactClassTable = null;
|
||||||
|
- redactValueTable = null;
|
||||||
|
- init(options);
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
public HeapRedactor(RedactParams redactParams) {
|
||||||
|
this.redactParams = redactParams;
|
||||||
|
redactLevel = HeapDumpRedactLevel.REDACT_UNKNOWN;
|
||||||
|
@@ -167,6 +161,10 @@ public class HeapRedactor {
|
||||||
|
return redactParams.getRedactClassPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public CharBuffer getRedactPassword(){
|
||||||
|
+ return redactParams.getRedactPassword();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
public Optional<Map<String, String>> getRedactRulesTable(String key) {
|
||||||
|
return Optional.ofNullable(redactClassTable == null ? null: redactClassTable.get(key));
|
||||||
|
}
|
||||||
|
@@ -218,7 +216,7 @@ public class HeapRedactor {
|
||||||
|
}
|
||||||
|
|
||||||
|
private RedactParams parseRedactOptions(String optionStr) {
|
||||||
|
- RedactParams params = new RedactParams(REDACT_OFF_OPTION, null, null, null);
|
||||||
|
+ RedactParams params = new RedactParams(REDACT_OFF_OPTION, null, null, null, null);
|
||||||
|
if (optionStr != null) {
|
||||||
|
String[] options = optionStr.split(",");
|
||||||
|
for (String option : options) {
|
||||||
|
@@ -321,16 +319,18 @@ public class HeapRedactor {
|
||||||
|
private String redactMap;
|
||||||
|
private String redactMapFile;
|
||||||
|
private String redactClassPath;
|
||||||
|
+ private CharBuffer redactPassword;
|
||||||
|
private boolean enableRedact = false;
|
||||||
|
|
||||||
|
public RedactParams() {
|
||||||
|
}
|
||||||
|
|
||||||
|
- public RedactParams(String heapDumpRedact, String redactMap, String redactMapFile, String redactClassPath) {
|
||||||
|
+ public RedactParams(String heapDumpRedact, String redactMap, String redactMapFile, String redactClassPath, CharBuffer redactPassword) {
|
||||||
|
this.heapDumpRedact = heapDumpRedact;
|
||||||
|
this.redactMap = redactMap;
|
||||||
|
this.redactMapFile = redactMapFile;
|
||||||
|
this.redactClassPath = redactClassPath;
|
||||||
|
+ this.redactPassword = redactPassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@@ -395,6 +395,14 @@ public class HeapRedactor {
|
||||||
|
this.redactClassPath = redactClassPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public CharBuffer getRedactPassword() {
|
||||||
|
+ return redactPassword;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setRedactPassword(CharBuffer redactPassword) {
|
||||||
|
+ this.redactPassword = redactPassword;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
public static boolean checkLauncherHeapdumpRedactSupport(String value) {
|
||||||
|
String[] validValues = {REDACT_BASIC_OPTION, REDACT_NAME_OPTION, REDACT_FULL_OPTION, REDACT_DIYRULES_OPTION, REDACT_ANNOTATION_OPTION, REDACT_OFF_OPTION};
|
||||||
|
for (String validValue : validValues) {
|
||||||
|
diff --git a/src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java b/src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java
|
||||||
|
index ef4ea7152..6479863a6 100644
|
||||||
|
--- a/src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java
|
||||||
|
+++ b/src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java
|
||||||
|
@@ -25,14 +25,17 @@
|
||||||
|
|
||||||
|
package sun.tools.jmap;
|
||||||
|
|
||||||
|
+import java.io.BufferedInputStream;
|
||||||
|
import java.io.Console;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
+import java.io.InputStreamReader;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.nio.CharBuffer;
|
||||||
|
-import java.nio.charset.Charset;
|
||||||
|
-import java.security.MessageDigest;
|
||||||
|
+import java.security.NoSuchAlgorithmException;
|
||||||
|
+import java.security.spec.InvalidKeySpecException;
|
||||||
|
+import java.security.spec.KeySpec;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
@@ -43,6 +46,10 @@ import com.sun.tools.attach.AttachNotSupportedException;
|
||||||
|
import sun.tools.attach.HotSpotVirtualMachine;
|
||||||
|
import sun.tools.common.ProcessArgumentMatcher;
|
||||||
|
|
||||||
|
+import javax.crypto.SecretKey;
|
||||||
|
+import javax.crypto.SecretKeyFactory;
|
||||||
|
+import javax.crypto.spec.PBEKeySpec;
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* This class is the main class for the JMap utility. It parses its arguments
|
||||||
|
* and decides if the command should be satisfied using the VM attach mechanism
|
||||||
|
@@ -51,6 +58,10 @@ import sun.tools.common.ProcessArgumentMatcher;
|
||||||
|
* options are mapped to SA tools.
|
||||||
|
*/
|
||||||
|
public class JMap {
|
||||||
|
+ // encrypt
|
||||||
|
+ private static int SALT_MIN_LENGTH = 8;
|
||||||
|
+ private static int HASH_BIT_SIZE = 256;
|
||||||
|
+ private static int HASH_ITERATIONS_COUNT = 10000;
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
if (args.length == 0) {
|
||||||
|
@@ -250,7 +261,7 @@ public class JMap {
|
||||||
|
} else if (subopt.startsWith("RedactClassPath")) {
|
||||||
|
redactParams.setRedactClassPath(subopt.substring("RedactClassPath=".length()));
|
||||||
|
} else if (subopt.startsWith("RedactPassword")) {
|
||||||
|
- redactPassword = getRedactPassword();
|
||||||
|
+ redactPassword = getRedactPassword(pid);
|
||||||
|
} else {
|
||||||
|
System.err.println("Fail: invalid option: '" + subopt + "'");
|
||||||
|
usage(1);
|
||||||
|
@@ -282,7 +293,7 @@ public class JMap {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- private static String getRedactPassword() {
|
||||||
|
+ private static String getRedactPassword(String pid) {
|
||||||
|
String redactPassword = ",RedactPassword=";
|
||||||
|
// heap dump may need a password
|
||||||
|
Console console = System.console();
|
||||||
|
@@ -300,42 +311,85 @@ public class JMap {
|
||||||
|
}
|
||||||
|
|
||||||
|
String digestStr = null;
|
||||||
|
- byte[] passwordBytes = null;
|
||||||
|
try {
|
||||||
|
CharBuffer cb = CharBuffer.wrap(passwords);
|
||||||
|
String passwordPattern = "^[0-9a-zA-Z!@#$]{1,9}$";
|
||||||
|
if(!Pattern.matches(passwordPattern, cb)) {
|
||||||
|
return redactPassword;
|
||||||
|
}
|
||||||
|
- Charset cs = Charset.forName("UTF-8");
|
||||||
|
- passwordBytes= cs.encode(cb).array();
|
||||||
|
-
|
||||||
|
- StringBuilder digestStrBuilder = new StringBuilder();
|
||||||
|
- MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
|
||||||
|
- byte[] digestBytes = messageDigest.digest(passwordBytes);
|
||||||
|
- for(byte b : digestBytes) {
|
||||||
|
- String hex = Integer.toHexString(0xff & b);
|
||||||
|
- if(hex.length() == 1) {
|
||||||
|
- digestStrBuilder.append('0');
|
||||||
|
- }
|
||||||
|
- digestStrBuilder.append(hex);
|
||||||
|
+
|
||||||
|
+ String salt = getSalt(pid);
|
||||||
|
+ if(salt == null) {
|
||||||
|
+ return redactPassword;
|
||||||
|
+ }
|
||||||
|
+ byte[] saltBytes = salt.getBytes("UTF-8");
|
||||||
|
+ if(saltBytes.length < SALT_MIN_LENGTH) {
|
||||||
|
+ return redactPassword;
|
||||||
|
}
|
||||||
|
- digestStr = digestStrBuilder.toString();
|
||||||
|
+ digestStr = getEncryptValue(passwords, saltBytes);
|
||||||
|
} catch (Exception e) {
|
||||||
|
}finally {
|
||||||
|
// clear all password
|
||||||
|
if(passwords != null) {
|
||||||
|
Arrays.fill(passwords, '0');
|
||||||
|
}
|
||||||
|
- if(passwordBytes != null) {
|
||||||
|
- Arrays.fill(passwordBytes, (byte) 0);
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
|
||||||
|
redactPassword += (digestStr == null ? "" : digestStr);
|
||||||
|
return redactPassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ private static String getSalt(String pid) throws Exception {
|
||||||
|
+ String salt = null;
|
||||||
|
+ StringBuilder redactAuth = new StringBuilder();
|
||||||
|
+
|
||||||
|
+ VirtualMachine vm = VirtualMachine.attach(pid);
|
||||||
|
+ HotSpotVirtualMachine hvm = (HotSpotVirtualMachine) vm;
|
||||||
|
+ String flag = "RedactPassword";
|
||||||
|
+ try (InputStream in = hvm.printFlag(flag); BufferedInputStream bis = new BufferedInputStream(in);
|
||||||
|
+ InputStreamReader isr = new InputStreamReader(bis, "UTF-8")) {
|
||||||
|
+ char c[] = new char[256];
|
||||||
|
+ int n;
|
||||||
|
+ do {
|
||||||
|
+ n = isr.read(c);
|
||||||
|
+
|
||||||
|
+ if (n > 0) {
|
||||||
|
+ redactAuth.append(n == c.length ? c : Arrays.copyOf(c, n));
|
||||||
|
+ }
|
||||||
|
+ } while (n > 0);
|
||||||
|
+ }
|
||||||
|
+ vm.detach();
|
||||||
|
+
|
||||||
|
+ if(redactAuth.length() > 0) {
|
||||||
|
+ String[] auths = redactAuth.toString().split(",");
|
||||||
|
+ if(auths.length != 2) {
|
||||||
|
+ return salt;
|
||||||
|
+ }
|
||||||
|
+ return auths[1].trim();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return salt;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private static String getEncryptValue(char[] passwordValue, byte[] saltBytes) throws InvalidKeySpecException, NoSuchAlgorithmException {
|
||||||
|
+ StringBuilder digestStrBuilder = new StringBuilder();
|
||||||
|
+
|
||||||
|
+ KeySpec spec = new PBEKeySpec(passwordValue, saltBytes, HASH_ITERATIONS_COUNT, HASH_BIT_SIZE);
|
||||||
|
+ SecretKeyFactory secretKeyFactory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256");
|
||||||
|
+ SecretKey secretKey = secretKeyFactory.generateSecret(spec);
|
||||||
|
+ byte[] digestBytes = secretKey.getEncoded();
|
||||||
|
+ for (byte b : digestBytes) {
|
||||||
|
+ String hex = Integer.toHexString(0xff & b);
|
||||||
|
+ if (hex.length() == 1) {
|
||||||
|
+ digestStrBuilder.append('0');
|
||||||
|
+ }
|
||||||
|
+ digestStrBuilder.append(hex);
|
||||||
|
+ }
|
||||||
|
+ String digestStr = digestStrBuilder.toString();
|
||||||
|
+
|
||||||
|
+ return digestStr;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
private static void checkForUnsupportedOptions(String[] args) {
|
||||||
|
// Check arguments for -F, -m, and non-numeric value
|
||||||
|
// and warn the user that SA is not supported anymore
|
||||||
|
--
|
||||||
|
2.22.0
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ index 000000000..b717bafbe
|
|||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/version.txt
|
+++ b/version.txt
|
||||||
@@ -0,0 +1 @@
|
@@ -0,0 +1 @@
|
||||||
+17.0.13.0.13
|
+17.0.14.0.13
|
||||||
--
|
--
|
||||||
2.19.0
|
2.19.0
|
||||||
|
|
||||||
|
|||||||
@ -1,20 +1,20 @@
|
|||||||
From 2e5e3cc58933e166cba5a3f0e3c59d0ca3849196 Mon Sep 17 00:00:00 2001
|
From 9771982512066b47e42084ac61f714a6d8da5d6d Mon Sep 17 00:00:00 2001
|
||||||
Date: Thu, 24 Mar 2022 11:12:46 +0800
|
Date: Sat, 30 Nov 2024 17:25:24 +0800
|
||||||
Subject: [PATCH] downgrade the glibc symver of memcpy
|
Subject: downgrade the glibc symver of memcpy
|
||||||
|
|
||||||
---
|
---
|
||||||
make/common/NativeCompilation.gmk | 9 +++++++++
|
make/common/NativeCompilation.gmk | 9 +++++++++
|
||||||
make/hotspot/lib/CompileJvm.gmk | 8 ++++++++
|
make/hotspot/lib/CompileJvm.gmk | 15 ++++++++++++++
|
||||||
src/hotspot/share/runtime/memcpy.cpp | 20 ++++++++++++++++++++
|
src/hotspot/share/runtime/memcpy.cpp | 20 +++++++++++++++++++
|
||||||
.../linux/native/applauncher/LinuxPackage.c | 3 +++
|
.../linux/native/applauncher/LinuxPackage.c | 3 +++
|
||||||
4 files changed, 40 insertions(+)
|
4 files changed, 47 insertions(+)
|
||||||
create mode 100644 src/hotspot/share/runtime/memcpy.cpp
|
create mode 100644 src/hotspot/share/runtime/memcpy.cpp
|
||||||
|
|
||||||
diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk
|
diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk
|
||||||
index 1e2b170..4f22e2d 100644
|
index 215d90d17..01c47dbb0 100644
|
||||||
--- a/make/common/NativeCompilation.gmk
|
--- a/make/common/NativeCompilation.gmk
|
||||||
+++ b/make/common/NativeCompilation.gmk
|
+++ b/make/common/NativeCompilation.gmk
|
||||||
@@ -1102,6 +1102,15 @@ define SetupNativeCompilationBody
|
@@ -1133,6 +1133,15 @@ define SetupNativeCompilationBody
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -31,10 +31,24 @@ index 1e2b170..4f22e2d 100644
|
|||||||
$$($1_LIBS) $$($1_EXTRA_LIBS) $$($1_MT) \
|
$$($1_LIBS) $$($1_EXTRA_LIBS) $$($1_MT) \
|
||||||
$$($1_CREATE_DEBUGINFO_CMDS) $$($1_MANIFEST_VERSION) \
|
$$($1_CREATE_DEBUGINFO_CMDS) $$($1_MANIFEST_VERSION) \
|
||||||
diff --git a/make/hotspot/lib/CompileJvm.gmk b/make/hotspot/lib/CompileJvm.gmk
|
diff --git a/make/hotspot/lib/CompileJvm.gmk b/make/hotspot/lib/CompileJvm.gmk
|
||||||
index 65edd04..d5b689e 100644
|
index 230aa54f7..93af36d93 100644
|
||||||
--- a/make/hotspot/lib/CompileJvm.gmk
|
--- a/make/hotspot/lib/CompileJvm.gmk
|
||||||
+++ b/make/hotspot/lib/CompileJvm.gmk
|
+++ b/make/hotspot/lib/CompileJvm.gmk
|
||||||
@@ -167,6 +167,14 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJVM, \
|
@@ -83,6 +83,13 @@ DISABLED_WARNINGS_gcc := parentheses comment unknown-pragmas address \
|
||||||
|
empty-body strict-overflow sequence-point maybe-uninitialized \
|
||||||
|
misleading-indentation cast-function-type shift-negative-value
|
||||||
|
|
||||||
|
+ifeq ($(DEBUG_LEVEL), fastdebug)
|
||||||
|
+ ifeq ($(call And, $(call isTargetOs, linux) $(call isTargetCpu, aarch64)), true)
|
||||||
|
+ # False positive warnings for atomic_linux_aarch64.hpp on GCC >= 12
|
||||||
|
+ DISABLED_WARNINGS_gcc += stringop-overflow
|
||||||
|
+ endif
|
||||||
|
+endif
|
||||||
|
+
|
||||||
|
ifeq ($(call check-jvm-feature, zero), true)
|
||||||
|
DISABLED_WARNINGS_gcc += return-type switch clobbered
|
||||||
|
endif
|
||||||
|
@@ -169,6 +176,14 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJVM, \
|
||||||
PRECOMPILED_HEADER_EXCLUDE := $(JVM_PRECOMPILED_HEADER_EXCLUDE), \
|
PRECOMPILED_HEADER_EXCLUDE := $(JVM_PRECOMPILED_HEADER_EXCLUDE), \
|
||||||
))
|
))
|
||||||
|
|
||||||
@ -51,7 +65,7 @@ index 65edd04..d5b689e 100644
|
|||||||
# macros.
|
# macros.
|
||||||
diff --git a/src/hotspot/share/runtime/memcpy.cpp b/src/hotspot/share/runtime/memcpy.cpp
|
diff --git a/src/hotspot/share/runtime/memcpy.cpp b/src/hotspot/share/runtime/memcpy.cpp
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..6ab4ddb
|
index 000000000..6ab4ddb64
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/hotspot/share/runtime/memcpy.cpp
|
+++ b/src/hotspot/share/runtime/memcpy.cpp
|
||||||
@@ -0,0 +1,20 @@
|
@@ -0,0 +1,20 @@
|
||||||
@ -76,10 +90,10 @@ index 0000000..6ab4ddb
|
|||||||
+#endif
|
+#endif
|
||||||
+#endif
|
+#endif
|
||||||
diff --git a/src/jdk.jpackage/linux/native/applauncher/LinuxPackage.c b/src/jdk.jpackage/linux/native/applauncher/LinuxPackage.c
|
diff --git a/src/jdk.jpackage/linux/native/applauncher/LinuxPackage.c b/src/jdk.jpackage/linux/native/applauncher/LinuxPackage.c
|
||||||
index 5e3ef36..55a7e9c 100644
|
index 26d65f806..b7b114ac3 100644
|
||||||
--- a/src/jdk.jpackage/linux/native/applauncher/LinuxPackage.c
|
--- a/src/jdk.jpackage/linux/native/applauncher/LinuxPackage.c
|
||||||
+++ b/src/jdk.jpackage/linux/native/applauncher/LinuxPackage.c
|
+++ b/src/jdk.jpackage/linux/native/applauncher/LinuxPackage.c
|
||||||
@@ -33,6 +33,9 @@
|
@@ -34,6 +34,9 @@
|
||||||
#include "JvmLauncher.h"
|
#include "JvmLauncher.h"
|
||||||
#include "LinuxPackage.h"
|
#include "LinuxPackage.h"
|
||||||
|
|
||||||
@ -90,5 +104,5 @@ index 5e3ef36..55a7e9c 100644
|
|||||||
static char* getModulePath(void) {
|
static char* getModulePath(void) {
|
||||||
char modulePath[PATH_MAX] = { 0 };
|
char modulePath[PATH_MAX] = { 0 };
|
||||||
--
|
--
|
||||||
1.8.3.1
|
2.33.0
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@ -10630,7 +10630,7 @@ index 1e16c157f..9ed420d52 100644
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -53,7 +54,13 @@ public class KeyAgreementTest {
|
@@ -53,7 +54,13 @@ public class KeyAgreementTest {
|
||||||
String kpgAlgo = args[1];
|
String kpgAlgo = args[1];
|
||||||
String provider = args[2];
|
String provider = System.getProperty("test.provider.name", args[2]);
|
||||||
System.out.println("Testing " + kaAlgo);
|
System.out.println("Testing " + kaAlgo);
|
||||||
- AlgoSpec aSpec = AlgoSpec.valueOf(AlgoSpec.class, kaAlgo);
|
- AlgoSpec aSpec = AlgoSpec.valueOf(AlgoSpec.class, kaAlgo);
|
||||||
+ AlgoSpec aSpec;
|
+ AlgoSpec aSpec;
|
||||||
@ -10663,16 +10663,18 @@ diff --git a/test/jdk/java/security/Signature/SignatureGetInstance.java b/test/j
|
|||||||
index c246773f8..b69258cd9 100644
|
index c246773f8..b69258cd9 100644
|
||||||
--- a/test/jdk/java/security/Signature/SignatureGetInstance.java
|
--- a/test/jdk/java/security/Signature/SignatureGetInstance.java
|
||||||
+++ b/test/jdk/java/security/Signature/SignatureGetInstance.java
|
+++ b/test/jdk/java/security/Signature/SignatureGetInstance.java
|
||||||
@@ -49,8 +49,11 @@ public class SignatureGetInstance {
|
@@ -54,9 +54,13 @@ public class SignatureGetInstance {
|
||||||
MyPrivKey testPriv = new MyPrivKey();
|
MyPrivKey testPriv = new MyPrivKey();
|
||||||
MyPubKey testPub = new MyPubKey();
|
MyPubKey testPub = new MyPubKey();
|
||||||
|
|
||||||
+ Provider kaeProvider = Security.getProvider("KAEProvider");
|
+ Provider kaeProvider = Security.getProvider("KAEProvider");
|
||||||
+ String expectedProvName = kaeProvider != null ? "KAEProvider" : "SunRsaSign";
|
+ String expectedProvName = kaeProvider != null ? "KAEProvider" : "SunRsaSign";
|
||||||
|
+
|
||||||
+
|
+
|
||||||
testDblInit(testPriv, testPub, true, "TestProvider");
|
testDblInit(testPriv, testPub, true, "TestProvider");
|
||||||
- testDblInit(kp.getPrivate(), kp.getPublic(), true, "SunRsaSign");
|
testDblInit(kp.getPrivate(), kp.getPublic(), true,
|
||||||
+ testDblInit(kp.getPrivate(), kp.getPublic(), true, expectedProvName);
|
- System.getProperty("test.provider.name", "SunRsaSign"));
|
||||||
|
+ System.getProperty("test.provider.name", expectedProName));
|
||||||
testDblInit(testPriv, kp.getPublic(), false, null);
|
testDblInit(testPriv, kp.getPublic(), false, null);
|
||||||
testDblInit(kp.getPrivate(), testPub, false, null);
|
testDblInit(kp.getPrivate(), testPub, false, null);
|
||||||
|
|
||||||
@ -12833,7 +12835,7 @@ index 58bcbe911..bfc38df35 100644
|
|||||||
|
|
||||||
String expected;
|
String expected;
|
||||||
String value = args[1];
|
String value = args[1];
|
||||||
- expected = "SunJCE";
|
- expected = System.getProperty("test.provider.name", "SunJCE");
|
||||||
+
|
+
|
||||||
+ if (Security.getProperty("security.provider.1").equals("KAEProvider")) {
|
+ if (Security.getProperty("security.provider.1").equals("KAEProvider")) {
|
||||||
+ expected = "KAEProvider";
|
+ expected = "KAEProvider";
|
||||||
@ -12873,12 +12875,12 @@ diff --git a/test/jdk/sun/security/pkcs11/policy b/test/jdk/sun/security/pkcs11/
|
|||||||
index 54281a781..4d887e239 100644
|
index 54281a781..4d887e239 100644
|
||||||
--- a/test/jdk/sun/security/pkcs11/policy
|
--- a/test/jdk/sun/security/pkcs11/policy
|
||||||
+++ b/test/jdk/sun/security/pkcs11/policy
|
+++ b/test/jdk/sun/security/pkcs11/policy
|
||||||
@@ -1,3 +1,4 @@
|
@@ -1,4 +1,5 @@
|
||||||
grant {
|
grant {
|
||||||
permission java.lang.RuntimePermission "setSecurityManager";
|
permission java.lang.RuntimePermission "setSecurityManager";
|
||||||
|
permission java.util.PropertyPermission "test.provider.name", "read";
|
||||||
+ permission java.util.PropertyPermission "kae.disableKaeDispose", "read";
|
+ permission java.util.PropertyPermission "kae.disableKaeDispose", "read";
|
||||||
};
|
};
|
||||||
\ No newline at end of file
|
|
||||||
diff --git a/test/jdk/sun/security/ssl/CipherSuite/DisabledCurve.java b/test/jdk/sun/security/ssl/CipherSuite/DisabledCurve.java
|
diff --git a/test/jdk/sun/security/ssl/CipherSuite/DisabledCurve.java b/test/jdk/sun/security/ssl/CipherSuite/DisabledCurve.java
|
||||||
index 26304c5df..ca618ccfe 100644
|
index 26304c5df..ca618ccfe 100644
|
||||||
--- a/test/jdk/sun/security/ssl/CipherSuite/DisabledCurve.java
|
--- a/test/jdk/sun/security/ssl/CipherSuite/DisabledCurve.java
|
||||||
|
|||||||
234
openjdk-17.spec
234
openjdk-17.spec
@ -74,6 +74,7 @@
|
|||||||
%global aarch64 aarch64 arm64 armv8
|
%global aarch64 aarch64 arm64 armv8
|
||||||
%global jit_arches x86_64 %{aarch64} loongarch64 riscv64
|
%global jit_arches x86_64 %{aarch64} loongarch64 riscv64
|
||||||
%global aot_arches x86_64 %{aarch64}
|
%global aot_arches x86_64 %{aarch64}
|
||||||
|
%global linux_x64_aarch64 aarch64 x86_64
|
||||||
|
|
||||||
# Set of architectures for which java has short vector math library (libsvml.so)
|
# Set of architectures for which java has short vector math library (libsvml.so)
|
||||||
%global svml_arches x86_64
|
%global svml_arches x86_64
|
||||||
@ -161,7 +162,7 @@
|
|||||||
# Used via new version scheme. JDK 17 was
|
# Used via new version scheme. JDK 17 was
|
||||||
# GA'ed in March 2021 => 21.9
|
# GA'ed in March 2021 => 21.9
|
||||||
%global vendor_version_string 21.9
|
%global vendor_version_string 21.9
|
||||||
%global securityver 13
|
%global securityver 14
|
||||||
# buildjdkver is usually same as %%{majorver},
|
# buildjdkver is usually same as %%{majorver},
|
||||||
# but in time of bootstrap of next jdk, it is majorver-1,
|
# but in time of bootstrap of next jdk, it is majorver-1,
|
||||||
# and this it is better to change it here, on single place
|
# and this it is better to change it here, on single place
|
||||||
@ -187,7 +188,7 @@
|
|||||||
%global origin_nice OpenJDK
|
%global origin_nice OpenJDK
|
||||||
%global top_level_dir_name %{origin}
|
%global top_level_dir_name %{origin}
|
||||||
%global minorver 0
|
%global minorver 0
|
||||||
%global buildver 11
|
%global buildver 7
|
||||||
# priority must be 8 digits in total; up to openjdk 1.8, we were using 18..... so when we moved to 11, we had to add another digit
|
# priority must be 8 digits in total; up to openjdk 1.8, we were using 18..... so when we moved to 11, we had to add another digit
|
||||||
%if %is_system_jdk
|
%if %is_system_jdk
|
||||||
%global priority %( printf '%02d%02d%02d%02d' %{majorver} %{minorver} %{securityver} %{buildver} )
|
%global priority %( printf '%02d%02d%02d%02d' %{majorver} %{minorver} %{securityver} %{buildver} )
|
||||||
@ -565,6 +566,9 @@ exit 0
|
|||||||
%ifarch %{aarch64}
|
%ifarch %{aarch64}
|
||||||
%{_jvmdir}/%{sdkdir -- %{?1}}/lib/libj2kae.so
|
%{_jvmdir}/%{sdkdir -- %{?1}}/lib/libj2kae.so
|
||||||
%endif
|
%endif
|
||||||
|
%ifarch %{linux_x64_aarch64}
|
||||||
|
%{_jvmdir}/%{sdkdir -- %{?1}}/lib/libjbooster.so
|
||||||
|
%endif
|
||||||
%{_jvmdir}/%{sdkdir -- %{?1}}/lib/libsyslookup.so
|
%{_jvmdir}/%{sdkdir -- %{?1}}/lib/libsyslookup.so
|
||||||
%{_jvmdir}/%{sdkdir -- %{?1}}/lib/libverify.so
|
%{_jvmdir}/%{sdkdir -- %{?1}}/lib/libverify.so
|
||||||
%{_jvmdir}/%{sdkdir -- %{?1}}/lib/libzip.so
|
%{_jvmdir}/%{sdkdir -- %{?1}}/lib/libzip.so
|
||||||
@ -645,6 +649,10 @@ exit 0
|
|||||||
%{_jvmdir}/%{sdkdir -- %{?1}}/bin/jdeps
|
%{_jvmdir}/%{sdkdir -- %{?1}}/bin/jdeps
|
||||||
%{_jvmdir}/%{sdkdir -- %{?1}}/bin/jdeprscan
|
%{_jvmdir}/%{sdkdir -- %{?1}}/bin/jdeprscan
|
||||||
%{_jvmdir}/%{sdkdir -- %{?1}}/bin/jimage
|
%{_jvmdir}/%{sdkdir -- %{?1}}/bin/jimage
|
||||||
|
%ifarch %{linux_x64_aarch64}
|
||||||
|
%{_jvmdir}/%{sdkdir -- %{?1}}/bin/jaotc
|
||||||
|
%{_jvmdir}/%{sdkdir -- %{?1}}/bin/jbooster
|
||||||
|
%endif
|
||||||
%ifarch %{jit_arches}
|
%ifarch %{jit_arches}
|
||||||
%{_jvmdir}/%{sdkdir -- %{?1}}/bin/jhsdb
|
%{_jvmdir}/%{sdkdir -- %{?1}}/bin/jhsdb
|
||||||
%{_mandir}/man1/jhsdb-%{uniquesuffix -- %{?1}}.1.gz
|
%{_mandir}/man1/jhsdb-%{uniquesuffix -- %{?1}}.1.gz
|
||||||
@ -690,6 +698,9 @@ exit 0
|
|||||||
%{_mandir}/man1/jmod-%{uniquesuffix -- %{?1}}.1.gz
|
%{_mandir}/man1/jmod-%{uniquesuffix -- %{?1}}.1.gz
|
||||||
%{_mandir}/man1/jshell-%{uniquesuffix -- %{?1}}.1.gz
|
%{_mandir}/man1/jshell-%{uniquesuffix -- %{?1}}.1.gz
|
||||||
%{_mandir}/man1/jfr-%{uniquesuffix -- %{?1}}.1.gz
|
%{_mandir}/man1/jfr-%{uniquesuffix -- %{?1}}.1.gz
|
||||||
|
%ifarch %{linux_x64_aarch64}
|
||||||
|
%{_mandir}/man1/jaotc-%{uniquesuffix -- %{?1}}.1.gz
|
||||||
|
%endif
|
||||||
|
|
||||||
%if %{with_systemtap}
|
%if %{with_systemtap}
|
||||||
%dir %{tapsetroot}
|
%dir %{tapsetroot}
|
||||||
@ -903,7 +914,7 @@ Provides: java-src%{?1} = %{epoch}:%{version}-%{release}
|
|||||||
|
|
||||||
Name: java-%{javaver}-%{origin}
|
Name: java-%{javaver}-%{origin}
|
||||||
Version: %{newjavaver}.%{buildver}
|
Version: %{newjavaver}.%{buildver}
|
||||||
Release: 3
|
Release: 2
|
||||||
|
|
||||||
# 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
|
||||||
@ -1040,6 +1051,16 @@ Patch66: Backport-of-8337712-Wrong-javadoc-in-java.util.Date-.patch
|
|||||||
#17.0.13
|
#17.0.13
|
||||||
Patch67: Huawei-Fix-JBooster-file-issue-caused-by-os-write-change.patch
|
Patch67: Huawei-Fix-JBooster-file-issue-caused-by-os-write-change.patch
|
||||||
Patch68: downgrade-fcntl64-to-fcntl-on-linux.patch
|
Patch68: downgrade-fcntl64-to-fcntl-on-linux.patch
|
||||||
|
Patch69: Add-jbolt-feature.patch
|
||||||
|
Patch70: Enable-TLS-to-communciation-between-JBooster-Server-.patch
|
||||||
|
Patch71: SA-redact-support-password.patch
|
||||||
|
Patch72: Add-specialized-hashmap-version-of-the-long-type.patch
|
||||||
|
Patch73: Implement-JBooster-RPC-byte-alignment.patch
|
||||||
|
Patch74: Optimize-LazyAOT-klasses-sending-strategy.patch
|
||||||
|
Patch75: Add-KAE-zip-GzipKAEBenchmark-Benchmark.patch
|
||||||
|
Patch76: Add-Fix-clear-mark-for-NativeGotJump.patch
|
||||||
|
Patch77: 8323066-TestSkipRebuildRemsetPhase.java-fails-with-S.patch
|
||||||
|
Patch78: Fix-a-concurrent-issue-of-program-data-ref-cnt.patch
|
||||||
############################################
|
############################################
|
||||||
#
|
#
|
||||||
# LoongArch64 specific patches
|
# LoongArch64 specific patches
|
||||||
@ -1268,69 +1289,117 @@ fi
|
|||||||
|
|
||||||
# OpenJDK patches
|
# OpenJDK patches
|
||||||
|
|
||||||
%ifnarch loongarch64
|
%ifnarch loongarch64 riscv64
|
||||||
pushd %{top_level_dir_name}
|
pushd %{top_level_dir_name}
|
||||||
%patch1 -p1
|
%patch 1 -p1
|
||||||
%patch3 -p1
|
%patch 3 -p1
|
||||||
%patch6 -p1
|
%patch 6 -p1
|
||||||
%patch7 -p1
|
%patch 7 -p1
|
||||||
%patch8 -p1
|
%patch 8 -p1
|
||||||
%patch9 -p1
|
%patch 9 -p1
|
||||||
%patch10 -p1
|
%patch 10 -p1
|
||||||
%patch11 -p1
|
%patch 11 -p1
|
||||||
%patch12 -p1
|
%patch 12 -p1
|
||||||
%patch13 -p1
|
%patch 13 -p1
|
||||||
%patch14 -p1
|
%patch 14 -p1
|
||||||
%patch16 -p1
|
%patch 16 -p1
|
||||||
%patch18 -p1
|
%patch 18 -p1
|
||||||
%patch19 -p1
|
%patch 19 -p1
|
||||||
%patch22 -p1
|
%patch 22 -p1
|
||||||
%patch23 -p1
|
%patch 23 -p1
|
||||||
%patch26 -p1
|
%patch 26 -p1
|
||||||
%patch28 -p1
|
%patch 28 -p1
|
||||||
%patch29 -p1
|
%patch 29 -p1
|
||||||
%patch30 -p1
|
%patch 30 -p1
|
||||||
%patch31 -p1
|
%patch 31 -p1
|
||||||
%patch32 -p1
|
%patch 32 -p1
|
||||||
%patch36 -p1
|
%patch 36 -p1
|
||||||
%patch41 -p1
|
%patch 41 -p1
|
||||||
%patch42 -p1
|
%patch 42 -p1
|
||||||
%patch43 -p1
|
%patch 43 -p1
|
||||||
%ifnarch riscv64
|
%patch 44 -p1
|
||||||
%patch44 -p1
|
%patch 45 -p1
|
||||||
%patch45 -p1
|
%patch 46 -p1
|
||||||
%patch46 -p1
|
%patch 47 -p1
|
||||||
%patch47 -p1
|
%patch 48 -p1
|
||||||
%patch48 -p1
|
%patch 49 -p1
|
||||||
%patch49 -p1
|
%patch 50 -p1
|
||||||
%patch50 -p1
|
%patch 51 -p1
|
||||||
%patch51 -p1
|
%patch 52 -p1
|
||||||
%patch52 -p1
|
%patch 53 -p1
|
||||||
%patch53 -p1
|
%patch 54 -p1
|
||||||
%patch54 -p1
|
%patch 55 -p1
|
||||||
%patch55 -p1
|
%patch 56 -p1
|
||||||
%patch56 -p1
|
%patch 57 -p1
|
||||||
%endif
|
%patch 58 -p1
|
||||||
%patch57 -p1
|
%patch 59 -p1
|
||||||
%patch58 -p1
|
%patch 60 -p1
|
||||||
%patch59 -p1
|
%patch 61 -p1
|
||||||
%patch60 -p1
|
%patch 62 -p1
|
||||||
%patch61 -p1
|
%patch 63 -p1
|
||||||
%patch62 -p1
|
%patch 64 -p1
|
||||||
%patch63 -p1
|
%patch 65 -p1
|
||||||
%patch64 -p1
|
%patch 66 -p1
|
||||||
%patch65 -p1
|
%patch 67 -p1
|
||||||
%patch66 -p1
|
%patch 68 -p1
|
||||||
%ifnarch riscv64
|
%patch 69 -p1
|
||||||
%patch67 -p1
|
%patch 70 -p1
|
||||||
%endif
|
%patch 71 -p1
|
||||||
%patch68 -p1
|
%patch 72 -p1
|
||||||
|
%patch 73 -p1
|
||||||
|
%patch 74 -p1
|
||||||
|
%patch 75 -p1
|
||||||
|
%patch 76 -p1
|
||||||
|
%patch 77 -p1
|
||||||
|
%patch 78 -p1
|
||||||
popd # openjdk
|
popd # openjdk
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
%ifarch riscv64
|
||||||
|
pushd %{top_level_dir_name}
|
||||||
|
%patch 1 -p1
|
||||||
|
%patch 3 -p1
|
||||||
|
%patch 6 -p1
|
||||||
|
%patch 7 -p1
|
||||||
|
%patch 8 -p1
|
||||||
|
%patch 9 -p1
|
||||||
|
%patch 10 -p1
|
||||||
|
%patch 11 -p1
|
||||||
|
%patch 12 -p1
|
||||||
|
%patch 13 -p1
|
||||||
|
%patch 14 -p1
|
||||||
|
%patch 16 -p1
|
||||||
|
%patch 18 -p1
|
||||||
|
%patch 19 -p1
|
||||||
|
%patch 22 -p1
|
||||||
|
%patch 23 -p1
|
||||||
|
%patch 26 -p1
|
||||||
|
%patch 28 -p1
|
||||||
|
%patch 29 -p1
|
||||||
|
%patch 30 -p1
|
||||||
|
%patch 31 -p1
|
||||||
|
%patch 32 -p1
|
||||||
|
%patch 36 -p1
|
||||||
|
%patch 41 -p1
|
||||||
|
%patch 42 -p1
|
||||||
|
%patch 43 -p1
|
||||||
|
%patch 57 -p1
|
||||||
|
%patch 58 -p1
|
||||||
|
%patch 59 -p1
|
||||||
|
%patch 60 -p1
|
||||||
|
%patch 61 -p1
|
||||||
|
%patch 62 -p1
|
||||||
|
%patch 63 -p1
|
||||||
|
%patch 64 -p1
|
||||||
|
%patch 65 -p1
|
||||||
|
%patch 66 -p1
|
||||||
|
%patch 68 -p1
|
||||||
|
popd
|
||||||
|
%endif
|
||||||
|
|
||||||
%ifarch loongarch64
|
%ifarch loongarch64
|
||||||
pushd %{top_level_dir_name}
|
pushd %{top_level_dir_name}
|
||||||
%patch2000 -p1
|
%patch 2000 -p1
|
||||||
popd
|
popd
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
@ -1464,6 +1533,9 @@ bash ../configure \
|
|||||||
--with-debug-level=$debugbuild \
|
--with-debug-level=$debugbuild \
|
||||||
--with-native-debug-symbols=internal \
|
--with-native-debug-symbols=internal \
|
||||||
--enable-unlimited-crypto \
|
--enable-unlimited-crypto \
|
||||||
|
%ifarch %{linux_x64_aarch64}
|
||||||
|
--enable-jvm-feature-jbooster \
|
||||||
|
%endif
|
||||||
--with-zlib=system \
|
--with-zlib=system \
|
||||||
--with-libjpeg=system \
|
--with-libjpeg=system \
|
||||||
--with-giflib=system \
|
--with-giflib=system \
|
||||||
@ -1891,6 +1963,48 @@ cjc.mainProgram(args) -- the returns from copy_jdk_configs.lua should not affect
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Feb 21 2025 songliyang <songliyang@kylinos.cn> - 1:17.0.14.7-2
|
||||||
|
- fix LoongArch64 support patch apply error
|
||||||
|
|
||||||
|
* Tue Feb 11 2025 Pan Xuefeng <panxuefeng@loongson.cn> - 1:17.0.14.7-1
|
||||||
|
- upgrade LoongArch64 port to 17.0.14
|
||||||
|
|
||||||
|
* Thu Jan 23 2025 Benshuai5D <benshuai5d@huawei> - 1:17.0.14.7-0
|
||||||
|
- update to 17.0.14
|
||||||
|
- modify 8264805-Backport-Ahead-of-Time-Compiler.patch
|
||||||
|
- modify 8280872-Reorder-code-cache-segments-to-improv.patch
|
||||||
|
- modify 8323066-TestSkipRebuildRemsetPhase.java-fails-with-S.patch
|
||||||
|
- modify Backport-Important-Fixed-Issues.patch
|
||||||
|
- modify add-version-txt.patch
|
||||||
|
- modify jdk17-Add-KAE-provider.patch
|
||||||
|
|
||||||
|
* Thu Dec 12 2024 kuenking111 <wangkun49@huawei.com> - 1:17.0.13.11-8
|
||||||
|
- add Fix-a-concurrent-issue-of-program-data-ref-cnt.patch
|
||||||
|
|
||||||
|
* Fri Dec 6 2024 kuenking111 <wangkun49@huawei.com> - 1:17.0.13.11-7
|
||||||
|
- modify Add-jbolt-feature.patch
|
||||||
|
- modify Add-specialized-hashmap-version-of-the-long-type.patch
|
||||||
|
- modify Enable-TLS-to-communciation-between-JBooster-Server-.patch
|
||||||
|
|
||||||
|
* Wed Dec 4 2024 Dingli Zhang <dingli@iscas.ac.cn> - 1:17.0.13.11-6
|
||||||
|
- Split patches for riscv64
|
||||||
|
- Increase the architecture isolation of jaotc
|
||||||
|
|
||||||
|
* Tue Dec 03 2024 shenzhongwei <shenzhongwei@kylinos.cn> - 1:17.0.13.11-5
|
||||||
|
- fix: %patchN is deprecated (51 usages found), use %patch N (or %patch -P N)
|
||||||
|
|
||||||
|
* Fri Nov 29 2024 kuenking111 <wangkun49@huawei.com> - 1:17.0.13.11-4
|
||||||
|
- add Add-jbolt-feature.patch
|
||||||
|
- add Enable-TLS-to-communciation-between-JBooster-Server-.patch
|
||||||
|
- add SA-redact-support-password.patch
|
||||||
|
- add Add-specialized-hashmap-version-of-the-long-type.patch
|
||||||
|
- add Implement-JBooster-RPC-byte-alignment.patch
|
||||||
|
- add Optimize-LazyAOT-klasses-sending-strategy.patch
|
||||||
|
- add Add-KAE-zip-GzipKAEBenchmark-Benchmark.patch
|
||||||
|
- add Add-Fix-clear-mark-for-NativeGotJump.patch
|
||||||
|
- add 8323066-TestSkipRebuildRemsetPhase.java-fails-with-S.patch
|
||||||
|
- modify downgrade-the-glibc-symver-of-memcpy.patch
|
||||||
|
|
||||||
* Tue Nov 12 2024 Dingli Zhang <dingli@iscas.ac.cn> - 1:17.0.13.11-3
|
* Tue Nov 12 2024 Dingli Zhang <dingli@iscas.ac.cn> - 1:17.0.13.11-3
|
||||||
- Fix build error for riscv64
|
- Fix build error for riscv64
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user