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 _om_cache.clear();
256 }
257 }
258
259 inline ObjectMonitor* JavaThread::om_get_from_monitor_cache(oop obj) {
260 assert(obj != nullptr, "do not look for null objects");
261 assert(this == current(), "only get own thread locals");
262 return _om_cache.get_monitor(obj);
263 }
|
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 InstanceKlass* JavaThread::set_class_being_initialized(InstanceKlass* k) {
245 assert(this == Thread::current(), "Only the current thread can set this field");
246 InstanceKlass* prev = _class_being_initialized;
247 _class_being_initialized = k;
248 return prev;
249 }
250
251 inline InstanceKlass* JavaThread::class_being_initialized() const {
252 assert(this == Thread::current(), "Only the current thread can get this field");
253 return _class_being_initialized;
254 }
255
256 inline void JavaThread::om_set_monitor_cache(ObjectMonitor* monitor) {
257 assert(UseObjectMonitorTable, "must be");
258 assert(monitor != nullptr, "use om_clear_monitor_cache to clear");
259 assert(this == current() || monitor->owner_raw() == this, "only add owned monitors for other threads");
260 assert(this == current() || is_obj_deopt_suspend(), "thread must not run concurrently");
261
262 _om_cache.set_monitor(monitor);
263 }
264
265 inline void JavaThread::om_clear_monitor_cache() {
266 if (UseObjectMonitorTable) {
267 _om_cache.clear();
268 }
269 }
270
271 inline ObjectMonitor* JavaThread::om_get_from_monitor_cache(oop obj) {
272 assert(obj != nullptr, "do not look for null objects");
273 assert(this == current(), "only get own thread locals");
274 return _om_cache.get_monitor(obj);
275 }
|