8318940: [JVMCI] do not set HotSpotNmethod oop for a default HotSpotNmethod

Reviewed-by: thartmann, never
This commit is contained in:
Doug Simon 2023-10-31 14:16:38 +00:00
parent 3e39d7b34c
commit 7452d50be5
2 changed files with 6 additions and 6 deletions

View File

@ -2779,11 +2779,11 @@ C2V_VMENTRY_0(jlong, translate, (JNIEnv* env, jobject, jobject obj_handle, jbool
} else { } else {
// Link the new HotSpotNmethod to the nmethod // Link the new HotSpotNmethod to the nmethod
PEER_JVMCIENV->initialize_installed_code(result, nm, JVMCI_CHECK_0); PEER_JVMCIENV->initialize_installed_code(result, nm, JVMCI_CHECK_0);
// Only HotSpotNmethod instances in the HotSpot heap are tracked directly by the runtime. // Only non-default HotSpotNmethod instances in the HotSpot heap are tracked directly by the runtime.
if (PEER_JVMCIENV->is_hotspot()) { if (!isDefault && PEER_JVMCIENV->is_hotspot()) {
JVMCINMethodData* data = nm->jvmci_nmethod_data(); JVMCINMethodData* data = nm->jvmci_nmethod_data();
if (data == nullptr) { if (data == nullptr) {
JVMCI_THROW_MSG_0(IllegalArgumentException, "Cannot set HotSpotNmethod mirror for default nmethod"); JVMCI_THROW_MSG_0(IllegalArgumentException, "Missing HotSpotNmethod data");
} }
if (data->get_nmethod_mirror(nm, /* phantom_ref */ false) != nullptr) { if (data->get_nmethod_mirror(nm, /* phantom_ref */ false) != nullptr) {
JVMCI_THROW_MSG_0(IllegalArgumentException, "Cannot overwrite existing HotSpotNmethod mirror for nmethod"); JVMCI_THROW_MSG_0(IllegalArgumentException, "Cannot overwrite existing HotSpotNmethod mirror for nmethod");

View File

@ -824,10 +824,10 @@ oop JVMCINMethodData::get_nmethod_mirror(nmethod* nm, bool phantom_ref) {
} }
void JVMCINMethodData::set_nmethod_mirror(nmethod* nm, oop new_mirror) { void JVMCINMethodData::set_nmethod_mirror(nmethod* nm, oop new_mirror) {
assert(_nmethod_mirror_index != -1, "cannot set JVMCI mirror for nmethod"); guarantee(_nmethod_mirror_index != -1, "cannot set JVMCI mirror for nmethod");
oop* addr = nm->oop_addr_at(_nmethod_mirror_index); oop* addr = nm->oop_addr_at(_nmethod_mirror_index);
assert(new_mirror != nullptr, "use clear_nmethod_mirror to clear the mirror"); guarantee(new_mirror != nullptr, "use clear_nmethod_mirror to clear the mirror");
assert(*addr == nullptr, "cannot overwrite non-null mirror"); guarantee(*addr == nullptr, "cannot overwrite non-null mirror");
*addr = new_mirror; *addr = new_mirror;