Faster BCP checksum verification.
Avoid opening dex files for updatable BCP components.
Just collect the checksums from jar files using the
`DexFileLoader::GetMultiDexChecksums()` API.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 191828947
Change-Id: Ib737fabc832c56bffef8a98382f689aabe588bd2
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index 01d6dfe..d70b1cf 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -3498,19 +3498,18 @@
oat_checksums.remove_prefix(1u);
const std::string& bcp_filename = boot_class_path[bcp_pos];
- std::vector<std::unique_ptr<const DexFile>> dex_files;
+ std::vector<uint32_t> checksums;
+ std::vector<std::string> dex_locations;
const ArtDexFileLoader dex_file_loader;
- if (!dex_file_loader.Open(bcp_filename.c_str(),
- bcp_filename, // The location does not matter here.
- /*verify=*/ false,
- /*verify_checksum=*/ false,
- error_msg,
- &dex_files)) {
+ if (!dex_file_loader.GetMultiDexChecksums(bcp_filename.c_str(),
+ &checksums,
+ &dex_locations,
+ error_msg)) {
return false;
}
- DCHECK(!dex_files.empty());
- for (const std::unique_ptr<const DexFile>& dex_file : dex_files) {
- std::string dex_file_checksum = StringPrintf("/%08x", dex_file->GetLocationChecksum());
+ DCHECK(!checksums.empty());
+ for (uint32_t checksum : checksums) {
+ std::string dex_file_checksum = StringPrintf("/%08x", checksum);
if (!StartsWith(oat_checksums, dex_file_checksum)) {
*error_msg = StringPrintf("Dex checksum mismatch, expected %s to start with %s",
std::string(oat_checksums).c_str(),