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_CONST_CLASS.S
     18     *
     19     * Code: Move a class reference to a register. Uses no substitutions.
     20     *
     21     * For: const/class
     22     *
     23     * Description: Move a reference to the class specified
     24     *              by the given index into the specified register.
     25     *              In the case where the indicated type is primitive,
     26     *              this will store a reference to the primitive type's
     27     *              degenerate class.
     28     *
     29     * Format: AA|op BBBBlo BBBBhi (21c)
     30     *
     31     * Syntax: op vAA, field@BBBB
     32     */
     33 
     34     movl        rGLUE, %edx             # get MterpGlue pointer
     35     FETCH       1, %ecx                 # %ecx<- BBBB
     36     movl        offGlue_methodClassDex(%edx), %eax # %eax<- pDvmDex
     37     movl        offDvmDex_pResClasses(%eax), %eax # %eax<- pDvmDex->pResClasses
     38     movl        (%eax, %ecx, 4), %eax   # %eax<- resolved class
     39     cmp         $$0, %eax               # check if classes is resolved before?
     40     je          .L${opcode}_resolve     # resolve class
     41     SET_VREG    %eax, rINST             # vAA<- resolved class
     42     FINISH      2                       # jump to next instruction
     43 %break
     44 
     45    /*
     46     * Continuation if the Class has not yet been resolved.
     47     *  %ecx: BBBB (Class ref)
     48     *  need: target register
     49     */
     50 
     51 .L${opcode}_resolve:
     52     EXPORT_PC
     53     movl        offGlue_method(%edx), %edx # %edx<- glue->method
     54     movl        offMethod_clazz(%edx), %edx # %edx<- glue->method->clazz
     55     movl        $$1, -4(%esp)           # push parameter true
     56     movl        %ecx, -8(%esp)          # push parameter
     57     movl        %edx, -12(%esp)         # push parameter glue->method->clazz
     58     lea         -12(%esp), %esp
     59     call        dvmResolveClass         # resolve ClassObject pointer
     60                                         # class: (const ClassObject* referrer, u4 classIdx,
     61                                         #         bool fromUnverifiedConstant)
     62                                         # return: ClassObject*
     63     lea         12(%esp), %esp
     64     cmp         $$0, %eax               # check for null pointer
     65     je          common_exceptionThrown  # handle exception
     66     SET_VREG    %eax, rINST             # vAA<- resolved class
     67     FINISH      2                       # jump to next instruction
     68