From 2d7210188805292e463be4bcf7a133b654d7e0ea Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Mon, 10 Nov 2014 11:08:06 -0800 Subject: Change 64 bit ArtMethod fields to be pointer sized Changed the 64 bit entrypoint and gc map fields in ArtMethod to be pointer sized. This saves a large amount of memory on 32 bit systems. Reduces ArtMethod size by 16 bytes on 32 bit. Total number of ArtMethod on low memory mako: 169957 Image size: 49203 methods -> 787248 image size reduction. Zygote space size: 1070 methods -> 17120 size reduction. App methods: ~120k -> 2 MB savings. Savings per app on low memory mako: 125K+ per app (less active apps -> more image methods per app). Savings depend on how often the shared methods are on dirty pages vs shared. TODO in another CL, delete gc map field from ArtMethod since we should be able to get it from the Oat method header. Bug: 17643507 Change-Id: Ie9508f05907a9f693882d4d32a564460bf273ee8 (cherry picked from commit e832e64a7e82d7f72aedbd7d798fb929d458ee8f) --- runtime/native_bridge_art_interface.cc | 4 ++-- 1 file changed, 2 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 c2c6b12037..ffadfc61a7 100644 --- a/runtime/native_bridge_art_interface.cc +++ b/runtime/native_bridge_art_interface.cc @@ -72,7 +72,7 @@ static uint32_t GetNativeMethods(JNIEnv* env, jclass clazz, JNINativeMethod* met if (count < method_count) { methods[count].name = m->GetName(); methods[count].signature = m->GetShorty(); - methods[count].fnPtr = const_cast(m->GetNativeMethod()); + methods[count].fnPtr = m->GetEntryPointFromJni(); count++; } else { LOG(WARNING) << "Output native method array too small. Skipping " << PrettyMethod(m); @@ -85,7 +85,7 @@ static uint32_t GetNativeMethods(JNIEnv* env, jclass clazz, JNINativeMethod* met if (count < method_count) { methods[count].name = m->GetName(); methods[count].signature = m->GetShorty(); - methods[count].fnPtr = const_cast(m->GetNativeMethod()); + methods[count].fnPtr = m->GetEntryPointFromJni(); count++; } else { LOG(WARNING) << "Output native method array too small. Skipping " << PrettyMethod(m); -- cgit v1.2.3