< prev index next >

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

Print this page




  39 template <>
  40 inline void ThreadsList::threads_do_dispatch<ThreadClosure>(ThreadClosure *cl, JavaThread *const thread) const {
  41   cl->do_thread(thread);
  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 // These three inlines are private to ThreadsSMRSupport, but
  56 // they are called by public inline update_tlh_stats() below:
  57 
  58 inline void ThreadsSMRSupport::add_tlh_times(uint add_value) {
  59   Atomic::add(add_value, &_tlh_times);
  60 }
  61 
  62 inline void ThreadsSMRSupport::inc_tlh_cnt() {
  63   Atomic::inc(&_tlh_cnt);
  64 }
  65 
  66 inline void ThreadsSMRSupport::update_tlh_time_max(uint new_value) {
  67   while (true) {
  68     uint cur_value = _tlh_time_max;
  69     if (new_value <= cur_value) {
  70       // No need to update max value so we're done.
  71       break;
  72     }
  73     if (Atomic::cmpxchg(new_value, &_tlh_time_max, cur_value) == cur_value) {
  74       // Updated max value so we're done. Otherwise try it all again.
  75       break;
  76     }
  77   }
  78 }
  79 


  39 template <>
  40 inline void ThreadsList::threads_do_dispatch<ThreadClosure>(ThreadClosure *cl, JavaThread *const thread) const {
  41   cl->do_thread(thread);
  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 // These three inlines are private to ThreadsSMRSupport, but
  56 // they are called by public inline update_tlh_stats() below:
  57 
  58 inline void ThreadsSMRSupport::add_tlh_times(uint add_value) {
  59   Atomic::add(&_tlh_times, add_value);
  60 }
  61 
  62 inline void ThreadsSMRSupport::inc_tlh_cnt() {
  63   Atomic::inc(&_tlh_cnt);
  64 }
  65 
  66 inline void ThreadsSMRSupport::update_tlh_time_max(uint new_value) {
  67   while (true) {
  68     uint cur_value = _tlh_time_max;
  69     if (new_value <= cur_value) {
  70       // No need to update max value so we're done.
  71       break;
  72     }
  73     if (Atomic::cmpxchg(new_value, &_tlh_time_max, cur_value) == cur_value) {
  74       // Updated max value so we're done. Otherwise try it all again.
  75       break;
  76     }
  77   }
  78 }
  79 
< prev index next >