Skip to content

Commit

Permalink
8264372: Threads::destroy_vm only ever returns true
Browse files Browse the repository at this point in the history
Reviewed-by: shade, dcubed
  • Loading branch information
David Holmes committed Apr 18, 2021
1 parent 73d5f3b commit 1ac25b8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
15 changes: 4 additions & 11 deletions src/hotspot/share/prims/jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 1 addition & 3 deletions src/hotspot/share/runtime/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -3792,8 +3792,6 @@ bool Threads::destroy_vm() {
#endif

LogConfiguration::finalize();

return true;
}


Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/runtime/thread.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1ac25b8

Please sign in to comment.