< prev index next >

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

Print this page

115 inline void JavaThread::clear_trace_flag() {
116   clear_suspend_flag(_trace_flag);
117 }
118 inline void JavaThread::set_obj_deopt_flag() {
119   set_suspend_flag(_obj_deopt);
120 }
121 inline void JavaThread::clear_obj_deopt_flag() {
122   clear_suspend_flag(_obj_deopt);
123 }
124 
125 inline void JavaThread::set_pending_async_exception(oop e) {
126   _pending_async_exception = e;
127   set_async_exception_condition(_async_exception);
128   // Set _suspend_flags too so we save a comparison in the transition from native to Java
129   // in the native wrappers. It will be cleared in check_and_handle_async_exceptions()
130   // when we actually install the exception.
131   set_suspend_flag(_has_async_exception);
132 }
133 
134 inline JavaThreadState JavaThread::thread_state() const    {
135 #if defined(PPC64) || defined (AARCH64)
136   // Use membars when accessing volatile _thread_state. See
137   // Threads::create_vm() for size checks.
138   return (JavaThreadState) Atomic::load_acquire((volatile jint*)&_thread_state);
139 #else
140   return _thread_state;
141 #endif
142 }
143 
144 inline void JavaThread::set_thread_state(JavaThreadState s) {
145   assert(current_or_null() == NULL || current_or_null() == this,
146          "state change should only be called by the current thread");
147 #if defined(PPC64) || defined (AARCH64)
148   // Use membars when accessing volatile _thread_state. See
149   // Threads::create_vm() for size checks.
150   Atomic::release_store((volatile jint*)&_thread_state, (jint)s);
151 #else
152   _thread_state = s;
153 #endif
154 }
155 

115 inline void JavaThread::clear_trace_flag() {
116   clear_suspend_flag(_trace_flag);
117 }
118 inline void JavaThread::set_obj_deopt_flag() {
119   set_suspend_flag(_obj_deopt);
120 }
121 inline void JavaThread::clear_obj_deopt_flag() {
122   clear_suspend_flag(_obj_deopt);
123 }
124 
125 inline void JavaThread::set_pending_async_exception(oop e) {
126   _pending_async_exception = e;
127   set_async_exception_condition(_async_exception);
128   // Set _suspend_flags too so we save a comparison in the transition from native to Java
129   // in the native wrappers. It will be cleared in check_and_handle_async_exceptions()
130   // when we actually install the exception.
131   set_suspend_flag(_has_async_exception);
132 }
133 
134 inline JavaThreadState JavaThread::thread_state() const    {
135 #if defined(PPC64) || defined (AARCH64) || defined(RISCV64)
136   // Use membars when accessing volatile _thread_state. See
137   // Threads::create_vm() for size checks.
138   return (JavaThreadState) Atomic::load_acquire((volatile jint*)&_thread_state);
139 #else
140   return _thread_state;
141 #endif
142 }
143 
144 inline void JavaThread::set_thread_state(JavaThreadState s) {
145   assert(current_or_null() == NULL || current_or_null() == this,
146          "state change should only be called by the current thread");
147 #if defined(PPC64) || defined (AARCH64)
148   // Use membars when accessing volatile _thread_state. See
149   // Threads::create_vm() for size checks.
150   Atomic::release_store((volatile jint*)&_thread_state, (jint)s);
151 #else
152   _thread_state = s;
153 #endif
154 }
155 
< prev index next >