summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2017-11-29 10:18:30 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2017-11-29 10:18:30 +0000
commitaa25db7d2a6f7f507c27ce49c99a33daf3059f8f (patch)
tree154ae8968a450a2e02d88207fa09e380fd380553 /compiler
parent299c1e168bde2039586d2486e52c73abbcec93b1 (diff)
parent2d8801f7b932496d5c2606294ff8fdea60e05b30 (diff)
Merge "Clean some dex2oat options."
Diffstat (limited to 'compiler')
-rw-r--r--compiler/common_compiler_test.cc5
-rw-r--r--compiler/common_compiler_test.h1
-rw-r--r--compiler/driver/compiled_method_storage_test.cc3
-rw-r--r--compiler/driver/compiler_driver.cc8
-rw-r--r--compiler/driver/compiler_driver.h20
-rw-r--r--compiler/driver/compiler_options.cc2
-rw-r--r--compiler/driver/compiler_options.h10
-rw-r--r--compiler/driver/compiler_options_map-inl.h14
-rw-r--r--compiler/driver/compiler_options_map.def2
-rw-r--r--compiler/jit/jit_compiler.cc4
-rw-r--r--compiler/jit/jit_compiler.h1
-rw-r--r--compiler/linker/relative_patcher_test.h3
-rw-r--r--compiler/optimizing/optimizing_compiler.cc4
13 files changed, 31 insertions, 46 deletions
diff --git a/compiler/common_compiler_test.cc b/compiler/common_compiler_test.cc
index 500fc4ae9a..40a5370ec7 100644
--- a/compiler/common_compiler_test.cc
+++ b/compiler/common_compiler_test.cc
@@ -174,7 +174,6 @@ void CommonCompilerTest::SetUp() {
}
}
- timer_.reset(new CumulativeLogger("Compilation times"));
CreateCompilerDriver(compiler_kind_, instruction_set);
}
}
@@ -193,9 +192,6 @@ void CommonCompilerTest::CreateCompilerDriver(Compiler::Kind kind,
GetCompiledClasses(),
GetCompiledMethods(),
number_of_threads,
- /* dump_stats */ true,
- /* dump_passes */ true,
- timer_.get(),
/* swap_fd */ -1,
GetProfileCompilationInfo()));
// We typically don't generate an image in unit tests, disable this optimization by default.
@@ -227,7 +223,6 @@ InstructionSet CommonCompilerTest::GetInstructionSet() const {
}
void CommonCompilerTest::TearDown() {
- timer_.reset();
compiler_driver_.reset();
callbacks_.reset();
verification_results_.reset();
diff --git a/compiler/common_compiler_test.h b/compiler/common_compiler_test.h
index bcda41a9b8..05fdc97e07 100644
--- a/compiler/common_compiler_test.h
+++ b/compiler/common_compiler_test.h
@@ -106,7 +106,6 @@ class CommonCompilerTest : public CommonRuntimeTest {
std::unique_ptr<CompilerOptions> compiler_options_;
std::unique_ptr<VerificationResults> verification_results_;
std::unique_ptr<CompilerDriver> compiler_driver_;
- std::unique_ptr<CumulativeLogger> timer_;
std::unique_ptr<const InstructionSetFeatures> instruction_set_features_;
diff --git a/compiler/driver/compiled_method_storage_test.cc b/compiler/driver/compiled_method_storage_test.cc
index de481caf07..0769561d0e 100644
--- a/compiler/driver/compiled_method_storage_test.cc
+++ b/compiler/driver/compiled_method_storage_test.cc
@@ -37,9 +37,6 @@ TEST(CompiledMethodStorage, Deduplicate) {
/* compiled_classes */ nullptr,
/* compiled_methods */ nullptr,
/* thread_count */ 1u,
- /* dump_stats */ false,
- /* dump_passes */ false,
- /* timer */ nullptr,
/* swap_fd */ -1,
/* profile_compilation_info */ nullptr);
CompiledMethodStorage* storage = driver.GetCompiledMethodStorage();
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index fd7ae9f570..0ca3c8f613 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -282,9 +282,6 @@ CompilerDriver::CompilerDriver(
std::unordered_set<std::string>* compiled_classes,
std::unordered_set<std::string>* compiled_methods,
size_t thread_count,
- bool dump_stats,
- bool dump_passes,
- CumulativeLogger* timer,
int swap_fd,
const ProfileCompilationInfo* profile_compilation_info)
: compiler_options_(compiler_options),
@@ -303,9 +300,6 @@ CompilerDriver::CompilerDriver(
had_hard_verifier_failure_(false),
parallel_thread_count_(thread_count),
stats_(new AOTCompilationStats),
- dump_stats_(dump_stats),
- dump_passes_(dump_passes),
- timings_logger_(timer),
compiler_context_(nullptr),
support_boot_image_fixup_(true),
compiled_method_storage_(swap_fd),
@@ -396,7 +390,7 @@ void CompilerDriver::CompileAll(jobject class_loader,
if (GetCompilerOptions().IsAnyCompilationEnabled()) {
Compile(class_loader, dex_files, timings);
}
- if (dump_stats_) {
+ if (GetCompilerOptions().GetDumpStats()) {
stats_->Dump();
}
diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h
index da4a580bf2..d2141e8bc7 100644
--- a/compiler/driver/compiler_driver.h
+++ b/compiler/driver/compiler_driver.h
@@ -97,9 +97,6 @@ class CompilerDriver {
std::unordered_set<std::string>* compiled_classes,
std::unordered_set<std::string>* compiled_methods,
size_t thread_count,
- bool dump_stats,
- bool dump_passes,
- CumulativeLogger* timer,
int swap_fd,
const ProfileCompilationInfo* profile_compilation_info);
@@ -302,18 +299,6 @@ class CompilerDriver {
return parallel_thread_count_;
}
- bool GetDumpStats() const {
- return dump_stats_;
- }
-
- bool GetDumpPasses() const {
- return dump_passes_;
- }
-
- CumulativeLogger* GetTimingsLogger() const {
- return timings_logger_;
- }
-
void SetDedupeEnabled(bool dedupe_enabled) {
compiled_method_storage_.SetDedupeEnabled(dedupe_enabled);
}
@@ -536,11 +521,6 @@ class CompilerDriver {
class AOTCompilationStats;
std::unique_ptr<AOTCompilationStats> stats_;
- bool dump_stats_;
- const bool dump_passes_;
-
- CumulativeLogger* const timings_logger_;
-
typedef void (*CompilerCallbackFn)(CompilerDriver& driver);
typedef MutexLock* (*CompilerMutexLockFn)(CompilerDriver& driver);
diff --git a/compiler/driver/compiler_options.cc b/compiler/driver/compiler_options.cc
index 032763cdff..c0a9a05aa6 100644
--- a/compiler/driver/compiler_options.cc
+++ b/compiler/driver/compiler_options.cc
@@ -49,6 +49,8 @@ CompilerOptions::CompilerOptions()
implicit_so_checks_(true),
implicit_suspend_checks_(false),
compile_pic_(false),
+ dump_timings_(false),
+ dump_stats_(false),
verbose_methods_(),
abort_on_hard_verifier_failure_(false),
abort_on_soft_verifier_failure_(false),
diff --git a/compiler/driver/compiler_options.h b/compiler/driver/compiler_options.h
index a71f61a9e3..3f660293d2 100644
--- a/compiler/driver/compiler_options.h
+++ b/compiler/driver/compiler_options.h
@@ -266,6 +266,14 @@ class CompilerOptions FINAL {
return passes_to_run_;
}
+ bool GetDumpTimings() const {
+ return dump_timings_;
+ }
+
+ bool GetDumpStats() const {
+ return dump_stats_;
+ }
+
private:
bool ParseDumpInitFailures(const std::string& option, std::string* error_msg);
void ParseDumpCfgPasses(const StringPiece& option, UsageFn Usage);
@@ -303,6 +311,8 @@ class CompilerOptions FINAL {
bool implicit_so_checks_;
bool implicit_suspend_checks_;
bool compile_pic_;
+ bool dump_timings_;
+ bool dump_stats_;
// Vector of methods to have verbose output enabled for.
std::vector<std::string> verbose_methods_;
diff --git a/compiler/driver/compiler_options_map-inl.h b/compiler/driver/compiler_options_map-inl.h
index e28d49974a..f97ab08600 100644
--- a/compiler/driver/compiler_options_map-inl.h
+++ b/compiler/driver/compiler_options_map-inl.h
@@ -78,6 +78,14 @@ inline bool ReadCompilerOptions(Base& map, CompilerOptions* options, std::string
map.AssignIfExists(Base::VerboseMethods, &options->verbose_methods_);
options->deduplicate_code_ = map.GetOrDefault(Base::DeduplicateCode);
+ if (map.Exists(Base::DumpTimings)) {
+ options->dump_timings_ = true;
+ }
+
+ if (map.Exists(Base::DumpStats)) {
+ options->dump_stats_ = true;
+ }
+
return true;
}
@@ -129,6 +137,12 @@ inline void AddCompilerOptionsArgumentParserOptions(Builder& b) {
.WithValueMap({{"false", false}, {"true", true}})
.IntoKey(Map::DeduplicateCode)
+ .Define({"--dump-timings"})
+ .IntoKey(Map::DumpTimings)
+
+ .Define({"--dump-stats"})
+ .IntoKey(Map::DumpStats)
+
.Define("--debuggable")
.IntoKey(Map::Debuggable)
diff --git a/compiler/driver/compiler_options_map.def b/compiler/driver/compiler_options_map.def
index cccd6184c6..2c56fd7974 100644
--- a/compiler/driver/compiler_options_map.def
+++ b/compiler/driver/compiler_options_map.def
@@ -58,5 +58,7 @@ COMPILER_OPTIONS_KEY (Unit, DumpCFGAppend)
COMPILER_OPTIONS_KEY (std::string, RegisterAllocationStrategy)
COMPILER_OPTIONS_KEY (ParseStringList<','>, VerboseMethods)
COMPILER_OPTIONS_KEY (bool, DeduplicateCode, true)
+COMPILER_OPTIONS_KEY (Unit, DumpTimings)
+COMPILER_OPTIONS_KEY (Unit, DumpStats)
#undef COMPILER_OPTIONS_KEY
diff --git a/compiler/jit/jit_compiler.cc b/compiler/jit/jit_compiler.cc
index 0c82d601a7..f33c5e1b97 100644
--- a/compiler/jit/jit_compiler.cc
+++ b/compiler/jit/jit_compiler.cc
@@ -130,7 +130,6 @@ JitCompiler::JitCompiler() {
if (instruction_set_features_ == nullptr) {
instruction_set_features_ = InstructionSetFeatures::FromCppDefines();
}
- cumulative_logger_.reset(new CumulativeLogger("jit times"));
compiler_driver_.reset(new CompilerDriver(
compiler_options_.get(),
/* verification_results */ nullptr,
@@ -141,9 +140,6 @@ JitCompiler::JitCompiler() {
/* compiled_classes */ nullptr,
/* compiled_methods */ nullptr,
/* thread_count */ 1,
- /* dump_stats */ false,
- /* dump_passes */ false,
- cumulative_logger_.get(),
/* swap_fd */ -1,
/* profile_compilation_info */ nullptr));
// Disable dedupe so we can remove compiled methods.
diff --git a/compiler/jit/jit_compiler.h b/compiler/jit/jit_compiler.h
index 1e1838efd5..31dc9e2fe5 100644
--- a/compiler/jit/jit_compiler.h
+++ b/compiler/jit/jit_compiler.h
@@ -48,7 +48,6 @@ class JitCompiler {
private:
std::unique_ptr<CompilerOptions> compiler_options_;
- std::unique_ptr<CumulativeLogger> cumulative_logger_;
std::unique_ptr<CompilerDriver> compiler_driver_;
std::unique_ptr<const InstructionSetFeatures> instruction_set_features_;
std::unique_ptr<JitLogger> jit_logger_;
diff --git a/compiler/linker/relative_patcher_test.h b/compiler/linker/relative_patcher_test.h
index 6297dd0481..9e9d14af9e 100644
--- a/compiler/linker/relative_patcher_test.h
+++ b/compiler/linker/relative_patcher_test.h
@@ -52,9 +52,6 @@ class RelativePatcherTest : public testing::Test {
/* compiled_classes */ nullptr,
/* compiled_methods */ nullptr,
/* thread_count */ 1u,
- /* dump_stats */ false,
- /* dump_passes */ false,
- /* timer */ nullptr,
/* swap_fd */ -1,
/* profile_compilation_info */ nullptr),
error_msg_(),
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc
index 5a9e2c59b2..a281c4a310 100644
--- a/compiler/optimizing/optimizing_compiler.cc
+++ b/compiler/optimizing/optimizing_compiler.cc
@@ -112,7 +112,7 @@ class PassObserver : public ValueObject {
Mutex& dump_mutex)
: graph_(graph),
cached_method_name_(),
- timing_logger_enabled_(compiler_driver->GetDumpPasses()),
+ timing_logger_enabled_(compiler_driver->GetCompilerOptions().GetDumpTimings()),
timing_logger_(timing_logger_enabled_ ? GetMethodName() : "", true, true),
disasm_info_(graph->GetAllocator()),
visualizer_oss_(),
@@ -407,7 +407,7 @@ void OptimizingCompiler::Init() {
driver->GetCompilerOptions().GetDumpCfgAppend() ? std::ofstream::app : std::ofstream::out;
visualizer_output_.reset(new std::ofstream(cfg_file_name, cfg_file_mode));
}
- if (driver->GetDumpStats()) {
+ if (driver->GetCompilerOptions().GetDumpStats()) {
compilation_stats_.reset(new OptimizingCompilerStats());
}
}