Update runtime/ implications to use (D)CHECK_IMPLIES
Follow-up to aosp/1988868 in which we added the (D)CHECK_IMPLIES
macro. This CL uses it on compiler/ occurrences found by a regex.
Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b
Change-Id: Id4ee45b41bad85a1f0d98c1e88af6baa3e34a662
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 62be39a..6cfd5c8 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -1999,8 +1999,8 @@
// Set image methods' entry point that point to the nterp trampoline to the
// nterp entry point. This allows taking the fast path when doing a
// nterp->nterp call.
- DCHECK(!NeedsClinitCheckBeforeCall(&method) ||
- method.GetDeclaringClass()->IsVisiblyInitialized());
+ DCHECK_IMPLIES(NeedsClinitCheckBeforeCall(&method),
+ method.GetDeclaringClass()->IsVisiblyInitialized());
method.SetEntryPointFromQuickCompiledCode(interpreter::GetNterpEntryPoint());
} else {
method.SetEntryPointFromQuickCompiledCode(GetQuickToInterpreterBridge());
@@ -4148,9 +4148,9 @@
}
// Core array classes, i.e. Object[], Class[], String[] and primitive
// arrays, have special initialization and they should be found above.
- DCHECK(!component_type->IsObjectClass() ||
- // Guard from false positives for errors before setting superclass.
- component_type->IsErroneousUnresolved());
+ DCHECK_IMPLIES(component_type->IsObjectClass(),
+ // Guard from false positives for errors before setting superclass.
+ component_type->IsErroneousUnresolved());
DCHECK(!component_type->IsStringClass());
DCHECK(!component_type->IsClassClass());
DCHECK(!component_type->IsPrimitive());
@@ -4566,7 +4566,7 @@
// If the oat file says the class had an error, re-run the verifier. That way we will either:
// 1) Be successful at runtime, or
// 2) Get a precise error message.
- DCHECK(!mirror::Class::IsErroneous(oat_file_class_status) || !preverified);
+ DCHECK_IMPLIES(mirror::Class::IsErroneous(oat_file_class_status), !preverified);
std::string error_msg;
verifier::FailureKind verifier_failure = verifier::FailureKind::kNoFailure;
@@ -8884,7 +8884,7 @@
self->EndAssertNoThreadSuspension(old_no_suspend_cause);
// We lie to the GC about the java.lang.ref.Reference.referent field, so it doesn't scan it.
- DCHECK(!class_linker->init_done_ || !klass->DescriptorEquals("Ljava/lang/ref/Reference;"));
+ DCHECK_IMPLIES(class_linker->init_done_, !klass->DescriptorEquals("Ljava/lang/ref/Reference;"));
if (!is_static &&
UNLIKELY(!class_linker->init_done_) &&
klass->DescriptorEquals("Ljava/lang/ref/Reference;")) {
@@ -9186,8 +9186,9 @@
// In case of jmvti, the dex file gets verified before being registered, so first
// check if it's registered before checking class tables.
const DexFile& dex_file = *dex_cache->GetDexFile();
- DCHECK(!IsDexFileRegistered(Thread::Current(), dex_file) ||
- FindClassTable(Thread::Current(), dex_cache) == ClassTableForClassLoader(class_loader))
+ DCHECK_IMPLIES(
+ IsDexFileRegistered(Thread::Current(), dex_file),
+ FindClassTable(Thread::Current(), dex_cache) == ClassTableForClassLoader(class_loader))
<< "DexFile referrer: " << dex_file.GetLocation()
<< " ClassLoader: " << DescribeLoaders(class_loader, "");
// Be a good citizen and update the dex cache to speed subsequent calls.