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/jni_internal.cc b/runtime/jni_internal.cc
index 5e3fa19..cb67ee3 100644
--- a/runtime/jni_internal.cc
+++ b/runtime/jni_internal.cc
@@ -316,12 +316,7 @@
static ArtMethod* FindMethod(mirror::Class* c, const StringPiece& name, const StringPiece& sig)
SHARED_REQUIRES(Locks::mutator_lock_) {
auto pointer_size = Runtime::Current()->GetClassLinker()->GetImagePointerSize();
- for (auto& method : c->GetDirectMethods(pointer_size)) {
- if (kNative == method.IsNative() && name == method.GetName() && method.GetSignature() == sig) {
- return &method;
- }
- }
- for (auto& method : c->GetVirtualMethods(pointer_size)) {
+ for (auto& method : c->GetMethods(pointer_size)) {
if (kNative == method.IsNative() && name == method.GetName() && method.GetSignature() == sig) {
return &method;
}
@@ -2220,13 +2215,7 @@
size_t unregistered_count = 0;
auto pointer_size = Runtime::Current()->GetClassLinker()->GetImagePointerSize();
- for (auto& m : c->GetDirectMethods(pointer_size)) {
- if (m.IsNative()) {
- m.UnregisterNative();
- unregistered_count++;
- }
- }
- for (auto& m : c->GetVirtualMethods(pointer_size)) {
+ for (auto& m : c->GetMethods(pointer_size)) {
if (m.IsNative()) {
m.UnregisterNative();
unregistered_count++;