Revert "Revert "Use compiler filter to determine oat file status.""
This reverts commit 845e5064580bd37ad5014f7aa0d078be7265464d.
Add an option to change what OatFileManager considers up-to-date.
In our tests we're allowed to write to the dalvik-cache, so it
cannot be kSpeed.
Bug: 27689078
Change-Id: I0c578705a9921114ed1fb00d360cc7448addc93a
diff --git a/runtime/oat_file_manager.cc b/runtime/oat_file_manager.cc
index 3ec3826..2f13f55 100644
--- a/runtime/oat_file_manager.cc
+++ b/runtime/oat_file_manager.cc
@@ -44,6 +44,8 @@
// If true, then we attempt to load the application image if it exists.
static constexpr bool kEnableAppImage = true;
+CompilerFilter::Filter OatFileManager::filter_ = CompilerFilter::Filter::kSpeed;
+
const OatFile* OatFileManager::RegisterOatFile(std::unique_ptr<const OatFile> oat_file) {
WriterMutexLock mu(Thread::Current(), *Locks::oat_file_manager_lock_);
DCHECK(oat_file != nullptr);
@@ -308,13 +310,10 @@
Locks::mutator_lock_->AssertNotHeld(self);
Runtime* const runtime = Runtime::Current();
- int target_compilation_type_mask = OatFileAssistant::kFullCompilation
- | OatFileAssistant::kProfileGuideCompilation
- | OatFileAssistant::kExtractOnly;
OatFileAssistant oat_file_assistant(dex_location,
oat_location,
- target_compilation_type_mask,
kRuntimeISA,
+ /*profile_changed*/false,
!runtime->IsAotCompiler());
// Lock the target oat location to avoid races generating and loading the
@@ -330,7 +329,7 @@
// Update the oat file on disk if we can. This may fail, but that's okay.
// Best effort is all that matters here.
- if (!oat_file_assistant.MakeUpToDate(/*out*/&error_msg)) {
+ if (!oat_file_assistant.MakeUpToDate(filter_, /*out*/ &error_msg)) {
LOG(INFO) << error_msg;
}
@@ -484,15 +483,7 @@
if (ContainsElement(boot_oat_files, oat_file.get())) {
continue;
}
- // Use "platform-default" if it's neither extract nor profile guided.
- // Saying 'full' could be misleading if for example the platform uses
- // compiler filters.
- const char* status = oat_file->IsExtractOnly()
- ? OatHeader::kExtractOnlyValue
- : oat_file->IsProfileGuideCompiled()
- ? OatHeader::kProfileGuideCompiledValue
- : "platform-default";
- os << oat_file->GetLocation() << ": " << status << "\n";
+ os << oat_file->GetLocation() << ": " << oat_file->GetCompilerFilter() << "\n";
}
}