Deterministic DexCache in heap images.
Preload each slot in dex cache arrays with the candidate
entry with the lowest index.
Also fix a discrepancy where we used to keep an ArtField*
in the DexCache if we kept the declaring class rather than
based on the class referenced in the corresponding FieldId.
This can result in accessing a field through a FieldId with
an unresolved class as demonstrated by the regression test.
Test: 159-app-image-fields
Test: testrunner.py --host
Bug: 30627598
Change-Id: I34735047cb064ff462cd9859e86a61ddf8615ecd
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 746cace..9a64097 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -7819,7 +7819,7 @@
mirror::String* ClassLinker::LookupString(const DexFile& dex_file,
dex::StringIndex string_idx,
- Handle<mirror::DexCache> dex_cache) {
+ ObjPtr<mirror::DexCache> dex_cache) {
DCHECK(dex_cache != nullptr);
ObjPtr<mirror::String> resolved = dex_cache->GetResolvedString(string_idx);
if (resolved != nullptr) {