Home | History | Annotate | Download | only in x86-atom
      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_STATIC.S
     18     *
     19     * Code: Call static direct method. Provides an "isrange" variable and
     20     *       a "routine" variable to specify this is the "range" version of
     21     *       invoke_static that allows up to 255 arguments.
     22     *
     23     * For: invoke-static, invoke-static/range
     24     *
     25     * Description: invoke-static is used to invoke static direct method.
     26     *
     27     * Format: B|A|op CCCC G|F|E|D (35c)
     28     *         AA|op BBBB CCCC (3rc)
     29     *
     30     * Syntax: [B=5] op {vD, vE, vF, vG, vA}, meth@CCCC (35c)
     31     *         [B=5] op {vD, vE, vF, vG, vA}, type@CCCC (35c)
     32     *         [B=4] op {vD, vE, vF, vG}, kind@CCCC (35c)
     33     *         [B=3] op {vD, vE, vF}, kind@CCCC (35c)
     34     *         [B=2] op {vD, vE}, kind@CCCC (35c)
     35     *         [B=1] op {vD}, kind@CCCC (35c)
     36     *         [B=0] op {}, kind@CCCC (35c)
     37     *
     38     *         op {vCCCC .. vNNNN}, meth@BBBB (3rc) (where NNNN = CCCC+AA-1, that
     39     *         op {vCCCC .. vNNNN}, type@BBBB (3rc) is A determines the count 0..255,
     40     *                                              and C determines the first register)
     41     */
     42 
     43 %default { "routine":"NoRange" }
     44 
     45     movl        rGLUE, %edx             # %edx<- pMterpGlue
     46     movl        offGlue_methodClassDex(%edx), %ecx # %edx<- pDvmDex
     47     FETCH       1, %eax                 # %eax<- method index
     48     movl        offDvmDex_pResMethods(%ecx), %ecx # %edx<- pDvmDex->pResMethods
     49     movl        (%ecx, %eax, 4), %ecx   # %ecx<- resolved method to call
     50     cmp         $$0, %ecx               # check if already resolved
     51     EXPORT_PC                           # must export for invoke
     52     jne         common_invokeMethod${routine} # invoke method common code
     53     jmp         .L${opcode}_break
     54 %break
     55 
     56 .L${opcode}_break:
     57     movl        offGlue_method(%edx), %edx # %edx<- glue->method
     58     movl        $$METHOD_STATIC, -4(%esp) # resolver method type
     59     movl        %eax, -8(%esp)          # push parameter method index
     60     movl        offMethod_clazz(%edx), %edx # %edx<- glue->method->clazz
     61     movl        %edx, -12(%esp)         # push parameter method
     62     lea         -12(%esp), %esp
     63     call        dvmResolveMethod        # call: (const ClassObject* referrer,
     64                                         #       u4 methodIdx, MethodType methodType)
     65                                         # return: Method*
     66     lea         12(%esp), %esp
     67     cmp         $$0, %eax               # check for null method
     68     je          common_exceptionThrown
     69     movl        %eax, %ecx              # %ecx<- method
     70     jmp         common_invokeMethod${routine} # invoke method common code
     71