• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1%verify "executed"
2    /*
3     * Array put, 32 bits or less.  vBB[vCC] <- vAA
4     *
5     * for: aput, aput-object, aput-boolean, aput-byte, aput-char, aput-short
6     */
7    /* op vAA, vBB, vCC */
8    movzbl    2(rPC),%eax               # eax<- BB
9    movzbl    3(rPC),%ecx               # ecx<- CC
10    movzbl    rINST_HI,rINST_FULL       # rINST_FULL<- AA
11    GET_VREG(%eax,%eax)                 # eax<- vBB (array object)
12    GET_VREG(%ecx,%ecx)                 # ecs<- vCC (requested index)
13    GET_VREG(rINST_FULL,rINST_FULL)     # rINST_FULL<- vAA
14    testl     %eax,%eax                 # null array object?
15    je        common_errNullObject      # bail if so
16    cmpl      offArrayObject_length(%eax),%ecx
17    jb        .L${opcode}_continue
18    jmp       common_errArrayIndex      # index >= length, bail
19%break
20
21    /* On entry:
22     *   eax<- array object
23     *   ecx<- index
24     *   rINST_FULL<- vAA
25     */
26.L${opcode}_continue:
27    leal      offArrayObject_contents(%eax,%ecx,4),%ecx
28    testl     rINST_FULL,rINST_FULL     # storing null reference?
29    je        .L${opcode}_skip_check
30    SPILL(rPC)
31    SPILL_TMP(%ecx)
32    movl      %eax,LOCAL0_OFFSET(%ebp)   # save copy of object head
33    movl      offObject_clazz(%eax),%eax # eax<- arrayObj->clazz
34    movl      offObject_clazz(rINST_FULL),%ecx # ecx<- obj->clazz
35    movl      %eax,OUT_ARG1(%esp)
36    movl      %ecx,OUT_ARG0(%esp)
37    call      dvmCanPutArrayElement     # test object type vs. array type
38    UNSPILL(rPC)
39    UNSPILL_TMP(%ecx)
40    testl     %eax,%eax
41    GET_GLUE(%eax)
42    je        common_errArrayStore
43    movl      offGlue_cardTable(%eax),%eax   # get card table base
44    movl      rINST_FULL,(%ecx)
45    movl      LOCAL0_OFFSET(%ebp),%ecx       # recover object head
46    FETCH_INST_WORD(2)
47    shrl      $$GC_CARD_SHIFT,%ecx           # object head to card number
48    movb      %al,(%eax,%ecx)                # mark card using object head
49    ADVANCE_PC(2)
50    GOTO_NEXT
51
52.L${opcode}_skip_check:
53    movl      rINST_FULL,(%ecx)
54    FETCH_INST_WORD(2)
55    ADVANCE_PC(2)
56    GOTO_NEXT
57