Avoid recomputing the dex checksum during class loading
Thread the already computed checksum to VerifyOatAndDexFileChecksums and
LoadMultiDexFilesFromOatFile to avoid recomputing it.
Bug:17346103
(cherry picked from commit ca3459398018360d9968a52eebf727df085caf83)
Change-Id: Ie244efaca55b9e7c814b35feec7fce11fab3856d
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index 7750c8e..d1f5aa0 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -613,9 +613,18 @@
bool* obsolete_file_cleanup_failed)
LOCKS_EXCLUDED(dex_lock_, Locks::mutator_lock_);
- // verify an oat file with the given dex file. Will return false when the dex file could not be
- // verified. Will return true otherwise.
+ // Verifies:
+ // - that the oat file contains the dex file (with a matching checksum, which may be null if the
+ // file was pre-opted)
+ // - the checksums of the oat file (against the image space)
+ // - the checksum of the dex file against dex_location_checksum
+ // - that the dex file can be opened
+ // Returns true iff all verification succeed.
+ //
+ // The dex_location is the dex location as stored in the oat file header.
+ // (see DexFile::GetDexCanonicalLocation for a description of location conventions)
bool VerifyOatWithDexFile(const OatFile* oat_file, const char* dex_location,
+ const uint32_t* dex_location_checksum,
std::string* error_msg);
mirror::ArtMethod* CreateProxyConstructor(Thread* self, ConstHandle<mirror::Class> klass,