Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8255441: Cleanup ciEnv/jvmciEnv::lookup_method-s
Reviewed-by: kvn
  • Loading branch information
shipilev committed Oct 28, 2020
1 parent 8ad7f38 commit af33e16
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 46 deletions.
43 changes: 19 additions & 24 deletions src/hotspot/share/ci/ciEnv.cpp
Expand Up @@ -761,34 +761,29 @@ Method* ciEnv::lookup_method(ciInstanceKlass* accessor,
Symbol* sig,
Bytecodes::Code bc,
constantTag tag) {
// Accessibility checks are performed in ciEnv::get_method_by_index_impl.
assert(check_klass_accessibility(accessor, holder->get_Klass()), "holder not accessible");

InstanceKlass* accessor_klass = accessor->get_instanceKlass();
Klass* holder_klass = holder->get_Klass();
Method* dest_method;
LinkInfo link_info(holder_klass, name, sig, accessor_klass, LinkInfo::AccessCheck::required, LinkInfo::LoaderConstraintCheck::required, tag);

// Accessibility checks are performed in ciEnv::get_method_by_index_impl.
assert(check_klass_accessibility(accessor, holder_klass), "holder not accessible");

LinkInfo link_info(holder_klass, name, sig, accessor_klass,
LinkInfo::AccessCheck::required,
LinkInfo::LoaderConstraintCheck::required,
tag);
switch (bc) {
case Bytecodes::_invokestatic:
dest_method =
LinkResolver::resolve_static_call_or_null(link_info);
break;
case Bytecodes::_invokespecial:
dest_method =
LinkResolver::resolve_special_call_or_null(link_info);
break;
case Bytecodes::_invokeinterface:
dest_method =
LinkResolver::linktime_resolve_interface_method_or_null(link_info);
break;
case Bytecodes::_invokevirtual:
dest_method =
LinkResolver::linktime_resolve_virtual_method_or_null(link_info);
break;
default: ShouldNotReachHere();
case Bytecodes::_invokestatic:
return LinkResolver::resolve_static_call_or_null(link_info);
case Bytecodes::_invokespecial:
return LinkResolver::resolve_special_call_or_null(link_info);
case Bytecodes::_invokeinterface:
return LinkResolver::linktime_resolve_interface_method_or_null(link_info);
case Bytecodes::_invokevirtual:
return LinkResolver::linktime_resolve_virtual_method_or_null(link_info);
default:
fatal("Unhandled bytecode: %s", Bytecodes::name(bc));
return NULL; // silence compiler warnings
}

return dest_method;
}


Expand Down
38 changes: 16 additions & 22 deletions src/hotspot/share/jvmci/jvmciRuntime.cpp
Expand Up @@ -1328,29 +1328,23 @@ Method* JVMCIRuntime::lookup_method(InstanceKlass* accessor,
// Accessibility checks are performed in JVMCIEnv::get_method_by_index_impl().
assert(check_klass_accessibility(accessor, holder), "holder not accessible");

Method* dest_method;
LinkInfo link_info(holder, name, sig, accessor, LinkInfo::AccessCheck::required, LinkInfo::LoaderConstraintCheck::required, tag);
LinkInfo link_info(holder, name, sig, accessor,
LinkInfo::AccessCheck::required,
LinkInfo::LoaderConstraintCheck::required,
tag);
switch (bc) {
case Bytecodes::_invokestatic:
dest_method =
LinkResolver::resolve_static_call_or_null(link_info);
break;
case Bytecodes::_invokespecial:
dest_method =
LinkResolver::resolve_special_call_or_null(link_info);
break;
case Bytecodes::_invokeinterface:
dest_method =
LinkResolver::linktime_resolve_interface_method_or_null(link_info);
break;
case Bytecodes::_invokevirtual:
dest_method =
LinkResolver::linktime_resolve_virtual_method_or_null(link_info);
break;
default: ShouldNotReachHere();
}

return dest_method;
case Bytecodes::_invokestatic:
return LinkResolver::resolve_static_call_or_null(link_info);
case Bytecodes::_invokespecial:
return LinkResolver::resolve_special_call_or_null(link_info);
case Bytecodes::_invokeinterface:
return LinkResolver::linktime_resolve_interface_method_or_null(link_info);
case Bytecodes::_invokevirtual:
return LinkResolver::linktime_resolve_virtual_method_or_null(link_info);
default:
fatal("Unhandled bytecode: %s", Bytecodes::name(bc));
return NULL; // silence compiler warnings
}
}


Expand Down

1 comment on commit af33e16

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on af33e16 Oct 28, 2020

Choose a reason for hiding this comment

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

Please sign in to comment.