< prev index next >

src/hotspot/share/runtime/javaThread.cpp

Print this page

 956   if (UseTLAB) {
 957     tlab().retire();
 958   }
 959 
 960   Threads::remove(this, is_daemon);
 961   this->smr_delete();
 962 }
 963 
 964 JavaThread* JavaThread::active() {
 965   Thread* thread = Thread::current();
 966   if (thread->is_Java_thread()) {
 967     return JavaThread::cast(thread);
 968   } else {
 969     assert(thread->is_VM_thread(), "this must be a vm thread");
 970     VM_Operation* op = ((VMThread*) thread)->vm_operation();
 971     JavaThread *ret = op == NULL ? NULL : JavaThread::cast(op->calling_thread());
 972     return ret;
 973   }
 974 }
 975 
 976 bool JavaThread::is_lock_owned(address adr) const {
 977   if (Thread::is_lock_owned(adr)) return true;
 978 
 979   for (MonitorChunk* chunk = monitor_chunks(); chunk != NULL; chunk = chunk->next()) {
 980     if (chunk->contains(adr)) return true;
 981   }
 982 
 983   return false;
 984 }
 985 
 986 bool JavaThread::is_lock_owned_current(address adr) const {
 987   address stack_end = _stack_base - _stack_size;
 988   const ContinuationEntry* ce = vthread_continuation();
 989   address stack_base = ce != nullptr ? (address)ce->entry_sp() : _stack_base;
 990   if (stack_base > adr && adr >= stack_end) {
 991     return true;
 992   }
 993 
 994   for (MonitorChunk* chunk = monitor_chunks(); chunk != NULL; chunk = chunk->next()) {
 995     if (chunk->contains(adr)) {
 996       return true;
 997     }
 998   }
 999 
1000   return false;
1001 }
1002 
1003 bool JavaThread::is_lock_owned_carrier(address adr) const {
1004   assert(is_vthread_mounted(), "");
1005   address stack_end = _stack_base - _stack_size;
1006   address stack_base = (address)vthread_continuation()->entry_sp();
1007   return stack_base > adr && adr >= stack_end;
1008 }
1009 
1010 oop JavaThread::exception_oop() const {
1011   return Atomic::load(&_exception_oop);
1012 }
1013 
1014 void JavaThread::set_exception_oop(oop o) {
1015   Atomic::store(&_exception_oop, o);
1016 }
1017 
1018 void JavaThread::add_monitor_chunk(MonitorChunk* chunk) {
1019   chunk->set_next(monitor_chunks());
1020   set_monitor_chunks(chunk);
1021 }
1022 
1023 void JavaThread::remove_monitor_chunk(MonitorChunk* chunk) {
1024   guarantee(monitor_chunks() != NULL, "must be non empty");
1025   if (monitor_chunks() == chunk) {
1026     set_monitor_chunks(chunk->next());
1027   } else {
1028     MonitorChunk* prev = monitor_chunks();
1029     while (prev->next() != chunk) prev = prev->next();

 956   if (UseTLAB) {
 957     tlab().retire();
 958   }
 959 
 960   Threads::remove(this, is_daemon);
 961   this->smr_delete();
 962 }
 963 
 964 JavaThread* JavaThread::active() {
 965   Thread* thread = Thread::current();
 966   if (thread->is_Java_thread()) {
 967     return JavaThread::cast(thread);
 968   } else {
 969     assert(thread->is_VM_thread(), "this must be a vm thread");
 970     VM_Operation* op = ((VMThread*) thread)->vm_operation();
 971     JavaThread *ret = op == NULL ? NULL : JavaThread::cast(op->calling_thread());
 972     return ret;
 973   }
 974 }
 975 


































 976 oop JavaThread::exception_oop() const {
 977   return Atomic::load(&_exception_oop);
 978 }
 979 
 980 void JavaThread::set_exception_oop(oop o) {
 981   Atomic::store(&_exception_oop, o);
 982 }
 983 
 984 void JavaThread::add_monitor_chunk(MonitorChunk* chunk) {
 985   chunk->set_next(monitor_chunks());
 986   set_monitor_chunks(chunk);
 987 }
 988 
 989 void JavaThread::remove_monitor_chunk(MonitorChunk* chunk) {
 990   guarantee(monitor_chunks() != NULL, "must be non empty");
 991   if (monitor_chunks() == chunk) {
 992     set_monitor_chunks(chunk->next());
 993   } else {
 994     MonitorChunk* prev = monitor_chunks();
 995     while (prev->next() != chunk) prev = prev->next();
< prev index next >