hotspot/src/share/vm/runtime/vm_operations.cpp
changeset 34633 2a6c7c7b30a7
parent 34262 43560e879d6d
child 35061 be6025ebffea
equal deleted inserted replaced
34632:bf3518bba285 34633:2a6c7c7b30a7
   376 Thread * VM_Exit::_shutdown_thread = NULL;
   376 Thread * VM_Exit::_shutdown_thread = NULL;
   377 
   377 
   378 int VM_Exit::set_vm_exited() {
   378 int VM_Exit::set_vm_exited() {
   379   CodeCacheExtensions::complete_step(CodeCacheExtensionsSteps::LastStep);
   379   CodeCacheExtensions::complete_step(CodeCacheExtensionsSteps::LastStep);
   380 
   380 
   381   Thread * thr_cur = ThreadLocalStorage::get_thread_slow();
   381   Thread * thr_cur = Thread::current();
   382 
   382 
   383   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint already");
   383   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint already");
   384 
   384 
   385   int num_active = 0;
   385   int num_active = 0;
   386 
   386 
   398 int VM_Exit::wait_for_threads_in_native_to_block() {
   398 int VM_Exit::wait_for_threads_in_native_to_block() {
   399   // VM exits at safepoint. This function must be called at the final safepoint
   399   // VM exits at safepoint. This function must be called at the final safepoint
   400   // to wait for threads in _thread_in_native state to be quiescent.
   400   // to wait for threads in _thread_in_native state to be quiescent.
   401   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint already");
   401   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint already");
   402 
   402 
   403   Thread * thr_cur = ThreadLocalStorage::get_thread_slow();
   403   Thread * thr_cur = Thread::current();
   404   Monitor timer(Mutex::leaf, "VM_Exit timer", true,
   404   Monitor timer(Mutex::leaf, "VM_Exit timer", true,
   405                 Monitor::_safepoint_check_never);
   405                 Monitor::_safepoint_check_never);
   406 
   406 
   407   // Compiler threads need longer wait because they can access VM data directly
   407   // Compiler threads need longer wait because they can access VM data directly
   408   // while in native. If they are active and some structures being used are
   408   // while in native. If they are active and some structures being used are
   475 }
   475 }
   476 
   476 
   477 
   477 
   478 void VM_Exit::wait_if_vm_exited() {
   478 void VM_Exit::wait_if_vm_exited() {
   479   if (_vm_exited &&
   479   if (_vm_exited &&
   480       ThreadLocalStorage::get_thread_slow() != _shutdown_thread) {
   480       Thread::current_or_null() != _shutdown_thread) {
   481     // _vm_exited is set at safepoint, and the Threads_lock is never released
   481     // _vm_exited is set at safepoint, and the Threads_lock is never released
   482     // we will block here until the process dies
   482     // we will block here until the process dies
   483     Threads_lock->lock_without_safepoint_check();
   483     Threads_lock->lock_without_safepoint_check();
   484     ShouldNotReachHere();
   484     ShouldNotReachHere();
   485   }
   485   }