< 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.
*** 2390,2404 ****
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
void JavaThread::verify_not_published() {
! ThreadsListHandle tlh;
! assert(!tlh.includes(this), "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.
--- 2390,2406 ----
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.
void JavaThread::verify_not_published() {
! // 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,4274 ****
VMThread::wait_for_vm_thread_exit();
assert(SafepointSynchronize::is_at_safepoint(), "VM thread should exit at Safepoint");
VMThread::destroy();
}
- // clean up ideal graph printers
- #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();
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
--- 4254,4281 ----
VMThread::wait_for_vm_thread_exit();
assert(SafepointSynchronize::is_at_safepoint(), "VM thread should exit at Safepoint");
VMThread::destroy();
}
// 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 >