Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/hotspot/share/jvmci/jvmciCompilerToVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2831,7 +2831,7 @@ C2V_VMENTRY_0(jlong, translate, (JNIEnv* env, jobject, jobject obj_handle, jbool
if (data != nullptr) {
// Only the mirror in the HotSpot heap is accessible
// through JVMCINMethodData
oop nmethod_mirror = data->get_nmethod_mirror(nm, /* phantom_ref */ true);
oop nmethod_mirror = data->get_nmethod_mirror(nm);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the nmethod guaranteed to be on-stack here? If not it gotta be phantom.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the use of JVMCINMethodHandle equivalent to nm being on-stack?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Great, so that should be fine then.

if (nmethod_mirror != nullptr) {
result = HotSpotJVMCI::wrap(nmethod_mirror);
}
Expand Down Expand Up @@ -2863,7 +2863,7 @@ C2V_VMENTRY_0(jlong, translate, (JNIEnv* env, jobject, jobject obj_handle, jbool
if (data == nullptr) {
JVMCI_THROW_MSG_0(IllegalArgumentException, "Missing HotSpotNmethod data");
}
if (data->get_nmethod_mirror(nm, /* phantom_ref */ false) != nullptr) {
if (data->get_nmethod_mirror(nm) != nullptr) {
JVMCI_THROW_MSG_0(IllegalArgumentException, "Cannot overwrite existing HotSpotNmethod mirror for nmethod");
}
oop nmethod_mirror = HotSpotJVMCI::resolve(result);
Expand Down
14 changes: 5 additions & 9 deletions src/hotspot/share/jvmci/jvmciRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -776,15 +776,11 @@ void JVMCINMethodData::add_failed_speculation(nmethod* nm, jlong speculation) {
FailedSpeculation::add_failed_speculation(nm, _failed_speculations, data, length);
}

oop JVMCINMethodData::get_nmethod_mirror(nmethod* nm, bool phantom_ref) {
oop JVMCINMethodData::get_nmethod_mirror(nmethod* nm) {
if (_nmethod_mirror_index == -1) {
return nullptr;
}
if (phantom_ref) {
return nm->oop_at_phantom(_nmethod_mirror_index);
} else {
return nm->oop_at(_nmethod_mirror_index);
}
return nm->oop_at(_nmethod_mirror_index);
}

void JVMCINMethodData::set_nmethod_mirror(nmethod* nm, oop new_mirror) {
Expand All @@ -802,7 +798,7 @@ void JVMCINMethodData::set_nmethod_mirror(nmethod* nm, oop new_mirror) {
}

void JVMCINMethodData::invalidate_nmethod_mirror(nmethod* nm) {
oop nmethod_mirror = get_nmethod_mirror(nm, /* phantom_ref */ false);
oop nmethod_mirror = get_nmethod_mirror(nm);
if (nmethod_mirror == nullptr) {
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor typo

}
Expand Down Expand Up @@ -2178,7 +2174,7 @@ JVMCI::CodeInstallResult JVMCIRuntime::register_method(JVMCIEnv* JVMCIENV,
JVMCINMethodData* data = nm->jvmci_nmethod_data();
assert(data != nullptr, "must be");
if (install_default) {
assert(!nmethod_mirror.is_hotspot() || data->get_nmethod_mirror(nm, /* phantom_ref */ false) == nullptr, "must be");
assert(!nmethod_mirror.is_hotspot() || data->get_nmethod_mirror(nm) == nullptr, "must be");
if (entry_bci == InvocationEntryBci) {
// If there is an old version we're done with it
nmethod* old = method->code();
Expand Down Expand Up @@ -2221,7 +2217,7 @@ JVMCI::CodeInstallResult JVMCIRuntime::register_method(JVMCIEnv* JVMCIENV,
}
}
} else {
assert(!nmethod_mirror.is_hotspot() || data->get_nmethod_mirror(nm, /* phantom_ref */ false) == HotSpotJVMCI::resolve(nmethod_mirror), "must be");
assert(!nmethod_mirror.is_hotspot() || data->get_nmethod_mirror(nm) == HotSpotJVMCI::resolve(nmethod_mirror), "must be");
MutexLocker ml(NMethodState_lock, Mutex::_no_safepoint_check_flag);
if (!nm->make_in_use()) {
result = JVMCI::nmethod_reclaimed;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/jvmci/jvmciRuntime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class JVMCINMethodData : public ResourceObj {
void invalidate_nmethod_mirror(nmethod* nm);

// Gets the mirror from nm's oops table.
oop get_nmethod_mirror(nmethod* nm, bool phantom_ref);
oop get_nmethod_mirror(nmethod* nm);

// Sets the mirror in nm's oops table.
void set_nmethod_mirror(nmethod* nm, oop mirror);
Expand Down