1%default { "postbarrier":"#  no-op", "prebarrier":"#  no-op" }
2%verify "executed"
3%verify "field already resolved"
4%verify "field not yet resolved"
5%verify "field cannot be resolved"
6    /*
7     * General 32-bit SPUT handler.
8     *
9     * for: sput, sput-object, sput-boolean, sput-byte, sput-char, sput-short
10     */
11    # op vAA, field                        /* BBBB */
12    LOAD_rSELF_methodClassDex(a2)          #  a2 <- DvmDex
13    FETCH(a1, 1)                           #  a1 <- field ref BBBB
14    LOAD_base_offDvmDex_pResFields(rBIX, a2) #  rBIX <- dvmDex->pResFields
15    LOAD_eas2(a0, rBIX, a1)                #  a0 <- resolved StaticField ptr
16    bnez      a0, .L${opcode}_finish       #  is resolved entry null?
17    /*
18     * Continuation if the field has not yet been resolved.
19     *  a1:  BBBB field ref
20     *  rBIX: dvmDex->pResFields
21     */
22    LOAD_rSELF_method(a2)                  #  a2 <- current method
23#if defined(WITH_JIT)
24    EAS2(rBIX, rBIX, a1)                   #  rBIX<- &dvmDex->pResFields[field]
25#endif
26    EXPORT_PC()                            #  resolve() may throw, so export now
27    LOAD_base_offMethod_clazz(a0, a2)      #  a0 <- method->clazz
28    JAL(dvmResolveStaticField)             #  v0 <- resolved StaticField ptr
29    move      a0, v0
30    beqz      v0, common_exceptionThrown   #  success? no, handle exception
31#if defined(WITH_JIT)
32    /*
33     * If the JIT is actively building a trace we need to make sure
34     * that the field is fully resolved before including this instruction.
35     */
36    JAL(common_verifyField)
37#endif
38    b        .L${opcode}_finish            # resume
39%break
40
41.L${opcode}_finish:
42    # field ptr in a0
43    GET_OPA(a2)                            #  a2 <- AA
44    FETCH_ADVANCE_INST(2)                  #  advance rPC, load rINST
45    GET_VREG(a1, a2)                       #  a1 <- fp[AA]
46    GET_INST_OPCODE(t0)                    #  extract opcode from rINST
47    $prebarrier                            #  releasing store
48    sw        a1, offStaticField_value(a0) #  field <- vAA
49    $postbarrier
50    GOTO_OPCODE(t0)                        #  jump to next instruction
51