Merge "Re-add location check for FindDexCache"
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));