Improve dex location canonicalization-related performance.
Eagerly add canonical dex file locations to the OatFile's
primary lookup map in Setup(). This moves the boot.oat work
from every app startup to the zygote initialization. Since
we always ended up initializing the canonical location map
anyway due to the way that we're loading dex files, the lazy
initialization didn't save anything.
Clean up dex file name canonicalization to make sure we
free() the memory returned by realpath() rather than using
std::unique_ptr<> with the default deleter.
Avoid some unnecessary duplicate OatDexFile lookups.
Bug: 16828525
Bug: 17346103
Change-Id: Id8fbc8992f62996138eb2006a0046c6529747c09
diff --git a/test/117-nopatchoat/nopatchoat.cc b/test/117-nopatchoat/nopatchoat.cc
index ced7f6e..5994653 100644
--- a/test/117-nopatchoat/nopatchoat.cc
+++ b/test/117-nopatchoat/nopatchoat.cc
@@ -28,9 +28,9 @@
ScopedObjectAccess soa(Thread::Current());
mirror::Class* klass = soa.Decode<mirror::Class*>(cls);
const DexFile& dex_file = klass->GetDexFile();
- const OatFile* oat_file =
- Runtime::Current()->GetClassLinker()->FindOpenedOatFileForDexFile(dex_file);
- return oat_file != nullptr && oat_file->IsExecutable();
+ const OatFile::OatDexFile* oat_dex_file =
+ Runtime::Current()->GetClassLinker()->FindOpenedOatDexFileForDexFile(dex_file);
+ return oat_dex_file != nullptr && oat_dex_file->GetOatFile()->IsExecutable();
}
};