Keep dex files live for duration of oatdump
Not keeping the dex file live caused a dex cache with a pointer to a
stale dex file resulting in oatdump failing. This is required to
remove the dex file location test that causes the class loader 068
test to fail.
Change-Id: I5d532862ab998482c0d16d7a63c6bdc3752f031a
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index a722fa8..3b505e6 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -2540,17 +2540,10 @@
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));