diff options
author | Richard Uhler <ruhler@google.com> | 2015-03-24 09:51:28 -0700 |
---|---|---|
committer | Richard Uhler <ruhler@google.com> | 2015-04-03 13:10:30 -0700 |
commit | 95abd04d211470ea4b9b9191b96dd0f32e7ce3a4 (patch) | |
tree | 68d61705d30c6ea5ebd1b4d2f8306f32c01aecb5 /runtime/oat_file_assistant.h | |
parent | 425587d25832145a45a0b76beaa93996b0226f0d (diff) | |
download | android_art-95abd04d211470ea4b9b9191b96dd0f32e7ce3a4.tar.gz android_art-95abd04d211470ea4b9b9191b96dd0f32e7ce3a4.tar.bz2 android_art-95abd04d211470ea4b9b9191b96dd0f32e7ce3a4.zip |
Rename isDexOptNeededInternal and add kSelfPatchOatNeeded
This change renames isDexOptNeededInternal to getDexOptNeeded and adds
another possible result: kSelfPatchOatNeeded. kSelfPatchOatNeeded is
returned when there is no odex file to relocate from but there is an
oat file that can be relocated in place.
Change-Id: Ib9a6373f98474f1242367b5285086251a9d580e5
Diffstat (limited to 'runtime/oat_file_assistant.h')
-rw-r--r-- | runtime/oat_file_assistant.h | 67 |
1 files changed, 44 insertions, 23 deletions
diff --git a/runtime/oat_file_assistant.h b/runtime/oat_file_assistant.h index f2abcf99d3..9e7c2efc45 100644 --- a/runtime/oat_file_assistant.h +++ b/runtime/oat_file_assistant.h @@ -43,20 +43,43 @@ namespace art { // be restored and tested, or removed. class OatFileAssistant { public: - enum Status { - // kOutOfDate - An oat file is said to be out of date if the file does not - // exist, or is out of date with respect to the dex file or boot image. - kOutOfDate, - - // kNeedsRelocation - An oat file is said to need relocation if the code - // is up to date, but not yet properly relocated for address space layout - // randomization (ASLR). In this case, the oat file is neither "out of - // date" nor "up to date". - kNeedsRelocation, - - // kUpToDate - An oat file is said to be up to date if it is not out of + enum DexOptNeeded { + // kNoDexOptNeeded - The code for this dex location is up to date and can + // be used as is. + // Matches Java: dalvik.system.DexFile.NO_DEXOPT_NEEDED = 0 + kNoDexOptNeeded = 0, + + // kDex2OatNeeded - In order to make the code for this dex location up to + // date, dex2oat must be run on the dex file. + // Matches Java: dalvik.system.DexFile.DEX2OAT_NEEDED = 1 + kDex2OatNeeded = 1, + + // kPatchOatNeeded - In order to make the code for this dex location up to + // date, patchoat must be run on the odex file. + // Matches Java: dalvik.system.DexFile.PATCHOAT_NEEDED = 2 + kPatchOatNeeded = 2, + + // kSelfPatchOatNeeded - In order to make the code for this dex location + // up to date, patchoat must be run on the oat file. + // Matches Java: dalvik.system.DexFile.SELF_PATCHOAT_NEEDED = 3 + kSelfPatchOatNeeded = 3, + }; + + enum OatStatus { + // kOatOutOfDate - An oat file is said to be out of date if the file does + // not exist, or is out of date with respect to the dex file or boot + // image. + kOatOutOfDate, + + // kOatNeedsRelocation - An oat file is said to need relocation if the + // code is up to date, but not yet properly relocated for address space + // layout randomization (ASLR). In this case, the oat file is neither + // "out of date" nor "up to date". + kOatNeedsRelocation, + + // kOatUpToDate - An oat file is said to be up to date if it is not out of // date and has been properly relocated for the purposes of ASLR. - kUpToDate, + kOatUpToDate, }; // Constructs an OatFileAssistant object to assist the oat file @@ -67,7 +90,6 @@ class OatFileAssistant { // Typically the dex_location is the absolute path to the original, // un-optimized dex file. // - // // Note: Currently the dex_location must have an extension. // TODO: Relax this restriction? // @@ -121,8 +143,9 @@ class OatFileAssistant { // file. bool Lock(std::string* error_msg); - // Returns the overall compilation status for the given dex location. - Status GetStatus(); + // Return what action needs to be taken to produce up-to-date code for this + // dex location. + DexOptNeeded GetDexOptNeeded(); // Attempts to generate or relocate the oat file as needed to make it up to // date. @@ -164,7 +187,7 @@ class OatFileAssistant { // determined. const std::string* OdexFileName(); bool OdexFileExists(); - Status OdexFileStatus(); + OatStatus OdexFileStatus(); bool OdexFileIsOutOfDate(); bool OdexFileNeedsRelocation(); bool OdexFileIsUpToDate(); @@ -176,20 +199,18 @@ class OatFileAssistant { // the dex location. // // Notes: - // * To get the overall status of the compiled code for this dex_location, - // use the GetStatus() method, not the OatFileStatus() method. // * OatFileName may return null if the oat file name could not be // determined. const std::string* OatFileName(); bool OatFileExists(); - Status OatFileStatus(); + OatStatus OatFileStatus(); bool OatFileIsOutOfDate(); bool OatFileNeedsRelocation(); bool OatFileIsUpToDate(); // These methods return the status for a given opened oat file with respect // to the dex location. - Status GivenOatFileStatus(const OatFile& file); + OatStatus GivenOatFileStatus(const OatFile& file); bool GivenOatFileIsOutOfDate(const OatFile& file); bool GivenOatFileNeedsRelocation(const OatFile& file); bool GivenOatFileIsUpToDate(const OatFile& file); @@ -216,7 +237,7 @@ class OatFileAssistant { // Copy the current profile to the old profile location. void CopyProfileFile(); - // Generates the oat file by relocation from the odex file. + // Generates the oat file by relocation from the named input file. // This does not check the current status before attempting to relocate the // oat file. // Returns true on success. @@ -224,7 +245,7 @@ class OatFileAssistant { // // If there is a failure, the value of error_msg will be set to a string // describing why there was failure. error_msg must not be nullptr. - bool RelocateOatFile(std::string* error_msg); + bool RelocateOatFile(const std::string* input_file, std::string* error_msg); // Generate the oat file from the dex file. // This does not check the current status before attempting to generate the |