diff options
author | Brian Carlstrom <bdc@google.com> | 2011-09-15 11:31:11 -0700 |
---|---|---|
committer | Brian Carlstrom <bdc@google.com> | 2011-09-15 11:39:41 -0700 |
commit | 8692721dd8a3679ca874c3d1be0cecb62ff148f6 (patch) | |
tree | abd3801c4b25dfd1ddade53285609808be4b2ae3 /src/class_linker_test.cc | |
parent | 161928613d3f097108319de60494fab1aab8d48a (diff) | |
download | art-8692721dd8a3679ca874c3d1be0cecb62ff148f6.zip art-8692721dd8a3679ca874c3d1be0cecb62ff148f6.tar.gz art-8692721dd8a3679ca874c3d1be0cecb62ff148f6.tar.bz2 |
Fix ClassLinker::LinkInterfaceMethods bug
Also:
- Expanded class_linker_test with additional vtable and iftable coverage
- Added -fkeep-inline-functions where it works on host for debugging
- Added disabled test for running command line Fibonacci with oatexec
Change-Id: Ie295551e42493c7cca05684e71e56bf55bd362a4
Diffstat (limited to 'src/class_linker_test.cc')
-rw-r--r-- | src/class_linker_test.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/class_linker_test.cc b/src/class_linker_test.cc index eab184e..4b48892 100644 --- a/src/class_linker_test.cc +++ b/src/class_linker_test.cc @@ -54,6 +54,9 @@ class ClassLinkerTest : public CommonTest { EXPECT_EQ(0U, primitive->NumInstanceFields()); EXPECT_EQ(0U, primitive->NumStaticFields()); EXPECT_EQ(0U, primitive->NumInterfaces()); + EXPECT_TRUE(primitive->GetVTable() == NULL); + EXPECT_EQ(0, primitive->GetIfTableCount()); + EXPECT_TRUE(primitive->GetIfTable() == NULL); } void AssertArrayClass(const StringPiece& array_descriptor, @@ -95,6 +98,12 @@ class ClassLinkerTest : public CommonTest { EXPECT_EQ(0U, array->NumInstanceFields()); EXPECT_EQ(0U, array->NumStaticFields()); EXPECT_EQ(2U, array->NumInterfaces()); + EXPECT_TRUE(array->GetVTable() != NULL); + EXPECT_EQ(2, array->GetIfTableCount()); + ObjectArray<InterfaceEntry>* iftable = array->GetIfTable(); + ASSERT_TRUE(iftable != NULL); + EXPECT_TRUE(iftable->Get(0)->GetInterface()->GetDescriptor()->Equals("Ljava/lang/Cloneable;")); + EXPECT_TRUE(iftable->Get(1)->GetInterface()->GetDescriptor()->Equals("Ljava/io/Serializable;")); } void AssertMethod(Class* klass, Method* method) { @@ -159,6 +168,20 @@ class ClassLinkerTest : public CommonTest { EXPECT_NE(0U, klass->NumDirectMethods()); } } + EXPECT_EQ(klass->IsInterface(), klass->GetVTable() == NULL); + for (int i = 0; i < klass->GetIfTableCount(); i++) { + const InterfaceEntry* interface_entry = klass->GetIfTable()->Get(i); + ASSERT_TRUE(interface_entry != NULL); + Class* interface = interface_entry->GetInterface(); + ASSERT_TRUE(interface != NULL); + EXPECT_TRUE(interface_entry->GetInterface() != NULL); + if (klass->IsInterface()) { + EXPECT_EQ(0U, interface_entry->GetMethodArrayCount()); + } else { + CHECK_EQ(interface->NumVirtualMethods(), interface_entry->GetMethodArrayCount()); + EXPECT_EQ(interface->NumVirtualMethods(), interface_entry->GetMethodArrayCount()); + } + } if (klass->IsAbstract()) { EXPECT_FALSE(klass->IsFinal()); } else { |