Compute and cache oat file status in OatFileAssistant.
Instead of computing and caching IsOutOfDate + IsUpToDate separately.
Test: oat file assistant tests.
Change-Id: Ic93812d99c547f54a1c29315d9a3572180cee8d1
diff --git a/runtime/oat_file_assistant.h b/runtime/oat_file_assistant.h
index b8fea82..e706a30 100644
--- a/runtime/oat_file_assistant.h
+++ b/runtime/oat_file_assistant.h
@@ -239,12 +239,9 @@
// |OatFileExists() == true|.
CompilerFilter::Filter OatFileCompilerFilter();
- // These methods return the status for a given opened oat file with respect
- // to the dex location.
+ // Return the status for a given opened oat file with respect to the dex
+ // location.
OatStatus GivenOatFileStatus(const OatFile& file);
- bool GivenOatFileIsOutOfDate(const OatFile& file);
- bool GivenOatFileNeedsRelocation(const OatFile& file);
- bool GivenOatFileIsUpToDate(const OatFile& file);
// Generates the oat file by relocation from the named input file.
// This does not check the current status before attempting to relocate the
@@ -397,13 +394,9 @@
bool odex_file_load_attempted_ = false;
std::unique_ptr<OatFile> cached_odex_file_;
- // Cached results for OdexFileIsOutOfDate
- bool odex_file_is_out_of_date_attempted_ = false;
- bool cached_odex_file_is_out_of_date_;
-
- // Cached results for OdexFileIsUpToDate
- bool odex_file_is_up_to_date_attempted_ = false;
- bool cached_odex_file_is_up_to_date_;
+ // Cached results for OdexFileStatus
+ bool odex_file_status_attempted_ = false;
+ OatStatus cached_odex_file_status_;
// Cached value of the oat file name.
// This should be accessed only by the OatFileName() method.
@@ -417,13 +410,9 @@
bool oat_file_load_attempted_ = false;
std::unique_ptr<OatFile> cached_oat_file_;
- // Cached results for OatFileIsOutOfDate
- bool oat_file_is_out_of_date_attempted_ = false;
- bool cached_oat_file_is_out_of_date_;
-
- // Cached results for OatFileIsUpToDate
- bool oat_file_is_up_to_date_attempted_ = false;
- bool cached_oat_file_is_up_to_date_;
+ // Cached results for OatFileStatus
+ bool oat_file_status_attempted_ = false;
+ OatStatus cached_oat_file_status_;
// Cached value of the image info.
// Use the GetImageInfo method rather than accessing these directly.