diff options
author | 2015-12-15 22:17:21 +0000 | |
---|---|---|
committer | 2015-12-15 22:17:21 +0000 | |
commit | bc90a0538e56f98b8e138cb622e6b9d834244ad9 (patch) | |
tree | fd85833863a13ce4abc7baaea1d2059c2419ad1e /runtime/native_bridge_art_interface.cc | |
parent | 0bbc1727c446ee5f4cc3c28e68127164ef379594 (diff) | |
parent | ae358c1d5cef227b44d6f4971b79e1ab91aa26eb (diff) |
Merge "Revert "Combine direct_methods_ and virtual_methods_ fields of mirror::Class""
Diffstat (limited to 'runtime/native_bridge_art_interface.cc')
-rw-r--r-- | runtime/native_bridge_art_interface.cc | 19 |
1 files changed, 17 insertions, 2 deletions
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<mirror::Class*>(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<mirror::Class*>(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(); |