1%default { "reg":"rINST", "store":"movl", "shift":"4" }
2%verify "executed"
3    /*
4     * Array put, 32 bits or less.  vBB[vCC] <- vAA
5     *
6     * for: aput, aput-object, aput-boolean, aput-byte, aput-char, aput-short
7     */
8    /* op vAA, vBB, vCC */
9    movzbl    2(rPC),%eax               # eax<- BB
10    movzbl    3(rPC),%ecx               # ecx<- CC
11    GET_VREG_R  %eax %eax               # eax<- vBB (array object)
12    GET_VREG_R  %ecx %ecx               # ecs<- vCC (requested index)
13    testl     %eax,%eax                 # null array object?
14    je        common_errNullObject      # bail if so
15    cmpl      offArrayObject_length(%eax),%ecx
16    jae       common_errArrayIndex      # index >= length, bail.  Expects:
17                                        #   arrayObj in eax
18                                        #   index in ecx
19    leal      offArrayObject_contents(%eax,%ecx,$shift),%eax
20.L${opcode}_finish:
21    GET_VREG_R  rINST rINST
22    FETCH_INST_OPCODE 2 %ecx
23    $store     $reg,(%eax)
24    ADVANCE_PC 2
25    GOTO_NEXT_R %ecx
26