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_APUT.S 18 * 19 * Code: Generic 32-bit array put operation. Provides a "scale" variable 20 * to specify a scale value which depends on the width of the array 21 * elements. Provides a "mov" variable which determines the type of 22 * move performed also dependent on the type of the array element. 23 * Provides a "value" register to specify the source of the move 24 * 25 * For: aput-boolean, aput-byte, aput-char, aput-object, aput-short 26 * 27 * Description: Perform an array put operation from the value register; 28 * store the value register at the identified index of a 29 * given array. vBB[vCC] <- vAA 30 * 31 * Format: AA|op CC|BB (23x) 32 * 33 * Syntax: op vAA, vBB, vCC 34 */ 35 36 %default { "mov":"l","scale":"4", "value": "rINST"} 37 38 FETCH_BB 1, %ecx # %ecx<- BB 39 FETCH_CC 1, %edx # %edx<- CC 40 GET_VREG %ecx # %ecx<- vBB 41 GET_VREG %edx # %edx<- vCC 42 cmp $$0, %ecx # check for null array object 43 je common_errNullObject # handle null array object 44 cmp offArrayObject_length(%ecx), %edx # compare index to arrayObj->length 45 jnc common_errArrayIndex # handle index >= length, bail 46 FFETCH_ADV 2, %eax # %eax<- next instruction hi; fetch, advance 47 lea (%ecx, %edx, $scale), %ecx # %ecx<- &vBB[vCC] 48 GET_VREG rINST # rINST<- vAA 49 mov$mov $value, offArrayObject_contents(%ecx) # vBB[vCC]<- rINSTx; value 50 FGETOP_JMP 2, %eax # jump to next instruction; getop, jmp 51