Skip to content

Commit 6cfd405

Browse files
author
Doug Simon
committed
8357619: [JVMCI] Revisit phantom_ref parameter in JVMCINMethodData::get_nmethod_mirror
Reviewed-by: eosterlund, never
1 parent 497a182 commit 6cfd405

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

src/hotspot/share/jvmci/jvmciCompilerToVM.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2836,7 +2836,7 @@ C2V_VMENTRY_0(jlong, translate, (JNIEnv* env, jobject, jobject obj_handle, jbool
28362836
if (data != nullptr) {
28372837
// Only the mirror in the HotSpot heap is accessible
28382838
// through JVMCINMethodData
2839-
oop nmethod_mirror = data->get_nmethod_mirror(nm, /* phantom_ref */ true);
2839+
oop nmethod_mirror = data->get_nmethod_mirror(nm);
28402840
if (nmethod_mirror != nullptr) {
28412841
result = HotSpotJVMCI::wrap(nmethod_mirror);
28422842
}
@@ -2868,7 +2868,7 @@ C2V_VMENTRY_0(jlong, translate, (JNIEnv* env, jobject, jobject obj_handle, jbool
28682868
if (data == nullptr) {
28692869
JVMCI_THROW_MSG_0(IllegalArgumentException, "Missing HotSpotNmethod data");
28702870
}
2871-
if (data->get_nmethod_mirror(nm, /* phantom_ref */ false) != nullptr) {
2871+
if (data->get_nmethod_mirror(nm) != nullptr) {
28722872
JVMCI_THROW_MSG_0(IllegalArgumentException, "Cannot overwrite existing HotSpotNmethod mirror for nmethod");
28732873
}
28742874
oop nmethod_mirror = HotSpotJVMCI::resolve(result);

src/hotspot/share/jvmci/jvmciRuntime.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -776,15 +776,11 @@ void JVMCINMethodData::add_failed_speculation(nmethod* nm, jlong speculation) {
776776
FailedSpeculation::add_failed_speculation(nm, _failed_speculations, data, length);
777777
}
778778

779-
oop JVMCINMethodData::get_nmethod_mirror(nmethod* nm, bool phantom_ref) {
779+
oop JVMCINMethodData::get_nmethod_mirror(nmethod* nm) {
780780
if (_nmethod_mirror_index == -1) {
781781
return nullptr;
782782
}
783-
if (phantom_ref) {
784-
return nm->oop_at_phantom(_nmethod_mirror_index);
785-
} else {
786-
return nm->oop_at(_nmethod_mirror_index);
787-
}
783+
return nm->oop_at(_nmethod_mirror_index);
788784
}
789785

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

804800
void JVMCINMethodData::invalidate_nmethod_mirror(nmethod* nm) {
805-
oop nmethod_mirror = get_nmethod_mirror(nm, /* phantom_ref */ false);
801+
oop nmethod_mirror = get_nmethod_mirror(nm);
806802
if (nmethod_mirror == nullptr) {
807803
return;
808804
}
@@ -2178,7 +2174,7 @@ JVMCI::CodeInstallResult JVMCIRuntime::register_method(JVMCIEnv* JVMCIENV,
21782174
JVMCINMethodData* data = nm->jvmci_nmethod_data();
21792175
assert(data != nullptr, "must be");
21802176
if (install_default) {
2181-
assert(!nmethod_mirror.is_hotspot() || data->get_nmethod_mirror(nm, /* phantom_ref */ false) == nullptr, "must be");
2177+
assert(!nmethod_mirror.is_hotspot() || data->get_nmethod_mirror(nm) == nullptr, "must be");
21822178
if (entry_bci == InvocationEntryBci) {
21832179
// If there is an old version we're done with it
21842180
nmethod* old = method->code();
@@ -2221,7 +2217,7 @@ JVMCI::CodeInstallResult JVMCIRuntime::register_method(JVMCIEnv* JVMCIENV,
22212217
}
22222218
}
22232219
} else {
2224-
assert(!nmethod_mirror.is_hotspot() || data->get_nmethod_mirror(nm, /* phantom_ref */ false) == HotSpotJVMCI::resolve(nmethod_mirror), "must be");
2220+
assert(!nmethod_mirror.is_hotspot() || data->get_nmethod_mirror(nm) == HotSpotJVMCI::resolve(nmethod_mirror), "must be");
22252221
MutexLocker ml(NMethodState_lock, Mutex::_no_safepoint_check_flag);
22262222
if (!nm->make_in_use()) {
22272223
result = JVMCI::nmethod_reclaimed;

src/hotspot/share/jvmci/jvmciRuntime.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class JVMCINMethodData : public ResourceObj {
124124
void invalidate_nmethod_mirror(nmethod* nm);
125125

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

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

0 commit comments

Comments
 (0)