diff options
author | 2023-06-15 15:48:20 +0100 | |
---|---|---|
committer | 2023-07-03 10:52:06 +0000 | |
commit | fdfa590b7b43ca70e497f1a8afe9a641b57ece56 (patch) | |
tree | 6054b4e9ae772c2f135fedde6be62864206ddcad /runtime/oat_file_assistant.h | |
parent | 2f8499ef214f9eadb75b36eab43214842f4da64b (diff) |
Reduce multidex checksum to single scalar value.
Change GetMultiDexChecksums to return a single value rather than
a vector. The single checksum represents the whole multidex set,
and will change if any dex file within the multidex set changes.
Fundamentally, we need a value to represent a .zip/.jar archive,
so that we can check whether our build artifacts are up to date.
We previously used a vector of CRC32 values (one per dex file),
however, one combined checksum per archive is also sufficient.
This is necessary, since the future multidex format will have
single zip entry, so we need to adjust the code to expect just
one checksum per zip file. This separates the change to own CL.
The two sides of the checksum comparison are trivially reduced:
* Zip files are reduced by XORing the individual CRC values.
* Likewise, checksums of already open DexFiles are XORed.
As a consequence, ClassLoader path needs to be reduced to
print only single checksum per jar file as well.
Bug: 266950186
Test: ./art/test.py -b --host
Change-Id: I848aee1e4836e87945a5172c7594e266739451e9
Diffstat (limited to 'runtime/oat_file_assistant.h')
-rw-r--r-- | runtime/oat_file_assistant.h | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/runtime/oat_file_assistant.h b/runtime/oat_file_assistant.h index 54287eb5f1..922dbf3e04 100644 --- a/runtime/oat_file_assistant.h +++ b/runtime/oat_file_assistant.h @@ -494,11 +494,9 @@ class OatFileAssistant { // location. OatStatus GivenOatFileStatus(const OatFile& file); - // Gets the dex checksums required for an up-to-date oat file. - // Returns cached_required_dex_checksums if the required checksums were located. Returns an empty - // list if `dex_location_` refers to a zip and there is no dex file in it. Returns nullptr if an - // error occurred. The caller shouldn't clean up or free the returned pointer. - const std::vector<uint32_t>* GetRequiredDexChecksums(std::string* error_msg); + // Gets the dex checksum required for an up-to-date oat file. + // Returns cached result from GetMultiDexChecksum. + bool GetRequiredDexChecksum(std::optional<uint32_t>* checksum, std::string* error); // Returns whether there is at least one boot image usable. bool IsPrimaryBootImageUsable(); @@ -555,8 +553,8 @@ class OatFileAssistant { // Cached value of the required dex checksums. // This should be accessed only by the GetRequiredDexChecksums() method. - std::optional<std::vector<uint32_t>> cached_required_dex_checksums_; - std::string cached_required_dex_checksums_error_; + std::optional<uint32_t> cached_required_dex_checksums_; + std::optional<std::string> cached_required_dex_checksums_error_; bool required_dex_checksums_attempted_ = false; // The AOT-compiled file of an app when the APK of the app is in /data. |