1 %default { "store":"str", "shift":"2" } 2 %verify "executed" 3 /* 4 * Array put, 32 bits or less. vBB[vCC] <- vAA. 5 * 6 * Note: using the usual FETCH/and/shift stuff, this fits in exactly 17 7 * instructions. We use a pair of FETCH_Bs instead. 8 * 9 * for: aput, aput-boolean, aput-byte, aput-char, aput-short 10 */ 11 /* op vAA, vBB, vCC */ 12 FETCH_B(r2, 1, 0) @ r2<- BB 13 mov r9, rINST, lsr #8 @ r9<- AA 14 FETCH_B(r3, 1, 1) @ r3<- CC 15 GET_VREG(r0, r2) @ r0<- vBB (array object) 16 GET_VREG(r1, r3) @ r1<- vCC (requested index) 17 cmp r0, #0 @ null array object? 18 beq common_errNullObject @ yes, bail 19 ldr r3, [r0, #offArrayObject_length] @ r3<- arrayObj->length 20 add r0, r0, r1, lsl #$shift @ r0<- arrayObj + index*width 21 cmp r1, r3 @ compare unsigned index, length 22 bcs common_errArrayIndex @ index >= length, bail 23 FETCH_ADVANCE_INST(2) @ advance rPC, load rINST 24 GET_VREG(r2, r9) @ r2<- vAA 25 GET_INST_OPCODE(ip) @ extract opcode from rINST 26 $store r2, [r0, #offArrayObject_contents] @ vBB[vCC]<- r2 27 GOTO_OPCODE(ip) @ jump to next instruction 28