1%default { "load":"lw", "shift":"2", "data_offset":"MIRROR_INT_ARRAY_DATA_OFFSET" } 2 /* 3 * Array get, 32 bits or less. vAA <- vBB[vCC]. 4 * 5 * for: aget, aget-boolean, aget-byte, aget-char, aget-short 6 * 7 * NOTE: assumes data offset for arrays is the same for all non-wide types. 8 * If this changes, specialize. 9 */ 10 /* op vAA, vBB, vCC */ 11 lbu a2, 2(rPC) # a2 <- BB 12 lbu a3, 3(rPC) # a3 <- CC 13 srl a4, rINST, 8 # a4 <- AA 14 GET_VREG_U a0, a2 # a0 <- vBB (array object) 15 GET_VREG a1, a3 # a1 <- vCC (requested index) 16 beqz a0, common_errNullObject # bail if null array object 17 lw a3, MIRROR_ARRAY_LENGTH_OFFSET(a0) # a3 <- arrayObj->length 18 .if $shift 19 # [d]lsa does not support shift count of 0. 20 dlsa a0, a1, a0, $shift # a0 <- arrayObj + index*width 21 .else 22 daddu a0, a1, a0 # a0 <- arrayObj + index*width 23 .endif 24 bgeu a1, a3, common_errArrayIndex # unsigned compare: index >= length, bail 25 FETCH_ADVANCE_INST 2 # advance rPC, load rINST 26 $load a2, $data_offset(a0) # a2 <- vBB[vCC] 27 GET_INST_OPCODE v0 # extract opcode from rINST 28 SET_VREG a2, a4 # vAA <- a2 29 GOTO_OPCODE v0 # jump to next instruction 30