1 %default { "isrange":"0", "routine":"NoRange" } 2 %verify "executed" 3 %verify "unknown method" 4 /* 5 * Handle a direct method call. 6 * 7 * (We could defer the "is 'this' pointer null" test to the common 8 * method invocation code, and use a flag to indicate that static 9 * calls don't count. If we do this as part of copying the arguments 10 * out we could avoiding loading the first arg twice.) 11 * 12 * for: invoke-direct, invoke-direct/range 13 */ 14 /* op vB, {vD, vE, vF, vG, vA}, class@CCCC */ 15 /* op {vCCCC..v(CCCC+AA-1)}, meth@BBBB */ 16 GET_GLUE(%ecx) 17 movzwl 2(rPC),%eax # eax<- BBBB 18 movl offGlue_methodClassDex(%ecx),%ecx # ecx<- pDvmDex 19 EXPORT_PC() 20 SPILL(rPC) 21 movl offDvmDex_pResMethods(%ecx),%ecx # ecx<- pDvmDex->pResMethods 22 movzwl 4(rPC),rPC # rPC<- GFED or CCCC 23 movl (%ecx,%eax,4),%eax # eax<- resolved methodToCall 24 .if (!$isrange) 25 andl $$0xf,rPC # rPC<- D (or stays CCCC) 26 .endif 27 testl %eax,%eax # already resolved? 28 GET_VREG(%ecx,rPC) # ecx<- "this" ptr 29 je .L${opcode}_resolve # not resolved, do it now 30 .L${opcode}_finish: 31 UNSPILL(rPC) 32 testl %ecx,%ecx # null "this"? 33 jne common_invokeMethod${routine} # no, continue on 34 jmp common_errNullObject 35 %break 36 37 /* 38 * On entry: 39 * TMP_SPILL <- "this" register 40 * Things a bit ugly on this path, but it's the less 41 * frequent one. We'll have to do some reloading. 42 */ 43 .L${opcode}_resolve: 44 SPILL_TMP(%ecx) 45 GET_GLUE(%ecx) 46 UNSPILL(rPC) 47 movl offGlue_method(%ecx),%ecx # ecx<- glue->method 48 movzwl 2(rPC),%eax # reference (BBBB or CCCC) 49 movl offMethod_clazz(%ecx),%ecx # ecx<- method->clazz 50 movl $$METHOD_DIRECT,OUT_ARG2(%esp) 51 movl %eax,OUT_ARG1(%esp) 52 movl %ecx,OUT_ARG0(%esp) 53 call dvmResolveMethod # eax<- call(clazz, ref, flags) 54 UNSPILL_TMP(%ecx) 55 testl %eax,%eax 56 jne .L${opcode}_finish 57 UNSPILL(rPC) 58 jmp common_exceptionThrown 59