summaryrefslogtreecommitdiffstats
path: root/dex2oat/dex2oat.cc
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2016-03-23 15:31:51 +0000
committerRichard Uhler <ruhler@google.com>2016-03-23 13:16:59 -0700
commit7bcfcb80a31f57a84d754e00bca8698829365208 (patch)
treead987ae592e4b42348319565e7d394e0e7f9c87b /dex2oat/dex2oat.cc
parent748438ed62dbd130c2f52f2f0ede1ce75b6c28f0 (diff)
downloadandroid_art-7bcfcb80a31f57a84d754e00bca8698829365208.tar.gz
android_art-7bcfcb80a31f57a84d754e00bca8698829365208.tar.bz2
android_art-7bcfcb80a31f57a84d754e00bca8698829365208.zip
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. (cherry picked from commit 29d38e77c553c6cf71fc4dafe2d22b4e3f814872) Bug: 27689078 Change-Id: I6274188610f31dcd9d086fc080b2be93afae5a6b
Diffstat (limited to 'dex2oat/dex2oat.cc')
-rw-r--r--dex2oat/dex2oat.cc42
1 files changed, 18 insertions, 24 deletions
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index ede0bdad6a..ec6f96f599 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -257,11 +257,14 @@ NO_RETURN static void Usage(const char* fmt, ...) {
"|verify-at-runtime"
"|verify-profile"
"|interpret-only"
+ "|time"
+ "|space-profile"
"|space"
"|balanced"
+ "|speed-profile"
"|speed"
- "|everything"
- "|time):");
+ "|everything-profile"
+ "|everything):");
UsageError(" select compiler filter.");
UsageError(" verify-profile requires a --profile(-fd) to also be passed in.");
UsageError(" Example: --compiler-filter=everything");
@@ -798,10 +801,6 @@ class Dex2Oat FINAL {
Usage("Profile file should not be specified with both --profile-file-fd and --profile-file");
}
- if (compiler_options_->VerifyOnlyProfile() && !have_profile_file && !have_profile_fd) {
- Usage("verify-profile compiler filter must be used with a profile file or fd");
- }
-
if (!parser_options->oat_symbols.empty()) {
oat_unstripped_ = std::move(parser_options->oat_symbols);
}
@@ -834,14 +833,14 @@ class Dex2Oat FINAL {
// time here, which is orthogonal to space.
if (compiler_options_->inline_depth_limit_ == CompilerOptions::kUnsetInlineDepthLimit) {
compiler_options_->inline_depth_limit_ =
- (compiler_options_->compiler_filter_ == CompilerOptions::kSpace)
+ (compiler_options_->compiler_filter_ == CompilerFilter::kSpace)
// Implementation of the space filter: limit inlining depth.
? CompilerOptions::kSpaceFilterInlineDepthLimit
: CompilerOptions::kDefaultInlineDepthLimit;
}
if (compiler_options_->inline_max_code_units_ == CompilerOptions::kUnsetInlineMaxCodeUnits) {
compiler_options_->inline_max_code_units_ =
- (compiler_options_->compiler_filter_ == CompilerOptions::kSpace)
+ (compiler_options_->compiler_filter_ == CompilerFilter::kSpace)
// Implementation of the space filter: limit inlining max code units.
? CompilerOptions::kSpaceFilterInlineMaxCodeUnits
: CompilerOptions::kDefaultInlineMaxCodeUnits;
@@ -1029,11 +1028,8 @@ class Dex2Oat FINAL {
key_value_store_->Put(
OatHeader::kNativeDebuggableKey,
compiler_options_->GetNativeDebuggable() ? OatHeader::kTrueValue : OatHeader::kFalseValue);
- if (compiler_options_->IsExtractOnly()) {
- key_value_store_->Put(OatHeader::kCompilationType, OatHeader::kExtractOnlyValue);
- } else if (UseProfileGuidedCompilation()) {
- key_value_store_->Put(OatHeader::kCompilationType, OatHeader::kProfileGuideCompiledValue);
- }
+ key_value_store_->Put(OatHeader::kCompilerFilter,
+ CompilerFilter::NameOfFilter(compiler_options_->GetCompilerFilter()));
}
// Parse the arguments from the command line. In case of an unrecognized option or impossible
@@ -1322,13 +1318,7 @@ class Dex2Oat FINAL {
return false;
}
- if (compiler_options_->IsExtractOnly()) {
- // ExtractOnly oat files only contain non-quickened DEX code and are
- // therefore independent of the image file.
- image_file_location_oat_checksum_ = 0u;
- image_file_location_oat_data_begin_ = 0u;
- image_patch_delta_ = 0;
- } else {
+ if (CompilerFilter::DependsOnImageChecksum(compiler_options_->GetCompilerFilter())) {
TimingLogger::ScopedTiming t3("Loading image checksum", timings_);
std::vector<gc::space::ImageSpace*> image_spaces =
Runtime::Current()->GetHeap()->GetBootImageSpaces();
@@ -1345,6 +1335,10 @@ class Dex2Oat FINAL {
if (!image_file_location.empty()) {
key_value_store_->Put(OatHeader::kImageLocationKey, image_file_location);
}
+ } else {
+ image_file_location_oat_checksum_ = 0u;
+ image_file_location_oat_data_begin_ = 0u;
+ image_patch_delta_ = 0;
}
// Open dex files for class path.
@@ -1456,7 +1450,7 @@ class Dex2Oat FINAL {
num_methods += dex_file->NumMethodIds();
}
if (num_methods <= compiler_options_->GetNumDexMethodsThreshold()) {
- compiler_options_->SetCompilerFilter(CompilerOptions::kSpeed);
+ compiler_options_->SetCompilerFilter(CompilerFilter::kSpeed);
VLOG(compiler) << "Below method threshold, compiling anyways";
}
}
@@ -1857,7 +1851,7 @@ class Dex2Oat FINAL {
}
bool UseProfileGuidedCompilation() const {
- return !profile_file_.empty() || (profile_file_fd_ != kInvalidFd);
+ return CompilerFilter::DependsOnProfile(compiler_options_->GetCompilerFilter());
}
bool LoadProfile() {
@@ -1865,7 +1859,7 @@ class Dex2Oat FINAL {
profile_compilation_info_.reset(new ProfileCompilationInfo());
ScopedFlock flock;
- bool success = false;
+ bool success = true;
std::string error;
if (profile_file_fd_ != -1) {
// The file doesn't need to be flushed so don't check the usage.
@@ -1874,7 +1868,7 @@ class Dex2Oat FINAL {
if (flock.Init(&file, &error)) {
success = profile_compilation_info_->Load(profile_file_fd_);
}
- } else {
+ } else if (profile_file_ != "") {
if (flock.Init(profile_file_.c_str(), O_RDONLY, /* block */ true, &error)) {
success = profile_compilation_info_->Load(flock.GetFile()->Fd());
}