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/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 2d43476..d51bded 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -701,7 +701,6 @@
// stable order.
static void ResolveConstStrings(Handle<mirror::DexCache> dex_cache,
- const DexFile& dex_file,
const DexFile::CodeItem* code_item)
REQUIRES_SHARED(Locks::mutator_lock_) {
if (code_item == nullptr) {
@@ -717,8 +716,7 @@
dex::StringIndex string_index((inst->Opcode() == Instruction::CONST_STRING)
? inst->VRegB_21c()
: inst->VRegB_31c());
- ObjPtr<mirror::String> string =
- class_linker->ResolveString(dex_file, string_index, dex_cache);
+ ObjPtr<mirror::String> string = class_linker->ResolveString(string_index, dex_cache);
CHECK(string != nullptr) << "Could not allocate a string when forcing determinism";
break;
}
@@ -773,7 +771,7 @@
continue;
}
previous_method_idx = method_idx;
- ResolveConstStrings(dex_cache, *dex_file, it.GetMethodCodeItem());
+ ResolveConstStrings(dex_cache, it.GetMethodCodeItem());
it.Next();
}
DCHECK(!it.HasNext());
@@ -2331,7 +2329,6 @@
StackHandleScope<1> hs(Thread::Current());
Handle<mirror::DexCache> dex_cache = hs.NewHandle(klass->GetDexCache());
- const DexFile* dex_file = manager_->GetDexFile();
const DexFile::ClassDef* class_def = klass->GetClassDef();
ClassLinker* class_linker = manager_->GetClassLinker();
@@ -2344,7 +2341,7 @@
if (value_it.GetValueType() == annotations::RuntimeEncodedStaticFieldValueIterator::kString) {
// Resolve the string. This will intern the string.
art::ObjPtr<mirror::String> resolved = class_linker->ResolveString(
- *dex_file, dex::StringIndex(value_it.GetJavaValue().i), dex_cache);
+ dex::StringIndex(value_it.GetJavaValue().i), dex_cache);
CHECK(resolved != nullptr);
}
}
@@ -2357,11 +2354,11 @@
for (const DexInstructionPcPair& inst : code_item->Instructions()) {
if (inst->Opcode() == Instruction::CONST_STRING) {
ObjPtr<mirror::String> s = class_linker->ResolveString(
- *dex_file, dex::StringIndex(inst->VRegB_21c()), dex_cache);
+ dex::StringIndex(inst->VRegB_21c()), dex_cache);
CHECK(s != nullptr);
} else if (inst->Opcode() == Instruction::CONST_STRING_JUMBO) {
ObjPtr<mirror::String> s = class_linker->ResolveString(
- *dex_file, dex::StringIndex(inst->VRegB_31c()), dex_cache);
+ dex::StringIndex(inst->VRegB_31c()), dex_cache);
CHECK(s != nullptr);
}
}
diff --git a/compiler/optimizing/sharpening.cc b/compiler/optimizing/sharpening.cc
index 64092d3..1e49411 100644
--- a/compiler/optimizing/sharpening.cc
+++ b/compiler/optimizing/sharpening.cc
@@ -262,7 +262,7 @@
// Compiling boot image. Resolve the string and allocate it if needed, to ensure
// the string will be added to the boot image.
DCHECK(!runtime->UseJitCompilation());
- string = class_linker->ResolveString(dex_file, string_index, dex_cache);
+ string = class_linker->ResolveString(string_index, dex_cache);
CHECK(string != nullptr);
if (compiler_driver->GetSupportBootImageFixup()) {
DCHECK(ContainsElement(compiler_driver->GetDexFilesForOatFile(), &dex_file));
@@ -273,7 +273,7 @@
}
} else if (runtime->UseJitCompilation()) {
DCHECK(!codegen->GetCompilerOptions().GetCompilePic());
- string = class_linker->LookupString(dex_file, string_index, dex_cache.Get());
+ string = class_linker->LookupString(string_index, dex_cache.Get());
if (string != nullptr) {
if (runtime->GetHeap()->ObjectIsInBootImageSpace(string)) {
desired_load_kind = HLoadString::LoadKind::kBootImageAddress;
@@ -285,7 +285,7 @@
}
} else {
// AOT app compilation. Try to lookup the string without allocating if not found.
- string = class_linker->LookupString(dex_file, string_index, dex_cache.Get());
+ string = class_linker->LookupString(string_index, dex_cache.Get());
if (string != nullptr && runtime->GetHeap()->ObjectIsInBootImageSpace(string)) {
if (codegen->GetCompilerOptions().GetCompilePic()) {
desired_load_kind = HLoadString::LoadKind::kBootImageInternTable;