8292917: [JVMCI] Extend InstalledCode API to make an nmethod non entrant.

Reviewed-by: never
This commit is contained in:
Doug Simon 2022-08-27 08:21:58 +00:00
parent 1500d3dfb2
commit b0e0b87891
8 changed files with 52 additions and 27 deletions

View file

@ -1510,7 +1510,7 @@ void JVMCIEnv::initialize_installed_code(JVMCIObject installed_code, CodeBlob* c
}
void JVMCIEnv::invalidate_nmethod_mirror(JVMCIObject mirror, JVMCI_TRAPS) {
void JVMCIEnv::invalidate_nmethod_mirror(JVMCIObject mirror, bool deoptimize, JVMCI_TRAPS) {
if (mirror.is_null()) {
JVMCI_THROW(NullPointerException);
}
@ -1529,8 +1529,13 @@ void JVMCIEnv::invalidate_nmethod_mirror(JVMCIObject mirror, JVMCI_TRAPS) {
"Cannot invalidate HotSpotNmethod object in shared library VM heap from non-JavaThread");
}
// Invalidating the HotSpotNmethod means we want the nmethod to be deoptimized.
Deoptimization::deoptimize_all_marked(nm);
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.