8152953: ForceSafepoint operations should be more specific
Reviewed-by: dholmes, sspitsyn, rkennke, coleenp
--- a/hotspot/src/share/vm/classfile/classLoader.cpp Wed May 24 17:30:45 2017 -0700
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp Thu May 25 09:38:33 2017 +0200
@@ -1945,7 +1945,7 @@
if (can_be_compiled(m, comp_level)) {
if (++_codecache_sweep_counter == CompileTheWorldSafepointInterval) {
// Give sweeper a chance to keep up with CTW
- VM_ForceSafepoint op;
+ VM_CTWThreshold op;
VMThread::execute(&op);
_codecache_sweep_counter = 0;
}
--- a/hotspot/src/share/vm/code/icBuffer.cpp Wed May 24 17:30:45 2017 -0700
+++ b/hotspot/src/share/vm/code/icBuffer.cpp Thu May 25 09:38:33 2017 +0200
@@ -126,8 +126,8 @@
// We do this by forcing a safepoint
EXCEPTION_MARK;
- VM_ForceSafepoint vfs;
- VMThread::execute(&vfs);
+ VM_ICBufferFull ibf;
+ VMThread::execute(&ibf);
// We could potential get an async. exception at this point.
// In that case we will rethrow it to ourselvs.
if (HAS_PENDING_EXCEPTION) {
--- a/hotspot/src/share/vm/prims/jvmtiEnv.cpp Wed May 24 17:30:45 2017 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiEnv.cpp Thu May 25 09:38:33 2017 +0200
@@ -985,8 +985,8 @@
results[i] = JVMTI_ERROR_NONE; // indicate successful suspend
}
if (needSafepoint > 0) {
- VM_ForceSafepoint vfs;
- VMThread::execute(&vfs);
+ VM_ThreadsSuspendJVMTI tsj;
+ VMThread::execute(&tsj);
}
// per-thread suspend results returned via results parameter
return JVMTI_ERROR_NONE;
--- a/hotspot/src/share/vm/runtime/synchronizer.cpp Wed May 24 17:30:45 2017 -0700
+++ b/hotspot/src/share/vm/runtime/synchronizer.cpp Thu May 25 09:38:33 2017 +0200
@@ -1063,7 +1063,7 @@
// Must VM_Operation instance be heap allocated as the op will be enqueue and posted
// to the VMthread and have a lifespan longer than that of this activation record.
// The VMThread will delete the op when completed.
- VMThread::execute(new VM_ForceAsyncSafepoint());
+ VMThread::execute(new VM_ScavengeMonitors());
if (ObjectMonitor::Knob_Verbose) {
tty->print_cr("INFO: Monitor scavenge - STW posted @%s (%d)",
--- a/hotspot/src/share/vm/runtime/thread.cpp Wed May 24 17:30:45 2017 -0700
+++ b/hotspot/src/share/vm/runtime/thread.cpp Thu May 25 09:38:33 2017 +0200
@@ -2275,7 +2275,7 @@
}
}
- VM_ForceSafepoint vm_suspend;
+ VM_ThreadSuspend vm_suspend;
VMThread::execute(&vm_suspend);
}
--- a/hotspot/src/share/vm/runtime/vm_operations.hpp Wed May 24 17:30:45 2017 -0700
+++ b/hotspot/src/share/vm/runtime/vm_operations.hpp Thu May 25 09:38:33 2017 +0200
@@ -106,6 +106,11 @@
template(MarkActiveNMethods) \
template(PrintCompileQueue) \
template(PrintClassHierarchy) \
+ template(ThreadSuspend) \
+ template(CTWThreshold) \
+ template(ThreadsSuspendJVMTI) \
+ template(ICBufferFull) \
+ template(ScavengeMonitors) \
class VM_Operation: public CHeapObj<mtInternal> {
public:
@@ -238,20 +243,41 @@
VMOp_Type type() const { return VMOp_ClearICs; }
};
-// dummy vm op, evaluated just to force a safepoint
+// empty vm op, evaluated just to force a safepoint
class VM_ForceSafepoint: public VM_Operation {
public:
- VM_ForceSafepoint() {}
void doit() {}
VMOp_Type type() const { return VMOp_ForceSafepoint; }
};
-// dummy vm op, evaluated just to force a safepoint
-class VM_ForceAsyncSafepoint: public VM_Operation {
+// empty vm op, when forcing a safepoint to suspend a thread
+class VM_ThreadSuspend: public VM_ForceSafepoint {
+ public:
+ VMOp_Type type() const { return VMOp_ThreadSuspend; }
+};
+
+// empty vm op, when forcing a safepoint due to ctw threshold is reached for the sweeper
+class VM_CTWThreshold: public VM_ForceSafepoint {
public:
- VM_ForceAsyncSafepoint() {}
- void doit() {}
- VMOp_Type type() const { return VMOp_ForceAsyncSafepoint; }
+ VMOp_Type type() const { return VMOp_CTWThreshold; }
+};
+
+// empty vm op, when forcing a safepoint to suspend threads from jvmti
+class VM_ThreadsSuspendJVMTI: public VM_ForceSafepoint {
+ public:
+ VMOp_Type type() const { return VMOp_ThreadsSuspendJVMTI; }
+};
+
+// empty vm op, when forcing a safepoint due to inline cache buffers being full
+class VM_ICBufferFull: public VM_ForceSafepoint {
+ public:
+ VMOp_Type type() const { return VMOp_ICBufferFull; }
+};
+
+// empty asynchronous vm op, when forcing a safepoint to scavenge monitors
+class VM_ScavengeMonitors: public VM_ForceSafepoint {
+ public:
+ VMOp_Type type() const { return VMOp_ScavengeMonitors; }
Mode evaluation_mode() const { return _async_safepoint; }
bool is_cheap_allocated() const { return true; }
};