< prev index next >

src/hotspot/share/runtime/thread.cpp

Print this page




 946     }
 947   }
 948 }
 949 
 950 static int ref_use_count  = 0;
 951 
 952 bool Thread::owns_locks_but_compiled_lock() const {
 953   for (Monitor *cur = _owned_locks; cur; cur = cur->next()) {
 954     if (cur != Compile_lock) return true;
 955   }
 956   return false;
 957 }
 958 
 959 
 960 #endif
 961 
 962 #ifndef PRODUCT
 963 
 964 // The flag: potential_vm_operation notifies if this particular safepoint state could potentially
 965 // invoke the vm-thread (e.g., an oop allocation). In that case, we also have to make sure that
 966 // no threads which allow_vm_block's are held
 967 void Thread::check_for_valid_safepoint_state(bool potential_vm_operation) {
 968   // Check if current thread is allowed to block at a safepoint
 969   if (!(_allow_safepoint_count == 0)) {
 970     fatal("Possible safepoint reached by thread that does not allow it");
 971   }
 972   if (is_Java_thread() && ((JavaThread*)this)->thread_state() != _thread_in_vm) {
 973     fatal("LEAF method calling lock?");
 974   }
 975 
 976 #ifdef ASSERT
 977   if (potential_vm_operation && is_Java_thread()
 978       && !Universe::is_bootstrapping()) {
 979     // Make sure we do not hold any locks that the VM thread also uses.
 980     // This could potentially lead to deadlocks
 981     for (Monitor *cur = _owned_locks; cur; cur = cur->next()) {
 982       // Threads_lock is special, since the safepoint synchronization will not start before this is
 983       // acquired. Hence, a JavaThread cannot be holding it at a safepoint. So is VMOperationRequest_lock,
 984       // since it is used to transfer control between JavaThreads and the VMThread
 985       // Do not *exclude* any locks unless you are absolutely sure it is correct. Ask someone else first!
 986       if ((cur->allow_vm_block() &&




 946     }
 947   }
 948 }
 949 
 950 static int ref_use_count  = 0;
 951 
 952 bool Thread::owns_locks_but_compiled_lock() const {
 953   for (Monitor *cur = _owned_locks; cur; cur = cur->next()) {
 954     if (cur != Compile_lock) return true;
 955   }
 956   return false;
 957 }
 958 
 959 
 960 #endif
 961 
 962 #ifndef PRODUCT
 963 
 964 // The flag: potential_vm_operation notifies if this particular safepoint state could potentially
 965 // invoke the vm-thread (e.g., an oop allocation). In that case, we also have to make sure that
 966 // no locks which allow_vm_block's are held
 967 void Thread::check_for_valid_safepoint_state(bool potential_vm_operation) {
 968   // Check if current thread is allowed to block at a safepoint
 969   if (!(_allow_safepoint_count == 0)) {
 970     fatal("Possible safepoint reached by thread that does not allow it");
 971   }
 972   if (is_Java_thread() && ((JavaThread*)this)->thread_state() != _thread_in_vm) {
 973     fatal("LEAF method calling lock?");
 974   }
 975 
 976 #ifdef ASSERT
 977   if (potential_vm_operation && is_Java_thread()
 978       && !Universe::is_bootstrapping()) {
 979     // Make sure we do not hold any locks that the VM thread also uses.
 980     // This could potentially lead to deadlocks
 981     for (Monitor *cur = _owned_locks; cur; cur = cur->next()) {
 982       // Threads_lock is special, since the safepoint synchronization will not start before this is
 983       // acquired. Hence, a JavaThread cannot be holding it at a safepoint. So is VMOperationRequest_lock,
 984       // since it is used to transfer control between JavaThreads and the VMThread
 985       // Do not *exclude* any locks unless you are absolutely sure it is correct. Ask someone else first!
 986       if ((cur->allow_vm_block() &&


< prev index next >