Only flush visualizer output at the end of the compilation.
Otherwise multiple threads compiling will mix their output.
Test: run-tests
Bug: 147094528
Change-Id: I905c8874cbe2c02c2d79577024d4606a3784b67a
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc
index f8eae2f..26e081d 100644
--- a/compiler/optimizing/optimizing_compiler.cc
+++ b/compiler/optimizing/optimizing_compiler.cc
@@ -137,13 +137,15 @@
LOG(INFO) << "TIMINGS " << GetMethodName();
LOG(INFO) << Dumpable<TimingLogger>(timing_logger_);
}
+ if (visualizer_enabled_) {
+ FlushVisualizer();
+ }
DCHECK(visualizer_oss_.str().empty());
}
- void DumpDisassembly() REQUIRES(!visualizer_dump_mutex_) {
+ void DumpDisassembly() {
if (visualizer_enabled_) {
visualizer_.DumpGraphWithDisassembly();
- FlushVisualizer();
}
}
@@ -158,12 +160,11 @@
}
private:
- void StartPass(const char* pass_name) REQUIRES(!visualizer_dump_mutex_) {
+ void StartPass(const char* pass_name) {
VLOG(compiler) << "Starting pass: " << pass_name;
// Dump graph first, then start timer.
if (visualizer_enabled_) {
visualizer_.DumpGraph(pass_name, /* is_after_pass= */ false, graph_in_bad_state_);
- FlushVisualizer();
}
if (timing_logger_enabled_) {
timing_logger_.StartTiming(pass_name);
@@ -178,14 +179,13 @@
visualizer_oss_.clear();
}
- void EndPass(const char* pass_name, bool pass_change) REQUIRES(!visualizer_dump_mutex_) {
+ void EndPass(const char* pass_name, bool pass_change) {
// Pause timer first, then dump graph.
if (timing_logger_enabled_) {
timing_logger_.EndTiming();
}
if (visualizer_enabled_) {
visualizer_.DumpGraph(pass_name, /* is_after_pass= */ true, graph_in_bad_state_);
- FlushVisualizer();
}
// Validate the HGraph if running in debug mode.