Skip to content

Commit af33e16

Browse files
committedOct 28, 2020
8255441: Cleanup ciEnv/jvmciEnv::lookup_method-s
Reviewed-by: kvn
1 parent 8ad7f38 commit af33e16

File tree

2 files changed

+35
-46
lines changed

2 files changed

+35
-46
lines changed
 

‎src/hotspot/share/ci/ciEnv.cpp

+19-24
Original file line numberDiff line numberDiff line change
@@ -761,34 +761,29 @@ Method* ciEnv::lookup_method(ciInstanceKlass* accessor,
761761
Symbol* sig,
762762
Bytecodes::Code bc,
763763
constantTag tag) {
764-
// Accessibility checks are performed in ciEnv::get_method_by_index_impl.
765-
assert(check_klass_accessibility(accessor, holder->get_Klass()), "holder not accessible");
766-
767764
InstanceKlass* accessor_klass = accessor->get_instanceKlass();
768765
Klass* holder_klass = holder->get_Klass();
769-
Method* dest_method;
770-
LinkInfo link_info(holder_klass, name, sig, accessor_klass, LinkInfo::AccessCheck::required, LinkInfo::LoaderConstraintCheck::required, tag);
766+
767+
// Accessibility checks are performed in ciEnv::get_method_by_index_impl.
768+
assert(check_klass_accessibility(accessor, holder_klass), "holder not accessible");
769+
770+
LinkInfo link_info(holder_klass, name, sig, accessor_klass,
771+
LinkInfo::AccessCheck::required,
772+
LinkInfo::LoaderConstraintCheck::required,
773+
tag);
771774
switch (bc) {
772-
case Bytecodes::_invokestatic:
773-
dest_method =
774-
LinkResolver::resolve_static_call_or_null(link_info);
775-
break;
776-
case Bytecodes::_invokespecial:
777-
dest_method =
778-
LinkResolver::resolve_special_call_or_null(link_info);
779-
break;
780-
case Bytecodes::_invokeinterface:
781-
dest_method =
782-
LinkResolver::linktime_resolve_interface_method_or_null(link_info);
783-
break;
784-
case Bytecodes::_invokevirtual:
785-
dest_method =
786-
LinkResolver::linktime_resolve_virtual_method_or_null(link_info);
787-
break;
788-
default: ShouldNotReachHere();
775+
case Bytecodes::_invokestatic:
776+
return LinkResolver::resolve_static_call_or_null(link_info);
777+
case Bytecodes::_invokespecial:
778+
return LinkResolver::resolve_special_call_or_null(link_info);
779+
case Bytecodes::_invokeinterface:
780+
return LinkResolver::linktime_resolve_interface_method_or_null(link_info);
781+
case Bytecodes::_invokevirtual:
782+
return LinkResolver::linktime_resolve_virtual_method_or_null(link_info);
783+
default:
784+
fatal("Unhandled bytecode: %s", Bytecodes::name(bc));
785+
return NULL; // silence compiler warnings
789786
}
790-
791-
return dest_method;
792787
}
793788

794789

‎src/hotspot/share/jvmci/jvmciRuntime.cpp

+16-22
Original file line numberDiff line numberDiff line change
@@ -1328,29 +1328,23 @@ Method* JVMCIRuntime::lookup_method(InstanceKlass* accessor,
13281328
// Accessibility checks are performed in JVMCIEnv::get_method_by_index_impl().
13291329
assert(check_klass_accessibility(accessor, holder), "holder not accessible");
13301330

1331-
Method* dest_method;
1332-
LinkInfo link_info(holder, name, sig, accessor, LinkInfo::AccessCheck::required, LinkInfo::LoaderConstraintCheck::required, tag);
1331+
LinkInfo link_info(holder, name, sig, accessor,
1332+
LinkInfo::AccessCheck::required,
1333+
LinkInfo::LoaderConstraintCheck::required,
1334+
tag);
13331335
switch (bc) {
1334-
case Bytecodes::_invokestatic:
1335-
dest_method =
1336-
LinkResolver::resolve_static_call_or_null(link_info);
1337-
break;
1338-
case Bytecodes::_invokespecial:
1339-
dest_method =
1340-
LinkResolver::resolve_special_call_or_null(link_info);
1341-
break;
1342-
case Bytecodes::_invokeinterface:
1343-
dest_method =
1344-
LinkResolver::linktime_resolve_interface_method_or_null(link_info);
1345-
break;
1346-
case Bytecodes::_invokevirtual:
1347-
dest_method =
1348-
LinkResolver::linktime_resolve_virtual_method_or_null(link_info);
1349-
break;
1350-
default: ShouldNotReachHere();
1351-
}
1352-
1353-
return dest_method;
1336+
case Bytecodes::_invokestatic:
1337+
return LinkResolver::resolve_static_call_or_null(link_info);
1338+
case Bytecodes::_invokespecial:
1339+
return LinkResolver::resolve_special_call_or_null(link_info);
1340+
case Bytecodes::_invokeinterface:
1341+
return LinkResolver::linktime_resolve_interface_method_or_null(link_info);
1342+
case Bytecodes::_invokevirtual:
1343+
return LinkResolver::linktime_resolve_virtual_method_or_null(link_info);
1344+
default:
1345+
fatal("Unhandled bytecode: %s", Bytecodes::name(bc));
1346+
return NULL; // silence compiler warnings
1347+
}
13541348
}
13551349

13561350

0 commit comments

Comments
 (0)
Please sign in to comment.