8295225: [JVMCI] codeStart should be cleared when entryPoint is cleared

Reviewed-by: never
This commit is contained in:
Doug Simon 2022-10-13 08:34:36 +00:00
parent 26ac836636
commit 03e63a2b87
3 changed files with 6 additions and 0 deletions

View File

@ -1616,6 +1616,7 @@ CodeBlob* JVMCIEnv::get_code_blob(JVMCIObject obj) {
// nmethod in the code cache.
set_InstalledCode_address(obj, 0);
set_InstalledCode_entryPoint(obj, 0);
set_HotSpotInstalledCode_codeStart(obj, 0);
}
return nm;
}

View File

@ -820,11 +820,13 @@ void JVMCINMethodData::invalidate_nmethod_mirror(nmethod* nm) {
// an InvalidInstalledCodeException.
HotSpotJVMCI::InstalledCode::set_address(jvmciEnv, nmethod_mirror, 0);
HotSpotJVMCI::InstalledCode::set_entryPoint(jvmciEnv, nmethod_mirror, 0);
HotSpotJVMCI::HotSpotInstalledCode::set_codeStart(jvmciEnv, nmethod_mirror, 0);
} else if (nm->is_not_entrant()) {
// Zero the entry point so any new invocation will fail but keep
// the address link around that so that existing activations can
// be deoptimized via the mirror (i.e. JVMCIEnv::invalidate_installed_code).
HotSpotJVMCI::InstalledCode::set_entryPoint(jvmciEnv, nmethod_mirror, 0);
HotSpotJVMCI::HotSpotInstalledCode::set_codeStart(jvmciEnv, nmethod_mirror, 0);
}
}

View File

@ -91,15 +91,18 @@ public class InvalidateInstalledCodeTest extends CodeInstallerTest {
Asserts.assertTrue(nmethod.isValid(), testCase + " : code is not valid, i = " + nmethod);
Asserts.assertTrue(nmethod.isAlive(), testCase + " : code is not alive, i = " + nmethod);
Asserts.assertNotEquals(nmethod.getStart(), 0L);
// Make nmethod non-entrant but still alive
CompilerToVMHelper.invalidateHotSpotNmethod(nmethod, false);
Asserts.assertFalse(nmethod.isValid(), testCase + " : code is valid, i = " + nmethod);
Asserts.assertTrue(nmethod.isAlive(), testCase + " : code is not alive, i = " + nmethod);
Asserts.assertEquals(nmethod.getStart(), 0L);
// Deoptimize the nmethod and cut the link to it from the HotSpotNmethod
CompilerToVMHelper.invalidateHotSpotNmethod(nmethod, true);
Asserts.assertFalse(nmethod.isValid(), testCase + " : code is valid, i = " + nmethod);
Asserts.assertFalse(nmethod.isAlive(), testCase + " : code is alive, i = " + nmethod);
Asserts.assertEquals(nmethod.getStart(), 0L);
}
}