1 /* Copyright (C) 2008 The Android Open Source Project 2 * 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 /* 17 * File: OP_INVOKE_INTERFACE.S 18 * 19 * Code: Call at method. Provides an "isrange" variable and 20 * a "routine" variable to specify this is the "range" version of 21 * invoke_interface that allows up to 255 arguments. 22 * 23 * For: invoke-interface, invoke-interface-range 24 * 25 * Description: invoke-interface is used to invoke an interface method; on an 26 * object whose concrete class isn't known, using a method_id that 27 * refers to an interface. 28 * 29 * Format: B|A|op CCCC G|F|E|D (35c) 30 * AA|op BBBB CCCC (3rc) 31 * 32 * Syntax: [B=5] op {vD, vE, vF, vG, vA}, meth@CCCC (35c) 33 * [B=5] op {vD, vE, vF, vG, vA}, type@CCCC (35c) 34 * [B=4] op {vD, vE, vF, vG}, kind@CCCC (35c) 35 * [B=3] op {vD, vE, vF}, kind@CCCC (35c) 36 * [B=2] op {vD, vE}, kind@CCCC (35c) 37 * [B=1] op {vD}, kind@CCCC (35c) 38 * [B=0] op {}, kind@CCCC (35c) 39 * 40 * op {vCCCC .. vNNNN}, meth@BBBB (3rc) (where NNNN = CCCC+AA-1, that 41 * op {vCCCC .. vNNNN}, type@BBBB (3rc) is A determines the count 0..255, 42 * and C determines the first register) 43 */ 44 45 %default { "isrange":"0", "routine":"NoRange" } 46 47 FETCH 2, %edx # %edx<- GFED or CCCC 48 FETCH 1, %ecx # %ecx<- method index 49 movl %ecx, -12(%esp) # push argument method index 50 .if (!$isrange) 51 and $$15, %edx # %edx<- D if not range 52 .endif 53 EXPORT_PC # must export for invoke 54 GET_VREG %edx # %edx<- first arg "this pointer" 55 movl rGLUE, %eax # %eax<- pMterpGlue 56 movl offGlue_methodClassDex(%eax), %eax # %eax<- glue->pDvmDex 57 movl %eax, -4(%esp) # push parameter class 58 cmp $$0, %edx # check for null object 59 je common_errNullObject # handle null object 60 jmp .L${opcode}_break 61 %break 62 .L${opcode}_break: 63 movl rGLUE, %ecx # %ecx<- pMterpGlue 64 movl offGlue_method(%ecx), %ecx # %ecx<- glue->method 65 movl %ecx, -8(%esp) # push parameter method 66 movl offObject_clazz(%edx), %edx # %edx<- glue->method->clazz 67 movl %edx, -16(%esp) # push parameter 68 lea -16(%esp), %esp 69 call dvmFindInterfaceMethodInCache # call: (ClassObject* thisClass, u4 methodIdx, 70 # const Method* method, DvmDex* methodClassDex) 71 # return: Method* 72 lea 16(%esp), %esp 73 cmp $$0, %eax # check if find failed 74 je common_exceptionThrown # handle exception 75 movl %eax, %ecx # %ecx<- method 76 jmp common_invokeMethod${routine} # invoke method common code 77