Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8212107: VMThread issues and cleanup #228

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
6 changes: 2 additions & 4 deletions src/hotspot/share/runtime/mutexLocker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions src/hotspot/share/runtime/mutexLocker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/hotspot/share/runtime/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 0 additions & 8 deletions src/hotspot/share/runtime/thread.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 1 addition & 9 deletions src/hotspot/share/runtime/vmOperations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand All @@ -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; }
Expand Down
Loading