blob: 2cc4d6656573d89930936089736ff2de8b8485be [file] [log] [blame]
buzbee1452bee2015-03-06 14:43:04 -08001%default { "load":"ldr", "shift":"2", "is_object":"0", "data_offset":"MIRROR_INT_ARRAY_DATA_OFFSET" }
2 /*
3 * Array get, 32 bits or less. vAA <- vBB[vCC].
4 *
5 * Note: using the usual FETCH/and/shift stuff, this fits in exactly 17
6 * instructions. We use a pair of FETCH_Bs instead.
7 *
8 * for: aget, aget-object, aget-boolean, aget-byte, aget-char, aget-short
9 *
10 * NOTE: assumes data offset for arrays is the same for all non-wide types.
11 * If this changes, specialize.
12 */
13 /* op vAA, vBB, vCC */
14 FETCH_B r2, 1, 0 @ r2<- BB
15 mov r9, rINST, lsr #8 @ r9<- AA
16 FETCH_B r3, 1, 1 @ r3<- CC
17 GET_VREG r0, r2 @ r0<- vBB (array object)
18 GET_VREG r1, r3 @ r1<- vCC (requested index)
19 cmp r0, #0 @ null array object?
20 beq common_errNullObject @ yes, bail
21 ldr r3, [r0, #MIRROR_ARRAY_LENGTH_OFFSET] @ r3<- arrayObj->length
22 add r0, r0, r1, lsl #$shift @ r0<- arrayObj + index*width
23 cmp r1, r3 @ compare unsigned index, length
24 bcs common_errArrayIndex @ index >= length, bail
25 FETCH_ADVANCE_INST 2 @ advance rPC, load rINST
26 $load r2, [r0, #$data_offset] @ r2<- vBB[vCC]
27 GET_INST_OPCODE ip @ extract opcode from rINST
28 .if $is_object
29 SET_VREG_OBJECT r2, r9 @ vAA<- r2
30 .else
31 SET_VREG r2, r9 @ vAA<- r2
32 .endif
33 GOTO_OPCODE ip @ jump to next instruction