Add fast path for FindClass using the type dex file.
If we are using the PathClassLoader with a BootClassLoader
parent, we can handle the common case in the FindClass function
without needing to go back to java code.
Around 10% speedup measured of maps launch, could be noise due to
large variation of app launch times. Eliminates defineClassNative
from being anywhere near the top of sampling profiles.
Bug: 17397179
Bug: 16828525
(cherry picked from commit 8a39e7fe02e9a81853dc7a75cb50d9ece07a9b37)
Change-Id: I1f31de76c1b1a53e32173b1e61a59b0e2f267c98
diff --git a/runtime/well_known_classes.h b/runtime/well_known_classes.h
index 7639f50..b10106c 100644
--- a/runtime/well_known_classes.h
+++ b/runtime/well_known_classes.h
@@ -40,7 +40,11 @@
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
static jclass com_android_dex_Dex;
+ static jclass dalvik_system_DexFile;
+ static jclass dalvik_system_DexPathList;
+ static jclass dalvik_system_DexPathList$Element;
static jclass dalvik_system_PathClassLoader;
+ static jclass java_lang_BootClassLoader;
static jclass java_lang_ClassLoader;
static jclass java_lang_ClassNotFoundException;
static jclass java_lang_Daemons;
@@ -93,6 +97,10 @@
static jmethodID org_apache_harmony_dalvik_ddmc_DdmServer_broadcast;
static jmethodID org_apache_harmony_dalvik_ddmc_DdmServer_dispatch;
+ static jfieldID dalvik_system_DexFile_cookie;
+ static jfieldID dalvik_system_DexPathList_dexElements;
+ static jfieldID dalvik_system_DexPathList$Element_dexFile;
+ static jfieldID dalvik_system_PathClassLoader_pathList;
static jfieldID java_lang_reflect_AbstractMethod_artMethod;
static jfieldID java_lang_reflect_Field_artField;
static jfieldID java_lang_reflect_Proxy_h;