mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8152953: ForceSafepoint operations should be more specific
Reviewed-by: dholmes, sspitsyn, rkennke, coleenp
This commit is contained in:
parent
81f1f2df46
commit
ad4bc13f9f
6 changed files with 40 additions and 14 deletions
|
@ -1945,7 +1945,7 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
|
||||||
if (can_be_compiled(m, comp_level)) {
|
if (can_be_compiled(m, comp_level)) {
|
||||||
if (++_codecache_sweep_counter == CompileTheWorldSafepointInterval) {
|
if (++_codecache_sweep_counter == CompileTheWorldSafepointInterval) {
|
||||||
// Give sweeper a chance to keep up with CTW
|
// Give sweeper a chance to keep up with CTW
|
||||||
VM_ForceSafepoint op;
|
VM_CTWThreshold op;
|
||||||
VMThread::execute(&op);
|
VMThread::execute(&op);
|
||||||
_codecache_sweep_counter = 0;
|
_codecache_sweep_counter = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,8 +126,8 @@ ICStub* InlineCacheBuffer::new_ic_stub() {
|
||||||
// We do this by forcing a safepoint
|
// We do this by forcing a safepoint
|
||||||
EXCEPTION_MARK;
|
EXCEPTION_MARK;
|
||||||
|
|
||||||
VM_ForceSafepoint vfs;
|
VM_ICBufferFull ibf;
|
||||||
VMThread::execute(&vfs);
|
VMThread::execute(&ibf);
|
||||||
// We could potential get an async. exception at this point.
|
// We could potential get an async. exception at this point.
|
||||||
// In that case we will rethrow it to ourselvs.
|
// In that case we will rethrow it to ourselvs.
|
||||||
if (HAS_PENDING_EXCEPTION) {
|
if (HAS_PENDING_EXCEPTION) {
|
||||||
|
|
|
@ -985,8 +985,8 @@ JvmtiEnv::SuspendThreadList(jint request_count, const jthread* request_list, jvm
|
||||||
results[i] = JVMTI_ERROR_NONE; // indicate successful suspend
|
results[i] = JVMTI_ERROR_NONE; // indicate successful suspend
|
||||||
}
|
}
|
||||||
if (needSafepoint > 0) {
|
if (needSafepoint > 0) {
|
||||||
VM_ForceSafepoint vfs;
|
VM_ThreadsSuspendJVMTI tsj;
|
||||||
VMThread::execute(&vfs);
|
VMThread::execute(&tsj);
|
||||||
}
|
}
|
||||||
// per-thread suspend results returned via results parameter
|
// per-thread suspend results returned via results parameter
|
||||||
return JVMTI_ERROR_NONE;
|
return JVMTI_ERROR_NONE;
|
||||||
|
|
|
@ -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
|
// 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.
|
// to the VMthread and have a lifespan longer than that of this activation record.
|
||||||
// The VMThread will delete the op when completed.
|
// The VMThread will delete the op when completed.
|
||||||
VMThread::execute(new VM_ForceAsyncSafepoint());
|
VMThread::execute(new VM_ScavengeMonitors());
|
||||||
|
|
||||||
if (ObjectMonitor::Knob_Verbose) {
|
if (ObjectMonitor::Knob_Verbose) {
|
||||||
tty->print_cr("INFO: Monitor scavenge - STW posted @%s (%d)",
|
tty->print_cr("INFO: Monitor scavenge - STW posted @%s (%d)",
|
||||||
|
|
|
@ -2275,7 +2275,7 @@ void JavaThread::java_suspend() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VM_ForceSafepoint vm_suspend;
|
VM_ThreadSuspend vm_suspend;
|
||||||
VMThread::execute(&vm_suspend);
|
VMThread::execute(&vm_suspend);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,6 +106,11 @@
|
||||||
template(MarkActiveNMethods) \
|
template(MarkActiveNMethods) \
|
||||||
template(PrintCompileQueue) \
|
template(PrintCompileQueue) \
|
||||||
template(PrintClassHierarchy) \
|
template(PrintClassHierarchy) \
|
||||||
|
template(ThreadSuspend) \
|
||||||
|
template(CTWThreshold) \
|
||||||
|
template(ThreadsSuspendJVMTI) \
|
||||||
|
template(ICBufferFull) \
|
||||||
|
template(ScavengeMonitors) \
|
||||||
|
|
||||||
class VM_Operation: public CHeapObj<mtInternal> {
|
class VM_Operation: public CHeapObj<mtInternal> {
|
||||||
public:
|
public:
|
||||||
|
@ -238,20 +243,41 @@ class VM_ClearICs: public VM_Operation {
|
||||||
VMOp_Type type() const { return VMOp_ClearICs; }
|
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 {
|
class VM_ForceSafepoint: public VM_Operation {
|
||||||
public:
|
public:
|
||||||
VM_ForceSafepoint() {}
|
|
||||||
void doit() {}
|
void doit() {}
|
||||||
VMOp_Type type() const { return VMOp_ForceSafepoint; }
|
VMOp_Type type() const { return VMOp_ForceSafepoint; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// dummy vm op, evaluated just to force a safepoint
|
// empty vm op, when forcing a safepoint to suspend a thread
|
||||||
class VM_ForceAsyncSafepoint: public VM_Operation {
|
class VM_ThreadSuspend: public VM_ForceSafepoint {
|
||||||
public:
|
public:
|
||||||
VM_ForceAsyncSafepoint() {}
|
VMOp_Type type() const { return VMOp_ThreadSuspend; }
|
||||||
void doit() {}
|
};
|
||||||
VMOp_Type type() const { return VMOp_ForceAsyncSafepoint; }
|
|
||||||
|
// 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; }
|
Mode evaluation_mode() const { return _async_safepoint; }
|
||||||
bool is_cheap_allocated() const { return true; }
|
bool is_cheap_allocated() const { return true; }
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue