summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Brazdil <dbrazdil@google.com>2015-01-15 00:02:31 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-01-15 00:02:31 +0000
commit1c1d40ab7fd856eac52e1a3be7ce60da3fc21fb5 (patch)
tree72df746c7d012f559e898707f7a039c034473d8d
parentcbabd3cba33662b296df7c1d392bdd35b3c978ad (diff)
parent866c03125a3fcd74c9fff04da87865f5eb1767d9 (diff)
downloadandroid_art-1c1d40ab7fd856eac52e1a3be7ce60da3fc21fb5.tar.gz
android_art-1c1d40ab7fd856eac52e1a3be7ce60da3fc21fb5.tar.bz2
android_art-1c1d40ab7fd856eac52e1a3be7ce60da3fc21fb5.zip
Merge "ART: dex2oat flag for HGraphVisualizer dump file"
-rw-r--r--compiler/common_compiler_test.cc2
-rw-r--r--compiler/driver/compiler_driver.cc4
-rw-r--r--compiler/driver/compiler_driver.h6
-rw-r--r--compiler/oat_test.cc2
-rw-r--r--compiler/optimizing/optimizing_compiler.cc5
-rw-r--r--dex2oat/dex2oat.cc4
-rwxr-xr-xtools/checker.py4
7 files changed, 20 insertions, 7 deletions
diff --git a/compiler/common_compiler_test.cc b/compiler/common_compiler_test.cc
index 7df71f5b8a..96f8e0c355 100644
--- a/compiler/common_compiler_test.cc
+++ b/compiler/common_compiler_test.cc
@@ -164,7 +164,7 @@ void CommonCompilerTest::SetUp() {
compiler_kind, instruction_set,
instruction_set_features_.get(),
true, new std::set<std::string>, nullptr,
- 2, true, true, timer_.get(), -1, ""));
+ 2, true, true, "", timer_.get(), -1, ""));
}
// We typically don't generate an image in unit tests, disable this optimization by default.
compiler_driver_->SetSupportBootImageFixup(false);
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 9985d66469..e37180768a 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -339,7 +339,8 @@ CompilerDriver::CompilerDriver(const CompilerOptions* compiler_options,
const InstructionSetFeatures* instruction_set_features,
bool image, std::set<std::string>* image_classes,
std::set<std::string>* compiled_classes, size_t thread_count,
- bool dump_stats, bool dump_passes, CumulativeLogger* timer,
+ bool dump_stats, bool dump_passes,
+ const std::string& dump_cfg_file_name, CumulativeLogger* timer,
int swap_fd, const std::string& profile_file)
: swap_space_(swap_fd == -1 ? nullptr : new SwapSpace(swap_fd, 10 * MB)),
swap_space_allocator_(new SwapAllocator<void>(swap_space_.get())),
@@ -361,6 +362,7 @@ CompilerDriver::CompilerDriver(const CompilerOptions* compiler_options,
stats_(new AOTCompilationStats),
dump_stats_(dump_stats),
dump_passes_(dump_passes),
+ dump_cfg_file_name_(dump_cfg_file_name),
timings_logger_(timer),
compiler_context_(nullptr),
support_boot_image_fixup_(instruction_set != kMips),
diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h
index 7ddc32cdd8..11b4329e32 100644
--- a/compiler/driver/compiler_driver.h
+++ b/compiler/driver/compiler_driver.h
@@ -97,6 +97,7 @@ class CompilerDriver {
bool image, std::set<std::string>* image_classes,
std::set<std::string>* compiled_classes,
size_t thread_count, bool dump_stats, bool dump_passes,
+ const std::string& dump_cfg_file_name,
CumulativeLogger* timer, int swap_fd,
const std::string& profile_file);
@@ -371,6 +372,10 @@ class CompilerDriver {
return dump_passes_;
}
+ const std::string& GetDumpCfgFileName() const {
+ return dump_cfg_file_name_;
+ }
+
CumulativeLogger* GetTimingsLogger() const {
return timings_logger_;
}
@@ -542,6 +547,7 @@ class CompilerDriver {
bool dump_stats_;
const bool dump_passes_;
+ const std::string& dump_cfg_file_name_;
CumulativeLogger* const timings_logger_;
diff --git a/compiler/oat_test.cc b/compiler/oat_test.cc
index b3ab370c99..d3d20555d8 100644
--- a/compiler/oat_test.cc
+++ b/compiler/oat_test.cc
@@ -92,7 +92,7 @@ TEST_F(OatTest, WriteRead) {
method_inliner_map_.get(),
compiler_kind, insn_set,
insn_features.get(), false, nullptr, nullptr, 2, true,
- true, timer_.get(), -1, ""));
+ true, "", timer_.get(), -1, ""));
jobject class_loader = nullptr;
if (kCompile) {
TimingLogger timings2("OatTest::WriteRead", false, false);
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc
index 692d452f54..eaecbb04ae 100644
--- a/compiler/optimizing/optimizing_compiler.cc
+++ b/compiler/optimizing/optimizing_compiler.cc
@@ -149,11 +149,12 @@ void OptimizingCompiler::Init() {
// Enable C1visualizer output. Must be done in Init() because the compiler
// driver is not fully initialized when passed to the compiler's constructor.
CompilerDriver* driver = GetCompilerDriver();
- if (driver->GetDumpPasses()) {
+ const std::string cfg_file_name = driver->GetDumpCfgFileName();
+ if (!cfg_file_name.empty()) {
CHECK_EQ(driver->GetThreadCount(), 1U)
<< "Graph visualizer requires the compiler to run single-threaded. "
<< "Invoke the compiler with '-j1'.";
- visualizer_output_.reset(new std::ofstream("art.cfg"));
+ visualizer_output_.reset(new std::ofstream(cfg_file_name));
}
}
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 56d4582e69..147700f663 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -668,6 +668,8 @@ class Dex2Oat FINAL {
dump_timing_ = true;
} else if (option == "--dump-passes") {
dump_passes_ = true;
+ } else if (option.starts_with("--dump-cfg=")) {
+ dump_cfg_file_name_ = option.substr(strlen("--dump-cfg=")).data();
} else if (option == "--dump-stats") {
dump_stats_ = true;
} else if (option == "--include-debug-symbols" || option == "--no-strip-symbols") {
@@ -1236,6 +1238,7 @@ class Dex2Oat FINAL {
thread_count_,
dump_stats_,
dump_passes_,
+ dump_cfg_file_name_,
compiler_phases_timings_.get(),
swap_fd_,
profile_file_));
@@ -1693,6 +1696,7 @@ class Dex2Oat FINAL {
bool dump_passes_;
bool dump_timing_;
bool dump_slow_timing_;
+ std::string dump_cfg_file_name_;
std::string swap_file_name_;
int swap_fd_;
std::string profile_file_; // Profile file to use
diff --git a/tools/checker.py b/tools/checker.py
index 406a311638..a7cde62fe8 100755
--- a/tools/checker.py
+++ b/tools/checker.py
@@ -713,7 +713,7 @@ def CompileTest(inputFile, tempFolder):
classFolder = tempFolder + "/classes"
dexFile = tempFolder + "/test.dex"
oatFile = tempFolder + "/test.oat"
- outputFile = tempFolder + "/art.cfg"
+ outputFile = tempFolder + "/test.cfg"
os.makedirs(classFolder)
# Build a DEX from the source file. We pass "--no-optimize" to dx to avoid
@@ -723,7 +723,7 @@ def CompileTest(inputFile, tempFolder):
# Run dex2oat and export the HGraph. The output is stored into ${PWD}/art.cfg.
with cd(tempFolder):
- check_call(["dex2oat", "-j1", "--dump-passes", "--compiler-backend=Optimizing",
+ check_call(["dex2oat", "-j1", "--dump-cfg=" + outputFile, "--compiler-backend=Optimizing",
"--android-root=" + os.environ["ANDROID_HOST_OUT"],
"--boot-image=" + os.environ["ANDROID_HOST_OUT"] + "/framework/core-optimizing.art",
"--runtime-arg", "-Xnorelocate", "--dex-file=" + dexFile, "--oat-file=" + oatFile])