1
2%default { "store":"movl", "reg":"rINST", "sqnum":"0" }
3%verify "executed"
4%verify "null object"
5%verify "field already resolved"
6%verify "field not yet resolved"
7%verify "field cannot be resolved"
8    /*
9     * General 32-bit instance field put.
10     *
11     * for: iput, iput-object, iput-boolean, iput-byte, iput-char, iput-short
12     */
13    /* op vA, vB, field@CCCC */
14    movl    rSELF,%ecx
15    SPILL   (rIBASE)
16    movzwl  2(rPC),rIBASE                       # rIBASE<- 0000CCCC
17    movl    offThread_methodClassDex(%ecx),%eax # eax<- DvmDex
18    movzbl  rINSTbl,%ecx                        # ecx<- BA
19    sarl    $$4,%ecx                            # ecx<- B
20    movl    offDvmDex_pResFields(%eax),%eax     # eax<- pDvmDex->pResFields
21    andb    $$0xf,rINSTbl                       # rINST<- A
22    GET_VREG_R %ecx %ecx                        # ecx<- fp[B], the object ptr
23    movl    (%eax,rIBASE,4),%eax                # resolved entry
24    testl   %eax,%eax                           # is resolved entry null?
25    jne     .L${opcode}_finish                  # no, already resolved
26    movl    rIBASE,OUT_ARG1(%esp)
27    movl    rSELF,rIBASE
28    EXPORT_PC
29    movl    offThread_method(rIBASE),rIBASE     # rIBASE<- current method
30    movl    offMethod_clazz(rIBASE),rIBASE      # rIBASE<- method->clazz
31    SPILL_TMP1(%ecx)                            # save obj pointer across call
32    movl    rIBASE,OUT_ARG0(%esp)               # pass in method->clazz
33    call    dvmResolveInstField                 #  ... to dvmResolveInstField
34    UNSPILL_TMP1(%ecx)
35    testl   %eax,%eax                           # returns InstrField ptr
36    jne     .L${opcode}_finish
37    jmp     common_exceptionThrown
38
39.L${opcode}_finish:
40    /*
41     * Currently:
42     *   eax holds resolved field
43     *   ecx holds object
44     *   rINST holds A
45     */
46    GET_VREG_R rINST rINST                       # rINST<- v[A]
47    movl    offInstField_byteOffset(%eax),%eax   # eax<- byte offset of field
48    testl   %ecx,%ecx                            # object null?
49    je      common_errNullObject                 # object was null
50    $store   $reg,(%ecx,%eax,1)            # obj.field <- v[A](8/16/32 bits)
51    FETCH_INST_OPCODE 2 %ecx
52    UNSPILL(rIBASE)
53    ADVANCE_PC 2
54    GOTO_NEXT_R %ecx
55