2390 |
2390 |
2391 return ret; |
2391 return ret; |
2392 } |
2392 } |
2393 |
2393 |
2394 #ifdef ASSERT |
2394 #ifdef ASSERT |
2395 // verify the JavaThread has not yet been published in the Threads::list, and |
2395 // Verify the JavaThread has not yet been published in the Threads::list, and |
2396 // hence doesn't need protection from concurrent access at this stage |
2396 // hence doesn't need protection from concurrent access at this stage. |
2397 void JavaThread::verify_not_published() { |
2397 void JavaThread::verify_not_published() { |
2398 ThreadsListHandle tlh; |
2398 // Cannot create a ThreadsListHandle here and check !tlh.includes(this) |
2399 assert(!tlh.includes(this), "JavaThread shouldn't have been published yet!"); |
2399 // since an unpublished JavaThread doesn't participate in the |
|
2400 // Thread-SMR protocol for keeping a ThreadsList alive. |
|
2401 assert(!on_thread_list(), "JavaThread shouldn't have been published yet!"); |
2400 } |
2402 } |
2401 #endif |
2403 #endif |
2402 |
2404 |
2403 // Slow path when the native==>VM/Java barriers detect a safepoint is in |
2405 // Slow path when the native==>VM/Java barriers detect a safepoint is in |
2404 // progress or when _suspend_flags is non-zero. |
2406 // progress or when _suspend_flags is non-zero. |
4260 VMThread::wait_for_vm_thread_exit(); |
4262 VMThread::wait_for_vm_thread_exit(); |
4261 assert(SafepointSynchronize::is_at_safepoint(), "VM thread should exit at Safepoint"); |
4263 assert(SafepointSynchronize::is_at_safepoint(), "VM thread should exit at Safepoint"); |
4262 VMThread::destroy(); |
4264 VMThread::destroy(); |
4263 } |
4265 } |
4264 |
4266 |
4265 // clean up ideal graph printers |
|
4266 #if defined(COMPILER2) && !defined(PRODUCT) |
|
4267 IdealGraphPrinter::clean_up(); |
|
4268 #endif |
|
4269 |
|
4270 // Now, all Java threads are gone except daemon threads. Daemon threads |
4267 // Now, all Java threads are gone except daemon threads. Daemon threads |
4271 // running Java code or in VM are stopped by the Safepoint. However, |
4268 // running Java code or in VM are stopped by the Safepoint. However, |
4272 // daemon threads executing native code are still running. But they |
4269 // daemon threads executing native code are still running. But they |
4273 // will be stopped at native=>Java/VM barriers. Note that we can't |
4270 // will be stopped at native=>Java/VM barriers. Note that we can't |
4274 // simply kill or suspend them, as it is inherently deadlock-prone. |
4271 // simply kill or suspend them, as it is inherently deadlock-prone. |
4275 |
4272 |
4276 VM_Exit::set_vm_exited(); |
4273 VM_Exit::set_vm_exited(); |
|
4274 |
|
4275 // Clean up ideal graph printers after the VMThread has started |
|
4276 // the final safepoint which will block all the Compiler threads. |
|
4277 // Note that this Thread has already logically exited so the |
|
4278 // clean_up() function's use of a JavaThreadIteratorWithHandle |
|
4279 // would be a problem except set_vm_exited() has remembered the |
|
4280 // shutdown thread which is granted a policy exception. |
|
4281 #if defined(COMPILER2) && !defined(PRODUCT) |
|
4282 IdealGraphPrinter::clean_up(); |
|
4283 #endif |
4277 |
4284 |
4278 notify_vm_shutdown(); |
4285 notify_vm_shutdown(); |
4279 |
4286 |
4280 // We are after VM_Exit::set_vm_exited() so we can't call |
4287 // We are after VM_Exit::set_vm_exited() so we can't call |
4281 // thread->smr_delete() or we will block on the Threads_lock. |
4288 // thread->smr_delete() or we will block on the Threads_lock. |