8229377: [JVMCI] Improve InstalledCode.invalidate for large code caches

Reviewed-by: kvn
This commit is contained in:
Tom Rodriguez 2019-12-11 17:17:58 -08:00
parent d8d4cd6508
commit 00ba4ea7b3
3 changed files with 18 additions and 19 deletions

View file

@ -814,22 +814,23 @@ class DeoptimizeMarkedClosure : public HandshakeClosure {
}
};
void Deoptimization::deoptimize_all_marked() {
void Deoptimization::deoptimize_all_marked(nmethod* nmethod_only) {
ResourceMark rm;
DeoptimizationMarker dm;
if (SafepointSynchronize::is_at_safepoint()) {
DeoptimizeMarkedClosure deopt;
// Make the dependent methods not entrant
// Make the dependent methods not entrant
if (nmethod_only != NULL) {
nmethod_only->mark_for_deoptimization();
nmethod_only->make_not_entrant();
} else {
MutexLocker mu(SafepointSynchronize::is_at_safepoint() ? NULL : CodeCache_lock, Mutex::_no_safepoint_check_flag);
CodeCache::make_marked_nmethods_not_entrant();
}
DeoptimizeMarkedClosure deopt;
if (SafepointSynchronize::is_at_safepoint()) {
Threads::java_threads_do(&deopt);
} else {
// Make the dependent methods not entrant
{
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
CodeCache::make_marked_nmethods_not_entrant();
}
DeoptimizeMarkedClosure deopt;
Handshake::execute(&deopt);
}
}