Skip to content

Commit

Permalink
8295225: [JVMCI] codeStart should be cleared when entryPoint is cleared
Browse files Browse the repository at this point in the history
Reviewed-by: never
  • Loading branch information
Doug Simon committed Oct 13, 2022
1 parent 26ac836 commit 03e63a2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/hotspot/share/jvmci/jvmciEnv.cpp
Expand Up @@ -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;
}
Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/share/jvmci/jvmciRuntime.cpp
Expand Up @@ -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);
}
}

Expand Down
Expand Up @@ -91,15 +91,18 @@ private void check(CompileCodeTestCase testCase) {

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);
}
}

0 comments on commit 03e63a2

Please sign in to comment.