diff options
| author | 2018-03-02 09:32:03 -0800 | |
|---|---|---|
| committer | 2018-03-05 17:56:36 -0800 | |
| commit | ed010d4eebdf12f327856debc2c73694777cccda (patch) | |
| tree | 0c6e2fb2adfd31dea5b38782d201a1960151e24e /runtime/oat_file_assistant.cc | |
| parent | 63354d1597b8db8db2f9fb887fcf8de6e98acb70 (diff) | |
ART: Update dex-file fallback code
Allow non-executable oat files when the boot image is out of
date.
(cherry picked from commit 9ea84d0bd33694162eb27d9d06bb687f8794a6a0)
Bug: 73667005
Test: m test-art-host
Merged-In: Ib04339bd87fa5e268d0c636c98df62ee72d613c5
Change-Id: Ib04339bd87fa5e268d0c636c98df62ee72d613c5
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>(); } |