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/class_linker.cc b/src/class_linker.cc
index 7225764..71abb21 100644
--- a/src/class_linker.cc
+++ b/src/class_linker.cc
@@ -533,7 +533,7 @@
Class* c = GetClassRoot(ClassRoot(i));
if (!c->IsArrayClass() && !c->IsPrimitive()) {
EnsureInitialized(GetClassRoot(ClassRoot(i)), true);
- CHECK(!self->IsExceptionPending());
+ CHECK(!self->IsExceptionPending()) << PrettyTypeOf(self->GetException());
}
}
}
@@ -1368,10 +1368,12 @@
klass->SetStatus(Class::kStatusVerified);
} else {
LOG(ERROR) << "Verification failed on class " << PrettyClass(klass);
- CHECK(!Thread::Current()->IsExceptionPending()) << PrettyTypeOf(Thread::Current()->GetException());
-
+ Thread* self = Thread::Current();
+ CHECK(!self->IsExceptionPending()) << PrettyTypeOf(self->GetException());
+ self->ThrowNewExceptionF("Ljava/lang/VerifyError;", "Verification of %s failed",
+ PrettyDescriptor(klass->GetDescriptor()).c_str());
CHECK_EQ(klass->GetStatus(), Class::kStatusVerifying);
- klass->SetStatus(Class::kStatusResolved);
+ klass->SetStatus(Class::kStatusError);
}
}
@@ -1465,7 +1467,7 @@
bool ClassLinker::WaitForInitializeClass(Class* klass, Thread* self, ObjectLock& lock) {
while (true) {
- CHECK(!self->IsExceptionPending());
+ CHECK(!self->IsExceptionPending()) << PrettyTypeOf(self->GetException());
lock.Wait();
// When we wake up, repeat the test for init-in-progress. If