< prev index next >
src/hotspot/share/runtime/thread.cpp
Print this page
rev 49294 : imported patch 8199813
@@ -2390,15 +2390,17 @@
return ret;
}
#ifdef ASSERT
-// verify the JavaThread has not yet been published in the Threads::list, and
-// hence doesn't need protection from concurrent access at this stage
+// Verify the JavaThread has not yet been published in the Threads::list, and
+// hence doesn't need protection from concurrent access at this stage.
void JavaThread::verify_not_published() {
- ThreadsListHandle tlh;
- assert(!tlh.includes(this), "JavaThread shouldn't have been published yet!");
+ // Cannot create a ThreadsListHandle here and check !tlh.includes(this)
+ // since an unpublished JavaThread doesn't participate in the
+ // Thread-SMR protocol for keeping a ThreadsList alive.
+ assert(!on_thread_list(), "JavaThread shouldn't have been published yet!");
}
#endif
// Slow path when the native==>VM/Java barriers detect a safepoint is in
// progress or when _suspend_flags is non-zero.
@@ -4252,11 +4254,17 @@
VMThread::wait_for_vm_thread_exit();
assert(SafepointSynchronize::is_at_safepoint(), "VM thread should exit at Safepoint");
VMThread::destroy();
}
- // clean up ideal graph printers
+ // Remember the Thread that is shutting down the VM because it needs
+ // to be immune to some of the sanity checks and policies that have
+ // to happen at VM shutdown time.
+ VM_Exit::set_shutdown_thread(thread);
+
+ // Clean up ideal graph printers after the VMThread has started
+ // the final safepoint which will block all the Compiler threads.
#if defined(COMPILER2) && !defined(PRODUCT)
IdealGraphPrinter::clean_up();
#endif
// Now, all Java threads are gone except daemon threads. Daemon threads
< prev index next >