1%default { "load":"movl", "sqnum":"0" }
2%verify "executed"
3%verify "null object"
4%verify "field already resolved"
5%verify "field not yet resolved"
6%verify "field cannot be resolved"
7    /*
8     * General 32-bit instance field get.
9     *
10     * for: iget, iget-object, iget-boolean, iget-byte, iget-char, iget-short
11     */
12    /* op vA, vB, field@CCCC */
13    GET_GLUE(%ecx)
14    SPILL(rIBASE)                                 # need another reg
15    movzwl  2(rPC),rIBASE                         # rIBASE<- 0000CCCC
16    movl    offGlue_methodClassDex(%ecx),%eax     # eax<- DvmDex
17    movzbl  rINST_HI,%ecx                         # ecx<- BA
18    sarl    $$4,%ecx                              # ecx<- B
19    movl    offDvmDex_pResFields(%eax),%eax       # eax<- pDvmDex->pResFields
20    movzbl  rINST_HI,rINST_FULL                   # rINST_FULL<- BA
21    andb    $$0xf,rINST_LO                        # rINST_FULL<- A
22    GET_VREG(%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)                 # needed by dvmResolveInstField
27    GET_GLUE(rIBASE)
28    jmp     .L${opcode}_resolve
29%break
30
31
32.L${opcode}_resolve:
33    EXPORT_PC()
34    SPILL(rPC)
35    movl    offGlue_method(rIBASE),rPC            # rPC<- current method
36    UNSPILL(rIBASE)
37    movl    offMethod_clazz(rPC),rPC              # rPC<- method->clazz
38    SPILL_TMP(%ecx)                               # save object pointer across call
39    movl    rPC,OUT_ARG0(%esp)                    # pass in method->clazz
40    call    dvmResolveInstField                   #  ... to dvmResolveInstField
41    UNSPILL_TMP(%ecx)
42    UNSPILL(rPC)
43    testl   %eax,%eax                             #  ... which returns InstrField ptr
44    jne     .L${opcode}_finish
45    jmp     common_exceptionThrown
46
47.L${opcode}_finish:
48    /*
49     * Currently:
50     *   eax holds resolved field
51     *   ecx holds object
52     *   rIBASE is scratch, but needs to be unspilled
53     *   rINST_FULL holds A
54     */
55    movl    offInstField_byteOffset(%eax),%eax   # eax<- byte offset of field
56    UNSPILL(rIBASE)
57    testl   %ecx,%ecx                            # object null?
58    je      common_errNullObject                 # object was null
59    $load   (%ecx,%eax,1),%ecx                   # ecx<- obj.field (8/16/32 bits)
60    movl    rINST_FULL,%eax                      # eax<- A
61    FETCH_INST_WORD(2)
62    SET_VREG(%ecx,%eax)
63    ADVANCE_PC(2)
64    GOTO_NEXT
65