summaryrefslogtreecommitdiffstats
path: root/compiler
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2014-10-22 19:10:23 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-10-22 19:10:24 +0000
commitaea6888b056be21adf762e066c7f33b8939b8a06 (patch)
treebfa17655ed3060b41e1cfd1583e590e9d9042f0a /compiler
parentb08f4dcf90215ed49e0b796ab3e609bd605be8ba (diff)
parentc7dd295a4e0cc1d15c0c96088e55a85389bade74 (diff)
downloadart-aea6888b056be21adf762e066c7f33b8939b8a06.zip
art-aea6888b056be21adf762e066c7f33b8939b8a06.tar.gz
art-aea6888b056be21adf762e066c7f33b8939b8a06.tar.bz2
Merge "Tidy up logging."
Diffstat (limited to 'compiler')
-rw-r--r--compiler/dex/compiler_ir.cc1
-rw-r--r--compiler/dex/frontend.cc12
-rw-r--r--compiler/driver/compiler_options.h89
-rw-r--r--compiler/optimizing/graph_checker.h4
-rw-r--r--compiler/optimizing/optimization.cc1
-rw-r--r--compiler/optimizing/register_allocator.cc2
6 files changed, 62 insertions, 47 deletions
diff --git a/compiler/dex/compiler_ir.cc b/compiler/dex/compiler_ir.cc
index 909c995..a2b3fe4 100644
--- a/compiler/dex/compiler_ir.cc
+++ b/compiler/dex/compiler_ir.cc
@@ -16,6 +16,7 @@
#include "compiler_ir.h"
+#include "base/dumpable.h"
#include "backend.h"
#include "frontend.h"
#include "mir_graph.h"
diff --git a/compiler/dex/frontend.cc b/compiler/dex/frontend.cc
index 2e21d05..3dc5655 100644
--- a/compiler/dex/frontend.cc
+++ b/compiler/dex/frontend.cc
@@ -19,6 +19,7 @@
#include <cstdint>
#include "backend.h"
+#include "base/dumpable.h"
#include "compiler.h"
#include "compiler_internals.h"
#include "driver/compiler_driver.h"
@@ -134,15 +135,8 @@ static CompiledMethod* CompileMethod(CompilerDriver& driver,
(cu.enable_debug & (1 << kDebugVerbose));
}
- if (gVerboseMethods.size() != 0) {
- cu.verbose = false;
- for (size_t i = 0; i < gVerboseMethods.size(); ++i) {
- if (PrettyMethod(method_idx, dex_file).find(gVerboseMethods[i])
- != std::string::npos) {
- cu.verbose = true;
- break;
- }
- }
+ if (driver.GetCompilerOptions().HasVerboseMethods()) {
+ cu.verbose = driver.GetCompilerOptions().IsVerboseMethod(PrettyMethod(method_idx, dex_file));
}
if (cu.verbose) {
diff --git a/compiler/driver/compiler_options.h b/compiler/driver/compiler_options.h
index 3a50bfd..fb7aeb9 100644
--- a/compiler/driver/compiler_options.h
+++ b/compiler/driver/compiler_options.h
@@ -17,9 +17,14 @@
#ifndef ART_COMPILER_DRIVER_COMPILER_OPTIONS_H_
#define ART_COMPILER_DRIVER_COMPILER_OPTIONS_H_
+#include <string>
+#include <vector>
+
+#include "base/macros.h"
+
namespace art {
-class CompilerOptions {
+class CompilerOptions FINAL {
public:
enum CompilerFilter {
kVerifyNone, // Skip verification and compile nothing except JNI stubs.
@@ -60,11 +65,12 @@ class CompilerOptions {
implicit_null_checks_(false),
implicit_so_checks_(false),
implicit_suspend_checks_(false),
- compile_pic_(false)
+ compile_pic_(false),
#ifdef ART_SEA_IR_MODE
- , sea_ir_mode_(false)
+ sea_ir_mode_(false),
#endif
- {}
+ verbose_methods_(nullptr) {
+ }
CompilerOptions(CompilerFilter compiler_filter,
size_t huge_method_threshold,
@@ -79,10 +85,11 @@ class CompilerOptions {
bool implicit_null_checks,
bool implicit_so_checks,
bool implicit_suspend_checks,
- bool compile_pic
+ bool compile_pic,
#ifdef ART_SEA_IR_MODE
- , bool sea_ir_mode
+ bool sea_ir_mode,
#endif
+ const std::vector<std::string>* verbose_methods
) : // NOLINT(whitespace/parens)
compiler_filter_(compiler_filter),
huge_method_threshold_(huge_method_threshold),
@@ -97,11 +104,12 @@ class CompilerOptions {
implicit_null_checks_(implicit_null_checks),
implicit_so_checks_(implicit_so_checks),
implicit_suspend_checks_(implicit_suspend_checks),
- compile_pic_(compile_pic)
+ compile_pic_(compile_pic),
#ifdef ART_SEA_IR_MODE
- , sea_ir_mode_(sea_ir_mode)
+ sea_ir_mode_(sea_ir_mode),
#endif
- {}
+ verbose_methods_(verbose_methods) {
+ }
CompilerFilter GetCompilerFilter() const {
return compiler_filter_;
@@ -168,28 +176,18 @@ class CompilerOptions {
return implicit_null_checks_;
}
- void SetImplicitNullChecks(bool new_val) {
- implicit_null_checks_ = new_val;
- }
-
bool GetImplicitStackOverflowChecks() const {
return implicit_so_checks_;
}
- void SetImplicitStackOverflowChecks(bool new_val) {
- implicit_so_checks_ = new_val;
- }
-
bool GetImplicitSuspendChecks() const {
return implicit_suspend_checks_;
}
- void SetImplicitSuspendChecks(bool new_val) {
- implicit_suspend_checks_ = new_val;
- }
-
#ifdef ART_SEA_IR_MODE
- bool GetSeaIrMode();
+ bool GetSeaIrMode() const {
+ return sea_ir_mode_;
+ }
#endif
bool GetGenerateGDBInformation() const {
@@ -205,25 +203,44 @@ class CompilerOptions {
return compile_pic_;
}
+ bool HasVerboseMethods() const {
+ return verbose_methods_ != nullptr && !verbose_methods_->empty();
+ }
+
+ bool IsVerboseMethod(const std::string& pretty_method) const {
+ for (const std::string& cur_method : *verbose_methods_) {
+ if (pretty_method.find(cur_method) != std::string::npos) {
+ return true;
+ }
+ }
+ return false;
+ }
+
private:
CompilerFilter compiler_filter_;
- size_t huge_method_threshold_;
- size_t large_method_threshold_;
- size_t small_method_threshold_;
- size_t tiny_method_threshold_;
- size_t num_dex_methods_threshold_;
- bool generate_gdb_information_;
- bool include_patch_information_;
+ const size_t huge_method_threshold_;
+ const size_t large_method_threshold_;
+ const size_t small_method_threshold_;
+ const size_t tiny_method_threshold_;
+ const size_t num_dex_methods_threshold_;
+ const bool generate_gdb_information_;
+ const bool include_patch_information_;
// When using a profile file only the top K% of the profiled samples will be compiled.
- double top_k_profile_threshold_;
- bool include_debug_symbols_;
- bool implicit_null_checks_;
- bool implicit_so_checks_;
- bool implicit_suspend_checks_;
- bool compile_pic_;
+ const double top_k_profile_threshold_;
+ const bool include_debug_symbols_;
+ const bool implicit_null_checks_;
+ const bool implicit_so_checks_;
+ const bool implicit_suspend_checks_;
+ const bool compile_pic_;
+
#ifdef ART_SEA_IR_MODE
- bool sea_ir_mode_;
+ const bool sea_ir_mode_;
#endif
+
+ // Vector of methods to have verbose output enabled for.
+ const std::vector<std::string>* const verbose_methods_;
+
+ DISALLOW_COPY_AND_ASSIGN(CompilerOptions);
};
} // namespace art
diff --git a/compiler/optimizing/graph_checker.h b/compiler/optimizing/graph_checker.h
index db31306..badf21d 100644
--- a/compiler/optimizing/graph_checker.h
+++ b/compiler/optimizing/graph_checker.h
@@ -53,7 +53,7 @@ class GraphChecker : public HGraphVisitor {
}
// Print detected errors on output stream `os`.
- void Dump(std::ostream& os) {
+ void Dump(std::ostream& os) const {
for (size_t i = 0, e = errors_.Size(); i < e; ++i) {
os << dump_prefix_ << errors_.Get(i) << std::endl;
}
@@ -68,7 +68,7 @@ class GraphChecker : public HGraphVisitor {
private:
// String displayed before dumped errors.
- const char* dump_prefix_;
+ const char* const dump_prefix_;
DISALLOW_COPY_AND_ASSIGN(GraphChecker);
};
diff --git a/compiler/optimizing/optimization.cc b/compiler/optimizing/optimization.cc
index 33dc040..ea98186 100644
--- a/compiler/optimizing/optimization.cc
+++ b/compiler/optimizing/optimization.cc
@@ -16,6 +16,7 @@
#include "optimization.h"
+#include "base/dumpable.h"
#include "graph_checker.h"
namespace art {
diff --git a/compiler/optimizing/register_allocator.cc b/compiler/optimizing/register_allocator.cc
index fc65f97..f95c4a4 100644
--- a/compiler/optimizing/register_allocator.cc
+++ b/compiler/optimizing/register_allocator.cc
@@ -16,6 +16,8 @@
#include "register_allocator.h"
+#include <sstream>
+
#include "base/bit_vector-inl.h"
#include "code_generator.h"
#include "ssa_liveness_analysis.h"