Reduce meta-data object sizes, introduce meta-data helper classes.
Change-Id: Id14ad218f1c74c659701352fdf1a45bf6444daa3
diff --git a/src/java_lang_reflect_Method.cc b/src/java_lang_reflect_Method.cc
index e36078f..90d718d 100644
--- a/src/java_lang_reflect_Method.cc
+++ b/src/java_lang_reflect_Method.cc
@@ -17,6 +17,7 @@
#include "jni_internal.h"
#include "class_linker.h"
#include "object.h"
+#include "object_utils.h"
#include "reflection.h"
#include "JniConstants.h" // Last to avoid problems with LOG redefinition.
@@ -25,33 +26,19 @@
namespace {
-jint Method_getMethodModifiers(JNIEnv* env, jclass, jclass javaDeclaringClass, jobject jmethod, jint slot) {
- Method* m = Decode<Object*>(env, jmethod)->AsMethod();
- jint access_flags = m->GetAccessFlags();
- // We move the DECLARED_SYNCHRONIZED flag into the SYNCHRONIZED
- // position, because the callers of this function are trying to convey
- // the "traditional" meaning of the flags to their callers.
- access_flags &= ~kAccSynchronized;
- if ((access_flags & kAccDeclaredSynchronized) != 0) {
- access_flags |= kAccSynchronized;
- }
-
- return access_flags & kAccJavaFlagsMask;
+jobject Method_invoke(JNIEnv* env, jobject javaMethod, jobject javaReceiver, jobject javaArgs) {
+ return InvokeMethod(env, javaMethod, javaReceiver, javaArgs);
}
-jint Method_getProtoIndex(JNIEnv* env, jclass, jclass javaDeclaringClass, jobject jmethod, jint slot) {
- Method* m = Decode<Object*>(env, jmethod)->AsMethod();
- return m->GetProtoIdx();
-}
-
-jobject Method_invokeNative(JNIEnv* env, jobject javaMethod, jobject javaReceiver, jobject javaArgs, jclass, jobject javaParams, jclass, jint, jboolean) {
- return InvokeMethod(env, javaMethod, javaReceiver, javaArgs, javaParams);
+jobject Method_getReturnTypeNative(JNIEnv* env, jobject javaMethod) {
+ Method* m = Decode<Object*>(env, javaMethod)->AsMethod();
+ MethodHelper mh(m);
+ return AddLocalReference<jobject>(env, mh.GetReturnType());
}
static JNINativeMethod gMethods[] = {
- NATIVE_METHOD(Method, getMethodModifiers, "(Ljava/lang/Class;Ljava/lang/reflect/AccessibleObject;I)I"),
- NATIVE_METHOD(Method, getProtoIndex, "(Ljava/lang/Class;Ljava/lang/reflect/AccessibleObject;I)I"),
- NATIVE_METHOD(Method, invokeNative, "(Ljava/lang/Object;[Ljava/lang/Object;Ljava/lang/Class;[Ljava/lang/Class;Ljava/lang/Class;IZ)Ljava/lang/Object;"),
+ NATIVE_METHOD(Method, invoke, "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;"),
+ NATIVE_METHOD(Method, getReturnTypeNative, "()Ljava/lang/Class;")
};
} // namespace