diff options
| -rw-r--r-- | compiler/driver/compiler_driver.cc | 6 | ||||
| -rw-r--r-- | compiler/oat_writer.cc | 4 | ||||
| -rw-r--r-- | dex2oat/dex2oat.cc | 12 | ||||
| -rw-r--r-- | runtime/base/logging.h | 2 | ||||
| -rw-r--r-- | runtime/runtime.cc | 3 | ||||
| -rw-r--r-- | runtime/verifier/method_verifier.cc | 37 |
6 files changed, 37 insertions, 27 deletions
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index 144271d581..47ef222bf8 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -64,7 +64,7 @@ static void DumpStat(size_t x, size_t y, const char* str) { 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 @@ static void MaybeAddToImageClasses(mirror::Class* klass, CompilerDriver::Descrip 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 @@ static void InitializeClass(const ParallelCompilationManager* manager, size_t cl } } 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 ce88cf6dd6..b129026a24 100644 --- a/compiler/oat_writer.cc +++ b/compiler/oat_writer.cc @@ -464,7 +464,7 @@ bool OatWriter::Write(OutputStream& out) { 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 @@ bool OatWriter::Write(OutputStream& out) { 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 b85378d9ec..0f146a9baf 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -164,7 +164,7 @@ class Dex2Oat { ~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 @@ static int dex2oat(int argc, char** argv) { } 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 @@ static int dex2oat(int argc, char** argv) { 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 @@ static int dex2oat(int argc, char** argv) { 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 @@ static int dex2oat(int argc, char** argv) { 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 @@ static int dex2oat(int argc, char** argv) { // 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 ade8d34ed6..8e40da0112 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 @@ class ToStr { // 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 70d8816401..7c354b5b66 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -365,6 +365,7 @@ Runtime::ParsedOptions* Runtime::ParsedOptions::Create(const Options& options, b 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 @@ Runtime::ParsedOptions* Runtime::ParsedOptions::Create(const Options& options, b 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 fc595d90d9..6f3bae595b 100644 --- a/runtime/verifier/method_verifier.cc +++ b/runtime/verifier/method_verifier.cc @@ -45,6 +45,7 @@ namespace art { 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 MethodVerifier::VerifyMethod(uint32_t method_idx, 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 @@ bool MethodVerifier::VerifyCodeFlow() { 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 @@ mirror::Field* MethodVerifier::GetStaticField(int field_idx) { 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 @@ mirror::Field* MethodVerifier::GetInstanceField(const RegType& obj_type, int fie 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()); |