< prev index next >

src/hotspot/share/runtime/safepoint.cpp

Print this page

714   }
715 
716   // All other thread states will continue to run until they
717   // transition and self-block in state _blocked
718   // Safepoint polling in compiled code causes the Java threads to do the same.
719   // Note: new threads may require a malloc so they must be allowed to finish
720 
721   assert(is_running(), "examine_state_of_thread on non-running thread");
722   return;
723 }
724 
725 void ThreadSafepointState::account_safe_thread() {
726   SafepointSynchronize::decrement_waiting_to_block();
727   if (_thread->in_critical()) {
728     // Notice that this thread is in a critical section
729     SafepointSynchronize::increment_jni_active_count();
730   }
731   DEBUG_ONLY(_thread->set_visited_for_critical_count(SafepointSynchronize::safepoint_counter());)
732   assert(!_safepoint_safe, "Must be unsafe before safe");
733   _safepoint_safe = true;





734 }
735 
736 void ThreadSafepointState::restart() {
737   assert(_safepoint_safe, "Must be safe before unsafe");
738   _safepoint_safe = false;
739 }
740 
741 void ThreadSafepointState::print_on(outputStream *st) const {
742   const char *s = _safepoint_safe ? "_at_safepoint" : "_running";
743 
744   st->print_cr("Thread: " INTPTR_FORMAT
745               "  [0x%2x] State: %s _at_poll_safepoint %d",
746                p2i(_thread), _thread->osthread()->thread_id(), s, _at_poll_safepoint);
747 
748   _thread->print_thread_state_on(st);
749 }
750 
751 // ---------------------------------------------------------------------------------------------------------------------
752 
753 // Process pending operation.

714   }
715 
716   // All other thread states will continue to run until they
717   // transition and self-block in state _blocked
718   // Safepoint polling in compiled code causes the Java threads to do the same.
719   // Note: new threads may require a malloc so they must be allowed to finish
720 
721   assert(is_running(), "examine_state_of_thread on non-running thread");
722   return;
723 }
724 
725 void ThreadSafepointState::account_safe_thread() {
726   SafepointSynchronize::decrement_waiting_to_block();
727   if (_thread->in_critical()) {
728     // Notice that this thread is in a critical section
729     SafepointSynchronize::increment_jni_active_count();
730   }
731   DEBUG_ONLY(_thread->set_visited_for_critical_count(SafepointSynchronize::safepoint_counter());)
732   assert(!_safepoint_safe, "Must be unsafe before safe");
733   _safepoint_safe = true;
734 
735   // The oops in the monitor cache are cleared to prevent stale cache entries
736   // from keeping dead objects alive. Because these oops are always cleared
737   // before safepoint operations they are not visited in JavaThread::oops_do.
738   _thread->om_clear_monitor_cache();
739 }
740 
741 void ThreadSafepointState::restart() {
742   assert(_safepoint_safe, "Must be safe before unsafe");
743   _safepoint_safe = false;
744 }
745 
746 void ThreadSafepointState::print_on(outputStream *st) const {
747   const char *s = _safepoint_safe ? "_at_safepoint" : "_running";
748 
749   st->print_cr("Thread: " INTPTR_FORMAT
750               "  [0x%2x] State: %s _at_poll_safepoint %d",
751                p2i(_thread), _thread->osthread()->thread_id(), s, _at_poll_safepoint);
752 
753   _thread->print_thread_state_on(st);
754 }
755 
756 // ---------------------------------------------------------------------------------------------------------------------
757 
758 // Process pending operation.
< prev index next >