aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar David Holmes <dholmes@openjdk.org> 2021-04-18 04:32:11 +0000
committerGravatar David Holmes <dholmes@openjdk.org> 2021-04-18 04:32:11 +0000
commit1ac25b8201479be51113ff657b9a87fa29a690e8 (patch)
tree2f99f3f3fb746c1462f91ecc5d96ae12e100db0d
parent73d5f3b586abf2bd16b72f11ce4972f6d779e722 (diff)
downloadjdk-1ac25b8201479be51113ff657b9a87fa29a690e8.tar.gz
jdk-1ac25b8201479be51113ff657b9a87fa29a690e8.zip
8264372: Threads::destroy_vm only ever returns true
Reviewed-by: shade, dcubed
-rw-r--r--src/hotspot/share/prims/jni.cpp15
-rw-r--r--src/hotspot/share/runtime/thread.cpp4
-rw-r--r--src/hotspot/share/runtime/thread.hpp2
3 files changed, 6 insertions, 15 deletions
diff --git a/src/hotspot/share/prims/jni.cpp b/src/hotspot/share/prims/jni.cpp
index e11a50ef4e8..d28ebeca00a 100644
--- a/src/hotspot/share/prims/jni.cpp
+++ b/src/hotspot/share/prims/jni.cpp
@@ -3731,17 +3731,10 @@ static jint JNICALL jni_DestroyJavaVM_inner(JavaVM *vm) {
MACOS_AARCH64_ONLY(WXMode oldmode = thread->enable_wx(WXWrite));
ThreadStateTransition::transition_from_native(thread, _thread_in_vm);
- if (Threads::destroy_vm()) {
- // Should not change thread state, VM is gone
- vm_created = 0;
- res = JNI_OK;
- return res;
- } else {
- ThreadStateTransition::transition(thread, _thread_in_vm, _thread_in_native);
- MACOS_AARCH64_ONLY(thread->enable_wx(oldmode));
- res = JNI_ERR;
- return res;
- }
+ Threads::destroy_vm();
+ // Don't bother restoring thread state, VM is gone.
+ vm_created = 0;
+ return JNI_OK;
}
jint JNICALL jni_DestroyJavaVM(JavaVM *vm) {
diff --git a/src/hotspot/share/runtime/thread.cpp b/src/hotspot/share/runtime/thread.cpp
index 1c3f8422eb9..75310478e9d 100644
--- a/src/hotspot/share/runtime/thread.cpp
+++ b/src/hotspot/share/runtime/thread.cpp
@@ -3699,7 +3699,7 @@ void JavaThread::invoke_shutdown_hooks() {
// + Delete this thread
// + Return to caller
-bool Threads::destroy_vm() {
+void Threads::destroy_vm() {
JavaThread* thread = JavaThread::current();
#ifdef ASSERT
@@ -3792,8 +3792,6 @@ bool Threads::destroy_vm() {
#endif
LogConfiguration::finalize();
-
- return true;
}
diff --git a/src/hotspot/share/runtime/thread.hpp b/src/hotspot/share/runtime/thread.hpp
index 51070f8eb79..762179f5354 100644
--- a/src/hotspot/share/runtime/thread.hpp
+++ b/src/hotspot/share/runtime/thread.hpp
@@ -1812,7 +1812,7 @@ class Threads: AllStatic {
static void create_vm_init_libraries();
static void create_vm_init_agents();
static void shutdown_vm_agents();
- static bool destroy_vm();
+ static void destroy_vm();
// Supported VM versions via JNI
// Includes JNI_VERSION_1_1
static jboolean is_supported_jni_version_including_1_1(jint version);