diff options
author | David Srbecky <dsrbecky@google.com> | 2023-06-07 13:22:42 +0000 |
---|---|---|
committer | David Srbecky <dsrbecky@google.com> | 2023-06-07 18:15:44 +0000 |
commit | a2e7178e61b6be6fa53f84263ef0eeedcb56ec92 (patch) | |
tree | 7913a15843c33f5f626ee99697171e1738fdb7af | |
parent | e2721a68acbb3312df6bbf380367756d6cb5075b (diff) | |
download | art-a2e7178e61b6be6fa53f84263ef0eeedcb56ec92.tar.gz |
Remove superfluous verification from dex2oat am: 094c315126
Original change: https://android-review.googlesource.com/c/platform/art/+/2609049
Bug: 282589477
Merged-In: I01802cb4851cb18ff87f574ec0858c64bc5fd299
Change-Id: I01802cb4851cb18ff87f574ec0858c64bc5fd299
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
(cherry picked from commit 45346476271efc1e1f82d0d206f5cba8bb66a84f)
-rw-r--r-- | dex2oat/linker/oat_writer.cc | 17 | ||||
-rw-r--r-- | dex2oat/linker/oat_writer.h | 1 |
2 files changed, 12 insertions, 6 deletions
diff --git a/dex2oat/linker/oat_writer.cc b/dex2oat/linker/oat_writer.cc index cfba522632..63d2a42af3 100644 --- a/dex2oat/linker/oat_writer.cc +++ b/dex2oat/linker/oat_writer.cc @@ -472,6 +472,10 @@ bool OatWriter::AddDexFileSource(File&& dex_file_fd, const char* location) { return false; } for (auto& dex_file : dex_files) { + if (dex_file->IsCompactDexFile()) { + LOG(ERROR) << "Compact dex is only supported from vdex: " << location; + return false; + } oat_dex_files_.emplace_back(std::move(dex_file)); } return true; @@ -568,7 +572,7 @@ bool OatWriter::WriteAndOpenDexFiles( std::vector<MemMap> dex_files_map; std::vector<std::unique_ptr<const DexFile>> dex_files; if (!WriteDexFiles(vdex_file, verify, use_existing_vdex, copy_dex_files, &dex_files_map) || - !OpenDexFiles(vdex_file, verify, &dex_files_map, &dex_files)) { + !OpenDexFiles(vdex_file, &dex_files_map, &dex_files)) { return false; } @@ -3202,6 +3206,9 @@ bool OatWriter::WriteDexFiles(File* file, TimingLogger::ScopedTiming split2("Verify input Dex files", timings_); for (OatDexFile& oat_dex_file : oat_dex_files_) { const DexFile* dex_file = oat_dex_file.GetDexFile(); + if (dex_file->IsCompactDexFile()) { + continue; // Compact dex files can not be verified. + } std::string error_msg; if (!dex::Verify(dex_file, dex_file->GetLocation().c_str(), @@ -3437,7 +3444,6 @@ bool OatWriter::LayoutDexFile(OatDexFile* oat_dex_file) { bool OatWriter::OpenDexFiles( File* file, - bool verify, /*inout*/ std::vector<MemMap>* opened_dex_files_map, /*out*/ std::vector<std::unique_ptr<const DexFile>>* opened_dex_files) { TimingLogger::ScopedTiming split("OpenDexFiles", timings_); @@ -3488,10 +3494,11 @@ bool OatWriter::OpenDexFiles( std::string error_msg; ArtDexFileLoader dex_file_loader( raw_dex_file, oat_dex_file.dex_file_size_, oat_dex_file.GetLocation()); + // All dex files have been already verified in WriteDexFiles before we copied them. dex_files.emplace_back(dex_file_loader.Open(oat_dex_file.dex_file_location_checksum_, - /* oat_dex_file */ nullptr, - verify, - verify, + /*oat_dex_file=*/nullptr, + /*verify=*/false, + /*verify_checksum=*/false, &error_msg)); if (dex_files.back() == nullptr) { LOG(ERROR) << "Failed to open dex file from oat file. File: " << oat_dex_file.GetLocation() diff --git a/dex2oat/linker/oat_writer.h b/dex2oat/linker/oat_writer.h index 0e872e9f85..79ec47e37f 100644 --- a/dex2oat/linker/oat_writer.h +++ b/dex2oat/linker/oat_writer.h @@ -284,7 +284,6 @@ class OatWriter { /*out*/ std::vector<MemMap>* opened_dex_files_map); bool LayoutDexFile(OatDexFile* oat_dex_file); bool OpenDexFiles(File* file, - bool verify, /*inout*/ std::vector<MemMap>* opened_dex_files_map, /*out*/ std::vector<std::unique_ptr<const DexFile>>* opened_dex_files); void WriteQuickeningInfo(/*out*/std::vector<uint8_t>* buffer); |