1%default { "load":"movl", "shift":"4", "data_offset":"MIRROR_INT_ARRAY_DATA_OFFSET", "wide":"0" }
2/*
3 * Array get, 32 bits or less.  vAA <- vBB[vCC].
4 *
5 * for: aget, aget-boolean, aget-byte, aget-char, aget-short, aget-wide
6 *
7 */
8    /* op vAA, vBB, vCC */
9    movzbq  2(rPC), %rax                    # eax <- BB
10    movzbq  3(rPC), %rcx                    # ecx <- CC
11    GET_VREG %eax, %rax                     # eax <- vBB (array object)
12    GET_VREG %ecx, %rcx                     # ecx <- vCC (requested index)
13    testl   %eax, %eax                      # null array object?
14    je      common_errNullObject            # bail if so
15    cmpl    MIRROR_ARRAY_LENGTH_OFFSET(%eax), %ecx
16    jae     common_errArrayIndex            # index >= length, bail.
17    .if $wide
18    movq    $data_offset(%rax,%rcx,8), %rax
19    SET_WIDE_VREG %rax, rINSTq
20    .else
21    $load   $data_offset(%rax,%rcx,$shift), %eax
22    SET_VREG %eax, rINSTq
23    .endif
24    ADVANCE_PC_FETCH_AND_GOTO_NEXT 2
25