Remove bogus CHECK and replace some CHECKs to DCHECKs.
The state of a class can be concurrently changed, so don't assume there
must be an exception after calling `VerifyClass`.
Also replace some CHECKs to DCHECKs as there's no need to crash the
process for such invariants.
Test: test.py
Bug: 264228375
Change-Id: Iffcb191ba4c4ed3f90ea47b6fa9fae5415ff4d7c
diff --git a/runtime/oat_file_manager.cc b/runtime/oat_file_manager.cc
index e9c0ddd..6351220 100644
--- a/runtime/oat_file_manager.cc
+++ b/runtime/oat_file_manager.cc
@@ -711,7 +711,7 @@
h_loader)));
if (h_class == nullptr) {
- CHECK(self->IsExceptionPending());
+ DCHECK(self->IsExceptionPending());
self->ClearException();
continue;
}
@@ -722,15 +722,14 @@
continue;
}
- CHECK(h_class->IsResolved()) << h_class->PrettyDescriptor();
+ DCHECK(h_class->IsResolved()) << h_class->PrettyDescriptor();
class_linker->VerifyClass(self, &verifier_deps, h_class);
- if (h_class->IsErroneous()) {
- // ClassLinker::VerifyClass throws, which isn't useful here.
- CHECK(soa.Self()->IsExceptionPending());
- soa.Self()->ClearException();
+ if (self->IsExceptionPending()) {
+ // ClassLinker::VerifyClass can throw, but the exception isn't useful here.
+ self->ClearException();
}
- CHECK(h_class->IsVerified() || h_class->IsErroneous())
+ DCHECK(h_class->IsVerified() || h_class->IsErroneous())
<< h_class->PrettyDescriptor() << ": state=" << h_class->GetStatus();
if (h_class->IsVerified()) {