Skip to content
Permalink
Browse files
8264372: Threads::destroy_vm only ever returns true
Reviewed-by: shade, dcubed
  • Loading branch information
David Holmes committed Apr 18, 2021
1 parent 73d5f3b commit 1ac25b8201479be51113ff657b9a87fa29a690e8
Showing 3 changed files with 6 additions and 15 deletions.
@@ -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) {
@@ -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;
}


@@ -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);

1 comment on commit 1ac25b8

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 1ac25b8 Apr 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.