summaryrefslogtreecommitdiff
path: root/runtime/oat_file_assistant.cc
diff options
context:
space:
mode:
author Shubham Ajmera <shubhamajmera@google.com> 2017-07-24 19:11:28 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2017-07-24 19:11:28 +0000
commit2ae4bc9f5b620bc768e4ae2ecab641a06a488a70 (patch)
tree071b002a76308f0a2830aa73c251970735ecb513 /runtime/oat_file_assistant.cc
parent8bf4fece8a4cecc869f8684d52e91ade630f84df (diff)
parente4e812a917345a3cb9ac955c8a84f64dfc26b5d9 (diff)
Merge "Allow DexFile#getDexOptNeeded to check case when downgrading is required"
Diffstat (limited to 'runtime/oat_file_assistant.cc')
-rw-r--r--runtime/oat_file_assistant.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/runtime/oat_file_assistant.cc b/runtime/oat_file_assistant.cc
index c8766578c4..96423c3ac3 100644
--- a/runtime/oat_file_assistant.cc
+++ b/runtime/oat_file_assistant.cc
@@ -187,9 +187,11 @@ bool OatFileAssistant::Lock(std::string* error_msg) {
return true;
}
-int OatFileAssistant::GetDexOptNeeded(CompilerFilter::Filter target, bool profile_changed) {
+int OatFileAssistant::GetDexOptNeeded(CompilerFilter::Filter target,
+ bool profile_changed,
+ bool downgrade) {
OatFileInfo& info = GetBestInfo();
- DexOptNeeded dexopt_needed = info.GetDexOptNeeded(target, profile_changed);
+ DexOptNeeded dexopt_needed = info.GetDexOptNeeded(target, profile_changed, downgrade);
if (info.IsOatLocation() || dexopt_needed == kDex2OatFromScratch) {
return dexopt_needed;
}
@@ -230,7 +232,7 @@ OatFileAssistant::MakeUpToDate(bool profile_changed, std::string* error_msg) {
}
OatFileInfo& info = GetBestInfo();
- switch (info.GetDexOptNeeded(target, profile_changed)) {
+ switch (info.GetDexOptNeeded(target, profile_changed, /*downgrade*/ false)) {
case kNoDexOptNeeded:
return kUpdateSucceeded;
@@ -1005,9 +1007,9 @@ OatFileAssistant::OatStatus OatFileAssistant::OatFileInfo::Status() {
}
OatFileAssistant::DexOptNeeded OatFileAssistant::OatFileInfo::GetDexOptNeeded(
- CompilerFilter::Filter target, bool profile_changed) {
+ CompilerFilter::Filter target, bool profile_changed, bool downgrade) {
bool compilation_desired = CompilerFilter::IsAotCompilationEnabled(target);
- bool filter_okay = CompilerFilterIsOkay(target, profile_changed);
+ bool filter_okay = CompilerFilterIsOkay(target, profile_changed, downgrade);
if (filter_okay && Status() == kOatUpToDate) {
// The oat file is in good shape as is.
@@ -1064,7 +1066,7 @@ const OatFile* OatFileAssistant::OatFileInfo::GetFile() {
}
bool OatFileAssistant::OatFileInfo::CompilerFilterIsOkay(
- CompilerFilter::Filter target, bool profile_changed) {
+ CompilerFilter::Filter target, bool profile_changed, bool downgrade) {
const OatFile* file = GetFile();
if (file == nullptr) {
return false;
@@ -1075,7 +1077,8 @@ bool OatFileAssistant::OatFileInfo::CompilerFilterIsOkay(
VLOG(oat) << "Compiler filter not okay because Profile changed";
return false;
}
- return CompilerFilter::IsAsGoodAs(current, target);
+ return downgrade ? !CompilerFilter::IsBetter(current, target) :
+ CompilerFilter::IsAsGoodAs(current, target);
}
bool OatFileAssistant::OatFileInfo::IsExecutable() {