diff options
author | Mathieu Chartier <mathieuc@google.com> | 2015-04-16 18:00:39 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2015-04-21 15:51:29 -0700 |
commit | fc58af45e342ba9e18bbdf597f205a58ec731658 (patch) | |
tree | 3f93906235cb4d2462d237223b72ccf4eedef645 /runtime/jni_internal.cc | |
parent | bbf02afc641a393d33342976e269218668c07386 (diff) | |
download | art-fc58af45e342ba9e18bbdf597f205a58ec731658.tar.gz art-fc58af45e342ba9e18bbdf597f205a58ec731658.tar.bz2 art-fc58af45e342ba9e18bbdf597f205a58ec731658.zip |
Add AbstractMethod, Constructor, Method
Moves functionality to ART from libcore. Precursor to moving
ArtMethods to native. Mostly performance improvements.
N5 perf before (irrelevant results removed):
Class_getConstructor 962.87 ===========
Class_getDeclaredMethod 2394.37 ============================
Class_getMethod 2509.20 ==============================
Class_newInstance 1999.81 =======================
Method_invokeI 1439.02 =================
Method_invokePreBoxedI 1415.82 ================
Method_invokeStaticI 1456.24 =================
Method_invokeStaticPreBoxedI 1427.32 =================
Method_invokeStaticV 814.47 =========
Method_invokeV 816.56 =========
After:
benchmark ns linear runtime
Class_getConstructor 1302.04 ================
Class_getDeclaredMethod 1459.01 ==================
Class_getMethod 1560.40 ===================
Class_newInstance 2029.94 =========================
Method_invokeI 1312.89 ================
Method_invokePreBoxedI 1255.01 ===============
Method_invokeStaticI 1289.13 ===============
Method_invokeStaticPreBoxedI 1196.52 ==============
Method_invokeStaticV 790.82 =========
Method_invokeV 791.73 =========
Performance improvements are more than just fixing regressions introduced
in: http://android-review.googlesource.com/#/c/146069/
Bug: 19264997
Change-Id: Ife79c469fdb09f30e3aefcfc3e0ce5ed32303fce
Diffstat (limited to 'runtime/jni_internal.cc')
-rw-r--r-- | runtime/jni_internal.cc | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/runtime/jni_internal.cc b/runtime/jni_internal.cc index 8a5461baee..554a28d3f4 100644 --- a/runtime/jni_internal.cc +++ b/runtime/jni_internal.cc @@ -42,6 +42,7 @@ #include "mirror/class-inl.h" #include "mirror/class_loader.h" #include "mirror/field-inl.h" +#include "mirror/method.h" #include "mirror/object-inl.h" #include "mirror/object_array-inl.h" #include "mirror/string-inl.h" @@ -361,19 +362,13 @@ class JNI { ScopedObjectAccess soa(env); mirror::ArtMethod* m = soa.DecodeMethod(mid); CHECK(!kMovingMethods); - ScopedLocalRef<jobject> art_method(env, soa.AddLocalReference<jobject>(m)); - jobject reflect_method; + mirror::AbstractMethod* method; if (m->IsConstructor()) { - reflect_method = env->AllocObject(WellKnownClasses::java_lang_reflect_Constructor); + method = mirror::Constructor::CreateFromArtMethod(soa.Self(), m); } else { - reflect_method = env->AllocObject(WellKnownClasses::java_lang_reflect_Method); + method = mirror::Method::CreateFromArtMethod(soa.Self(), m); } - if (env->ExceptionCheck()) { - return nullptr; - } - SetObjectField(env, reflect_method, - WellKnownClasses::java_lang_reflect_AbstractMethod_artMethod, art_method.get()); - return reflect_method; + return soa.AddLocalReference<jobject>(method); } static jobject ToReflectedField(JNIEnv* env, jclass, jfieldID fid, jboolean) { |