Fix the weird state transitions in verification.
This probably wants to be done differently, without Compiler involving
ClassLinker, and with DexVerifier being told whether it should throw
or not. But this gets us further for now.
Test 077 still crashes, but that's now in code that's actively being
worked on, which I'll leave for now.
Change-Id: I4f265b20663837547933d0c5fa70032d22fc6c12
diff --git a/src/compiler.cc b/src/compiler.cc
index c6705a6..f4e8874 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -201,6 +201,15 @@
}
CHECK(klass->IsResolved()) << PrettyClass(klass);
class_linker->VerifyClass(klass);
+
+ if (klass->IsErroneous()) {
+ // ClassLinker::VerifyClass throws, which isn't useful in the compiler.
+ CHECK(Thread::Current()->IsExceptionPending());
+ Thread::Current()->ClearException();
+ // We want to try verification again at run-time, so move back into the resolved state.
+ klass->SetStatus(Class::kStatusResolved);
+ }
+
CHECK(klass->IsVerified() || klass->IsResolved()) << PrettyClass(klass);
CHECK(!Thread::Current()->IsExceptionPending()) << PrettyTypeOf(Thread::Current()->GetException());
}