Improvements to Field.get/set.
Avoid unnecessary repeated computation in Field.get/set.
Refactor FromReflectedField and FromReflectedMethod into common helpers in
mirror::ArtField and mirror::ArtMethod, and make use of thereby avoiding
transitions through JNI.
Avoid JNI use from within FromReflectedField and FromReflectedMethod.
Tidy up Field.get/set wrt moving collector support.
Bug: 12189533
Change-Id: I643ab3474bade4abac3a3ae2b6e373b2bb0891c8
diff --git a/runtime/reflection.cc b/runtime/reflection.cc
index dde9a94..f567055 100644
--- a/runtime/reflection.cc
+++ b/runtime/reflection.cc
@@ -462,8 +462,7 @@
jobject InvokeMethod(const ScopedObjectAccess& soa, jobject javaMethod,
jobject javaReceiver, jobject javaArgs) {
- jmethodID mid = soa.Env()->FromReflectedMethod(javaMethod);
- mirror::ArtMethod* m = soa.DecodeMethod(mid);
+ mirror::ArtMethod* m = mirror::ArtMethod::FromReflectedMethod(soa, javaMethod);
mirror::Class* declaring_class = m->GetDeclaringClass();
if (UNLIKELY(!declaring_class->IsInitialized())) {