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_IPUT.S
     18     *
     19     * Code: Generic 32-bit instance field "put" operation. Provides a
     20     *       "mov" variable which determines the type of mov performed.
     21     *       Currently, none of the iput's use this variable - may want
     22     *       to change this, but seems ok for now.
     23     *
     24     * For: iput-boolean, iput-byte, iput-char, iput-object, iput
     25     *      iput-short
     26     *
     27     * Description: Perform the object instance field "get" operation
     28     *              with the identified field; load the instance value into
     29     *              the value register.
     30     *
     31     *
     32     * Format: B|A|op CCCC (22c)
     33     *
     34     * Syntax: op vA, vB, type@CCCC
     35     *         op vA, vB, field@CCCC
     36     */
     37 
     38 %default { "mov":"l" }
     39 
     40     movl        rGLUE, %edx             # %edx<- pMterpGlue
     41     movl        offGlue_methodClassDex(%edx), %edx # %edx<- pDvmDex
     42     FETCH       1, %ecx                 # %ecx<- CCCC
     43     movl        offDvmDex_pResFields(%edx), %edx # %edx<- pDvmDex->pResFields
     44     cmp         $$0, (%edx, %ecx, 4)    # check for null ptr; resolved InstField ptr
     45     movl        (%edx, %ecx, 4), %eax   # %eax<- resolved InstField ptr
     46     jne         .L${opcode}_finish2
     47     movl        rGLUE, %edx             # %edx<- pMterpGlue
     48     jmp         .L${opcode}_finish
     49 %break
     50 
     51 .L${opcode}_finish:
     52     movl        offGlue_method(%edx), %edx # %edx<- glue->method
     53     EXPORT_PC                           # in case an exception is thrown
     54     movl        %ecx, -4(%esp)          # push parameter CCCC; field ref
     55     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
     56     lea         -8(%esp), %esp
     57     movl        %edx, (%esp)            # push parameter method->clazz
     58     call        dvmResolveInstField     # call: (const ClassObject* referrer, u4 ifieldIdx)
     59                                         # return: InstField*
     60     lea         8(%esp), %esp
     61     cmp         $$0, %eax               # check if resolved
     62     jne         .L${opcode}_finish2
     63     jmp         common_exceptionThrown  # not resolved; handle exception
     64 
     65 .L${opcode}_finish2:
     66     movl        rINST, %ecx             # %ecx<- BA+
     67     shr         $$4, %ecx               # %ecx<- B
     68     and         $$15, rINST             # rINST<- A
     69     GET_VREG    %ecx                    # %ecx<- vB
     70     cmp         $$0, %ecx               # check for null object
     71     je          common_errNullObject    # handle null object
     72     movl        offInstField_byteOffset(%eax), %edx # %edx<- field offset
     73     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
     74     GET_VREG    rINST                   # rINST<- vA
     75     mov$mov     rINST, (%edx, %ecx)     # object field<- vA
     76     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
     77