Added second pass which does code flow checking to verifier.
Ran this through libcore and it finds no errors, but I still need to
create tests to make sure it catches errors when it should. Also, it's
still missing 2 pieces, replacement of failing opcodes and generation of
the register map.
Change-Id: I0f4c4c20751b5b030ca44c23e1d1c2e133404e0c
diff --git a/src/class_linker.cc b/src/class_linker.cc
index f312556..14f4883 100644
--- a/src/class_linker.cc
+++ b/src/class_linker.cc
@@ -1193,7 +1193,7 @@
CHECK(klass->GetStatus() == Class::kStatusResolved);
klass->SetStatus(Class::kStatusVerifying);
- if (!DexVerify::VerifyClass(klass)) {
+ if (!DexVerifier::VerifyClass(klass)) {
LG << "Verification failed"; // TODO: ThrowVerifyError
Object* exception = self->GetException();
klass->SetVerifyErrorClass(exception->GetClass());
@@ -1592,6 +1592,8 @@
for (size_t i = 0; i < count; ++i) {
klass->GetVirtualMethodDuringLinking(i)->SetMethodIndex(i);
}
+ // Link interface method tables
+ LinkInterfaceMethods(klass);
} else {
// Link virtual method tables
LinkVirtualMethods(klass);
@@ -2103,7 +2105,9 @@
const char* name = dex_file.dexStringById(method_id.name_idx_);
std::string signature(dex_file.CreateMethodDescriptor(method_id.proto_idx_, NULL));
- if (is_direct) {
+ if (klass->IsInterface()) {
+ resolved = klass->FindInterfaceMethod(name, signature);
+ } else if (is_direct) {
resolved = klass->FindDirectMethod(name, signature);
} else {
resolved = klass->FindVirtualMethod(name, signature);