Remove the notion of soft failure within the verifier. am: 4b0c9b91de
Original change: https://android-review.googlesource.com/c/platform/art/+/1842426
Change-Id: Ib8d155a400e448bbb257feccc0433f66408746a9
diff --git a/dex2oat/driver/compiler_driver.cc b/dex2oat/driver/compiler_driver.cc
index a46e9ed..c8fd24b 100644
--- a/dex2oat/driver/compiler_driver.cc
+++ b/dex2oat/driver/compiler_driver.cc
@@ -1830,7 +1830,6 @@
class_loader,
class_def,
Runtime::Current()->GetCompilerCallbacks(),
- true /* allow soft failures */,
log_level_,
sdk_version_,
&error_msg);
diff --git a/dex2oat/verifier_deps_test.cc b/dex2oat/verifier_deps_test.cc
index d096e68..40b8c6b 100644
--- a/dex2oat/verifier_deps_test.cc
+++ b/dex2oat/verifier_deps_test.cc
@@ -162,7 +162,6 @@
method.GetIndex(),
method.GetAccessFlags(),
/* can_load_classes= */ true,
- /* allow_soft_failures= */ true,
/* verify to dump */ false,
/* allow_thread_suspension= */ true,
/* api_level= */ 0));
diff --git a/openjdkjvmti/ti_redefine.cc b/openjdkjvmti/ti_redefine.cc
index c2fbadf..cd3cfb5 100644
--- a/openjdkjvmti/ti_redefine.cc
+++ b/openjdkjvmti/ti_redefine.cc
@@ -1623,7 +1623,6 @@
hs.NewHandle(GetClassLoader()),
/*class_def=*/ dex_file_->GetClassDef(0),
/*callbacks=*/ nullptr,
- /*allow_soft_failures=*/ true,
/*log_level=*/
art::verifier::HardFailLogMode::kLogWarning,
art::Runtime::Current()->GetTargetSdkVersion(),
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 05edb03..2ce0294 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -4720,7 +4720,6 @@
class_loader,
*klass->GetClassDef(),
runtime->GetCompilerCallbacks(),
- runtime->IsAotCompiler(),
log_level,
Runtime::Current()->GetTargetSdkVersion(),
error_msg);
diff --git a/runtime/verifier/class_verifier.cc b/runtime/verifier/class_verifier.cc
index d88421e..8c541f8 100644
--- a/runtime/verifier/class_verifier.cc
+++ b/runtime/verifier/class_verifier.cc
@@ -89,7 +89,6 @@
Handle<mirror::ClassLoader> class_loader,
const dex::ClassDef& class_def,
CompilerCallbacks* callbacks,
- bool allow_soft_failures,
HardFailLogMode log_level,
uint32_t api_level,
std::string* error) {
@@ -135,7 +134,6 @@
class_def,
method.GetCodeItem(),
method.GetAccessFlags(),
- allow_soft_failures,
log_level,
api_level,
Runtime::Current()->IsAotCompiler(),
diff --git a/runtime/verifier/class_verifier.h b/runtime/verifier/class_verifier.h
index 26cdf2b..3048e6f 100644
--- a/runtime/verifier/class_verifier.h
+++ b/runtime/verifier/class_verifier.h
@@ -64,7 +64,6 @@
Handle<mirror::ClassLoader> class_loader,
const dex::ClassDef& class_def,
CompilerCallbacks* callbacks,
- bool allow_soft_failures,
HardFailLogMode log_level,
uint32_t api_level,
std::string* error)
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index bbc6cee..102d30d 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -145,7 +145,6 @@
uint32_t method_idx,
bool can_load_classes,
bool allow_thread_suspension,
- bool allow_soft_failures,
bool aot_mode,
Handle<mirror::DexCache> dex_cache,
Handle<mirror::ClassLoader> class_loader,
@@ -163,7 +162,6 @@
method_idx,
can_load_classes,
allow_thread_suspension,
- allow_soft_failures,
aot_mode),
method_access_flags_(access_flags),
return_type_(nullptr),
@@ -4971,7 +4969,6 @@
uint32_t dex_method_idx,
bool can_load_classes,
bool allow_thread_suspension,
- bool allow_soft_failures,
bool aot_mode)
: self_(self),
arena_stack_(arena_pool),
@@ -4987,7 +4984,6 @@
flags_({false, false, aot_mode}),
encountered_failure_types_(0),
can_load_classes_(can_load_classes),
- allow_soft_failures_(allow_soft_failures),
class_linker_(class_linker),
verifier_deps_(verifier_deps),
link_(nullptr) {
@@ -5010,7 +5006,6 @@
const dex::ClassDef& class_def,
const dex::CodeItem* code_item,
uint32_t method_access_flags,
- bool allow_soft_failures,
HardFailLogMode log_level,
uint32_t api_level,
bool aot_mode,
@@ -5027,7 +5022,6 @@
class_def,
code_item,
method_access_flags,
- allow_soft_failures,
log_level,
api_level,
aot_mode,
@@ -5044,7 +5038,6 @@
class_def,
code_item,
method_access_flags,
- allow_soft_failures,
log_level,
api_level,
aot_mode,
@@ -5081,7 +5074,6 @@
const dex::ClassDef& class_def,
const dex::CodeItem* code_item,
uint32_t method_access_flags,
- bool allow_soft_failures,
HardFailLogMode log_level,
uint32_t api_level,
bool aot_mode,
@@ -5098,7 +5090,6 @@
method_idx,
/* can_load_classes= */ true,
/* allow_thread_suspension= */ true,
- allow_soft_failures,
aot_mode,
dex_cache,
class_loader,
@@ -5212,7 +5203,6 @@
method->GetDexMethodIndex(),
/* can_load_classes= */ false,
/* allow_thread_suspension= */ false,
- /* allow_soft_failures= */ true,
Runtime::Current()->IsAotCompiler(),
dex_cache,
class_loader,
@@ -5257,7 +5247,6 @@
dex_method_idx,
/* can_load_classes= */ true,
/* allow_thread_suspension= */ true,
- /* allow_soft_failures= */ true,
Runtime::Current()->IsAotCompiler(),
dex_cache,
class_loader,
@@ -5296,7 +5285,6 @@
m->GetDexMethodIndex(),
/* can_load_classes= */ false,
/* allow_thread_suspension= */ false,
- /* allow_soft_failures= */ true,
Runtime::Current()->IsAotCompiler(),
dex_cache,
class_loader,
@@ -5319,7 +5307,6 @@
uint32_t method_idx,
uint32_t access_flags,
bool can_load_classes,
- bool allow_soft_failures,
bool verify_to_dump,
bool allow_thread_suspension,
uint32_t api_level) {
@@ -5332,7 +5319,6 @@
method_idx,
can_load_classes,
allow_thread_suspension,
- allow_soft_failures,
Runtime::Current()->IsAotCompiler(),
dex_cache,
class_loader,
@@ -5381,13 +5367,6 @@
// This will be reported to the runtime as a soft failure.
break;
- // Indication that verification should be retried at runtime.
- case VERIFY_ERROR_BAD_CLASS_SOFT:
- if (!allow_soft_failures_) {
- flags_.have_pending_hard_failure_ = true;
- }
- break;
-
// Hard verification failures at compile time will still fail at runtime, so the class is
// marked as rejected to prevent it from being compiled.
case VERIFY_ERROR_BAD_CLASS_HARD: {
@@ -5400,7 +5379,6 @@
}
}
} else if (kIsDebugBuild) {
- CHECK_NE(error, VERIFY_ERROR_BAD_CLASS_SOFT);
CHECK_NE(error, VERIFY_ERROR_BAD_CLASS_HARD);
}
diff --git a/runtime/verifier/method_verifier.h b/runtime/verifier/method_verifier.h
index fd320b3..92cfb45 100644
--- a/runtime/verifier/method_verifier.h
+++ b/runtime/verifier/method_verifier.h
@@ -207,7 +207,6 @@
uint32_t dex_method_idx,
bool can_load_classes,
bool allow_thread_suspension,
- bool allow_soft_failures,
bool aot_mode)
REQUIRES_SHARED(Locks::mutator_lock_);
@@ -243,7 +242,6 @@
const dex::ClassDef& class_def_idx,
const dex::CodeItem* code_item,
uint32_t method_access_flags,
- bool allow_soft_failures,
HardFailLogMode log_level,
uint32_t api_level,
bool aot_mode,
@@ -262,7 +260,6 @@
const dex::ClassDef& class_def_idx,
const dex::CodeItem* code_item,
uint32_t method_access_flags,
- bool allow_soft_failures,
HardFailLogMode log_level,
uint32_t api_level,
bool aot_mode,
@@ -284,7 +281,6 @@
uint32_t method_idx,
uint32_t access_flags,
bool can_load_classes,
- bool allow_soft_failures,
bool verify_to_dump,
bool allow_thread_suspension,
uint32_t api_level)
@@ -349,10 +345,6 @@
const bool can_load_classes_;
- // Converts soft failures to hard failures when false. Only false when the compiler isn't
- // running and the verifier is called from the class linker.
- const bool allow_soft_failures_;
-
// Classlinker to use when resolving.
ClassLinker* class_linker_;
diff --git a/runtime/verifier/method_verifier_test.cc b/runtime/verifier/method_verifier_test.cc
index aa79470..ec07047 100644
--- a/runtime/verifier/method_verifier_test.cc
+++ b/runtime/verifier/method_verifier_test.cc
@@ -57,7 +57,6 @@
loader,
*klass->GetClassDef(),
nullptr,
- true,
HardFailLogMode::kLogWarning,
/* api_level= */ 0u,
&error_msg);
diff --git a/runtime/verifier/verifier_enums.h b/runtime/verifier/verifier_enums.h
index bcb5f45..9c55e99 100644
--- a/runtime/verifier/verifier_enums.h
+++ b/runtime/verifier/verifier_enums.h
@@ -67,29 +67,20 @@
/*
* An enumeration of problems that can turn up during verification.
- * Both VERIFY_ERROR_BAD_CLASS_SOFT and VERIFY_ERROR_BAD_CLASS_HARD denote failures that cause
- * the entire class to be rejected. However, VERIFY_ERROR_BAD_CLASS_SOFT denotes a soft failure
- * that can potentially be corrected, and the verifier will try again at runtime.
- * VERIFY_ERROR_BAD_CLASS_HARD denotes a hard failure that can't be corrected, and will cause
- * the class to remain uncompiled. Other errors denote verification errors that cause bytecode
- * to be rewritten to fail at runtime.
*/
enum VerifyError : uint32_t {
VERIFY_ERROR_BAD_CLASS_HARD = 1 << 0, // VerifyError; hard error that skips compilation.
- VERIFY_ERROR_BAD_CLASS_SOFT = 1 << 1, // VerifyError; soft error that verifies again at
- // runtime.
-
- VERIFY_ERROR_NO_CLASS = 1 << 2, // NoClassDefFoundError.
- VERIFY_ERROR_UNRESOLVED_TYPE_CHECK = 1 << 3, // Missing class for doing a type check
- VERIFY_ERROR_NO_METHOD = 1 << 4, // NoSuchMethodError.
- VERIFY_ERROR_ACCESS_CLASS = 1 << 5, // IllegalAccessError.
- VERIFY_ERROR_ACCESS_FIELD = 1 << 6, // IllegalAccessError.
- VERIFY_ERROR_ACCESS_METHOD = 1 << 7, // IllegalAccessError.
- VERIFY_ERROR_CLASS_CHANGE = 1 << 8, // IncompatibleClassChangeError.
- VERIFY_ERROR_INSTANTIATION = 1 << 9, // InstantiationError.
- VERIFY_ERROR_LOCKING = 1 << 10, // Could not guarantee balanced locking. This should be
+ VERIFY_ERROR_NO_CLASS = 1 << 1, // NoClassDefFoundError.
+ VERIFY_ERROR_UNRESOLVED_TYPE_CHECK = 1 << 2, // Missing class for doing a type check
+ VERIFY_ERROR_NO_METHOD = 1 << 3, // NoSuchMethodError.
+ VERIFY_ERROR_ACCESS_CLASS = 1 << 4, // IllegalAccessError.
+ VERIFY_ERROR_ACCESS_FIELD = 1 << 5, // IllegalAccessError.
+ VERIFY_ERROR_ACCESS_METHOD = 1 << 6, // IllegalAccessError.
+ VERIFY_ERROR_CLASS_CHANGE = 1 << 7, // IncompatibleClassChangeError.
+ VERIFY_ERROR_INSTANTIATION = 1 << 8, // InstantiationError.
+ VERIFY_ERROR_LOCKING = 1 << 9, // Could not guarantee balanced locking. This should be
// punted to the interpreter with access checks.
- VERIFY_ERROR_RUNTIME_THROW = 1 << 11, // The interpreter found an instruction that will
+ VERIFY_ERROR_RUNTIME_THROW = 1 << 10, // The interpreter found an instruction that will
// throw. Used for app compatibility for apps < T.
};
std::ostream& operator<<(std::ostream& os, VerifyError rhs);
diff --git a/tools/art_verifier/art_verifier.cc b/tools/art_verifier/art_verifier.cc
index 98935a2..2f2562b 100644
--- a/tools/art_verifier/art_verifier.cc
+++ b/tools/art_verifier/art_verifier.cc
@@ -256,7 +256,6 @@
h_loader,
*h_klass->GetClassDef(),
runtime->GetCompilerCallbacks(),
- true,
verifier::HardFailLogMode::kLogWarning,
args_->api_level_,
&error_msg);