< prev index next >

src/hotspot/share/runtime/threadSMR.inline.hpp

Print this page
rev 48154 : 8191789: migrate more Thread-SMR stuff from thread.[ch]pp -> threadSMR.[ch]pp
Reviewed-by:


  42 }
  43 
  44 template <class T>
  45 inline void ThreadsList::threads_do(T *cl) const {
  46   const intx scan_interval = PrefetchScanIntervalInBytes;
  47   JavaThread *const *const end = _threads + _length;
  48   for (JavaThread *const *current_p = _threads; current_p != end; current_p++) {
  49     Prefetch::read((void*)current_p, scan_interval);
  50     JavaThread *const current = *current_p;
  51     threads_do_dispatch(cl, current);
  52   }
  53 }
  54 
  55 inline ThreadsList* ThreadsListSetter::list() {
  56   ThreadsList *ret = _target->get_threads_hazard_ptr();
  57   assert(ret != NULL, "hazard ptr should be set");
  58   assert(!Thread::is_hazard_ptr_tagged(ret), "hazard ptr should be validated");
  59   return ret;
  60 }
  61 








































  62 #endif // SHARE_VM_RUNTIME_THREADSMR_INLINE_HPP


  42 }
  43 
  44 template <class T>
  45 inline void ThreadsList::threads_do(T *cl) const {
  46   const intx scan_interval = PrefetchScanIntervalInBytes;
  47   JavaThread *const *const end = _threads + _length;
  48   for (JavaThread *const *current_p = _threads; current_p != end; current_p++) {
  49     Prefetch::read((void*)current_p, scan_interval);
  50     JavaThread *const current = *current_p;
  51     threads_do_dispatch(cl, current);
  52   }
  53 }
  54 
  55 inline ThreadsList* ThreadsListSetter::list() {
  56   ThreadsList *ret = _target->get_threads_hazard_ptr();
  57   assert(ret != NULL, "hazard ptr should be set");
  58   assert(!Thread::is_hazard_ptr_tagged(ret), "hazard ptr should be validated");
  59   return ret;
  60 }
  61 
  62 inline void ThreadsSMRSupport::add_smr_tlh_times(uint add_value) {
  63   Atomic::add(add_value, &_smr_tlh_times);
  64 }
  65 
  66 inline ThreadsList* ThreadsSMRSupport::get_smr_java_thread_list() {
  67   return (ThreadsList*)OrderAccess::load_acquire(&_smr_java_thread_list);
  68 }
  69 
  70 inline void ThreadsSMRSupport::inc_smr_java_thread_list_alloc_cnt() {
  71   _smr_java_thread_list_alloc_cnt++;
  72 }
  73 
  74 inline void ThreadsSMRSupport::inc_smr_tlh_cnt() {
  75   Atomic::inc(&_smr_tlh_cnt);
  76 }
  77 
  78 inline void ThreadsSMRSupport::update_smr_java_thread_list_max(uint new_value) {
  79   if (new_value > _smr_java_thread_list_max) {
  80     _smr_java_thread_list_max = new_value;
  81   }
  82 }
  83 
  84 inline void ThreadsSMRSupport::update_smr_tlh_time_max(uint new_value) {
  85   while (true) {
  86     uint cur_value = _smr_tlh_time_max;
  87     if (new_value <= cur_value) {
  88       // No need to update max value so we're done.
  89       break;
  90     }
  91     if (Atomic::cmpxchg(new_value, &_smr_tlh_time_max, cur_value) == cur_value) {
  92       // Updated max value so we're done. Otherwise try it all again.
  93       break;
  94     }
  95   }
  96 }
  97 
  98 inline ThreadsList* ThreadsSMRSupport::xchg_smr_java_thread_list(ThreadsList* new_list) {
  99   return (ThreadsList*)Atomic::xchg(new_list, &_smr_java_thread_list);
 100 }
 101 
 102 #endif // SHARE_VM_RUNTIME_THREADSMR_INLINE_HPP
< prev index next >