133 inline void JavaThread::set_pending_async_exception(oop e) {
134 _pending_async_exception = e;
135 set_suspend_flag(_has_async_exception);
136 }
137
138 inline void JavaThread::set_pending_unsafe_access_error() {
139 set_suspend_flag(_has_async_exception);
140 DEBUG_ONLY(_is_unsafe_access_error = true);
141 }
142
143
144 inline JavaThread::NoAsyncExceptionDeliveryMark::NoAsyncExceptionDeliveryMark(JavaThread *t) : _target(t) {
145 assert((_target->_suspend_flags & _async_delivery_disabled) == 0, "Nesting is not supported");
146 _target->set_suspend_flag(_async_delivery_disabled);
147 }
148 inline JavaThread::NoAsyncExceptionDeliveryMark::~NoAsyncExceptionDeliveryMark() {
149 _target->clear_suspend_flag(_async_delivery_disabled);
150 }
151
152 inline JavaThreadState JavaThread::thread_state() const {
153 #if defined(PPC64) || defined (AARCH64)
154 // Use membars when accessing volatile _thread_state. See
155 // Threads::create_vm() for size checks.
156 return (JavaThreadState) Atomic::load_acquire((volatile jint*)&_thread_state);
157 #else
158 return _thread_state;
159 #endif
160 }
161
162 inline void JavaThread::set_thread_state(JavaThreadState s) {
163 assert(current_or_null() == NULL || current_or_null() == this,
164 "state change should only be called by the current thread");
165 #if defined(PPC64) || defined (AARCH64)
166 // Use membars when accessing volatile _thread_state. See
167 // Threads::create_vm() for size checks.
168 Atomic::release_store((volatile jint*)&_thread_state, (jint)s);
169 #else
170 _thread_state = s;
171 #endif
172 }
173
|
133 inline void JavaThread::set_pending_async_exception(oop e) {
134 _pending_async_exception = e;
135 set_suspend_flag(_has_async_exception);
136 }
137
138 inline void JavaThread::set_pending_unsafe_access_error() {
139 set_suspend_flag(_has_async_exception);
140 DEBUG_ONLY(_is_unsafe_access_error = true);
141 }
142
143
144 inline JavaThread::NoAsyncExceptionDeliveryMark::NoAsyncExceptionDeliveryMark(JavaThread *t) : _target(t) {
145 assert((_target->_suspend_flags & _async_delivery_disabled) == 0, "Nesting is not supported");
146 _target->set_suspend_flag(_async_delivery_disabled);
147 }
148 inline JavaThread::NoAsyncExceptionDeliveryMark::~NoAsyncExceptionDeliveryMark() {
149 _target->clear_suspend_flag(_async_delivery_disabled);
150 }
151
152 inline JavaThreadState JavaThread::thread_state() const {
153 #if defined(PPC64) || defined (AARCH64) || defined(RISCV64)
154 // Use membars when accessing volatile _thread_state. See
155 // Threads::create_vm() for size checks.
156 return (JavaThreadState) Atomic::load_acquire((volatile jint*)&_thread_state);
157 #else
158 return _thread_state;
159 #endif
160 }
161
162 inline void JavaThread::set_thread_state(JavaThreadState s) {
163 assert(current_or_null() == NULL || current_or_null() == this,
164 "state change should only be called by the current thread");
165 #if defined(PPC64) || defined (AARCH64)
166 // Use membars when accessing volatile _thread_state. See
167 // Threads::create_vm() for size checks.
168 Atomic::release_store((volatile jint*)&_thread_state, (jint)s);
169 #else
170 _thread_state = s;
171 #endif
172 }
173
|