Merge "Clean up logcat spam from compiler and verifier" into dalvik-dev
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 144271d..47ef222 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -64,7 +64,7 @@
if (x == 0 && y == 0) {
return;
}
- LOG(INFO) << Percentage(x, y) << "% of " << str << " for " << (x + y) << " cases";
+ VLOG(compiler) << Percentage(x, y) << "% of " << str << " for " << (x + y) << " cases";
}
class AOTCompilationStats {
@@ -724,7 +724,7 @@
std::pair<CompilerDriver::DescriptorSet::iterator, bool> result =
image_classes->insert(descriptor);
if (result.second) {
- LOG(INFO) << "Adding " << descriptor << " to image classes";
+ VLOG(compiler) << "Adding " << descriptor << " to image classes";
} else {
return;
}
@@ -2070,7 +2070,7 @@
}
}
if (!is_black_listed) {
- LOG(INFO) << "Initializing: " << descriptor;
+ VLOG(compiler) << "Initializing: " << descriptor;
if (StringPiece(descriptor) == "Ljava/lang/Void;") {
// Hand initialize j.l.Void to avoid Dex file operations in un-started runtime.
mirror::ObjectArray<mirror::Field>* fields = klass->GetSFields();
diff --git a/compiler/oat_writer.cc b/compiler/oat_writer.cc
index ce88cf6..b129026 100644
--- a/compiler/oat_writer.cc
+++ b/compiler/oat_writer.cc
@@ -464,7 +464,7 @@
if (kIsDebugBuild) {
uint32_t size_total = 0;
#define DO_STAT(x) \
- LOG(INFO) << #x "=" << PrettySize(x) << " (" << x << "B)"; \
+ VLOG(compiler) << #x "=" << PrettySize(x) << " (" << x << "B)"; \
size_total += x;
DO_STAT(size_dex_file_alignment_);
@@ -495,7 +495,7 @@
DO_STAT(size_oat_class_method_offsets_);
#undef DO_STAT
- LOG(INFO) << "size_total=" << PrettySize(size_total) << " (" << size_total << "B)"; \
+ VLOG(compiler) << "size_total=" << PrettySize(size_total) << " (" << size_total << "B)"; \
CHECK_EQ(file_offset + size_total, static_cast<uint32_t>(out.Seek(0, kSeekCurrent)));
CHECK_EQ(size_, size_total);
}
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index b85378d..0f146a9 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -164,7 +164,7 @@
~Dex2Oat() {
delete runtime_;
- LOG(INFO) << "dex2oat took " << PrettyDuration(NanoTime() - start_ns_)
+ VLOG(compiler) << "dex2oat took " << PrettyDuration(NanoTime() - start_ns_)
<< " (threads: " << thread_count_ << ")";
}
@@ -923,7 +923,7 @@
}
if (num_methods <= Runtime::Current()->GetNumDexMethodsThreshold()) {
Runtime::Current()->SetCompilerFilter(Runtime::kSpeed);
- LOG(INFO) << "Below method threshold, compiling anyways";
+ VLOG(compiler) << "Below method threshold, compiling anyways";
}
}
@@ -945,7 +945,7 @@
return EXIT_FAILURE;
}
- LOG(INFO) << "Oat file written successfully (unstripped): " << oat_location;
+ VLOG(compiler) << "Oat file written successfully (unstripped): " << oat_location;
// Notes on the interleaving of creating the image and oat file to
// ensure the references between the two are correct.
@@ -1009,7 +1009,7 @@
if (!image_creation_success) {
return EXIT_FAILURE;
}
- LOG(INFO) << "Image written successfully: " << image_filename;
+ VLOG(compiler) << "Image written successfully: " << image_filename;
}
if (is_host) {
@@ -1037,7 +1037,7 @@
CHECK(write_ok);
}
oat_file.reset(out.release());
- LOG(INFO) << "Oat file copied successfully (stripped): " << oat_stripped;
+ VLOG(compiler) << "Oat file copied successfully (stripped): " << oat_stripped;
}
#if ART_USE_PORTABLE_COMPILER // We currently only generate symbols on Portable
@@ -1049,7 +1049,7 @@
// We wrote the oat file successfully, and want to keep it.
- LOG(INFO) << "Oat file written successfully (stripped): " << oat_location;
+ VLOG(compiler) << "Oat file written successfully (stripped): " << oat_location;
#endif // ART_USE_PORTABLE_COMPILER
timings.EndSplit();
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());