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_WIDE.S
18    *
19    * Code: 64 bit instance field "get" operation. Uses no substitutions.
20    *
21    * For: iget-wide
22    *
23    * Description: Perform the object instance field "get" operation
24    *              with the identified field; load the instance value into
25    *              the value register.
26    *
27    * Format:  B|A|op CCCC (22c)
28    *
29    * Syntax: op vA, vB, type@CCCC
30    *         op vA, vB, field@CCCC
31    */
32
33    movl        rGLUE, %eax             # %eax<- MterpGlue pointer
34    movl        offGlue_methodClassDex(%eax), %ecx # %ecx<- pDvmDex
35    movl        offDvmDex_pResFields(%ecx), %ecx # %ecx<- CCCC
36    FETCH       1, %edx                 # %edx<- pDvmDex->pResFields
37    movl        (%ecx, %edx, 4), %ecx   # %ecx<- resolved InstField ptr
38    cmp         $$0, %ecx               # check for null ptr; resolved InstField ptr
39    jne         .L${opcode}_finish
40    movl        offGlue_method(%eax), %ecx # %ecx <- current method
41    EXPORT_PC                           # in case an exception is thrown
42    movl        offMethod_clazz(%ecx), %ecx # %ecx<- method->clazz
43    movl        %ecx, -8(%esp)          # push parameter CCCC; field ref
44    movl        %edx, -4(%esp)          # push parameter method->clazz
45    jmp         .L${opcode}_finish2
46%break
47
48.L${opcode}_finish2:
49    lea         -8(%esp), %esp
50    call        dvmResolveInstField     # resolve InstField ptr
51                                        # call: (const ClassObject* referrer, u4 ifieldIdx)
52                                        # return: InstField*
53    cmp         $$0, %eax               # check if resolved
54    lea         8(%esp), %esp
55    movl        %eax, %ecx              # %ecx<- %eax; %ecx expected to hold field
56    je          common_exceptionThrown
57
58   /*
59    *  %ecx holds resolved field
60    */
61
62.L${opcode}_finish:
63
64    movl        rINST, %edx             # %edx<- BA
65    shr         $$4, %edx               # %edx<- B
66    andl        $$15, rINST             # rINST<- A
67    GET_VREG    %edx                    # %edx<- vB
68    cmp         $$0, %edx               # check for null object
69    je          common_errNullObject
70    movl        offInstField_byteOffset(%ecx), %ecx # %ecx<- field offset
71    FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
72    movq        (%ecx, %edx), %xmm0     # %xmm0<- object field
73    movq        %xmm0, (rFP, rINST, 4)  # vA<- %xmm0; object field
74    FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
75
76
77