Lines Matching refs:Method
54 when the native method returns into the VM, or global, which are held
68 The most common mode of operation is for a method to create zero or
172 const Method* meth = dvmGetCurrentJNIMethod();
717 static void dumpMethods(Method* methods, size_t methodCount, const char* name) {
720 Method* method = &methods[i];
721 if (strcmp(name, method->name) == 0) {
722 char* desc = dexProtoCopyMethodDescriptor(&method->prototype);
723 LOGE("Candidate: %s.%s:%s", method->clazz->descriptor, name, desc);
730 LOGE("ERROR: couldn't find native method");
737 * Register a method that uses JNI calling conventions.
752 LOGV("fast JNI method %s.%s:%s detected", clazz->descriptor, methodName, signature);
755 Method* method = dvmFindDirectMethodByDescriptor(clazz, methodName, signature);
756 if (method == NULL) {
757 method = dvmFindVirtualMethodByDescriptor(clazz, methodName, signature);
759 if (method == NULL) {
764 if (!dvmIsNativeMethod(method)) {
771 if (dvmIsSynchronizedMethod(method)) {
774 LOGE("fast JNI method %s.%s:%s cannot be synchronized",
778 if (!dvmIsStaticMethod(method)) {
782 LOGE("fast JNI method %s.%s:%s cannot be non-static",
788 if (method->nativeFunc != dvmResolveNativeMethod) {
793 method->fastJni = fastJni;
794 dvmUseJNIBridge(method, fnPtr);
811 static bool shouldTrace(Method* method) {
812 const char* className = method->clazz->descriptor;
813 // Return true if the -Xjnitrace setting implies we should trace 'method'.
817 // Return true if we're trying to log all third-party JNI activity and 'method' doesn't look
831 * Point "method->nativeFunc" at the JNI bridge, and overload "method->insns"
834 void dvmUseJNIBridge(Method* method, void* func) {
835 method->shouldTrace = shouldTrace(method);
837 // Does the method take any reference arguments?
838 method->noRef = true;
839 const char* cp = method->shorty;
842 method->noRef = false;
848 dvmSetNativeFunc(method, bridge, (const u2*) func);
911 static void logNativeMethodEntry(const Method* method, const u4* args)
915 if (!dvmIsStaticMethod(method)) {
920 const char* desc = &method->shorty[1];
934 std::string className(dvmHumanReadableDescriptor(method->clazz->descriptor));
935 char* signature = dexProtoCopyMethodDescriptor(&method->prototype);
936 LOGI("-> %s %s%s %s(%s)", className.c_str(), method->name, signature, thisString, argsString);
940 static void logNativeMethodExit(const Method* method, Thread* self, const JValue returnValue)
942 method->clazz->descriptor));
943 char* signature = dexProtoCopyMethodDescriptor(&method->prototype);
948 method->name, signature, exceptionClassName.c_str());
951 char returnType = method->shorty[0];
954 method->name, signature, returnValueString);
960 * Get the method currently being executed by examining the interp stack.
962 const Method* dvmGetCurrentJNIMethod() {
966 const Method* meth = SAVEAREA_FROM_FP(fp)->method;
1077 * store the function result (if any), the method to call, and a pointer
1081 * A pointer in the Method struct points to one of these, and when a native
1082 * method is invoked the interpreter jumps to it.
1085 * of calling through a bridge, the target method is called directly.)
1089 * the current method's interpreted stack. This area is ignored by the
1090 * precise GC, because there is no register map for a native method (for
1091 * an interpreted method the args would be listed in the argument set).
1093 * because the method call setup copies them right before making the call,
1112 const Method* method, Thread* self)
1114 if (method->shorty[0] == 'L' && !dvmCheckException(self) && pResult->l != NULL) {
1122 void dvmCallJNIMethod(const u4* args, JValue* pResult, const Method* method, Thread* self) {
1127 bool isSynchronized = dvmIsSynchronizedMethod(method);
1130 //LOGI("JNI calling %p (%s.%s:%s):", method->insns,
1131 // method->clazz->descriptor, method->name, method->shorty);
1138 if (dvmIsStaticMethod(method)) {
1139 lockObj = (Object*) method->clazz;
1142 staticMethodClass = (jclass) addLocalReference(env, (Object*) method->clazz);
1160 if (!method->noRef) {
1161 const char* shorty = &method->shorty[1]; /* skip return type */
1187 if (method->shouldTrace) {
1188 logNativeMethodEntry(method, args);
1196 ANDROID_MEMBAR_FULL(); /* guarantee ordering on method->insns */
1197 assert(method->insns != NULL);
1200 dvmPlatformInvoke(method->fastJni ? NULL : env,
1202 method->jniArgInfo, method->insSize, modArgs, method->shorty,
1203 (void*) method->insns, pResult);
1208 convertReferenceResult(env, pResult, method, self);
1213 if (method->shouldTrace) {
1214 logNativeMethodExit(method, self, *pResult);
1232 * Return the version of the native method interface.
1270 * method. If there is no native method, e.g. we're calling this from native
1273 * method, but it's likely they meant ClassLoader.getSystemClassLoader.
1279 const Method* thisMethod = dvmGetCurrentJNIMethod();
1334 * Given a java.lang.reflect.Method or .Constructor, return a methodID.
1338 Object* method = dvmDecodeIndirectRef(env, jmethod);
1339 return (jmethodID) dvmGetMethodFromReflectObj(method);
1352 * Convert a methodID to a java.lang.reflect.Method or .Constructor.
1361 Object* obj = dvmCreateReflectObjForMethod(clazz, (Method*) methodID);
1466 * The new frame must have the same method pointer. (If for no other
1592 dvmCallMethodV(ts.self(), (Method*) methodID, newObj, true, &unused, args);
1611 dvmCallMethodV(ts.self(), (Method*) methodID, newObj, true, &unused, args);
1629 dvmCallMethodA(ts.self(), (Method*) methodID, newObj, true, &unused, args);
1665 * Get a method ID for an instance method.
1668 * static, direct, and interface method invocation, JNI only provides
1669 * two functions for acquiring a method ID. This call handles everything
1672 * JNI defines <init> as an instance method, but Dalvik considers it a
1673 * "direct" method, so we have to special-case it here.
1685 Method* meth = dvmFindInterfaceMethodHierByDescriptor(clazz, name, sig);
1688 "no method with name='%s' signature='%s' in interface %s",
1693 Method* meth = dvmFindVirtualMethodHierByDescriptor(clazz, name, sig);
1701 LOGD("GetMethodID: not returning static method %s.%s %s",
1709 "no method with name='%s' signature='%s' in class %s",
1713 * The method's class may not be the same as clazz, but if
1714 * it isn't this must be a virtual method and the class must
1745 * Get the method ID for a static method in a class.
1756 Method* meth = dvmFindDirectMethodHierByDescriptor(clazz, name, sig);
1762 LOGD("GetStaticMethodID: not returning nonstatic method %s.%s %s",
1772 "no static method with name='%s' signature='%s' in class %s",
1960 * Make a virtual method call.
1966 static _ctype Call##_jname##Method(JNIEnv* env, jobject jobj, \
1971 const Method* meth; \
1974 meth = dvmGetVirtualizedMethod(obj->clazz, (Method*)methodID); \
1990 const Method* meth; \
1992 meth = dvmGetVirtualizedMethod(obj->clazz, (Method*)methodID); \
2006 const Method* meth; \
2008 meth = dvmGetVirtualizedMethod(obj->clazz, (Method*)methodID); \
2029 * Make a "non-virtual" method call. We're still calling a virtual method,
2031 * The "clazz" parameter defines which implementation of a method we want.
2036 static _ctype CallNonvirtual##_jname##Method(JNIEnv* env, jobject jobj, \
2043 const Method* meth; \
2046 meth = dvmGetVirtualizedMethod(clazz, (Method*)methodID); \
2064 const Method* meth; \
2066 meth = dvmGetVirtualizedMethod(clazz, (Method*)methodID); \
2082 const Method* meth; \
2084 meth = dvmGetVirtualizedMethod(clazz, (Method*)methodID); \
2106 * Call a static method.
2109 static _ctype CallStatic##_jname##Method(JNIEnv* env, jclass jclazz, \
2117 dvmCallMethodV(ts.self(), (Method*)methodID, NULL, true, &result, args);\
2129 dvmCallMethodV(ts.self(), (Method*)methodID, NULL, true, &result, args);\
2140 dvmCallMethodA(ts.self(), (Method*)methodID, NULL, true, &result, args);\
2506 * This can be called multiple times on the same method, allowing the
2507 * caller to redefine the method implementation at will.
2537 * this before redefining a method implementation with RegisterNatives.
2551 * method that is pointing at unmapped memory, crashing the VM. In theory
3458 * which effectively means the caller is executing in a native method.