Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8212107: VMThread issues and cleanup
Reviewed-by: shade, dcubed, coleenp, dholmes, redestad
  • Loading branch information
robehn committed Sep 29, 2020
1 parent 6bddeb7 commit 431338bcb3c2979fff049f625da732955bdbeffe
Show file tree
Hide file tree
Showing 8 changed files with 221 additions and 334 deletions.
@@ -454,12 +454,8 @@ static bool prepare_for_emergency_dump(Thread* thread) {
Heap_lock->unlock();
}

if (VMOperationQueue_lock->owned_by_self()) {
VMOperationQueue_lock->unlock();
}

if (VMOperationRequest_lock->owned_by_self()) {
VMOperationRequest_lock->unlock();
if (VMOperation_lock->owned_by_self()) {
VMOperation_lock->unlock();
}

if (Service_lock->owned_by_self()) {
@@ -65,8 +65,7 @@ Monitor* CodeSweeper_lock = NULL;
Mutex* MethodData_lock = NULL;
Mutex* TouchedMethodLog_lock = NULL;
Mutex* RetData_lock = NULL;
Monitor* VMOperationQueue_lock = NULL;
Monitor* VMOperationRequest_lock = NULL;
Monitor* VMOperation_lock = NULL;
Monitor* Threads_lock = NULL;
Mutex* NonJavaThreadsList_lock = NULL;
Mutex* NonJavaThreadsListSync_lock = NULL;
@@ -280,8 +279,7 @@ void mutex_init() {
def(NonJavaThreadsList_lock , PaddedMutex, barrier, true, _safepoint_check_never);
def(NonJavaThreadsListSync_lock , PaddedMutex, leaf, true, _safepoint_check_never);

def(VMOperationQueue_lock , PaddedMonitor, nonleaf, true, _safepoint_check_never); // VM_thread allowed to block on these
def(VMOperationRequest_lock , PaddedMonitor, nonleaf, true, _safepoint_check_always);
def(VMOperation_lock , PaddedMonitor, nonleaf, true, _safepoint_check_always); // VM_thread allowed to block on these
def(RetData_lock , PaddedMutex , nonleaf, false, _safepoint_check_always);
def(Terminator_lock , PaddedMonitor, nonleaf, true, _safepoint_check_always);
def(InitCompleted_lock , PaddedMonitor, leaf, true, _safepoint_check_never);
@@ -58,8 +58,7 @@ extern Monitor* CodeSweeper_lock; // a lock used by the sweeper o
extern Mutex* MethodData_lock; // a lock on installation of method data
extern Mutex* TouchedMethodLog_lock; // a lock on allocation of LogExecutedMethods info
extern Mutex* RetData_lock; // a lock on installation of RetData inside method data
extern Monitor* VMOperationQueue_lock; // a lock on queue of vm_operations waiting to execute
extern Monitor* VMOperationRequest_lock; // a lock on Threads waiting for a vm_operation to terminate
extern Monitor* VMOperation_lock; // a lock on queue of vm_operations waiting to execute
extern Monitor* Threads_lock; // a lock on the Threads table of active Java threads
// (also used by Safepoints too to block threads creation/destruction)
extern Mutex* NonJavaThreadsList_lock; // a lock on the NonJavaThreads list
@@ -255,8 +255,6 @@ Thread::Thread() {
NOT_PRODUCT(_skip_gcalot = false;)
_jvmti_env_iteration_count = 0;
set_allocated_bytes(0);
_vm_operation_started_count = 0;
_vm_operation_completed_count = 0;
_current_pending_monitor = NULL;
_current_pending_monitor_is_from_java = true;
_current_waiting_monitor = NULL;
@@ -401,9 +401,6 @@ class Thread: public ThreadShadow {

JFR_ONLY(DEFINE_THREAD_LOCAL_FIELD_JFR;) // Thread-local data for jfr

int _vm_operation_started_count; // VM_Operation support
int _vm_operation_completed_count; // VM_Operation support

ObjectMonitor* _current_pending_monitor; // ObjectMonitor this thread
// is waiting to lock
bool _current_pending_monitor_is_from_java; // locking is from Java code
@@ -621,11 +618,6 @@ class Thread: public ThreadShadow {

bool is_trace_suspend() { return (_suspend_flags & _trace_flag) != 0; }

// VM operation support
int vm_operation_ticket() { return ++_vm_operation_started_count; }
int vm_operation_completed_count() { return _vm_operation_completed_count; }
void increment_vm_operation_completed_count() { _vm_operation_completed_count++; }

// For tracking the heavyweight monitor the thread is pending on.
ObjectMonitor* current_pending_monitor() {
return _current_pending_monitor;
@@ -121,14 +121,12 @@ class VM_Operation : public StackObj {

private:
Thread* _calling_thread;
VM_Operation* _next;
VM_Operation* _prev;

// The VM operation name array
static const char* _names[];

public:
VM_Operation() : _calling_thread(NULL), _next(NULL), _prev(NULL) {}
VM_Operation() : _calling_thread(NULL) {}

// VM operation support (used by VM thread)
Thread* calling_thread() const { return _calling_thread; }
@@ -148,12 +146,6 @@ class VM_Operation : public StackObj {
virtual bool doit_prologue() { return true; };
virtual void doit_epilogue() {};

// Linking
VM_Operation *next() const { return _next; }
VM_Operation *prev() const { return _prev; }
void set_next(VM_Operation *next) { _next = next; }
void set_prev(VM_Operation *prev) { _prev = prev; }

// Configuration. Override these appropriately in subclasses.
virtual VMOp_Type type() const = 0;
virtual bool allow_nested_vm_operations() const { return false; }

0 comments on commit 431338b

Please sign in to comment.