diff options
| author | 2018-03-07 16:40:17 +0000 | |
|---|---|---|
| committer | 2018-03-07 16:40:17 +0000 | |
| commit | 52fcfea4b717367f92dc9ac2a25a44991dfd79fd (patch) | |
| tree | a83ebfa2f74b57a054b568aa7dc39ead033b1506 | |
| parent | abcbf8222e3eea8d6e6bc98a5552b7d11490b131 (diff) | |
| parent | ed010d4eebdf12f327856debc2c73694777cccda (diff) | |
Merge "ART: Update dex-file fallback code" into pi-dev
| -rw-r--r-- | runtime/oat_file_assistant.cc | 37 | ||||
| -rw-r--r-- | runtime/oat_file_manager.cc | 3 |
2 files changed, 29 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>(); } diff --git a/runtime/oat_file_manager.cc b/runtime/oat_file_manager.cc index e4194442d3..f6fb9ded87 100644 --- a/runtime/oat_file_manager.cc +++ b/runtime/oat_file_manager.cc @@ -469,6 +469,9 @@ std::vector<std::unique_ptr<const DexFile>> OatFileManager::OpenDexFilesFromOat( // Get the oat file on disk. std::unique_ptr<const OatFile> oat_file(oat_file_assistant.GetBestOatFile().release()); + VLOG(oat) << "OatFileAssistant(" << dex_location << ").GetBestOatFile()=" + << reinterpret_cast<uintptr_t>(oat_file.get()) + << " (executable=" << (oat_file != nullptr ? oat_file->IsExecutable() : false) << ")"; if ((class_loader != nullptr || dex_elements != nullptr) && oat_file != nullptr) { // Prevent oat files from being loaded if no class_loader or dex_elements are provided. |