8305404: Compile_lock not needed for InstanceKlass::implementor()

Reviewed-by: eosterlund, fparain
This commit is contained in:
Coleen Phillimore
2023-04-14 15:32:51 +00:00
parent d2ce04bb10
commit ebeee6dce8
2 changed files with 6 additions and 11 deletions

View File

@@ -623,14 +623,14 @@ ciInstanceKlass* ciInstanceKlass::implementor() {
} else {
// Go into the VM to fetch the implementor.
VM_ENTRY_MARK;
MutexLocker ml(Compile_lock);
Klass* k = get_instanceKlass()->implementor();
if (k != nullptr) {
if (k == get_instanceKlass()) {
InstanceKlass* ik = get_instanceKlass();
Klass* implk = ik->implementor();
if (implk != nullptr) {
if (implk == ik) {
// More than one implementors. Use 'this' in this case.
impl = this;
} else {
impl = CURRENT_THREAD_ENV->get_instance_klass(k);
impl = CURRENT_THREAD_ENV->get_instance_klass(implk);
}
}
}

View File

@@ -450,12 +450,7 @@ C2V_VMENTRY_NULL(jobject, getImplementor, (JNIEnv* env, jobject, ARGUMENT_PAIR(k
err_msg("Expected interface type, got %s", klass->external_name()));
}
InstanceKlass* iklass = InstanceKlass::cast(klass);
JVMCIKlassHandle handle(THREAD);
{
// Need Compile_lock around implementor()
MutexLocker locker(Compile_lock);
handle = iklass->implementor();
}
JVMCIKlassHandle handle(THREAD, iklass->implementor());
JVMCIObject implementor = JVMCIENV->get_jvmci_type(handle, JVMCI_CHECK_NULL);
return JVMCIENV->get_jobject(implementor);
C2V_END