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_SPUT_OBJECT.S
     18     *
     19     * Code: Generic 32-bit static field "put" operation. Uses no substitutions.
     20     *
     21     * For: sput-boolean, sput-byte, sput-char, sput-object, sput, sput-short
     22     *
     23     * Description: Perform the identified object static field operation
     24     *              with the identified static field; store the field value
     25     *              register.
     26     *
     27     * Format: AA|op BBBB (21c)
     28     *
     29     * Syntax: op vAA, string@BBBB
     30     */
     31 
     32     movl        rGLUE, %edx             # %edx<- pMterpGlue
     33     movl        offGlue_methodClassDex(%edx), %ecx # %ecx<- pDvmDex
     34     FETCH       1, %eax                 # %eax<- BBBB
     35     movl        offDvmDex_pResFields(%ecx), %ecx # %ecx<- pResFields
     36     cmp         $$0, (%ecx, %eax, 4)    # check for null ptr; resolved StaticField
     37     movl        (%ecx, %eax, 4), %ecx   # %ecx<- resolved StaticField
     38     je          .L${opcode}_resolve
     39     jmp         .L${opcode}_finish
     40 %break
     41 
     42 .L${opcode}_resolve:
     43     movl        offGlue_method(%edx), %edx # %edx <- glue->method
     44     EXPORT_PC                           # in case an exception is thrown
     45     movl        %eax, -4(%esp)          # push parameter CCCC; field ref
     46     movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
     47     movl        %edx, -8(%esp)          # push parameter method->clazz
     48     lea         -8(%esp), %esp
     49     call        dvmResolveStaticField   # call: (const ClassObject* referrer, u4 ifieldIdx)
     50                                         # return: StaticField*
     51     cmp         $$0, %eax               # check if initalization failed
     52     lea         8(%esp), %esp
     53     je          common_exceptionThrown  # failed; handle exception
     54     movl        %eax, %ecx              # %ecx<- result
     55 
     56 .L${opcode}_finish:
     57     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
     58     GET_VREG    rINST                   # rINST<- vAA
     59 
     60 
     61     movl        rINST, offStaticField_value(%ecx) # field value<- vAA
     62     testl       rINST, rINST            # stored null object ptr?
     63     je          1f
     64     movl        rGLUE, %edx             # get glue
     65     movl        offField_clazz(%ecx), %ecx # ecx<- field->clazz
     66     movl        offGlue_cardTable(%edx), %edx # get card table base
     67     shrl        $$GC_CARD_SHIFT, %ecx   # head to card number
     68     movb        %dl, (%edx, %ecx)       # mark card
     69 1:
     70     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
     71