Do not pass DexFile to ClassLinker::Lookup/ResolveString().
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: I8c4cec43b31b27de7e4e94374fdd69c6d6ca6c13
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 012e2a4..093ec65 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -7726,8 +7726,7 @@
klass->SetReferenceInstanceOffsets(reference_offsets);
}
-ObjPtr<mirror::String> ClassLinker::ResolveString(const DexFile& dex_file,
- dex::StringIndex string_idx,
+ObjPtr<mirror::String> ClassLinker::ResolveString(dex::StringIndex string_idx,
Handle<mirror::DexCache> dex_cache) {
DCHECK(dex_cache != nullptr);
Thread::PoisonObjectPointersIfDebug();
@@ -7735,6 +7734,7 @@
if (resolved != nullptr) {
return resolved;
}
+ const DexFile& dex_file = *dex_cache->GetDexFile();
uint32_t utf16_length;
const char* utf8_data = dex_file.StringDataAndUtf16LengthByIdx(string_idx, &utf16_length);
ObjPtr<mirror::String> string = intern_table_->InternStrong(utf16_length, utf8_data);
@@ -7744,14 +7744,14 @@
return string;
}
-ObjPtr<mirror::String> ClassLinker::LookupString(const DexFile& dex_file,
- dex::StringIndex string_idx,
+ObjPtr<mirror::String> ClassLinker::LookupString(dex::StringIndex string_idx,
ObjPtr<mirror::DexCache> dex_cache) {
DCHECK(dex_cache != nullptr);
ObjPtr<mirror::String> resolved = dex_cache->GetResolvedString(string_idx);
if (resolved != nullptr) {
return resolved;
}
+ const DexFile& dex_file = *dex_cache->GetDexFile();
uint32_t utf16_length;
const char* utf8_data = dex_file.StringDataAndUtf16LengthByIdx(string_idx, &utf16_length);
ObjPtr<mirror::String> string =