Refactor ClassLinker::LinkInterfaceMethods().
Add a helper class and split LinkInterfaceMethods() into
several functions to improve readability. Even with this
change, it is still almost 250 lines long.
Fix the method array reallocation to use the appropriate
linear allocator for the class's defining loader. Given that
this is a native reallocation, failure to reallocate would
result in an abort, so CHECK() that we get a non-null array
instead of expecting a null and asserting a pending OOME.
Test: m test-art-host
Change-Id: I8ff8257e4271ae8c975ea4b33fd8af36e1a1f77e
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index 9b25303..20fba13 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -652,6 +652,8 @@
};
private:
+ class LinkInterfaceMethodsHelper;
+
struct ClassLoaderData {
jweak weak_root; // Weak root to enable class unloading.
ClassTable* class_table;
@@ -1089,6 +1091,12 @@
REQUIRES(!Locks::dex_lock_)
REQUIRES_SHARED(Locks::mutator_lock_);
+ // Allocate method arrays for interfaces.
+ bool AllocateIfTableMethodArrays(Thread* self,
+ Handle<mirror::Class> klass,
+ Handle<mirror::IfTable> iftable)
+ REQUIRES_SHARED(Locks::mutator_lock_);
+
// Sets imt_ref appropriately for LinkInterfaceMethods.
// If there is no method in the imt location of imt_ref it will store the given method there.
// Otherwise it will set the conflict method which will figure out which method to use during