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
diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
index 2e813c8..2e7e2df 100644
--- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
@@ -26,6 +26,7 @@
#include "mirror/art_method-inl.h"
#include "mirror/class-inl.h"
#include "mirror/dex_cache-inl.h"
+#include "mirror/method.h"
#include "mirror/object-inl.h"
#include "mirror/object_array-inl.h"
#include "runtime.h"
@@ -760,11 +761,12 @@
mirror::ArtMethod* interface_method = proxy_method->FindOverriddenMethod();
DCHECK(interface_method != nullptr) << PrettyMethod(proxy_method);
DCHECK(!interface_method->IsProxyMethod()) << PrettyMethod(interface_method);
- jobject interface_method_jobj = soa.AddLocalReference<jobject>(interface_method);
+ self->EndAssertNoThreadSuspension(old_cause);
+ jobject interface_method_jobj = soa.AddLocalReference<jobject>(
+ mirror::Method::CreateFromArtMethod(soa.Self(), interface_method));
// All naked Object*s should now be in jobjects, so its safe to go into the main invoke code
// that performs allocations.
- self->EndAssertNoThreadSuspension(old_cause);
JValue result = InvokeProxyInvocationHandler(soa, shorty, rcvr_jobj, interface_method_jobj, args);
// Restore references which might have moved.
local_ref_visitor.FixupReferences();