IB9HZP: Fix crash caused by incidental JFR concurrency

This commit is contained in:
佛系少年中二 2024-12-06 12:21:02 +08:00
parent f917b0e4e6
commit 4afee5c244
4 changed files with 134 additions and 63 deletions

View File

@ -1,5 +1,4 @@
From cc339c9652296e561b5ae4b09651b96aa17e4855 Mon Sep 17 00:00:00 2001
Date: Sat, 30 Nov 2024 15:02:14 +0800
From e0b3171f6f3e09acacd493c66aa18f61a65ec18a Mon Sep 17 00:00:00 2001
Subject: Add jbolt feature
---
@ -16,12 +15,12 @@ Subject: Add jbolt feature
src/hotspot/share/compiler/compileTask.hpp | 14 +-
src/hotspot/share/jbolt/jBoltCallGraph.cpp | 476 ++++++
src/hotspot/share/jbolt/jBoltCallGraph.hpp | 277 ++++
.../share/jbolt/jBoltControlThread.cpp | 219 +++
.../share/jbolt/jBoltControlThread.cpp | 220 +++
.../share/jbolt/jBoltControlThread.hpp | 69 +
src/hotspot/share/jbolt/jBoltDcmds.cpp | 221 +++
src/hotspot/share/jbolt/jBoltDcmds.hpp | 129 ++
src/hotspot/share/jbolt/jBoltManager.cpp | 1387 +++++++++++++++++
src/hotspot/share/jbolt/jBoltManager.hpp | 323 ++++
src/hotspot/share/jbolt/jBoltManager.cpp | 1411 +++++++++++++++++
src/hotspot/share/jbolt/jBoltManager.hpp | 329 ++++
src/hotspot/share/jbolt/jBoltUtils.cpp | 38 +
src/hotspot/share/jbolt/jBoltUtils.hpp | 55 +
src/hotspot/share/jbolt/jBoltUtils.inline.hpp | 38 +
@ -51,7 +50,7 @@ Subject: Add jbolt feature
.../jtreg/compiler/codecache/jbolt/o4.log | 12 +
.../runtime/cds/appcds/ClassLoaderTest.java | 2 +-
test/lib/jdk/test/whitebox/code/BlobType.java | 24 +-
48 files changed, 4317 insertions(+), 39 deletions(-)
48 files changed, 4348 insertions(+), 39 deletions(-)
create mode 100644 src/hotspot/share/jbolt/jBoltCallGraph.cpp
create mode 100644 src/hotspot/share/jbolt/jBoltCallGraph.hpp
create mode 100644 src/hotspot/share/jbolt/jBoltControlThread.cpp
@ -521,7 +520,7 @@ index 03beb350b..53dccf232 100644
#endif // SHARE_COMPILER_COMPILETASK_HPP
diff --git a/src/hotspot/share/jbolt/jBoltCallGraph.cpp b/src/hotspot/share/jbolt/jBoltCallGraph.cpp
new file mode 100644
index 000000000..47e11a5e7
index 000000000..84a35e85e
--- /dev/null
+++ b/src/hotspot/share/jbolt/jBoltCallGraph.cpp
@@ -0,0 +1,476 @@
@ -714,13 +713,13 @@ index 000000000..47e11a5e7
+}
+
+void JBoltCallGraph::add_func(JBoltFunc* func) {
+ if (!(UseJBolt && JBoltManager::reorder_phase_is_profiling())) return;
+ if (!(UseJBolt && JBoltManager::reorder_phase_is_profiling_or_waiting())) return;
+ JBoltCluster* cluster = find_cluster(func);
+ assert(cluster != NULL, "invariant");
+}
+
+void JBoltCallGraph::add_call(JBoltCall* call) {
+ if (!(UseJBolt && JBoltManager::reorder_phase_is_profiling())) return;
+ if (!(UseJBolt && JBoltManager::reorder_phase_is_profiling_or_waiting())) return;
+ add_call_to_calls(_calls, call);
+}
+
@ -1287,10 +1286,10 @@ index 000000000..95a1ffeba
+#endif // SHARE_JBOLT_JBOLTCALLGRAPH_HPP
diff --git a/src/hotspot/share/jbolt/jBoltControlThread.cpp b/src/hotspot/share/jbolt/jBoltControlThread.cpp
new file mode 100644
index 000000000..e9402b86b
index 000000000..52c94f088
--- /dev/null
+++ b/src/hotspot/share/jbolt/jBoltControlThread.cpp
@@ -0,0 +1,219 @@
@@ -0,0 +1,220 @@
+/*
+ * Copyright (c) 2020, 2024, Huawei Technologies Co., Ltd. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@ -1409,6 +1408,7 @@ index 000000000..e9402b86b
+ }
+ }
+ // Close JFR
+ guarantee(JBoltManager::reorder_phase_profiling_to_waiting(), "sanity");
+ bufferedStream output;
+ DCmd::parse_and_execute(DCmd_Source_Internal, &output, "JFR.stop name=jbolt-jfr", ' ', THREAD);
+ if (HAS_PENDING_EXCEPTION) {
@ -1438,7 +1438,7 @@ index 000000000..e9402b86b
+ JBoltManager::swap_semi_jbolt_segs();
+ }
+
+ guarantee(JBoltManager::reorder_phase_profiling_to_reordering(), "sanity");
+ guarantee(JBoltManager::reorder_phase_waiting_to_reordering(), "sanity");
+ Atomic::release_store(&_signal, SIG_NULL);
+
+ // Start reorder
@ -1453,14 +1453,13 @@ index 000000000..e9402b86b
+void JBoltControlThread::thread_run(TRAPS) {
+ if (JBoltManager::auto_mode()) {
+ do {
+ guarantee(JBoltManager::reorder_phase_available_to_profiling(), "sanity");
+ Atomic::release_store(&_signal, SIG_NULL);
+ if (not_first && !prev_control_schdule(THREAD)) continue;
+ guarantee(JBoltManager::reorder_phase_available_to_profiling(), "sanity");
+ control_schdule(THREAD);
+ JBoltManager::clear_structures();
+ if (!JBoltManager::reorder_phase_reordering_to_available()) {
+ // abort logic
+ guarantee(JBoltManager::reorder_phase_profiling_to_available(), "sanity");
+ guarantee(JBoltManager::reorder_phase_waiting_to_available(), "sanity");
+ guarantee(Atomic::cmpxchg(&_signal, SIG_STOP_PROFILING, SIG_NULL) == SIG_STOP_PROFILING, "sanity");
+ }
+ else if (not_first) {
@ -1471,6 +1470,7 @@ index 000000000..e9402b86b
+ while (Atomic::load_acquire(&_signal) != SIG_START_PROFILING) {
+ locker.wait(60 * 1000);
+ }
+ JBoltManager::clear_structures();
+ } while(true);
+ } else {
+ guarantee(JBoltManager::can_reorder_now(), "sanity");
@ -1951,10 +1951,10 @@ index 000000000..f73fc01e6
\ No newline at end of file
diff --git a/src/hotspot/share/jbolt/jBoltManager.cpp b/src/hotspot/share/jbolt/jBoltManager.cpp
new file mode 100644
index 000000000..abead8167
index 000000000..be1acd6cc
--- /dev/null
+++ b/src/hotspot/share/jbolt/jBoltManager.cpp
@@ -0,0 +1,1387 @@
@@ -0,0 +1,1411 @@
+/*
+ * Copyright (c) 2020, 2024, Huawei Technologies Co., Ltd. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@ -2338,7 +2338,7 @@ index 000000000..abead8167
+ * we update the CG by invoke construct_stacktrace().
+ */
+void JBoltManager::construct_cg_once() {
+ guarantee((UseJBolt && JBoltManager::reorder_phase_is_profiling()), "sanity");
+ guarantee((UseJBolt && JBoltManager::reorder_phase_is_profiling_or_waiting()), "sanity");
+
+ GrowableArray<JfrStackTrace*>* traces = create_growable_array<JfrStackTrace*>();
+
@ -2409,6 +2409,7 @@ index 000000000..abead8167
+ */
+void JBoltManager::dump_order_in_manual() {
+ guarantee((UseJBolt && JBoltDumpMode), "sanity");
+ guarantee(reorder_phase_profiling_to_waiting(), "sanity");
+ NoSafepointVerifier nsv;
+ ResourceMark rm;
+ GrowableArray<JBoltFunc>* order = JBoltCallGraph::callgraph_instance().hfsort();
@ -2906,10 +2907,28 @@ index 000000000..abead8167
+ return Atomic::cmpxchg(&_reorder_phase, JBoltReorderPhase::Profiling, JBoltReorderPhase::Available) == JBoltReorderPhase::Profiling;
+}
+
+bool JBoltManager::reorder_phase_profiling_to_waiting() {
+ return Atomic::cmpxchg(&_reorder_phase, JBoltReorderPhase::Profiling, JBoltReorderPhase::Waiting) == JBoltReorderPhase::Profiling;
+}
+
+bool JBoltManager::reorder_phase_waiting_to_reordering() {
+ assert(auto_mode(), "one-phase only");
+ return Atomic::cmpxchg(&_reorder_phase, JBoltReorderPhase::Waiting, JBoltReorderPhase::Reordering) == JBoltReorderPhase::Waiting;
+}
+
+bool JBoltManager::reorder_phase_waiting_to_available() {
+ assert(auto_mode(), "one-phase only");
+ return Atomic::cmpxchg(&_reorder_phase, JBoltReorderPhase::Waiting, JBoltReorderPhase::Available) == JBoltReorderPhase::Waiting;
+}
+
+bool JBoltManager::reorder_phase_reordering_to_end() {
+ return Atomic::cmpxchg(&_reorder_phase, JBoltReorderPhase::Reordering, JBoltReorderPhase::End) == JBoltReorderPhase::Reordering;
+}
+
+bool JBoltManager::reorder_phase_is_waiting() {
+ return Atomic::load_acquire(&_reorder_phase) == JBoltReorderPhase::Waiting;
+}
+
+bool JBoltManager::reorder_phase_is_available() {
+ bool res = (Atomic::load_acquire(&_reorder_phase) == JBoltReorderPhase::Available);
+ assert(!res || auto_mode(), "one-phase only");
@ -2938,6 +2957,11 @@ index 000000000..abead8167
+ return p == JBoltReorderPhase::Collecting || p == JBoltReorderPhase::Reordering;
+}
+
+bool JBoltManager::reorder_phase_is_profiling_or_waiting() {
+ int p = Atomic::load_acquire(&_reorder_phase);
+ return p == JBoltReorderPhase::Profiling || p == JBoltReorderPhase::Waiting;
+}
+
+Method* JBoltManager::cur_reordering_method() {
+ return Atomic::load_acquire(&_cur_reordering_method);
+}
@ -3001,7 +3025,7 @@ index 000000000..abead8167
+ * Swap primary hot segment with secondary hot segment
+ */
+void JBoltManager::swap_semi_jbolt_segs() {
+ guarantee(reorder_phase_is_profiling(), "swap must happen in reorder phase Profiling.");
+ guarantee(reorder_phase_is_waiting(), "swap must happen in reorder phase Profiling.");
+ int tmp = Atomic::xchg(&_secondary_hot_seg, Atomic::load_acquire(&_primary_hot_seg));
+ Atomic::xchg(&_primary_hot_seg, tmp);
+}
@ -3345,10 +3369,10 @@ index 000000000..abead8167
\ No newline at end of file
diff --git a/src/hotspot/share/jbolt/jBoltManager.hpp b/src/hotspot/share/jbolt/jBoltManager.hpp
new file mode 100644
index 000000000..1718075c4
index 000000000..2b8599d7f
--- /dev/null
+++ b/src/hotspot/share/jbolt/jBoltManager.hpp
@@ -0,0 +1,323 @@
@@ -0,0 +1,329 @@
+/*
+ * Copyright (c) 2020, 2024, Huawei Technologies Co., Ltd. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@ -3398,6 +3422,7 @@ index 000000000..1718075c4
+};
+
+struct JBoltReorderPhase {
+ static const int Waiting = -1; // JBolt logic is waiting for something to be done.
+ static const int Available = 0; // JBolt logic is not working or is done (can be reordered again now).
+ static const int Collecting = 1; // Collecting methods in the order file (this phase is for two-phase only).
+ static const int Profiling = 2; // JFR is working (this phase is for one-phase only).
@ -3626,6 +3651,9 @@ index 000000000..1718075c4
+ static bool reorder_phase_profiling_to_reordering();
+ static bool reorder_phase_reordering_to_available();
+ static bool reorder_phase_profiling_to_available();
+ static bool reorder_phase_profiling_to_waiting();
+ static bool reorder_phase_waiting_to_reordering();
+ static bool reorder_phase_waiting_to_available();
+
+ static bool reorder_phase_reordering_to_end();
+
@ -3653,10 +3681,12 @@ index 000000000..1718075c4
+
+ static bool auto_mode() { return _auto_mode; }
+
+ static bool reorder_phase_is_waiting();
+ static bool reorder_phase_is_available();
+ static bool reorder_phase_is_collecting();
+ static bool reorder_phase_is_profiling();
+ static bool reorder_phase_is_reordering();
+ static bool reorder_phase_is_profiling_or_waiting();
+ static bool reorder_phase_is_collecting_or_reordering();
+
+ static bool can_reorder_now();
@ -4046,7 +4076,7 @@ index c3aabca40..53a82cc58 100644
#endif // SHARE_JFR_RECORDER_STACKTRACE_JFRSTACKTRACE_HPP
diff --git a/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp b/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp
index 1e940ef6f..93fce8bab 100644
index 1e940ef6f..1edd81e0e 100644
--- a/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp
+++ b/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp
@@ -29,6 +29,9 @@
@ -4081,7 +4111,7 @@ index 1e940ef6f..93fce8bab 100644
size_t JfrStackTraceRepository::write(JfrChunkWriter& sw, bool clear) {
+#if INCLUDE_JBOLT
+ if (clear && (UseJBolt && JBoltManager::reorder_phase_is_profiling())) {
+ if (clear && (UseJBolt && JBoltManager::reorder_phase_is_profiling_or_waiting())) {
+ JBoltManager::construct_cg_once();
+ }
+#endif

View File

@ -1,5 +1,4 @@
From abd1e549e0849d6688dcb42e93fa808c528c3070 Mon Sep 17 00:00:00 2001
Date: Fri, 29 Nov 2024 15:37:57 +0800
From b22f9684326910c85512a3f8a828aeae342025c7 Mon Sep 17 00:00:00 2001
Subject: Add specialized hashmap version of the long type
---
@ -16,9 +15,9 @@ Subject: Add specialized hashmap version of the long type
src/hotspot/share/runtime/java.cpp | 6 +
src/hotspot/share/runtime/java.hpp | 2 +
src/hotspot/share/runtime/vm_version.cpp | 8 +
test/jdk/java/util/HashMap/HashMap.java | 3799 +++++++++++++++++
test/jdk/java/util/HashMap/HashMap.java | 3798 +++++++++++++++++
test/jdk/java/util/HashMap/LinkedHashMap.java | 798 ++++
15 files changed, 4700 insertions(+), 6 deletions(-)
15 files changed, 4699 insertions(+), 6 deletions(-)
create mode 100644 test/jdk/java/util/HashMap/HashMap.java
create mode 100644 test/jdk/java/util/HashMap/LinkedHashMap.java
@ -305,10 +304,10 @@ index 33a5c792c..1e6756aaa 100644
ResourceMark rm;
diff --git a/test/jdk/java/util/HashMap/HashMap.java b/test/jdk/java/util/HashMap/HashMap.java
new file mode 100644
index 000000000..8d7db3569
index 000000000..4880c2e8f
--- /dev/null
+++ b/test/jdk/java/util/HashMap/HashMap.java
@@ -0,0 +1,3799 @@
@@ -0,0 +1,3798 @@
+/*
+ * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@ -750,7 +749,7 @@ index 000000000..8d7db3569
+ /**
+ * The keys in prim long hashmap.
+ */
+ transient long[] primMapKeys;
+ transient Long[] primMapKeys;
+
+ /**
+ * The values in prim long hashmap.
@ -1366,7 +1365,7 @@ index 000000000..8d7db3569
+ }
+ if (remaining > 0) {
+ boolean[] valids = primMapValids;
+ long[] keys = primMapKeys;
+ Long[] keys = primMapKeys;
+ int length = valids.length;
+ for (int i = 0; remaining > 0 && i < length; ++i) {
+ if (valids[i]) {
@ -1478,7 +1477,7 @@ index 000000000..8d7db3569
+ }
+ if (remaining > 0) {
+ boolean[] valids = primMapValids;
+ long[] keys = primMapKeys;
+ Long[] keys = primMapKeys;
+ int length = valids.length;
+ for (int i = 0; remaining > 0 && i < length; ++i) {
+ if (valids[i]) {
@ -2033,7 +2032,7 @@ index 000000000..8d7db3569
+ }
+ if (remaining > 0) {
+ boolean[] valids = primMapValids;
+ long[] keys = primMapKeys;
+ Long[] keys = primMapKeys;
+ V[] values = primMapValues;
+ int length = valids.length;
+ for (int i = 0; remaining > 0 && i < length; ++i) {
@ -2072,7 +2071,7 @@ index 000000000..8d7db3569
+ }
+ if (remaining > 0) {
+ boolean[] valids = primMapValids;
+ long[] keys = primMapKeys;
+ Long[] keys = primMapKeys;
+ V[] values = primMapValues;
+ int length = valids.length;
+ for (int i = 0; remaining > 0 && i < length; ++i) {
@ -2625,7 +2624,7 @@ index 000000000..8d7db3569
+ }
+ if (remaining > 0) {
+ boolean[] valids = primMapValids;
+ long[] keys = primMapKeys;
+ Long[] keys = primMapKeys;
+ V[] values = primMapValues;
+ int length = valids.length;
+ for (int i = 0; remaining > 0 && i < length; ++i) {
@ -3256,8 +3255,8 @@ index 000000000..8d7db3569
+ // Primitive long HashMap support
+
+ @SuppressWarnings("unchecked")
+ private K castKeyToGenericType(long key) {
+ return (K)(Long)(key);
+ private K castKeyToGenericType(Long key) {
+ return (K)(key);
+ }
+
+ private void initUsingPrimHashMap() {
@ -3316,7 +3315,7 @@ index 000000000..8d7db3569
+ }
+ final boolean[] valids = primMapValids;
+ if (valids != null) {
+ final long[] keys = primMapKeys;
+ final Long[] keys = primMapKeys;
+ final V[] values = primMapValues;
+ int Cap = valids.length;
+ for (int i = 0; remaining > 0 && i < Cap; ++i) {
@ -3353,20 +3352,20 @@ index 000000000..8d7db3569
+ }
+
+ final boolean[] newValids = new boolean[newCap];
+ final long[] newKeys = new long[newCap];
+ final Long[] newKeys = new Long[newCap];
+ @SuppressWarnings({"rawtypes","unchecked"})
+ final V[] newValues = (V[])new Object[newCap];
+
+ final int mask = newCap - 1;
+ if (oldValids != null) {
+ final long[] oldKeys = primMapKeys;
+ final Long[] oldKeys = primMapKeys;
+ final V[] oldValues = primMapValues;
+ int remaining = primMapNullKeyValid ? size - 1 : size;
+ for (int i = 0; remaining > 0 && i < oldCap; ++i) {
+ if (oldValids[i]) {
+ long key = oldKeys[i];
+ V value = oldValues[i];
+ int index = primHashMapCalculateIndex((Long)key, mask);
+ int index = primHashMapCalculateIndex(key, mask);
+ while (newValids[index]) {
+ index = (++index) & mask;
+ }
@ -3407,16 +3406,16 @@ index 000000000..8d7db3569
+ if (primMapValids == null || primMapValids.length == 0) {
+ primHashMapResize();
+ }
+ long primKey = key;
+
+ final boolean[] valids = primMapValids;
+ final long[] keys = primMapKeys;
+ final Long[] keys = primMapKeys;
+ final V[] values = primMapValues;
+ int remainingLength = valids.length;
+ final int mask = remainingLength - 1;
+ int index = primHashMapCalculateIndex(key, mask);
+ // find empty slots to insert
+ while (valids[index] && remainingLength > 0) {
+ if (keys[index] == primKey) {
+ if (Objects.equals(keys[index], key)) {
+ break;
+ }
+ index = (++index) & mask;
@ -3429,7 +3428,7 @@ index 000000000..8d7db3569
+ }
+ return oldValue;
+ }
+ keys[index] = primKey;
+ keys[index] = key;
+ values[index] = value;
+ valids[index] = true;
+ ++modCount;
@ -3458,13 +3457,12 @@ index 000000000..8d7db3569
+ return KEY_NO_EXIST_FOR_PRIM_MAP;
+ }
+
+ final long[] keys = primMapKeys;
+ final Long[] keys = primMapKeys;
+ int remainingLength = valids.length;
+ final int mask = remainingLength - 1;
+ long primKey = (Long)key;
+ int index = primHashMapCalculateIndex(key, mask);
+ while (valids[index] && remainingLength > 0) {
+ if (keys[index] == primKey) {
+ if (Objects.equals(keys[index], key)) {
+ return index;
+ }
+ index = (++index) & mask;
@ -3530,13 +3528,13 @@ index 000000000..8d7db3569
+ oldValue = primMapValues[removeIdx];
+ final boolean[] valids = primMapValids;
+ final V[] values = primMapValues;
+ final long[] keys = primMapKeys;
+ final Long[] keys = primMapKeys;
+ int mask = valids.length - 1;
+ // Moves the slot, whose expected idx and its actual index overwrite the removed slot, to the removed slot.
+ // Do it recursively until reaching an empty slot(there is always an empty slot since load factor <= 0.8f)
+ int actualIdx = (removeIdx + 1) & mask;
+ while (valids[actualIdx]) {
+ int expectedIdx = primHashMapCalculateIndex((Long)(keys[actualIdx]), mask);
+ int expectedIdx = primHashMapCalculateIndex(keys[actualIdx], mask);
+ // move actual to remove, then set actual as new remove
+ // | expectedIdx--->removeIdx--->actualIdx | or
+ // |--->actualIdx expectedIdx--->removeIdx--->| or
@ -3885,7 +3883,7 @@ index 000000000..8d7db3569
+ if (action == null)
+ throw new NullPointerException();
+ boolean[] valids = primMapValids;
+ long[] keys = primMapKeys;
+ Long[] keys = primMapKeys;
+ if ((hi = fence) < 0) {
+ mc = expectedModCount = modCount;
+ hi = fence = (valids == null) ? 0 : valids.length;
@ -3916,7 +3914,7 @@ index 000000000..8d7db3569
+ if (action == null)
+ throw new NullPointerException();
+ boolean[] valids = primMapValids;
+ long[] keys = primMapKeys;
+ Long[] keys = primMapKeys;
+ if (valids != null && valids.length >= hi && index >= 0) {
+ while (index < hi) {
+ if (!valids[index]) {

View File

@ -1,5 +1,4 @@
From afc216706bb555316211691268c01d7c977997c4 Mon Sep 17 00:00:00 2001
Date: Fri, 29 Nov 2024 15:36:29 +0800
From 0e8fec37da9cf57066d72798633fe1fd31481ece Mon Sep 17 00:00:00 2001
Subject: Enable TLS to communciation between JBooster Server and Client JVM
---
@ -24,7 +23,7 @@ Subject: Enable TLS to communciation between JBooster Server and Client JVM
src/hotspot/share/jbooster/net/errorCode.hpp | 1 +
.../jbooster/net/serverListeningThread.cpp | 55 ++++-
.../jbooster/net/serverListeningThread.hpp | 13 +-
.../share/jbooster/net/serverStream.cpp | 27 +-
.../share/jbooster/net/serverStream.cpp | 31 +--
.../share/jbooster/net/serverStream.hpp | 6 +-
src/hotspot/share/jbooster/net/sslUtils.cpp | 231 ++++++++++++++++++
src/hotspot/share/jbooster/net/sslUtils.hpp | 148 +++++++++++
@ -37,13 +36,15 @@ Subject: Enable TLS to communciation between JBooster Server and Client JVM
.../share/classes/jdk/jbooster/JBooster.java | 11 +-
.../share/classes/jdk/jbooster/Options.java | 22 ++
.../share/native/libjbooster/JBooster.c | 8 +-
test/jdk/tools/jbooster/JBoosterCmdTest.java | 2 +-
test/jdk/tools/jbooster/JBoosterNetTest.java | 2 +-
test/jdk/tools/jbooster/JBoosterSSLTest.java | 152 ++++++++++++
.../jbooster/JBoosterSharedCacheTest.java | 150 ++++++++++++
test/jdk/tools/jbooster/JBoosterTestBase.java | 6 +-
test/jdk/tools/jbooster/server-cert.pem | 22 ++
test/jdk/tools/jbooster/server-key.pem | 27 ++
test/jdk/tools/jbooster/unrelated-cert.pem | 22 ++
40 files changed, 1239 insertions(+), 231 deletions(-)
42 files changed, 1243 insertions(+), 235 deletions(-)
create mode 100644 src/hotspot/share/jbooster/net/sslUtils.cpp
create mode 100644 src/hotspot/share/jbooster/net/sslUtils.hpp
create mode 100644 test/jdk/tools/jbooster/JBoosterSSLTest.java
@ -1219,7 +1220,7 @@ index 49f5efb3f..abf6e4f79 100644
#endif // SHARE_JBOOSTER_NET_SERVERLISTENINGTHREAD_HPP
diff --git a/src/hotspot/share/jbooster/net/serverStream.cpp b/src/hotspot/share/jbooster/net/serverStream.cpp
index a3e7fa5c6..3f70f273b 100644
index a3e7fa5c6..838364fca 100644
--- a/src/hotspot/share/jbooster/net/serverStream.cpp
+++ b/src/hotspot/share/jbooster/net/serverStream.cpp
@@ -30,16 +30,16 @@
@ -1243,6 +1244,17 @@ index a3e7fa5c6..3f70f273b 100644
}
ServerStream::~ServerStream() {
@@ -52,8 +52,8 @@ uint32_t ServerStream::session_id() {
void ServerStream::set_session_data(JClientSessionData* sd) {
JClientSessionData* old_sd = _session_data;
- if (sd == old_sd) return;
- // Do not call sd->ref_cnt().inc() here as it has been inc when obtained.
+ // Do not let `sd` increase 1 here as it has been increased when obtained.
+ // But let `old_sd` decrease 1 even if `sd == old_sd` for the same reason.
if (old_sd != nullptr) {
old_sd->ref_cnt().dec_and_update_time();
}
@@ -105,7 +105,8 @@ int ServerStream::sync_session_meta__server() {
RpcCompatibility comp;
uint64_t client_random_id;
@ -2212,9 +2224,35 @@ index 0c25710ae..1c489b57b 100644
}
JNIEXPORT void JNICALL
diff --git a/test/jdk/tools/jbooster/JBoosterCmdTest.java b/test/jdk/tools/jbooster/JBoosterCmdTest.java
index 98439e699..4a2c0801a 100644
--- a/test/jdk/tools/jbooster/JBoosterCmdTest.java
+++ b/test/jdk/tools/jbooster/JBoosterCmdTest.java
@@ -35,7 +35,7 @@ import static jdk.test.lib.Asserts.*;
* /test/lib
* @modules jdk.jbooster
* @build SimpleClient
- * @run main/othervm/timeout=300 JBoosterCmdTest
+ * @run main/othervm/timeout=5000 JBoosterCmdTest
*/
public class JBoosterCmdTest extends JBoosterTestBase {
diff --git a/test/jdk/tools/jbooster/JBoosterNetTest.java b/test/jdk/tools/jbooster/JBoosterNetTest.java
index a71368127..0df0e265f 100644
--- a/test/jdk/tools/jbooster/JBoosterNetTest.java
+++ b/test/jdk/tools/jbooster/JBoosterNetTest.java
@@ -36,7 +36,7 @@ import static jdk.test.lib.Asserts.*;
* /test/lib
* @modules jdk.jbooster
* @build SimpleClient
- * @run main/othervm/timeout=300 JBoosterNetTest
+ * @run main/othervm/timeout=5000 JBoosterNetTest
*/
public class JBoosterNetTest extends JBoosterTestBase {
diff --git a/test/jdk/tools/jbooster/JBoosterSSLTest.java b/test/jdk/tools/jbooster/JBoosterSSLTest.java
new file mode 100644
index 000000000..ba6bec8d5
index 000000000..192acc6dd
--- /dev/null
+++ b/test/jdk/tools/jbooster/JBoosterSSLTest.java
@@ -0,0 +1,152 @@
@ -2257,7 +2295,7 @@ index 000000000..ba6bec8d5
+* /test/lib
+* @modules jdk.jbooster
+* @build SimpleClient
+* @run main/othervm/timeout=300 JBoosterSSLTest
+* @run main/othervm/timeout=5000 JBoosterSSLTest
+*/
+public class JBoosterSSLTest extends JBoosterTestBase {
+ private static void testSSLCorrectArgs(TestContext ctx) throws Exception {
@ -2373,7 +2411,7 @@ index 000000000..ba6bec8d5
\ No newline at end of file
diff --git a/test/jdk/tools/jbooster/JBoosterSharedCacheTest.java b/test/jdk/tools/jbooster/JBoosterSharedCacheTest.java
new file mode 100644
index 000000000..874bce0ea
index 000000000..bab3e2fa8
--- /dev/null
+++ b/test/jdk/tools/jbooster/JBoosterSharedCacheTest.java
@@ -0,0 +1,150 @@
@ -2416,7 +2454,7 @@ index 000000000..874bce0ea
+ * /test/lib
+ * @modules jdk.jbooster
+ * @build SimpleClient
+ * @run main/othervm/timeout=300 JBoosterSharedCacheTest
+ * @run main/othervm/timeout=5000 JBoosterSharedCacheTest
+ */
+ public class JBoosterSharedCacheTest extends JBoosterTestBase {
+

View File

@ -914,7 +914,7 @@ Provides: java-src%{?1} = %{epoch}:%{version}-%{release}
Name: java-%{javaver}-%{origin}
Version: %{newjavaver}.%{buildver}
Release: 4
Release: 5
# java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons
# and this change was brought into RHEL-4. java-1.5.0-ibm packages
@ -1961,11 +1961,16 @@ cjc.mainProgram(args) -- the returns from copy_jdk_configs.lua should not affect
%changelog
* Fri Dec 6 2024 kuenking111 <wangkun49@huawei.com> - 1:17.0.13.11-5
- modify Add-jbolt-feature.patch
- modify Add-specialized-hashmap-version-of-the-long-type.patch
- modify Enable-TLS-to-communciation-between-JBooster-Server-.patch
* Tue Dec 3 2024 Dingli Zhang <dingli@iscas.ac.cn> - 1:17.0.13.11-4
- Split patches for riscv64
- Increase the architecture isolation of jaotc
* Fri Nov 29 2024 kuenking111 <wangkun49@huawei.com.cn> - 1:17.0.13.11-3
* Fri Nov 29 2024 kuenking111 <wangkun49@huawei.com> - 1:17.0.13.11-3
- add Add-jbolt-feature.patch
- add Enable-TLS-to-communciation-between-JBooster-Server-.patch
- add SA-redact-support-password.patch