8191787: move private inline functions from thread.inline.hpp -> thread.cpp
authordcubed
Thu, 30 Nov 2017 18:38:20 -0500
changeset 48173 cb63f08dad03
parent 48172 e26fc5201707
child 48174 0a52219cfb16
8191787: move private inline functions from thread.inline.hpp -> thread.cpp Reviewed-by: coleenp, dholmes
src/hotspot/share/runtime/thread.cpp
src/hotspot/share/runtime/thread.hpp
src/hotspot/share/runtime/thread.inline.hpp
--- a/src/hotspot/share/runtime/thread.cpp	Thu Nov 30 10:40:48 2017 -0800
+++ b/src/hotspot/share/runtime/thread.cpp	Thu Nov 30 18:38:20 2017 -0500
@@ -3561,6 +3561,10 @@
          MACRO_current_p++,                                                                                               \
              X = (JavaThread*)prefetch_and_load_ptr((void**)MACRO_current_p, (intx)MACRO_scan_interval))
 
+inline ThreadsList* Threads::get_smr_java_thread_list() {
+  return (ThreadsList*)OrderAccess::load_acquire(&_smr_java_thread_list);
+}
+
 // All JavaThreads
 #define ALL_JAVA_THREADS(X) DO_JAVA_THREADS(get_smr_java_thread_list(), X)
 
@@ -3772,6 +3776,14 @@
   return node->t_list();
 }
 
+inline void Threads::add_smr_deleted_thread_times(uint add_value) {
+  Atomic::add(add_value, &_smr_deleted_thread_times);
+}
+
+inline void Threads::inc_smr_deleted_thread_cnt() {
+  Atomic::inc(&_smr_deleted_thread_cnt);
+}
+
 // Release a stable ThreadsList.
 //
 void Threads::release_stable_list(Thread *self) {
@@ -3871,6 +3883,24 @@
   }
 }
 
+inline void Threads::update_smr_deleted_thread_time_max(uint new_value) {
+  while (true) {
+    uint cur_value = _smr_deleted_thread_time_max;
+    if (new_value <= cur_value) {
+      // No need to update max value so we're done.
+      break;
+    }
+    if (Atomic::cmpxchg(new_value, &_smr_deleted_thread_time_max, cur_value) == cur_value) {
+      // Updated max value so we're done. Otherwise try it all again.
+      break;
+    }
+  }
+}
+
+inline ThreadsList* Threads::xchg_smr_java_thread_list(ThreadsList* new_list) {
+  return (ThreadsList*)Atomic::xchg(new_list, &_smr_java_thread_list);
+}
+
 void Threads::initialize_java_lang_classes(JavaThread* main_thread, TRAPS) {
   TraceTime timer("Initialize java.lang classes", TRACETIME_LOG(Info, startuptime));
 
--- a/src/hotspot/share/runtime/thread.hpp	Thu Nov 30 10:40:48 2017 -0800
+++ b/src/hotspot/share/runtime/thread.hpp	Thu Nov 30 18:38:20 2017 -0500
@@ -2127,19 +2127,22 @@
   friend class VMStructs;
  private:
   // Safe Memory Reclamation (SMR) support:
+  // The coordination between Threads::release_stable_list() and
+  // Threads::smr_delete() uses the smr_delete_lock in order to
+  // reduce the traffic on the Threads_lock.
   static Monitor*              _smr_delete_lock;
   // The '_cnt', '_max' and '_times" fields are enabled via
   // -XX:+EnableThreadSMRStatistics (see thread.cpp for a
   // description about each field):
   static uint                  _smr_delete_lock_wait_cnt;
   static uint                  _smr_delete_lock_wait_max;
+  // The smr_delete_notify flag is used for proper double-check
+  // locking in order to reduce the traffic on the smr_delete_lock.
   static volatile uint         _smr_delete_notify;
   static volatile uint         _smr_deleted_thread_cnt;
   static volatile uint         _smr_deleted_thread_time_max;
   static volatile uint         _smr_deleted_thread_times;
   static ThreadsList* volatile _smr_java_thread_list;
-  static ThreadsList*          get_smr_java_thread_list();
-  static ThreadsList*          xchg_smr_java_thread_list(ThreadsList* new_list);
   static uint64_t              _smr_java_thread_list_alloc_cnt;
   static uint64_t              _smr_java_thread_list_free_cnt;
   static uint                  _smr_java_thread_list_max;
@@ -2163,7 +2166,21 @@
   static void initialize_java_lang_classes(JavaThread* main_thread, TRAPS);
   static void initialize_jsr292_core_classes(TRAPS);
 
+  static ThreadsList *acquire_stable_list_fast_path(Thread *self);
+  static ThreadsList *acquire_stable_list_nested_path(Thread *self);
+  static void add_smr_deleted_thread_times(uint add_value);
+  static void clear_smr_delete_notify();
+  static ThreadsList* get_smr_java_thread_list();
+  static void inc_smr_deleted_thread_cnt();
+  static void release_stable_list_fast_path(Thread *self);
+  static void release_stable_list_nested_path(Thread *self);
+  static void release_stable_list_wake_up(char *log_str);
+  static void set_smr_delete_notify();
+  static Monitor* smr_delete_lock() { return _smr_delete_lock; }
+  static bool smr_delete_notify();
   static void smr_free_list(ThreadsList* threads);
+  static void update_smr_deleted_thread_time_max(uint new_value);
+  static ThreadsList* xchg_smr_java_thread_list(ThreadsList* new_list);
 
  public:
   // Thread management
@@ -2176,30 +2193,13 @@
 
   // SMR support:
   static ThreadsList *acquire_stable_list(Thread *self, bool is_ThreadsListSetter);
-  static ThreadsList *acquire_stable_list_fast_path(Thread *self);
-  static ThreadsList *acquire_stable_list_nested_path(Thread *self);
   static void release_stable_list(Thread *self);
-  static void release_stable_list_fast_path(Thread *self);
-  static void release_stable_list_nested_path(Thread *self);
-  static void release_stable_list_wake_up(char *log_str);
   static bool is_a_protected_JavaThread(JavaThread *thread);
   static bool is_a_protected_JavaThread_with_lock(JavaThread *thread) {
     MutexLockerEx ml(Threads_lock->owned_by_self() ? NULL : Threads_lock);
     return is_a_protected_JavaThread(thread);
   }
   static void smr_delete(JavaThread *thread);
-  // The coordination between Threads::release_stable_list() and
-  // Threads::smr_delete() uses the smr_delete_lock in order to
-  // reduce the traffic on the Threads_lock.
-  static Monitor* smr_delete_lock() { return _smr_delete_lock; }
-  // The smr_delete_notify flag is used for proper double-check
-  // locking in order to reduce the traffic on the smr_delete_lock.
-  static bool smr_delete_notify();
-  static void set_smr_delete_notify();
-  static void clear_smr_delete_notify();
-  static void inc_smr_deleted_thread_cnt();
-  static void update_smr_deleted_thread_time_max(uint new_value);
-  static void add_smr_deleted_thread_times(uint add_value);
   static void inc_smr_tlh_cnt();
   static void update_smr_tlh_time_max(uint new_value);
   static void add_smr_tlh_times(uint add_value);
--- a/src/hotspot/share/runtime/thread.inline.hpp	Thu Nov 30 10:40:48 2017 -0800
+++ b/src/hotspot/share/runtime/thread.inline.hpp	Thu Nov 30 18:38:20 2017 -0500
@@ -212,34 +212,8 @@
   OrderAccess::release_store((volatile jint *) &_terminated, (jint) _thread_terminated);
 }
 
-inline ThreadsList* Threads::get_smr_java_thread_list() {
-  return (ThreadsList*)OrderAccess::load_acquire(&_smr_java_thread_list);
-}
-
-inline ThreadsList* Threads::xchg_smr_java_thread_list(ThreadsList* new_list) {
-  return (ThreadsList*)Atomic::xchg(new_list, &_smr_java_thread_list);
-}
-
-inline void Threads::inc_smr_deleted_thread_cnt() {
-  Atomic::inc(&_smr_deleted_thread_cnt);
-}
-
-inline void Threads::update_smr_deleted_thread_time_max(uint new_value) {
-  while (true) {
-    uint cur_value = _smr_deleted_thread_time_max;
-    if (new_value <= cur_value) {
-      // No need to update max value so we're done.
-      break;
-    }
-    if (Atomic::cmpxchg(new_value, &_smr_deleted_thread_time_max, cur_value) == cur_value) {
-      // Updated max value so we're done. Otherwise try it all again.
-      break;
-    }
-  }
-}
-
-inline void Threads::add_smr_deleted_thread_times(uint add_value) {
-  Atomic::add(add_value, &_smr_deleted_thread_times);
+inline void Threads::add_smr_tlh_times(uint add_value) {
+  Atomic::add(add_value, &_smr_tlh_times);
 }
 
 inline void Threads::inc_smr_tlh_cnt() {
@@ -260,8 +234,4 @@
   }
 }
 
-inline void Threads::add_smr_tlh_times(uint add_value) {
-  Atomic::add(add_value, &_smr_tlh_times);
-}
-
 #endif // SHARE_VM_RUNTIME_THREAD_INLINE_HPP