diff options
| author | 2018-03-07 16:40:17 +0000 | |
|---|---|---|
| committer | 2018-03-07 16:40:17 +0000 | |
| commit | 52fcfea4b717367f92dc9ac2a25a44991dfd79fd (patch) | |
| tree | a83ebfa2f74b57a054b568aa7dc39ead033b1506 /runtime/oat_file_assistant.cc | |
| parent | abcbf8222e3eea8d6e6bc98a5552b7d11490b131 (diff) | |
| parent | ed010d4eebdf12f327856debc2c73694777cccda (diff) | |
Merge "ART: Update dex-file fallback code" into pi-dev
Diffstat (limited to 'runtime/oat_file_assistant.cc')
| -rw-r--r-- | runtime/oat_file_assistant.cc | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/runtime/oat_file_assistant.cc b/runtime/oat_file_assistant.cc index 6bf05b77a8..c5569ff909 100644 --- a/runtime/oat_file_assistant.cc +++ b/runtime/oat_file_assistant.cc @@ -1261,18 +1261,33 @@ std::unique_ptr<OatFile> OatFileAssistant::OatFileInfo::ReleaseFileForUse() { return ReleaseFile(); } - if (Status() == kOatRelocationOutOfDate) { - // We are loading an oat file for runtime use that needs relocation. - // Reload the file non-executable to ensure that we interpret out of the - // dex code in the oat file rather than trying to execute the unrelocated - // compiled code. - oat_file_assistant_->load_executable_ = false; - Reset(); - if (IsUseable()) { - CHECK(!IsExecutable()); - return ReleaseFile(); - } + switch (Status()) { + case kOatBootImageOutOfDate: + if (oat_file_assistant_->HasOriginalDexFiles()) { + // If there are original dex files, it is better to use them. + break; + } + FALLTHROUGH_INTENDED; + + case kOatRelocationOutOfDate: + // We are loading an oat file for runtime use that needs relocation. + // Reload the file non-executable to ensure that we interpret out of the + // dex code in the oat file rather than trying to execute the unrelocated + // compiled code. + oat_file_assistant_->load_executable_ = false; + Reset(); + if (IsUseable()) { + CHECK(!IsExecutable()); + return ReleaseFile(); + } + break; + + case kOatUpToDate: + case kOatCannotOpen: + case kOatDexOutOfDate: + break; } + return std::unique_ptr<OatFile>(); } |