8229377: [JVMCI] Improve InstalledCode.invalidate for large code caches
Reviewed-by: kvn
This commit is contained in:
parent
d8d4cd6508
commit
00ba4ea7b3
@ -1493,10 +1493,8 @@ void JVMCIEnv::invalidate_nmethod_mirror(JVMCIObject mirror, JVMCI_TRAPS) {
|
||||
|
||||
nmethodLocker nml(nm);
|
||||
if (nm->is_alive()) {
|
||||
// Invalidating the HotSpotNmethod means we want the nmethod
|
||||
// to be deoptimized.
|
||||
nm->mark_for_deoptimization();
|
||||
Deoptimization::deoptimize_all_marked();
|
||||
// Invalidating the HotSpotNmethod means we want the nmethod to be deoptimized.
|
||||
Deoptimization::deoptimize_all_marked(nm);
|
||||
}
|
||||
|
||||
// A HotSpotNmethod instance can only reference a single nmethod
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -137,13 +137,13 @@ class Deoptimization : AllStatic {
|
||||
Unpack_LIMIT = 4
|
||||
};
|
||||
|
||||
static void deoptimize_all_marked();
|
||||
// Make all nmethods that are marked_for_deoptimization not_entrant and deoptimize any live
|
||||
// activations using those nmethods. If an nmethod is passed as an argument then it is
|
||||
// marked_for_deoptimization and made not_entrant. Otherwise a scan of the code cache is done to
|
||||
// find all marked nmethods and they are made not_entrant.
|
||||
static void deoptimize_all_marked(nmethod* nmethod_only = NULL);
|
||||
|
||||
private:
|
||||
// Checks all compiled methods. Invalid methods are deleted and
|
||||
// corresponding activations are deoptimized.
|
||||
static int deoptimize_dependents();
|
||||
|
||||
// Revoke biased locks at deopt.
|
||||
static void revoke_from_deopt_handler(JavaThread* thread, frame fr, RegisterMap* map);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user