Home | History | Annotate | Download | only in interp

Lines Matching refs:method

18  * Stacks and their uses (e.g. native --> interpreted method calls).
44 * We're calling an interpreted method from an internal VM function or
47 * Push a frame for an interpreted method onto the stack. This is only
59 static bool dvmPushInterpFrame(Thread* self, const Method* method)
66 assert(!dvmIsNativeMethod(method));
67 assert(!dvmIsAbstractMethod(method));
69 stackReq = method->registersSize * 4 // params + locals
71 + method->outsSize * 4; // args to other methods
83 self->interpStackSize, method->clazz->descriptor, method->name);
84 dvmHandleStackOverflow(self, method);
95 stackPtr -= method->registersSize * 4 + sizeof(StackSaveArea);
100 memset(stackPtr - (method->outsSize*4), 0xaf, stackReq);
110 breakSaveBlock->method = NULL;
114 saveBlock->method = method;
126 * We're calling a JNI native method from an internal VM fuction or
127 * via reflection. This is also used to create the "fake" native-method
134 bool dvmPushJNIFrame(Thread* self, const Method* method)
141 assert(dvmIsNativeMethod(method));
143 stackReq = method->registersSize * 4 // params only
156 self->interpStackSize, method->name);
157 dvmHandleStackOverflow(self, method);
165 * We leave space for the method args, which are copied in later.
169 stackPtr -= method->registersSize * 4 + sizeof(StackSaveArea);
187 breakSaveBlock->method = NULL;
195 saveBlock->method = method;
212 bool dvmPushLocalFrame(Thread* self, const Method* method)
218 assert(dvmIsNativeMethod(method));
230 self->interpStackSize, method->name);
231 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) ?
341 if (saveBlock->method != NULL) {
359 static ClassObject* callPrep(Thread* self, const Method* method, Object* obj,
368 method->clazz->descriptor, method->name);
373 assert(method != NULL);
378 clazz = method->clazz;
381 char* desc = dexProtoCopyMethodDescriptor(&method->prototype);
383 clazz->descriptor, method->name, desc);
388 /* needed for java.lang.reflect.Method.invoke */
390 method))
394 "access to method denied");
405 if (dvmIsNativeMethod(method)) {
407 if (!dvmPushJNIFrame(self, method)) {
413 if (!dvmPushInterpFrame(self, method)) {
423 * Issue a method call.
429 void dvmCallMethod(Thread* self, const Method* method, Object* obj,
436 dvmCallMethodV(self, method, obj, false, pResult, args);
441 * Issue a method call with a variable number of arguments. We process
442 * the contents of "args" by scanning the method signature.
449 void dvmCallMethodV(Thread* self, const Method* method, Object* obj,
452 const char* desc = &(method->shorty[1]); // [0] is the return type.
457 clazz = callPrep(self, method, obj, false);
462 ins = ((u4*)self->curFrame) + (method->registersSize - method->insSize);
467 if (!dvmIsStaticMethod(method)) {
512 if (verifyCount != method->insSize) {
514 method->insSize, clazz->descriptor, method->name);
522 if (dvmIsNativeMethod(method)) {
524 TRACE_METHOD_ENTER(self, method);
528 * directly at the method arguments.
530 (*method->nativeFunc)(self->curFrame, pResult, method, self);
532 TRACE_METHOD_EXIT(self, method);
535 dvmInterpret(self, method, pResult);
543 * Issue a method call with arguments provided in an array. We process
544 * the contents of "args" by scanning the method signature.
553 * "args" may be NULL if the method has no arguments.
555 void dvmCallMethodA(Thread* self, const Method* method, Object* obj,
558 const char* desc = &(method->shorty[1]); // [0] is the return type.
563 clazz = callPrep(self, method, obj, false);
568 ins = ((u4*)self->curFrame) + (method->registersSize - method->insSize);
571 if (!dvmIsStaticMethod(method)) {
610 *(desc-1), clazz->descriptor, method->name);
620 if (verifyCount != method->insSize) {
622 method->insSize, clazz->descriptor, method->name);
628 if (dvmIsNativeMethod(method)) {
630 TRACE_METHOD_ENTER(self, method);
634 * directly at the method arguments.
636 (*method->nativeFunc)(self->curFrame, pResult, method, self);
638 TRACE_METHOD_EXIT(self, method);
641 dvmInterpret(self, method, pResult);
649 * Invoke a method, using the specified arguments and return type, through
650 * one of the reflection interfaces. Could be a virtual or direct method
655 * "invokeObj" will be null for a static method.
659 Object* dvmInvokeMethod(Object* obj, const Method* method,
683 clazz = callPrep(self, method, obj, !noAccessCheck);
688 ins = ((s4*)self->curFrame) + (method->registersSize - method->insSize);
694 if (!dvmIsStaticMethod(method)) {
730 if (verifyCount != method->insSize) {
732 method->insSize, clazz->descriptor, method->name);
738 if (dvmIsNativeMethod(method)) {
740 TRACE_METHOD_ENTER(self, method);
744 * directly at the method arguments.
746 (*method->nativeFunc)(self->curFrame, &retval, method, self);
748 TRACE_METHOD_EXIT(self, method);
751 dvmInterpret(self, method, &retval);
756 * because the invoked method could have thrown a checked exception
766 * If this isn't a void method or constructor, convert the return type
810 * "pc" is an offset, in 16-bit units, from the start of the method's code.
816 int dvmLineNumFromPC(const Method* method, u4 relPc)
818 const DexCode* pDexCode = dvmGetMethodCode(method);
821 if (dvmIsNativeMethod(method) && !dvmIsAbstractMethod(method))
823 return -1; /* can happen for abstract method stub */
829 // A method with no line number info should return -1
832 dexDecodeDebugInfo(method->clazz->pDvmDex->pDexFile, pDexCode,
833 method->clazz->descriptor,
834 method->prototype.protoIdx,
835 method->accessFlags,
894 * If we got here by java.lang.reflect.Method.invoke(), we don't
895 * want to return Method's class loader. Shift up one and try
899 if (dvmIsReflectionMethod(saveArea->method)) {
922 return SAVEAREA_FROM_FP(caller)->method->clazz;
929 * class loader of the method that called it.
945 return SAVEAREA_FROM_FP(callerCaller)->method->clazz;
952 * class loader of the method that called it.
970 return SAVEAREA_FROM_FP(caller)->method->clazz;
977 * Allocates a new array and fills it with method pointers. Break frames
985 bool dvmCreateStackTraceArray(const void* fp, const Method*** pArray,
988 const Method** array;
992 array = (const Method**) malloc(depth * sizeof(Method*));
998 array[idx++] = SAVEAREA_FROM_FP(fp)->method;
1018 void dvmHandleStackOverflow(Thread* self, const Method* method)
1036 method->clazz->descriptor, method->name, method->shorty);
1038 LOGI(" method requires %d+%d+%d=%d bytes, fp is %p (%d left)\n",
1039 method->registersSize * 4, sizeof(StackSaveArea), method->outsSize * 4,
1040 (method->registersSize + method->outsSize) * 4 + sizeof(StackSaveArea),
1116 const Method* method = saveArea->method;
1119 /* check Method* */
1120 if (!dvmLinearAllocContains(method, sizeof(Method))) {
1121 LOGD("ExtrMon: method %p not valid\n", method);
1126 u4 insnsSize = dvmGetMethodInsnsSize(method);
1127 if (currentPc < method->insns ||
1128 currentPc >= method->insns + insnsSize)
1131 currentPc, method->insns, method->insns + insnsSize);
1144 if (reg >= method->registersSize) {
1146 reg, method->registersSize);
1177 * Each frame holds a pointer to the currently executing method, and the
1179 * we don't have the PC for the current method on the stack, which is
1190 const Method* method;
1208 method = saveArea->method;
1216 relPc = currentPc - saveArea->method->insns;
1220 char* className = dvmDescriptorToDot(method->clazz->descriptor);
1221 if (dvmIsNativeMethod(method))
1223 " at %s.%s(Native Method)\n", className, method->name);
1227 className, method->name, dvmGetMethodSourceFile(method),
1229 relPc < 0 ? -1 : dvmLineNumFromPC(method, relPc));