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     movl        rGLUE, %edx             # %edx<- pMterpGlue
     39     movl        offGlue_methodClassDex(%edx), %edx # %edx<- pDvmDex
     40     FETCH       1, %ecx                 # %ecx<- CCCC
     41     movl        offDvmDex_pResFields(%edx), %edx # %edx<- pDvmDex->pResFields
     42     cmp         $$0, (%edx, %ecx, 4)    # check for null ptr; resolved InstField ptr
     43     movl        (%edx, %ecx, 4), %eax   # %eax<- resolved InstField ptr
     44     jne         .L${opcode}_finish2
     45     movl        rGLUE, %edx             # %edx<- pMterpGlue
     46     jmp         .L${opcode}_finish
     47 %break
     48 
     49 .L${opcode}_finish:
     50     movl        offGlue_method(%edx), %edx # %edx<- glue->method
     51     EXPORT_PC                           # in case an exception is thrown
     52     movl        %ecx, -4(%esp)          # push parameter CCCC; field ref
     53     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
     54     lea         -8(%esp), %esp
     55     movl        %edx, (%esp)            # push parameter method->clazz
     56     call        dvmResolveInstField     # call: (const ClassObject* referrer, u4 ifieldIdx)
     57                                         # return: InstField*
     58     lea         8(%esp), %esp
     59     cmp         $$0, %eax               # check if resolved
     60     jne         .L${opcode}_finish2
     61     jmp         common_exceptionThrown  # not resolved; handle exception
     62 
     63 .L${opcode}_finish2:
     64     movl        rINST, %ecx             # %ecx<- BA+
     65     shr         $$4, %ecx               # %ecx<- B
     66     and         $$15, rINST             # rINST<- A
     67     GET_VREG    %ecx                    # %ecx<- vB
     68     cmp         $$0, %ecx               # check for null object
     69     je          common_errNullObject    # handle null object
     70     movl        offInstField_byteOffset(%eax), %edx # %edx<- field offset
     71     GET_VREG    rINST                   # rINST<- vA
     72     movl        rINST, (%edx, %ecx)     # object field<- vA
     73     FFETCH_ADV  2, %edx                 # %edx<- next instruction hi; fetch, advance
     74     movl     rGLUE, %eax             # get glue
     75     movl        offGlue_cardTable(%eax), %eax # get card table base
     76     testl       rINST, rINST            # test if we stored a null value
     77     je          1f                     # skip card mark if null stored
     78     shrl        $$GC_CARD_SHIFT, %ecx   # set obeject head to card number
     79     movb        %al, (%eax, %ecx)
     80 1:
     81     FGETOP_JMP  2, %edx                 # jump to next instruction; getop, jmp
     82