8294676: [JVMCI] InstalledCode.deoptimize(false) should not touch address field

Reviewed-by: never
This commit is contained in:
Doug Simon 2022-10-01 11:20:46 +00:00
parent fd594302f7
commit b8b9b97a1a
7 changed files with 98 additions and 73 deletions

View file

@ -1547,14 +1547,18 @@ void JVMCIEnv::invalidate_nmethod_mirror(JVMCIObject mirror, bool deoptimize, JV
if (!deoptimize) {
// Prevent future executions of the nmethod but let current executions complete.
nm->make_not_entrant();
} else {
// We want the nmethod to be deoptimized immediately.
Deoptimization::deoptimize_all_marked(nm);
}
// A HotSpotNmethod instance can only reference a single nmethod
// during its lifetime so simply clear it here.
set_InstalledCode_address(mirror, 0);
// Do not clear the address field here as the Java code may still
// want to later call this method with deoptimize == true. That requires
// the address field to still be pointing at the nmethod.
} else {
// Deoptimize the nmethod immediately.
Deoptimization::deoptimize_all_marked(nm);
// A HotSpotNmethod instance can only reference a single nmethod
// during its lifetime so simply clear it here.
set_InstalledCode_address(mirror, 0);
}
}
Klass* JVMCIEnv::asKlass(JVMCIObject obj) {