1%default { "store":"str", "shift":"2", "data_offset":"MIRROR_INT_ARRAY_DATA_OFFSET" }
2    /*
3     * Array put, 32 bits or less.  vBB[vCC] <- vAA.
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: aput, aput-boolean, aput-byte, aput-char, aput-short
9     *
10     * NOTE: this 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 w2, 1, 0                    // w2<- BB
15    lsr     w9, wINST, #8               // w9<- AA
16    FETCH_B w3, 1, 1                    // w3<- CC
17    GET_VREG w0, w2                     // w0<- vBB (array object)
18    GET_VREG w1, w3                     // w1<- vCC (requested index)
19    cbz     w0, common_errNullObject    // bail if null
20    ldr     w3, [x0, #MIRROR_ARRAY_LENGTH_OFFSET]     // w3<- arrayObj->length
21    add     x0, x0, w1, lsl #$shift     // w0<- arrayObj + index*width
22    cmp     w1, w3                      // compare unsigned index, length
23    bcs     common_errArrayIndex        // index >= length, bail
24    FETCH_ADVANCE_INST 2                // advance rPC, load rINST
25    GET_VREG w2, w9                     // w2<- vAA
26    GET_INST_OPCODE ip                  // extract opcode from rINST
27    $store  w2, [x0, #$data_offset]     // vBB[vCC]<- w2
28    GOTO_OPCODE ip                      // jump to next instruction
29