8218151: Simplify JavaThread::thread_state definition
authorshade
Fri, 01 Feb 2019 16:03:16 +0100
changeset 53606 c153b4c52e39
parent 53605 853c68ff2ed7
child 53607 9c84d2865c2d
8218151: Simplify JavaThread::thread_state definition Reviewed-by: stefank, dholmes, kbarrett
src/hotspot/share/runtime/thread.hpp
src/hotspot/share/runtime/thread.inline.hpp
--- a/src/hotspot/share/runtime/thread.hpp	Fri Feb 01 16:03:15 2019 +0100
+++ b/src/hotspot/share/runtime/thread.hpp	Fri Feb 01 16:03:16 2019 +0100
@@ -1280,15 +1280,8 @@
   address last_Java_pc(void)                     { return _anchor.last_Java_pc(); }
 
   // Safepoint support
-#if !(defined(PPC64) || defined(AARCH64))
-  JavaThreadState thread_state() const           { return _thread_state; }
-  void set_thread_state(JavaThreadState s)       { _thread_state = s;    }
-#else
-  // Use membars when accessing volatile _thread_state. See
-  // Threads::create_vm() for size checks.
   inline JavaThreadState thread_state() const;
   inline void set_thread_state(JavaThreadState s);
-#endif
   inline ThreadSafepointState* safepoint_state() const;
   inline void set_safepoint_state(ThreadSafepointState* state);
   inline bool is_at_poll_safepoint();
--- a/src/hotspot/share/runtime/thread.inline.hpp	Fri Feb 01 16:03:15 2019 +0100
+++ b/src/hotspot/share/runtime/thread.inline.hpp	Fri Feb 01 16:03:16 2019 +0100
@@ -121,15 +121,25 @@
   set_has_async_exception();
 }
 
+inline JavaThreadState JavaThread::thread_state() const    {
 #if defined(PPC64) || defined (AARCH64)
-inline JavaThreadState JavaThread::thread_state() const    {
+  // Use membars when accessing volatile _thread_state. See
+  // Threads::create_vm() for size checks.
   return (JavaThreadState) OrderAccess::load_acquire((volatile jint*)&_thread_state);
+#else
+  return _thread_state;
+#endif
 }
 
 inline void JavaThread::set_thread_state(JavaThreadState s) {
+#if defined(PPC64) || defined (AARCH64)
+  // Use membars when accessing volatile _thread_state. See
+  // Threads::create_vm() for size checks.
   OrderAccess::release_store((volatile jint*)&_thread_state, (jint)s);
+#else
+  _thread_state = s;
+#endif
 }
-#endif
 
 ThreadSafepointState* JavaThread::safepoint_state() const  {
   return _safepoint_state;