Home | History | Annotate | Download | only in mips
      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      * 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: aget, aget-boolean, aget-byte, aget-char, aget-short
      9      *
     10      * NOTE: 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(a2, 1, 0)                      #  a2 <- BB
     15     GET_OPA(rOBJ)                          #  rOBJ <- AA
     16     FETCH_B(a3, 1, 1)                      #  a3 <- CC
     17     GET_VREG(a0, a2)                       #  a0 <- vBB (array object)
     18     GET_VREG(a1, a3)                       #  a1 <- vCC (requested index)
     19     # null array object?
     20     beqz      a0, common_errNullObject     #  yes, bail
     21     LOAD_base_offMirrorArray_length(a3, a0) #  a3 <- arrayObj->length
     22     .if $shift
     23     EASN(a0, a0, a1, $shift)               #  a0 <- arrayObj + index*width
     24     .else
     25     addu      a0, a0, a1
     26     .endif
     27     # a1 >= a3; compare unsigned index
     28     bgeu      a1, a3, common_errArrayIndex #  index >= length, bail
     29     FETCH_ADVANCE_INST(2)                  #  advance rPC, load rINST
     30     $load a2, $data_offset(a0)             #  a2 <- vBB[vCC]
     31     GET_INST_OPCODE(t0)                    #  extract opcode from rINST
     32     SET_VREG_GOTO(a2, rOBJ, t0)            #  vAA <- a2
     33