Combine direct_methods_ and virtual_methods_ fields of mirror::Class
Manual cherry-pick of 6286a97 to master
This makes several parts of the overall runtime simpler and reduces
the size of a class object by 32-bits.
Bug: 24618811
Change-Id: I36129b52189e26898ea56fa2b7b45652e06af236
diff --git a/runtime/entrypoints/entrypoint_utils.cc b/runtime/entrypoints/entrypoint_utils.cc
index 87e29ae..915d9ab 100644
--- a/runtime/entrypoints/entrypoint_utils.cc
+++ b/runtime/entrypoints/entrypoint_utils.cc
@@ -306,11 +306,13 @@
mirror::Method* interface_method = soa.Decode<mirror::Method*>(interface_method_jobj);
ArtMethod* proxy_method = rcvr->GetClass()->FindVirtualMethodForInterface(
interface_method->GetArtMethod(), sizeof(void*));
- auto* virtual_methods = proxy_class->GetVirtualMethodsPtr();
+ auto virtual_methods = proxy_class->GetVirtualMethodsSlice(sizeof(void*));
size_t num_virtuals = proxy_class->NumVirtualMethods();
size_t method_size = ArtMethod::Size(sizeof(void*));
+ // Rely on the fact that the methods are contiguous to determine the index of the method in
+ // the slice.
int throws_index = (reinterpret_cast<uintptr_t>(proxy_method) -
- reinterpret_cast<uintptr_t>(virtual_methods)) / method_size;
+ reinterpret_cast<uintptr_t>(&virtual_methods.At(0))) / method_size;
CHECK_LT(throws_index, static_cast<int>(num_virtuals));
mirror::ObjectArray<mirror::Class>* declared_exceptions =
proxy_class->GetThrows()->Get(throws_index);