summaryrefslogtreecommitdiff
path: root/compiler/driver/compiler_driver.cc
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2017-10-20 15:38:14 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2017-10-20 15:38:14 +0000
commit2f707787e60d74a187c570d6b47a5a14036e09ba (patch)
tree7e50caf2df0ce6556585a21c044572f4d2f7ed61 /compiler/driver/compiler_driver.cc
parent71ae03b7a56ddb9c45e3a7edd690fe919af9f17a (diff)
parentf39208f6787928151153795a3cdae28cba964df6 (diff)
Merge "ART: Add abort-on-soft-verifier-error"
Diffstat (limited to 'compiler/driver/compiler_driver.cc')
-rw-r--r--compiler/driver/compiler_driver.cc19
1 files changed, 15 insertions, 4 deletions
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 7573367788..547ffbcf62 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -296,6 +296,7 @@ CompilerDriver::CompilerDriver(
image_classes_(image_classes),
classes_to_compile_(compiled_classes),
methods_to_compile_(compiled_methods),
+ number_of_soft_verifier_failures_(0),
had_hard_verifier_failure_(false),
parallel_thread_count_(thread_count),
stats_(new AOTCompilationStats),
@@ -923,6 +924,12 @@ void CompilerDriver::PreCompile(jobject class_loader,
LOG(FATAL_WITHOUT_ABORT) << "Had a hard failure verifying all classes, and was asked to abort "
<< "in such situations. Please check the log.";
abort();
+ } else if (number_of_soft_verifier_failures_ > 0 &&
+ GetCompilerOptions().AbortOnSoftVerifierFailure()) {
+ LOG(FATAL_WITHOUT_ABORT) << "Had " << number_of_soft_verifier_failures_ << " soft failure(s) "
+ << "verifying all classes, and was asked to abort in such situations. "
+ << "Please check the log.";
+ abort();
}
if (compiler_options_->IsAnyCompilationEnabled()) {
@@ -2069,13 +2076,13 @@ class VerifyClassVisitor : public CompilationVisitor {
LOG(ERROR) << "Verification failed on class " << PrettyDescriptor(descriptor)
<< " because: " << error_msg;
manager_->GetCompiler()->SetHadHardVerifierFailure();
+ } else if (failure_kind == verifier::FailureKind::kSoftFailure) {
+ manager_->GetCompiler()->AddSoftVerifierFailure();
} else {
// Force a soft failure for the VerifierDeps. This is a sanity measure, as
// the vdex file already records that the class hasn't been resolved. It avoids
// trying to do future verification optimizations when processing the vdex file.
- DCHECK(failure_kind == verifier::FailureKind::kSoftFailure ||
- failure_kind == verifier::FailureKind::kNoFailure)
- << failure_kind;
+ DCHECK(failure_kind == verifier::FailureKind::kNoFailure) << failure_kind;
failure_kind = verifier::FailureKind::kSoftFailure;
}
} else if (!SkipClass(jclass_loader, dex_file, klass.Get())) {
@@ -2087,6 +2094,8 @@ class VerifyClassVisitor : public CompilationVisitor {
CHECK(soa.Self()->IsExceptionPending());
soa.Self()->ClearException();
manager_->GetCompiler()->SetHadHardVerifierFailure();
+ } else if (failure_kind == verifier::FailureKind::kSoftFailure) {
+ manager_->GetCompiler()->AddSoftVerifierFailure();
}
CHECK(klass->ShouldVerifyAtRuntime() || klass->IsVerified() || klass->IsErroneous())
@@ -2152,7 +2161,9 @@ void CompilerDriver::VerifyDexFile(jobject class_loader,
ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
ParallelCompilationManager context(class_linker, class_loader, this, &dex_file, dex_files,
thread_pool);
- verifier::HardFailLogMode log_level = GetCompilerOptions().AbortOnHardVerifierFailure()
+ bool abort_on_verifier_failures = GetCompilerOptions().AbortOnHardVerifierFailure()
+ || GetCompilerOptions().AbortOnSoftVerifierFailure();
+ verifier::HardFailLogMode log_level = abort_on_verifier_failures
? verifier::HardFailLogMode::kLogInternalFatal
: verifier::HardFailLogMode::kLogWarning;
VerifyClassVisitor visitor(&context, log_level);