Clean up logcat spam from compiler and verifier
Moved to VLOG(...), adding verifer tag for VLOG.
Change-Id: Ia9ac8aeaf5aa1f4881e384003e82a66e560c5692
diff --git a/runtime/base/logging.h b/runtime/base/logging.h
index ade8d34..8e40da0 100644
--- a/runtime/base/logging.h
+++ b/runtime/base/logging.h
@@ -125,6 +125,7 @@
#define VLOG_IS_ON(module) UNLIKELY(::art::gLogVerbosity.module)
#define VLOG(module) if (VLOG_IS_ON(module)) ::art::LogMessage(__FILE__, __LINE__, INFO, -1).stream()
+#define VLOG_STREAM(module) ::art::LogMessage(__FILE__, __LINE__, INFO, -1).stream()
//
// Implementation details beyond this point.
@@ -306,6 +307,7 @@
// and the "-verbose:" command line argument.
struct LogVerbosity {
bool class_linker; // Enabled with "-verbose:class".
+ bool verifier;
bool compiler;
bool heap;
bool gc;
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 70d8816..7c354b5 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -365,6 +365,7 @@
parsed->sea_ir_mode_ = false;
// gLogVerbosity.class_linker = true; // TODO: don't check this in!
// gLogVerbosity.compiler = true; // TODO: don't check this in!
+// gLogVerbosity.verifier = true; // TODO: don't check this in!
// gLogVerbosity.heap = true; // TODO: don't check this in!
// gLogVerbosity.gc = true; // TODO: don't check this in!
// gLogVerbosity.jdwp = true; // TODO: don't check this in!
@@ -522,6 +523,8 @@
for (size_t i = 0; i < verbose_options.size(); ++i) {
if (verbose_options[i] == "class") {
gLogVerbosity.class_linker = true;
+ } else if (verbose_options[i] == "verifier") {
+ gLogVerbosity.verifier = true;
} else if (verbose_options[i] == "compiler") {
gLogVerbosity.compiler = true;
} else if (verbose_options[i] == "heap") {
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index fc595d9..6f3bae5 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -45,6 +45,7 @@
namespace verifier {
static const bool gDebugVerify = false;
+// TODO: Add a constant to method_verifier to turn on verbose logging?
void PcToRegisterLineTable::Init(RegisterTrackingMode mode, InstructionFlags* flags,
uint32_t insns_size, uint16_t registers_size,
@@ -231,26 +232,28 @@
MethodVerifier::FailureKind result = kNoFailure;
uint64_t start_ns = NanoTime();
- MethodVerifier verifier(dex_file, dex_cache, class_loader, class_def_idx, code_item, method_idx,
- method, method_access_flags, true, allow_soft_failures);
- if (verifier.Verify()) {
+ MethodVerifier verifier_(dex_file, dex_cache, class_loader, class_def_idx, code_item, method_idx,
+ method, method_access_flags, true, allow_soft_failures);
+ if (verifier_.Verify()) {
// Verification completed, however failures may be pending that didn't cause the verification
// to hard fail.
- CHECK(!verifier.have_pending_hard_failure_);
- if (verifier.failures_.size() != 0) {
- verifier.DumpFailures(LOG(INFO) << "Soft verification failures in "
- << PrettyMethod(method_idx, *dex_file) << "\n");
+ CHECK(!verifier_.have_pending_hard_failure_);
+ if (verifier_.failures_.size() != 0) {
+ if (VLOG_IS_ON(verifier)) {
+ verifier_.DumpFailures(VLOG_STREAM(verifier) << "Soft verification failures in "
+ << PrettyMethod(method_idx, *dex_file) << "\n");
+ }
result = kSoftFailure;
}
} else {
// Bad method data.
- CHECK_NE(verifier.failures_.size(), 0U);
- CHECK(verifier.have_pending_hard_failure_);
- verifier.DumpFailures(LOG(INFO) << "Verification error in "
+ CHECK_NE(verifier_.failures_.size(), 0U);
+ CHECK(verifier_.have_pending_hard_failure_);
+ verifier_.DumpFailures(LOG(INFO) << "Verification error in "
<< PrettyMethod(method_idx, *dex_file) << "\n");
if (gDebugVerify) {
- std::cout << "\n" << verifier.info_messages_.str();
- verifier.Dump(std::cout);
+ std::cout << "\n" << verifier_.info_messages_.str();
+ verifier_.Dump(std::cout);
}
result = kHardFailure;
}
@@ -1079,8 +1082,10 @@
std::ostream& MethodVerifier::DumpFailures(std::ostream& os) {
DCHECK_EQ(failures_.size(), failure_messages_.size());
- for (size_t i = 0; i < failures_.size(); ++i) {
- os << failure_messages_[i]->str() << "\n";
+ if (VLOG_IS_ON(verifier)) {
+ for (size_t i = 0; i < failures_.size(); ++i) {
+ os << failure_messages_[i]->str() << "\n";
+ }
}
return os;
}
@@ -3386,7 +3391,7 @@
dex_cache_,
class_loader_);
if (field == NULL) {
- LOG(INFO) << "Unable to resolve static field " << field_idx << " ("
+ VLOG(verifier) << "Unable to resolve static field " << field_idx << " ("
<< dex_file_->GetFieldName(field_id) << ") in "
<< dex_file_->GetFieldDeclaringClassDescriptor(field_id);
DCHECK(Thread::Current()->IsExceptionPending());
@@ -3423,7 +3428,7 @@
dex_cache_,
class_loader_);
if (field == NULL) {
- LOG(INFO) << "Unable to resolve instance field " << field_idx << " ("
+ VLOG(verifier) << "Unable to resolve instance field " << field_idx << " ("
<< dex_file_->GetFieldName(field_id) << ") in "
<< dex_file_->GetFieldDeclaringClassDescriptor(field_id);
DCHECK(Thread::Current()->IsExceptionPending());