summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/dex/verification_results.cc2
-rw-r--r--compiler/driver/compiler_options.cc22
-rw-r--r--compiler/driver/compiler_options.h42
-rw-r--r--compiler/optimizing/builder.cc4
-rw-r--r--compiler/optimizing/optimizing_compiler.cc2
5 files changed, 55 insertions, 17 deletions
diff --git a/compiler/dex/verification_results.cc b/compiler/dex/verification_results.cc
index 7c9ce1ee60..dd24220e0e 100644
--- a/compiler/dex/verification_results.cc
+++ b/compiler/dex/verification_results.cc
@@ -109,7 +109,7 @@ bool VerificationResults::IsCandidateForCompilation(MethodReference&,
return false;
}
// Don't compile class initializers unless kEverything.
- if ((compiler_options_->GetCompilerFilter() != CompilerFilter::kEverything) &&
+ if ((compiler_options_->GetCompilerFilter() != CompilerOptions::kEverything) &&
((access_flags & kAccConstructor) != 0) && ((access_flags & kAccStatic) != 0)) {
return false;
}
diff --git a/compiler/driver/compiler_options.cc b/compiler/driver/compiler_options.cc
index 1bd4c3ad80..f5969aa825 100644
--- a/compiler/driver/compiler_options.cc
+++ b/compiler/driver/compiler_options.cc
@@ -52,7 +52,7 @@ CompilerOptions::~CompilerOptions() {
// because we don't want to include the PassManagerOptions definition from the header file.
}
-CompilerOptions::CompilerOptions(CompilerFilter::Filter compiler_filter,
+CompilerOptions::CompilerOptions(CompilerFilter compiler_filter,
size_t huge_method_threshold,
size_t large_method_threshold,
size_t small_method_threshold,
@@ -147,7 +147,25 @@ void CompilerOptions::ParseDumpInitFailures(const StringPiece& option,
bool CompilerOptions::ParseCompilerOption(const StringPiece& option, UsageFn Usage) {
if (option.starts_with("--compiler-filter=")) {
const char* compiler_filter_string = option.substr(strlen("--compiler-filter=")).data();
- if (!CompilerFilter::ParseCompilerFilter(compiler_filter_string, &compiler_filter_)) {
+ if (strcmp(compiler_filter_string, "verify-none") == 0) {
+ compiler_filter_ = CompilerOptions::kVerifyNone;
+ } else if (strcmp(compiler_filter_string, "interpret-only") == 0) {
+ compiler_filter_ = CompilerOptions::kInterpretOnly;
+ } else if (strcmp(compiler_filter_string, "verify-at-runtime") == 0) {
+ compiler_filter_ = CompilerOptions::kVerifyAtRuntime;
+ } else if (strcmp(compiler_filter_string, "space") == 0) {
+ compiler_filter_ = CompilerOptions::kSpace;
+ } else if (strcmp(compiler_filter_string, "balanced") == 0) {
+ compiler_filter_ = CompilerOptions::kBalanced;
+ } else if (strcmp(compiler_filter_string, "speed") == 0) {
+ compiler_filter_ = CompilerOptions::kSpeed;
+ } else if (strcmp(compiler_filter_string, "everything") == 0) {
+ compiler_filter_ = CompilerOptions::kEverything;
+ } else if (strcmp(compiler_filter_string, "time") == 0) {
+ compiler_filter_ = CompilerOptions::kTime;
+ } else if (strcmp(compiler_filter_string, "verify-profile") == 0) {
+ compiler_filter_ = CompilerOptions::kVerifyProfile;
+ } else {
Usage("Unknown --compiler-filter value %s", compiler_filter_string);
}
} else if (option == "--compile-pic") {
diff --git a/compiler/driver/compiler_options.h b/compiler/driver/compiler_options.h
index c67ab6ef14..11a4e06313 100644
--- a/compiler/driver/compiler_options.h
+++ b/compiler/driver/compiler_options.h
@@ -22,7 +22,6 @@
#include <vector>
#include "base/macros.h"
-#include "compiler_filter.h"
#include "globals.h"
#include "utils.h"
@@ -30,8 +29,20 @@ namespace art {
class CompilerOptions FINAL {
public:
+ enum CompilerFilter {
+ kVerifyNone, // Skip verification and compile nothing except JNI stubs.
+ kInterpretOnly, // Verify, and compile only JNI stubs.
+ kVerifyAtRuntime, // Only compile JNI stubs and verify at runtime.
+ kSpace, // Maximize space savings.
+ kBalanced, // Try to get the best performance return on compilation investment.
+ kSpeed, // Maximize runtime performance.
+ kEverything, // Force compilation of everything capable of being compiled.
+ kTime, // Compile methods, but minimize compilation time.
+ kVerifyProfile, // Verify only the classes in the profile.
+ };
+
// Guide heuristics to determine whether to compile method if profile data not available.
- static const CompilerFilter::Filter kDefaultCompilerFilter = CompilerFilter::kSpeed;
+ static const CompilerFilter kDefaultCompilerFilter = kSpeed;
static const size_t kDefaultHugeMethodThreshold = 10000;
static const size_t kDefaultLargeMethodThreshold = 600;
static const size_t kDefaultSmallMethodThreshold = 60;
@@ -53,7 +64,7 @@ class CompilerOptions FINAL {
CompilerOptions();
~CompilerOptions();
- CompilerOptions(CompilerFilter::Filter compiler_filter,
+ CompilerOptions(CompilerFilter compiler_filter,
size_t huge_method_threshold,
size_t large_method_threshold,
size_t small_method_threshold,
@@ -77,32 +88,40 @@ class CompilerOptions FINAL {
bool dump_cfg_append,
bool force_determinism);
- CompilerFilter::Filter GetCompilerFilter() const {
+ CompilerFilter GetCompilerFilter() const {
return compiler_filter_;
}
- void SetCompilerFilter(CompilerFilter::Filter compiler_filter) {
+ void SetCompilerFilter(CompilerFilter compiler_filter) {
compiler_filter_ = compiler_filter;
}
bool VerifyAtRuntime() const {
- return compiler_filter_ == CompilerFilter::kVerifyAtRuntime;
+ return compiler_filter_ == CompilerOptions::kVerifyAtRuntime;
}
bool IsCompilationEnabled() const {
- return CompilerFilter::IsCompilationEnabled(compiler_filter_);
+ return compiler_filter_ != CompilerOptions::kVerifyNone &&
+ compiler_filter_ != CompilerOptions::kInterpretOnly &&
+ compiler_filter_ != CompilerOptions::kVerifyAtRuntime &&
+ compiler_filter_ != CompilerOptions::kVerifyProfile;
}
bool IsVerificationEnabled() const {
- return CompilerFilter::IsVerificationEnabled(compiler_filter_);
+ return compiler_filter_ != CompilerOptions::kVerifyNone &&
+ compiler_filter_ != CompilerOptions::kVerifyAtRuntime;
}
bool NeverVerify() const {
- return compiler_filter_ == CompilerFilter::kVerifyNone;
+ return compiler_filter_ == CompilerOptions::kVerifyNone;
+ }
+
+ bool IsExtractOnly() const {
+ return compiler_filter_ == CompilerOptions::kVerifyAtRuntime;
}
bool VerifyOnlyProfile() const {
- return compiler_filter_ == CompilerFilter::kVerifyProfile;
+ return compiler_filter_ == CompilerOptions::kVerifyProfile;
}
size_t GetHugeMethodThreshold() const {
@@ -252,7 +271,7 @@ class CompilerOptions FINAL {
void ParseLargeMethodMax(const StringPiece& option, UsageFn Usage);
void ParseHugeMethodMax(const StringPiece& option, UsageFn Usage);
- CompilerFilter::Filter compiler_filter_;
+ CompilerFilter compiler_filter_;
size_t huge_method_threshold_;
size_t large_method_threshold_;
size_t small_method_threshold_;
@@ -298,6 +317,7 @@ class CompilerOptions FINAL {
DISALLOW_COPY_AND_ASSIGN(CompilerOptions);
};
+std::ostream& operator<<(std::ostream& os, const CompilerOptions::CompilerFilter& rhs);
} // namespace art
diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc
index 082d15961a..124afbc73b 100644
--- a/compiler/optimizing/builder.cc
+++ b/compiler/optimizing/builder.cc
@@ -145,8 +145,8 @@ void HGraphBuilder::MaybeRecordStat(MethodCompilationStat compilation_stat) {
bool HGraphBuilder::SkipCompilation(const DexFile::CodeItem& code_item,
size_t number_of_branches) {
const CompilerOptions& compiler_options = compiler_driver_->GetCompilerOptions();
- CompilerFilter::Filter compiler_filter = compiler_options.GetCompilerFilter();
- if (compiler_filter == CompilerFilter::kEverything) {
+ CompilerOptions::CompilerFilter compiler_filter = compiler_options.GetCompilerFilter();
+ if (compiler_filter == CompilerOptions::kEverything) {
return false;
}
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc
index 125c00d275..f1c5581c5b 100644
--- a/compiler/optimizing/optimizing_compiler.cc
+++ b/compiler/optimizing/optimizing_compiler.cc
@@ -655,7 +655,7 @@ CodeGenerator* OptimizingCompiler::TryCompile(ArenaAllocator* arena,
// code units is bigger than 128.
static constexpr size_t kSpaceFilterOptimizingThreshold = 128;
const CompilerOptions& compiler_options = compiler_driver->GetCompilerOptions();
- if ((compiler_options.GetCompilerFilter() == CompilerFilter::kSpace)
+ if ((compiler_options.GetCompilerFilter() == CompilerOptions::kSpace)
&& (code_item->insns_size_in_code_units_ > kSpaceFilterOptimizingThreshold)) {
MaybeRecordStat(MethodCompilationStat::kNotCompiledSpaceFilter);
return nullptr;