51 threads_do_dispatch(cl, current); |
51 threads_do_dispatch(cl, current); |
52 } |
52 } |
53 } |
53 } |
54 |
54 |
55 // These three inlines are private to ThreadsSMRSupport, but |
55 // These three inlines are private to ThreadsSMRSupport, but |
56 // they are called by public inline update_smr_tlh_stats() below: |
56 // they are called by public inline update_tlh_stats() below: |
57 |
57 |
58 inline void ThreadsSMRSupport::add_smr_tlh_times(uint add_value) { |
58 inline void ThreadsSMRSupport::add_tlh_times(uint add_value) { |
59 Atomic::add(add_value, &_smr_tlh_times); |
59 Atomic::add(add_value, &_tlh_times); |
60 } |
60 } |
61 |
61 |
62 inline void ThreadsSMRSupport::inc_smr_tlh_cnt() { |
62 inline void ThreadsSMRSupport::inc_tlh_cnt() { |
63 Atomic::inc(&_smr_tlh_cnt); |
63 Atomic::inc(&_tlh_cnt); |
64 } |
64 } |
65 |
65 |
66 inline void ThreadsSMRSupport::update_smr_tlh_time_max(uint new_value) { |
66 inline void ThreadsSMRSupport::update_tlh_time_max(uint new_value) { |
67 while (true) { |
67 while (true) { |
68 uint cur_value = _smr_tlh_time_max; |
68 uint cur_value = _tlh_time_max; |
69 if (new_value <= cur_value) { |
69 if (new_value <= cur_value) { |
70 // No need to update max value so we're done. |
70 // No need to update max value so we're done. |
71 break; |
71 break; |
72 } |
72 } |
73 if (Atomic::cmpxchg(new_value, &_smr_tlh_time_max, cur_value) == cur_value) { |
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. |
74 // Updated max value so we're done. Otherwise try it all again. |
75 break; |
75 break; |
76 } |
76 } |
77 } |
77 } |
78 } |
78 } |
83 assert(ret != NULL, "hazard ptr should be set"); |
83 assert(ret != NULL, "hazard ptr should be set"); |
84 assert(!Thread::is_hazard_ptr_tagged(ret), "hazard ptr should be validated"); |
84 assert(!Thread::is_hazard_ptr_tagged(ret), "hazard ptr should be validated"); |
85 return ret; |
85 return ret; |
86 } |
86 } |
87 |
87 |
88 inline ThreadsList* ThreadsSMRSupport::get_smr_java_thread_list() { |
88 inline ThreadsList* ThreadsSMRSupport::get_java_thread_list() { |
89 return (ThreadsList*)OrderAccess::load_acquire(&_smr_java_thread_list); |
89 return (ThreadsList*)OrderAccess::load_acquire(&_java_thread_list); |
90 } |
90 } |
91 |
91 |
92 inline bool ThreadsSMRSupport::is_a_protected_JavaThread_with_lock(JavaThread *thread) { |
92 inline bool ThreadsSMRSupport::is_a_protected_JavaThread_with_lock(JavaThread *thread) { |
93 MutexLockerEx ml(Threads_lock->owned_by_self() ? NULL : Threads_lock); |
93 MutexLockerEx ml(Threads_lock->owned_by_self() ? NULL : Threads_lock); |
94 return is_a_protected_JavaThread(thread); |
94 return is_a_protected_JavaThread(thread); |
95 } |
95 } |
96 |
96 |
97 inline void ThreadsSMRSupport::update_smr_tlh_stats(uint millis) { |
97 inline void ThreadsSMRSupport::update_tlh_stats(uint millis) { |
98 ThreadsSMRSupport::inc_smr_tlh_cnt(); |
98 ThreadsSMRSupport::inc_tlh_cnt(); |
99 ThreadsSMRSupport::add_smr_tlh_times(millis); |
99 ThreadsSMRSupport::add_tlh_times(millis); |
100 ThreadsSMRSupport::update_smr_tlh_time_max(millis); |
100 ThreadsSMRSupport::update_tlh_time_max(millis); |
101 } |
101 } |
102 |
102 |
103 #endif // SHARE_VM_RUNTIME_THREADSMR_INLINE_HPP |
103 #endif // SHARE_VM_RUNTIME_THREADSMR_INLINE_HPP |