summaryrefslogtreecommitdiff
path: root/runtime/class_linker.cc
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2024-11-05 14:43:07 +0000
committer Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-11-28 14:38:30 +0000
commit6963ab426aca2058ab5c4cd575beaf7d1a63547b (patch)
treed88567cb70778f3352eeb5c4043a339b50c2750f /runtime/class_linker.cc
parent2191e733117542a684c7e6c87a5d8d6881ae5936 (diff)
Refactor ResolveMethod.
Introduce ResolveMethodId and ResolveMethodWithChecks to make it more explicit at the call site. This also simplifies the implementation of ResolveMethodWithChecks. Also avoid creating handles in ResolveField when the dex cache already contains the field. Test: test.py Change-Id: Ie722c6d7ecadf7c6dbd780f0fc58dfae89140a01
Diffstat (limited to 'runtime/class_linker.cc')
-rw-r--r--runtime/class_linker.cc48
1 files changed, 18 insertions, 30 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index eb9e9062cb..0c9b6e2f55 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -10455,21 +10455,17 @@ ObjPtr<mirror::MethodHandle> ClassLinker::ResolveMethodHandleForMethod(
case DexFile::MethodHandleType::kInvokeStatic: {
kind = mirror::MethodHandle::Kind::kInvokeStatic;
receiver_count = 0;
- target_method =
- ResolveMethod<ResolveMode::kCheckICCEAndIAE>(self,
- method_handle.field_or_method_idx_,
- referrer,
- InvokeType::kStatic);
+ target_method = ResolveMethodWithChecks(method_handle.field_or_method_idx_,
+ referrer,
+ InvokeType::kStatic);
break;
}
case DexFile::MethodHandleType::kInvokeInstance: {
kind = mirror::MethodHandle::Kind::kInvokeVirtual;
receiver_count = 1;
- target_method =
- ResolveMethod<ResolveMode::kCheckICCEAndIAE>(self,
- method_handle.field_or_method_idx_,
- referrer,
- InvokeType::kVirtual);
+ target_method = ResolveMethodWithChecks(method_handle.field_or_method_idx_,
+ referrer,
+ InvokeType::kVirtual);
break;
}
case DexFile::MethodHandleType::kInvokeConstructor: {
@@ -10477,11 +10473,9 @@ ObjPtr<mirror::MethodHandle> ClassLinker::ResolveMethodHandleForMethod(
// are special cased later in this method.
kind = mirror::MethodHandle::Kind::kInvokeTransform;
receiver_count = 0;
- target_method =
- ResolveMethod<ResolveMode::kCheckICCEAndIAE>(self,
- method_handle.field_or_method_idx_,
- referrer,
- InvokeType::kDirect);
+ target_method = ResolveMethodWithChecks(method_handle.field_or_method_idx_,
+ referrer,
+ InvokeType::kDirect);
break;
}
case DexFile::MethodHandleType::kInvokeDirect: {
@@ -10503,18 +10497,14 @@ ObjPtr<mirror::MethodHandle> ClassLinker::ResolveMethodHandleForMethod(
if (target_method->IsPrivate()) {
kind = mirror::MethodHandle::Kind::kInvokeDirect;
- target_method =
- ResolveMethod<ResolveMode::kCheckICCEAndIAE>(self,
- method_handle.field_or_method_idx_,
- referrer,
- InvokeType::kDirect);
+ target_method = ResolveMethodWithChecks(method_handle.field_or_method_idx_,
+ referrer,
+ InvokeType::kDirect);
} else {
kind = mirror::MethodHandle::Kind::kInvokeSuper;
- target_method =
- ResolveMethod<ResolveMode::kCheckICCEAndIAE>(self,
- method_handle.field_or_method_idx_,
- referrer,
- InvokeType::kSuper);
+ target_method = ResolveMethodWithChecks(method_handle.field_or_method_idx_,
+ referrer,
+ InvokeType::kSuper);
if (UNLIKELY(target_method == nullptr)) {
break;
}
@@ -10530,11 +10520,9 @@ ObjPtr<mirror::MethodHandle> ClassLinker::ResolveMethodHandleForMethod(
case DexFile::MethodHandleType::kInvokeInterface: {
kind = mirror::MethodHandle::Kind::kInvokeInterface;
receiver_count = 1;
- target_method =
- ResolveMethod<ResolveMode::kCheckICCEAndIAE>(self,
- method_handle.field_or_method_idx_,
- referrer,
- InvokeType::kInterface);
+ target_method = ResolveMethodWithChecks(method_handle.field_or_method_idx_,
+ referrer,
+ InvokeType::kInterface);
break;
}
}