src/hotspot/share/runtime/safepoint.cpp
changeset 54323 846bc643f4ef
parent 54031 feea57b38a1c
child 54495 941db9c0b5b5
equal deleted inserted replaced
54322:cf75ea6af695 54323:846bc643f4ef
   475       DEBUG_ONLY(current->reset_visited_for_critical_count(safepoint_id);)
   475       DEBUG_ONLY(current->reset_visited_for_critical_count(safepoint_id);)
   476       ThreadSafepointState* cur_state = current->safepoint_state();
   476       ThreadSafepointState* cur_state = current->safepoint_state();
   477       assert(!cur_state->is_running(), "Thread not suspended at safepoint");
   477       assert(!cur_state->is_running(), "Thread not suspended at safepoint");
   478       cur_state->restart(); // TSS _running
   478       cur_state->restart(); // TSS _running
   479       assert(cur_state->is_running(), "safepoint state has not been reset");
   479       assert(cur_state->is_running(), "safepoint state has not been reset");
   480       SafepointMechanism::disarm_local_poll(current);
   480 
       
   481       SafepointMechanism::disarm_if_needed(current, false /* NO release */);
   481     }
   482     }
   482   } // ~JavaThreadIteratorWithHandle
   483   } // ~JavaThreadIteratorWithHandle
   483 
   484 
   484   // Release threads lock, so threads can be created/destroyed again.
   485   // Release threads lock, so threads can be created/destroyed again.
   485   Threads_lock->unlock();
   486   Threads_lock->unlock();
   714     return false;
   715     return false;
   715   }
   716   }
   716 }
   717 }
   717 
   718 
   718 bool SafepointSynchronize::handshake_safe(JavaThread *thread) {
   719 bool SafepointSynchronize::handshake_safe(JavaThread *thread) {
   719   // The polls must be armed otherwise the safe state can change to unsafe at any time.
       
   720   assert(SafepointMechanism::should_block(thread), "Must be armed");
       
   721   // This function must be called with the Threads_lock held so an externally
   720   // This function must be called with the Threads_lock held so an externally
   722   // suspended thread cannot be resumed thus it is safe.
   721   // suspended thread cannot be resumed thus it is safe.
   723   assert(Threads_lock->owned_by_self() && Thread::current()->is_VM_thread(),
   722   assert(Threads_lock->owned_by_self() && Thread::current()->is_VM_thread(),
   724          "Must hold Threads_lock and be VMThread");
   723          "Must hold Threads_lock and be VMThread");
   725   if (thread->is_ext_suspended() || thread->is_terminated()) {
   724   if (thread->is_ext_suspended() || thread->is_terminated()) {
   849       state != _thread_in_vm_trans &&
   848       state != _thread_in_vm_trans &&
   850       thread->has_special_runtime_exit_condition()) {
   849       thread->has_special_runtime_exit_condition()) {
   851     thread->handle_special_runtime_exit_condition(
   850     thread->handle_special_runtime_exit_condition(
   852       !thread->is_at_poll_safepoint() && (state != _thread_in_native_trans));
   851       !thread->is_at_poll_safepoint() && (state != _thread_in_native_trans));
   853   }
   852   }
       
   853 
       
   854   // cross_modify_fence is done by SafepointMechanism::block_if_requested_slow
       
   855   // which is the only caller here.
   854 }
   856 }
   855 
   857 
   856 // ------------------------------------------------------------------------------------------------------
   858 // ------------------------------------------------------------------------------------------------------
   857 // Exception handlers
   859 // Exception handlers
   858 
   860