Lines Matching refs:method
18 * Stacks and their uses (e.g. native --> interpreted method calls).
48 * We're calling an interpreted method from an internal VM function or
51 * Push a frame for an interpreted method onto the stack. This is only
63 static bool dvmPushInterpFrame(Thread* self, const Method* method)
70 assert(!dvmIsNativeMethod(method));
71 assert(!dvmIsAbstractMethod(method));
73 stackReq = method->registersSize * 4 // params + locals
75 + method->outsSize * 4; // args to other methods
87 self->interpStackSize, method->clazz->descriptor, method->name);
88 dvmHandleStackOverflow(self, method);
99 stackPtr -= method->registersSize * 4 + sizeof(StackSaveArea);
104 memset(stackPtr - (method->outsSize*4), 0xaf, stackReq);
115 breakSaveBlock->method = NULL;
119 saveBlock->method = method;
131 * We're calling a JNI native method from an internal VM fuction or
132 * via reflection. This is also used to create the "fake" native-method
139 bool dvmPushJNIFrame(Thread* self, const Method* method)
146 assert(dvmIsNativeMethod(method));
148 stackReq = method->registersSize * 4 // params only
161 self->interpStackSize, method->name);
162 dvmHandleStackOverflow(self, method);
170 * We leave space for the method args, which are copied in later.
174 stackPtr -= method->registersSize * 4 + sizeof(StackSaveArea);
194 breakSaveBlock->method = NULL;
198 saveBlock->method = method;
215 bool dvmPushLocalFrame(Thread* self, const Method* method)
221 assert(dvmIsNativeMethod(method));
233 self->interpStackSize, method->name);
234 dvmHandleStackOverflow(self, method);
258 saveBlock->method = method;
273 * an interpreted frame. Either way, the method pointer won't match.
280 if (saveBlock->method != SAVEAREA_FROM_FP(saveBlock->prevFrame)->method) {
282 * The previous frame doesn't have the same method pointer -- we've
287 SAVEAREA_FROM_FP(saveBlock->prevFrame)->method));
292 saveBlock->method->name,
293 SAVEAREA_FROM_FP(saveBlock->prevFrame)->method->name);
301 * Pop a frame we added. There should be one method frame and one break
305 * popping multiple method frames before we find the break.
323 while (saveBlock->prevFrame != NULL && saveBlock->method != NULL) {
326 if (dvmIsNativeMethod(saveBlock->method)) {
328 saveBlock->method->clazz->descriptor,
329 saveBlock->method->name,
330 (SAVEAREA_FROM_FP(saveBlock->prevFrame)->method == NULL) ?
337 if (saveBlock->method != NULL) {
355 static ClassObject* callPrep(Thread* self, const Method* method, Object* obj,
364 method->clazz->descriptor, method->name);
369 assert(method != NULL);
374 clazz = method->clazz;
377 char* desc = dexProtoCopyMethodDescriptor(&method->prototype);
379 clazz->descriptor, method->name, desc);
384 /* needed for java.lang.reflect.Method.invoke */
386 method))
389 dvmThrowIllegalAccessException("access to method denied");
400 if (dvmIsNativeMethod(method)) {
402 if (!dvmPushJNIFrame(self, method)) {
408 if (!dvmPushInterpFrame(self, method)) {
418 * Issue a method call.
424 void dvmCallMethod(Thread* self, const Method* method, Object* obj,
429 dvmCallMethodV(self, method, obj, false, pResult, args);
434 * Issue a method call with a variable number of arguments. We process
435 * the contents of "args" by scanning the method signature.
442 void dvmCallMethodV(Thread* self, const Method* method, Object* obj,
445 const char* desc = &(method->shorty[1]); // [0] is the return type.
450 clazz = callPrep(self, method, obj, false);
456 (method->registersSize - method->insSize);
461 if (!dvmIsStaticMethod(method)) {
506 if (verifyCount != method->insSize) {
508 method->insSize, clazz->descriptor, method->name);
516 if (dvmIsNativeMethod(method)) {
517 TRACE_METHOD_ENTER(self, method);
520 * directly at the method arguments.
522 (*method->nativeFunc)((u4*)self->interpSave.curFrame, pResult,
523 method, self);
524 TRACE_METHOD_EXIT(self, method);
526 dvmInterpret(self, method, pResult);
536 * Issue a method call with arguments provided in an array. We process
537 * the contents of "args" by scanning the method signature.
546 * "args" may be NULL if the method has no arguments.
548 void dvmCallMethodA(Thread* self, const Method* method, Object* obj,
551 const char* desc = &(method->shorty[1]); // [0] is the return type.
556 clazz = callPrep(self, method, obj, false);
562 (method->registersSize - method->insSize);
565 if (!dvmIsStaticMethod(method)) {
603 *(desc-1), clazz->descriptor, method->name);
613 if (verifyCount != method->insSize) {
615 method->insSize, clazz->descriptor, method->name);
621 if (dvmIsNativeMethod(method)) {
622 TRACE_METHOD_ENTER(self, method);
625 * directly at the method arguments.
627 (*method->nativeFunc)((u4*)self->interpSave.curFrame, pResult,
628 method, self);
629 TRACE_METHOD_EXIT(self, method);
631 dvmInterpret(self, method, pResult);
646 * Invoke a method, using the specified arguments and return type, through
647 * one of the reflection interfaces. Could be a virtual or direct method
652 * "invokeObj" will be null for a static method.
656 Object* dvmInvokeMethod(Object* obj, const Method* method,
680 clazz = callPrep(self, method, obj, !noAccessCheck);
687 (method->registersSize - method->insSize);
693 if (!dvmIsStaticMethod(method)) {
719 if (verifyCount != method->insSize) {
721 method->insSize, clazz->descriptor, method->name);
727 if (dvmIsNativeMethod(method)) {
728 TRACE_METHOD_ENTER(self, method);
731 * directly at the method arguments.
733 (*method->nativeFunc)((u4*)self->interpSave.curFrame, &retval,
734 method, self);
735 TRACE_METHOD_EXIT(self, method);
737 dvmInterpret(self, method, &retval);
749 * because the invoked method could have thrown a checked exception
759 * If this isn't a void method or constructor, convert the return type
804 * "pc" is an offset, in 16-bit units, from the start of the method's code.
810 int dvmLineNumFromPC(const Method* method, u4 relPc)
812 const DexCode* pDexCode = dvmGetMethodCode(method);
815 if (dvmIsNativeMethod(method) && !dvmIsAbstractMethod(method))
817 return -1; /* can happen for abstract method stub */
823 // A method with no line number info should return -1
826 dexDecodeDebugInfo(method->clazz->pDvmDex->pDexFile, pDexCode,
827 method->clazz->descriptor,
828 method->prototype.protoIdx,
829 method->accessFlags,
888 * If we got here by java.lang.reflect.Method.invoke(), we don't
889 * want to return Method's class loader. Shift up one and try
893 if (dvmIsReflectionMethod(saveArea->method)) {
916 return SAVEAREA_FROM_FP(caller)->method->clazz;
923 * class loader of the method that called it.
940 return SAVEAREA_FROM_FP(callerCaller)->method->clazz;
947 * class loader of the method that called it.
966 return SAVEAREA_FROM_FP(caller)->method->clazz;
976 void dvmFillStackTraceArray(const void* fp, const Method** array, size_t length)
984 array[i++] = SAVEAREA_FROM_FP(fp)->method;
1001 void dvmHandleStackOverflow(Thread* self, const Method* method)
1019 method->clazz->descriptor, method->name, method->shorty);
1021 ALOGI(" method requires %d+%d+%d=%d bytes, fp is %p (%d left)",
1022 method->registersSize * 4, sizeof(StackSaveArea), method->outsSize * 4,
1023 (method->registersSize + method->outsSize) * 4 + sizeof(StackSaveArea),
1098 const Method* method = saveArea->method;
1101 /* check Method* */
1102 if (!dvmLinearAllocContains(method, sizeof(Method))) {
1103 ALOGD("ExtrMon: method %p not valid", method);
1108 u4 insnsSize = dvmGetMethodInsnsSize(method);
1109 if (currentPc < method->insns ||
1110 currentPc >= method->insns + insnsSize)
1113 currentPc, method->insns, method->insns + insnsSize);
1126 if (reg >= method->registersSize) {
1128 reg, method->registersSize);
1178 * Each frame holds a pointer to the currently executing method, and the
1180 * we don't have the PC for the current method on the stack, which is
1191 const Method* method;
1216 method = saveArea->method;
1224 relPc = currentPc - saveArea->method->insns;
1228 std::string methodName(dvmHumanReadableMethod(method, false));
1229 if (dvmIsNativeMethod(method)) {
1230 dvmPrintDebugMessage(target, " at %s(Native Method)\n",
1234 methodName.c_str(), dvmGetMethodSourceFile(method),
1236 relPc < 0 ? -1 : dvmLineNumFromPC(method, relPc));