< prev index next >

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

Print this page

 19  *
 20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 21  * or visit www.oracle.com if you need additional information or have any
 22  * questions.
 23  *
 24  */
 25 
 26 #ifndef SHARE_RUNTIME_JAVATHREAD_INLINE_HPP
 27 #define SHARE_RUNTIME_JAVATHREAD_INLINE_HPP
 28 
 29 #include "runtime/javaThread.hpp"
 30 
 31 #include "classfile/javaClasses.hpp"
 32 #include "gc/shared/tlab_globals.hpp"
 33 #include "memory/universe.hpp"
 34 #include "oops/instanceKlass.hpp"
 35 #include "oops/oopHandle.inline.hpp"
 36 #include "runtime/atomic.hpp"
 37 #include "runtime/continuation.hpp"
 38 #include "runtime/continuationEntry.inline.hpp"

 39 #include "runtime/nonJavaThread.hpp"

 40 #include "runtime/orderAccess.hpp"
 41 #include "runtime/safepoint.hpp"
 42 
 43 inline void JavaThread::set_suspend_flag(SuspendFlags f) {
 44   uint32_t flags;
 45   do {
 46     flags = _suspend_flags;
 47   }
 48   while (Atomic::cmpxchg(&_suspend_flags, flags, (flags | f)) != flags);
 49 }
 50 inline void JavaThread::clear_suspend_flag(SuspendFlags f) {
 51   uint32_t flags;
 52   do {
 53     flags = _suspend_flags;
 54   }
 55   while (Atomic::cmpxchg(&_suspend_flags, flags, (flags & ~f)) != flags);
 56 }
 57 
 58 inline void JavaThread::set_trace_flag() {
 59   set_suspend_flag(_trace_flag);

222 inline void JavaThread::set_terminated(TerminatedTypes t) {
223   Atomic::release_store(&_terminated, t);
224 }
225 
226 inline bool JavaThread::is_active_Java_thread() const {
227   return on_thread_list() && !is_terminated();
228 }
229 
230 // Allow tracking of class initialization monitor use
231 inline void JavaThread::set_class_to_be_initialized(InstanceKlass* k) {
232   assert((k == nullptr && _class_to_be_initialized != nullptr) ||
233          (k != nullptr && _class_to_be_initialized == nullptr), "incorrect usage");
234   assert(this == Thread::current(), "Only the current thread can set this field");
235   _class_to_be_initialized = k;
236 }
237 
238 inline InstanceKlass* JavaThread::class_to_be_initialized() const {
239   return _class_to_be_initialized;
240 }
241 























242 #endif // SHARE_RUNTIME_JAVATHREAD_INLINE_HPP

 19  *
 20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 21  * or visit www.oracle.com if you need additional information or have any
 22  * questions.
 23  *
 24  */
 25 
 26 #ifndef SHARE_RUNTIME_JAVATHREAD_INLINE_HPP
 27 #define SHARE_RUNTIME_JAVATHREAD_INLINE_HPP
 28 
 29 #include "runtime/javaThread.hpp"
 30 
 31 #include "classfile/javaClasses.hpp"
 32 #include "gc/shared/tlab_globals.hpp"
 33 #include "memory/universe.hpp"
 34 #include "oops/instanceKlass.hpp"
 35 #include "oops/oopHandle.inline.hpp"
 36 #include "runtime/atomic.hpp"
 37 #include "runtime/continuation.hpp"
 38 #include "runtime/continuationEntry.inline.hpp"
 39 #include "runtime/lockStack.inline.hpp"
 40 #include "runtime/nonJavaThread.hpp"
 41 #include "runtime/objectMonitor.inline.hpp"
 42 #include "runtime/orderAccess.hpp"
 43 #include "runtime/safepoint.hpp"
 44 
 45 inline void JavaThread::set_suspend_flag(SuspendFlags f) {
 46   uint32_t flags;
 47   do {
 48     flags = _suspend_flags;
 49   }
 50   while (Atomic::cmpxchg(&_suspend_flags, flags, (flags | f)) != flags);
 51 }
 52 inline void JavaThread::clear_suspend_flag(SuspendFlags f) {
 53   uint32_t flags;
 54   do {
 55     flags = _suspend_flags;
 56   }
 57   while (Atomic::cmpxchg(&_suspend_flags, flags, (flags & ~f)) != flags);
 58 }
 59 
 60 inline void JavaThread::set_trace_flag() {
 61   set_suspend_flag(_trace_flag);

224 inline void JavaThread::set_terminated(TerminatedTypes t) {
225   Atomic::release_store(&_terminated, t);
226 }
227 
228 inline bool JavaThread::is_active_Java_thread() const {
229   return on_thread_list() && !is_terminated();
230 }
231 
232 // Allow tracking of class initialization monitor use
233 inline void JavaThread::set_class_to_be_initialized(InstanceKlass* k) {
234   assert((k == nullptr && _class_to_be_initialized != nullptr) ||
235          (k != nullptr && _class_to_be_initialized == nullptr), "incorrect usage");
236   assert(this == Thread::current(), "Only the current thread can set this field");
237   _class_to_be_initialized = k;
238 }
239 
240 inline InstanceKlass* JavaThread::class_to_be_initialized() const {
241   return _class_to_be_initialized;
242 }
243 
244 inline void JavaThread::om_set_monitor_cache(ObjectMonitor* monitor) {
245   assert(UseObjectMonitorTable, "must be");
246   assert(monitor != nullptr, "use om_clear_monitor_cache to clear");
247   assert(this == current() || monitor->owner_raw() == this, "only add owned monitors for other threads");
248   assert(this == current() || is_obj_deopt_suspend(), "thread must not run concurrently");
249 
250   _om_cache.set_monitor(monitor);
251 }
252 
253 inline void JavaThread::om_clear_monitor_cache() {
254   if (!UseObjectMonitorTable) {
255     return;
256   }
257 
258   _om_cache.clear();
259 }
260 
261 inline ObjectMonitor* JavaThread::om_get_from_monitor_cache(oop obj) {
262   assert(obj != nullptr, "do not look for null objects");
263   assert(this == current(), "only get own thread locals");
264   return _om_cache.get_monitor(obj);
265 }
266 
267 #endif // SHARE_RUNTIME_JAVATHREAD_INLINE_HPP
< prev index next >