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_SGET_WIDE.S 18 * 19 * Code: 64-bit static field "get" operation. Uses no substitutions. 20 * 21 * For: sget-wide 22 * 23 * Description: Perform the identified object static field operation 24 * with the identified static field, loading or storing 25 * into the value register. 26 * 27 * Format: AA|op BBBB (21c) 28 * 29 * Syntax: op vAA, string@BBBB 30 */ 31 32 movl rGLUE, %eax # %eax<- pMterpGlue 33 movl offGlue_methodClassDex(%eax), %ecx # %ecx<- glue->pDvmDex 34 FETCH 1, %edx # %edx<- BBBB 35 movl offDvmDex_pResFields(%ecx), %ecx # %ecx<- pResFields 36 cmp $$0, (%ecx, %edx, 4) # check for null ptr; resolved StaticField ptr 37 movl (%ecx, %edx, 4), %ecx # %ecx<- resolved StaticField ptr 38 je .L${opcode}_resolve 39 40.L${opcode}_finish: 41 FFETCH_ADV 2, %eax # %eax<- next instruction hi; fetch, advance 42 movq offStaticField_value(%ecx), %xmm0 # %xmm0<- field value 43 movq %xmm0, (rFP, rINST, 4) # vAA<- field value 44 FGETOP_JMP 2, %eax # jump to next instruction; getop, jmp 45%break 46 47 /* 48 * Continuation if the field has not yet been resolved. 49 * %edx: BBBB field ref 50 */ 51 52.L${opcode}_resolve: 53 movl offGlue_method(%eax), %eax # %eax <- glue->method 54 EXPORT_PC # in case an exception is thrown 55 movl %edx, -4(%esp) # push parameter CCCC; field ref 56 movl offMethod_clazz(%eax), %eax # %eax<- method->clazz 57 movl %eax, -8(%esp) # push parameter method->clazz 58 lea -8(%esp), %esp 59 call dvmResolveStaticField # call: (const ClassObject* referrer, u4 ifieldIdx) 60 # return: StaticField* 61 lea 8(%esp), %esp 62 cmp $$0, %eax # check if initalization failed 63 movl %eax, %ecx # %ecx<- result 64 jne .L${opcode}_finish # success, continue 65 jmp common_exceptionThrown # failed; handle exception 66