Re-add location check for FindDexCache
Fixes oatdump test.
Bug: 22720414
Change-Id: I4a7622ab9e47893deaea2c100fabfa1f3386a4bc
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 3b505e6..a722fa8 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -2540,10 +2540,17 @@
return dex_cache;
}
}
+ // Check dex file by location, this is used for oatdump.
+ std::string location(dex_file.GetLocation());
+ for (jobject weak_root : dex_caches_) {
+ mirror::DexCache* dex_cache = down_cast<mirror::DexCache*>(self->DecodeJObject(weak_root));
+ if (dex_cache != nullptr && dex_cache->GetDexFile()->GetLocation() == location) {
+ return dex_cache;
+ }
+ }
if (allow_failure) {
return nullptr;
}
- std::string location(dex_file.GetLocation());
// Failure, dump diagnostic and abort.
for (jobject weak_root : dex_caches_) {
mirror::DexCache* dex_cache = down_cast<mirror::DexCache*>(self->DecodeJObject(weak_root));