Do not pass DexFile to ClassLinker::Lookup/ResolveMethod().
The DexFile can be easily retrieved from the DexCache,
so reduce the number of arguments that need to be passed.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Change-Id: I2e47280e7cb8b84595130c4abfb5ece18d7f5c75
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 093ec65..892c28d 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -7938,8 +7938,7 @@
}
template <ClassLinker::ResolveMode kResolveMode>
-ArtMethod* ClassLinker::ResolveMethod(const DexFile& dex_file,
- uint32_t method_idx,
+ArtMethod* ClassLinker::ResolveMethod(uint32_t method_idx,
Handle<mirror::DexCache> dex_cache,
Handle<mirror::ClassLoader> class_loader,
ArtMethod* referrer,
@@ -7957,6 +7956,7 @@
DCHECK(resolved->GetDeclaringClassUnchecked() != nullptr) << resolved->GetDexMethodIndex();
return resolved;
}
+ const DexFile& dex_file = *dex_cache->GetDexFile();
const DexFile::MethodId& method_id = dex_file.GetMethodId(method_idx);
ObjPtr<mirror::Class> klass = nullptr;
if (valid_dex_cache_method) {
@@ -8048,8 +8048,7 @@
}
}
-ArtMethod* ClassLinker::ResolveMethodWithoutInvokeType(const DexFile& dex_file,
- uint32_t method_idx,
+ArtMethod* ClassLinker::ResolveMethodWithoutInvokeType(uint32_t method_idx,
Handle<mirror::DexCache> dex_cache,
Handle<mirror::ClassLoader> class_loader) {
ArtMethod* resolved = dex_cache->GetResolvedMethod(method_idx, image_pointer_size_);
@@ -8060,6 +8059,7 @@
return resolved;
}
// Fail, get the declaring class.
+ const DexFile& dex_file = *dex_cache->GetDexFile();
const DexFile::MethodId& method_id = dex_file.GetMethodId(method_idx);
ObjPtr<mirror::Class> klass =
ResolveType(dex_file, method_id.class_idx_, dex_cache, class_loader);
@@ -8431,8 +8431,7 @@
// the invocation type to determine if the method is private. We
// then resolve again specifying the intended invocation type to
// force the appropriate checks.
- target_method = ResolveMethodWithoutInvokeType(*dex_file,
- method_handle.field_or_method_idx_,
+ target_method = ResolveMethodWithoutInvokeType(method_handle.field_or_method_idx_,
hs.NewHandle(referrer->GetDexCache()),
hs.NewHandle(referrer->GetClassLoader()));
if (UNLIKELY(target_method == nullptr)) {
@@ -9033,14 +9032,12 @@
// Instantiate ResolveMethod.
template ArtMethod* ClassLinker::ResolveMethod<ClassLinker::ResolveMode::kCheckICCEAndIAE>(
- const DexFile& dex_file,
uint32_t method_idx,
Handle<mirror::DexCache> dex_cache,
Handle<mirror::ClassLoader> class_loader,
ArtMethod* referrer,
InvokeType type);
template ArtMethod* ClassLinker::ResolveMethod<ClassLinker::ResolveMode::kNoChecks>(
- const DexFile& dex_file,
uint32_t method_idx,
Handle<mirror::DexCache> dex_cache,
Handle<mirror::ClassLoader> class_loader,