Remove experimental flag in verifier. am: f8b5288ab5 am: bf44f60685
Original change: https://android-review.googlesource.com/c/platform/art/+/1748080
Change-Id: I185b8fe0faaabefce0522d8bb958c636dacd4b8f
diff --git a/dex2oat/driver/compiler_driver.cc b/dex2oat/driver/compiler_driver.cc
index c9f61bc..54ca9b1 100644
--- a/dex2oat/driver/compiler_driver.cc
+++ b/dex2oat/driver/compiler_driver.cc
@@ -465,7 +465,7 @@
// Do not have failures that should punt to the interpreter.
!verified_method->HasRuntimeThrow() &&
(verified_method->GetEncounteredVerificationFailures() &
- (verifier::VERIFY_ERROR_FORCE_INTERPRETER | verifier::VERIFY_ERROR_LOCKING)) == 0 &&
+ verifier::VERIFY_ERROR_LOCKING) == 0 &&
// Is eligable for compilation by methods-to-compile filter.
driver->ShouldCompileBasedOnProfile(method_ref);
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index 12abed2..e9094c3 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -1194,17 +1194,6 @@
template <bool kAllowRuntimeOnlyInstructions>
bool MethodVerifier<kVerifierDebug>::VerifyInstruction(const Instruction* inst,
uint32_t code_offset) {
- if (Instruction::kHaveExperimentalInstructions && UNLIKELY(inst->IsExperimental())) {
- // Experimental instructions don't yet have verifier support implementation.
- // While it is possible to use them by themselves, when we try to use stable instructions
- // with a virtual register that was created by an experimental instruction,
- // the data flow analysis will fail.
- Fail(VERIFY_ERROR_FORCE_INTERPRETER)
- << "experimental instruction is not supported by verifier; skipping verification";
- flags_.have_pending_experimental_failure_ = true;
- return false;
- }
-
bool result = true;
switch (inst->GetVerifyTypeArgumentA()) {
case Instruction::kVerifyRegA:
@@ -5014,7 +5003,7 @@
class_def_(class_def),
code_item_accessor_(*dex_file, code_item),
// TODO: make it designated initialization when we compile as C++20.
- flags_({false, false, false, false, aot_mode}),
+ flags_({false, false, false, aot_mode}),
encountered_failure_types_(0),
can_load_classes_(can_load_classes),
allow_soft_failures_(allow_soft_failures),
@@ -5199,48 +5188,41 @@
} else {
// Bad method data.
CHECK_NE(verifier.failures_.size(), 0U);
+ CHECK(verifier.flags_.have_pending_hard_failure_);
+ if (VLOG_IS_ON(verifier)) {
+ log_level = std::max(HardFailLogMode::kLogVerbose, log_level);
+ }
+ if (log_level >= HardFailLogMode::kLogVerbose) {
+ LogSeverity severity;
+ switch (log_level) {
+ case HardFailLogMode::kLogVerbose:
+ severity = LogSeverity::VERBOSE;
+ break;
+ case HardFailLogMode::kLogWarning:
+ severity = LogSeverity::WARNING;
+ break;
+ case HardFailLogMode::kLogInternalFatal:
+ severity = LogSeverity::FATAL_WITHOUT_ABORT;
+ break;
+ default:
+ LOG(FATAL) << "Unsupported log-level " << static_cast<uint32_t>(log_level);
+ UNREACHABLE();
+ }
+ verifier.DumpFailures(LOG_STREAM(severity) << "Verification error in "
+ << dex_file->PrettyMethod(method_idx)
+ << "\n");
+ }
+ if (hard_failure_msg != nullptr) {
+ CHECK(!verifier.failure_messages_.empty());
+ *hard_failure_msg =
+ verifier.failure_messages_[verifier.failure_messages_.size() - 1]->str();
+ }
+ result.kind = FailureKind::kHardFailure;
- if (UNLIKELY(verifier.flags_.have_pending_experimental_failure_)) {
- // Failed due to being forced into interpreter. This is ok because
- // we just want to skip verification.
- result.kind = FailureKind::kSoftFailure;
- } else {
- CHECK(verifier.flags_.have_pending_hard_failure_);
- if (VLOG_IS_ON(verifier)) {
- log_level = std::max(HardFailLogMode::kLogVerbose, log_level);
- }
- if (log_level >= HardFailLogMode::kLogVerbose) {
- LogSeverity severity;
- switch (log_level) {
- case HardFailLogMode::kLogVerbose:
- severity = LogSeverity::VERBOSE;
- break;
- case HardFailLogMode::kLogWarning:
- severity = LogSeverity::WARNING;
- break;
- case HardFailLogMode::kLogInternalFatal:
- severity = LogSeverity::FATAL_WITHOUT_ABORT;
- break;
- default:
- LOG(FATAL) << "Unsupported log-level " << static_cast<uint32_t>(log_level);
- UNREACHABLE();
- }
- verifier.DumpFailures(LOG_STREAM(severity) << "Verification error in "
- << dex_file->PrettyMethod(method_idx)
- << "\n");
- }
- if (hard_failure_msg != nullptr) {
- CHECK(!verifier.failure_messages_.empty());
- *hard_failure_msg =
- verifier.failure_messages_[verifier.failure_messages_.size() - 1]->str();
- }
- result.kind = FailureKind::kHardFailure;
-
- if (callbacks != nullptr) {
- // Let the interested party know that we failed the class.
- ClassReference ref(dex_file, dex_file->GetIndexForClassDef(class_def));
- callbacks->ClassRejected(ref);
- }
+ if (callbacks != nullptr) {
+ // Let the interested party know that we failed the class.
+ ClassReference ref(dex_file, dex_file->GetIndexForClassDef(class_def));
+ callbacks->ClassRejected(ref);
}
if (kVerifierDebug || VLOG_IS_ON(verifier)) {
LOG(ERROR) << verifier.info_messages_.str();
@@ -5488,10 +5470,6 @@
}
break;
- case VERIFY_ERROR_FORCE_INTERPRETER:
- // This will be reported to the runtime as a soft failure.
- break;
-
case VERIFY_ERROR_LOCKING:
if (!IsAotMode()) {
// If we fail again at runtime, mark that this instruction would throw.
diff --git a/runtime/verifier/method_verifier.h b/runtime/verifier/method_verifier.h
index 1dfcaab..0e7d924 100644
--- a/runtime/verifier/method_verifier.h
+++ b/runtime/verifier/method_verifier.h
@@ -369,9 +369,6 @@
// Note: this flag is reset after processing each instruction.
bool have_pending_runtime_throw_failure_ : 1;
- // Is there a pending experimental failure?
- bool have_pending_experimental_failure_ : 1;
-
// A version of the above that is not reset and thus captures if there were *any* throw
// failures.
bool have_any_pending_runtime_throw_failure_ : 1;
diff --git a/runtime/verifier/verifier_enums.h b/runtime/verifier/verifier_enums.h
index 16bf004..8c0d739 100644
--- a/runtime/verifier/verifier_enums.h
+++ b/runtime/verifier/verifier_enums.h
@@ -87,14 +87,7 @@
VERIFY_ERROR_ACCESS_METHOD = 1 << 7, // IllegalAccessError.
VERIFY_ERROR_CLASS_CHANGE = 1 << 8, // IncompatibleClassChangeError.
VERIFY_ERROR_INSTANTIATION = 1 << 9, // InstantiationError.
- // For opcodes that don't have complete verifier support, we need a way to continue
- // execution at runtime without attempting to re-verify (since we know it will fail no
- // matter what). Instead, run as the interpreter in a special "do access checks" mode
- // which will perform verifier-like checking on the fly.
- VERIFY_ERROR_FORCE_INTERPRETER = 1 << 10, // Skip the verification phase at runtime;
- // force the interpreter to do access checks.
- // (sets a soft fail at compile time).
- VERIFY_ERROR_LOCKING = 1 << 11, // Could not guarantee balanced locking. This should be
+ VERIFY_ERROR_LOCKING = 1 << 10, // Could not guarantee balanced locking. This should be
// punted to the interpreter with access checks.
VERIFY_ERROR_SKIP_COMPILER = 1u << 31, // Flag to note that the failure should preclude
// optimization. Meant as a signal from the verifier