diff options
| author | 2015-12-15 22:15:34 +0000 | |
|---|---|---|
| committer | 2015-12-15 22:15:34 +0000 | |
| commit | 2efb0aa57da168944f99a2d13aed2a426cfa76e7 (patch) | |
| tree | 5ca742f9a2a89f9c3c588f6f1863ab55bbdb5c5c /runtime/native_bridge_art_interface.cc | |
| parent | 9539150b85142c18e9e8c2264b5b6100942667c3 (diff) | |
Revert "Combine direct_methods_ and virtual_methods_ fields of mirror::Class"
This reverts commit 9539150b85142c18e9e8c2264b5b6100942667c3.
Change-Id: I596876cd643ec0ad524a56621efb6b89e8886230
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(); |