• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_IGET.S
18    *
19    * Code: Generic 32-bit instance field "get" operation. Provides a
20    *       "mov" variable which determines the type of mov performed.
21    *       Currently, none of the iget's use this variable - may want
22    *       to change this, but seems ok for now.
23    *
24    * For: iget-boolean, iget-byte, iget-char, iget-object, iget
25    *      iget-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    movl        offGlue_method(%edx), %edx # %edx <- current method
49    EXPORT_PC                           # in case an exception is thrown
50    movl        offMethod_clazz(%edx), %edx # %edx<- method->clazz
51    movl        %ecx, -4(%esp)          # push parameter CCCC; field ref
52    movl        %edx, -8(%esp)          # push parameter method->clazz
53    lea         -8(%esp), %esp
54    jmp         .L${opcode}_finish
55%break
56
57.L${opcode}_finish:
58    call        dvmResolveInstField     # call: (const ClassObject* referrer, u4 ifieldIdx)
59                                        # return: InstField*
60    cmp         $$0, %eax               # check if resolved
61    lea         8(%esp), %esp
62    je          common_exceptionThrown  # not resolved; handle exception
63
64    /*
65     *  %eax holds resolved field
66     */
67
68.L${opcode}_finish2:
69    movl        rINST, %ecx             # %ecx<- BA
70    shr         $$4, %ecx               # %ecx<- B
71    and         $$15, rINST             # rINST<- A
72
73    GET_VREG    %ecx                    # %ecx<- vB
74    cmp         $$0, %ecx               # check for null object
75    je          common_errNullObject    # handle null object
76    movl        offInstField_byteOffset(%eax), %edx # %edx<- field offset
77    FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
78    mov$mov     (%ecx, %edx), %edx      # %edx<- object field
79    SET_VREG    %edx, rINST             # vA<- %edx; object field
80    FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
81