8152953: ForceSafepoint operations should be more specific

Reviewed-by: dholmes, sspitsyn, rkennke, coleenp
This commit is contained in:
Robbin Ehn 2017-05-25 09:38:33 +02:00
parent 81f1f2df46
commit ad4bc13f9f
6 changed files with 40 additions and 14 deletions

View file

@ -1945,7 +1945,7 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
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;
}

View file

@ -126,8 +126,8 @@ ICStub* InlineCacheBuffer::new_ic_stub() {
// 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) {

View file

@ -985,8 +985,8 @@ JvmtiEnv::SuspendThreadList(jint request_count, const jthread* request_list, jvm
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;

View file

@ -1063,7 +1063,7 @@ static void InduceScavenge(Thread * Self, const char * Whence) {
// 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)",

View file

@ -2275,7 +2275,7 @@ void JavaThread::java_suspend() {
}
}
VM_ForceSafepoint vm_suspend;
VM_ThreadSuspend vm_suspend;
VMThread::execute(&vm_suspend);
}

View file

@ -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 @@ class VM_ClearICs: public VM_Operation {
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:
VM_ForceAsyncSafepoint() {}
void doit() {}
VMOp_Type type() const { return VMOp_ForceAsyncSafepoint; }
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:
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; }
};