From 2efb0aa57da168944f99a2d13aed2a426cfa76e7 Mon Sep 17 00:00:00 2001 From: Alex Light Date: Tue, 15 Dec 2015 22:15:34 +0000 Subject: Revert "Combine direct_methods_ and virtual_methods_ fields of mirror::Class" This reverts commit 9539150b85142c18e9e8c2264b5b6100942667c3. Change-Id: I596876cd643ec0ad524a56621efb6b89e8886230 --- runtime/native_bridge_art_interface.cc | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'runtime/native_bridge_art_interface.cc') diff --git a/runtime/native_bridge_art_interface.cc b/runtime/native_bridge_art_interface.cc index 61a1085c0e..46cc5aaff8 100644 --- a/runtime/native_bridge_art_interface.cc +++ b/runtime/native_bridge_art_interface.cc @@ -45,7 +45,10 @@ static uint32_t GetNativeMethodCount(JNIEnv* env, jclass clazz) { mirror::Class* c = soa.Decode(clazz); uint32_t native_method_count = 0; - for (auto& m : c->GetMethods(sizeof(void*))) { + for (auto& m : c->GetDirectMethods(sizeof(void*))) { + native_method_count += m.IsNative() ? 1u : 0u; + } + for (auto& m : c->GetVirtualMethods(sizeof(void*))) { native_method_count += m.IsNative() ? 1u : 0u; } return native_method_count; @@ -60,7 +63,19 @@ static uint32_t GetNativeMethods(JNIEnv* env, jclass clazz, JNINativeMethod* met mirror::Class* c = soa.Decode(clazz); uint32_t count = 0; - for (auto& m : c->GetMethods(sizeof(void*))) { + for (auto& m : c->GetDirectMethods(sizeof(void*))) { + if (m.IsNative()) { + if (count < method_count) { + methods[count].name = m.GetName(); + methods[count].signature = m.GetShorty(); + methods[count].fnPtr = m.GetEntryPointFromJni(); + count++; + } else { + LOG(WARNING) << "Output native method array too small. Skipping " << PrettyMethod(&m); + } + } + } + for (auto& m : c->GetVirtualMethods(sizeof(void*))) { if (m.IsNative()) { if (count < method_count) { methods[count].name = m.GetName(); -- cgit v1.2.3-59-g8ed1b