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_CONST_STRING.S 18 * 19 * Code: Move a string reference to a register. Uses no substitutions. 20 * 21 * For: const/string 22 * 23 * Description: Move a referece to the string specified by the given 24 * index into the specified register. vAA <- pResString[BBBB] 25 * 26 * Format: AA|op BBBB (21c) 27 * 28 * Syntax: op vAA, string@BBBB 29 */ 30 31 FETCH 1, %ecx # %ecx<- BBBB 32 movl rGLUE, %edx # get MterpGlue pointer 33 movl offGlue_methodClassDex(%edx), %eax # %eax<- glue->methodClassDex 34 movl offDvmDex_pResStrings(%eax), %eax # %eax<- glue->methodClassDex->pResStrings 35 movl (%eax, %ecx, 4), %eax # %eax<- pResStrings[BBBB] 36 cmp $$0, %eax # check if string is resolved 37 je .L${opcode}_resolve # resolve string reference 38 SET_VREG %eax, rINST # vAA<- %eax; pResString[BBBB] 39 FINISH 2 # jump to next instruction 40 41%break 42 43 44 /* 45 * Continuation if the Class has not yet been resolved. 46 * %ecx: BBBB (Class ref) 47 * need: target register 48 */ 49 50.L${opcode}_resolve: 51 EXPORT_PC 52 movl offGlue_method(%edx), %edx # %edx<- glue->method 53 movl offMethod_clazz(%edx), %edx # %edx<- glue->method->clazz 54 movl %ecx, -4(%esp) # push parameter class ref 55 movl %edx, -8(%esp) # push parameter glue->method->clazz 56 lea -8(%esp), %esp 57 call dvmResolveString # resolve string reference 58 # call: (const ClassObject* referrer, u4 stringIdx) 59 # return: StringObject* 60 lea 8(%esp), %esp 61 cmp $$0, %eax # check if resolved string failed 62 je common_exceptionThrown # resolve failed; exception thrown 63 SET_VREG %eax, rINST # vAA<- %eax; pResString[BBBB] 64 FFETCH_ADV 2, %edx # %edx<- next instruction hi; fetch, advance 65 FGETOP_JMP 2, %edx # jump to next instruction; getop, jmp 66