Home | History | Annotate | Download | only in arm64
      1 %default { "load":"ldr", "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 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     x0, common_errNullObject    // bail if null array object.
     20     ldr     w3, [x0, #MIRROR_ARRAY_LENGTH_OFFSET]    // w3<- arrayObj->length
     21     add     x0, x0, w1, uxtw #$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     $load   w2, [x0, #$data_offset]     // w2<- vBB[vCC]
     26     GET_INST_OPCODE ip                  // extract opcode from rINST
     27     SET_VREG w2, w9                     // vAA<- w2
     28     GOTO_OPCODE ip                      // jump to next instruction
     29