< prev index next >

src/hotspot/share/runtime/thread.cpp

Print this page
rev 49294 : imported patch 8199813
rev 49295 : Move IdealGraphPrinter::clean_up() call so VM_Exit::set_shutdown_thread() can be removed.

@@ -4254,29 +4254,28 @@
     VMThread::wait_for_vm_thread_exit();
     assert(SafepointSynchronize::is_at_safepoint(), "VM thread should exit at Safepoint");
     VMThread::destroy();
   }
 
-  // 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
   // running Java code or in VM are stopped by the Safepoint. However,
   // daemon threads executing native code are still running.  But they
   // will be stopped at native=>Java/VM barriers. Note that we can't
   // simply kill or suspend them, as it is inherently deadlock-prone.
 
   VM_Exit::set_vm_exited();
 
+  // Clean up ideal graph printers after the VMThread has started
+  // the final safepoint which will block all the Compiler threads.
+  // Note that this Thread has already logically exited so the
+  // clean_up() function's use of a JavaThreadIteratorWithHandle
+  // would be a problem except set_vm_exited() has remembered the
+  // shutdown thread which is granted a policy exception.
+#if defined(COMPILER2) && !defined(PRODUCT)
+  IdealGraphPrinter::clean_up();
+#endif
+
   notify_vm_shutdown();
 
   // We are after VM_Exit::set_vm_exited() so we can't call
   // thread->smr_delete() or we will block on the Threads_lock.
   // Deleting the shutdown thread here is safe because another
< prev index next >