1%default {"volatile":"0"}
2%verify "executed"
3%verify "field already resolved"
4%verify "field not yet resolved"
5%verify "field cannot be resolved"
6    /*
7     * 64-bit SPUT handler.
8     */
9    # sput-wide vAA, field                 /* BBBB */
10    LOAD_rSELF_methodClassDex(a2)          #  a2 <- DvmDex
11    FETCH(a1, 1)                           #  a1 <- field ref BBBB
12    LOAD_base_offDvmDex_pResFields(rBIX, a2) #  rBIX <- dvmDex->pResFields
13    GET_OPA(t0)                            #  t0 <- AA
14    LOAD_eas2(a2, rBIX, a1)                #  a2 <- resolved StaticField ptr
15    EAS2(rOBJ, rFP, t0)                    #  rOBJ<- &fp[AA]
16    # is resolved entry null?
17    beqz      a2, .L${opcode}_resolve      #  yes, do resolve
18.L${opcode}_finish:                        #  field ptr in a2, AA in rOBJ
19    FETCH_ADVANCE_INST(2)                  #  advance rPC, load rINST
20    LOAD64(a0, a1, rOBJ)                   #  a0/a1 <- vAA/vAA+1
21    GET_INST_OPCODE(rBIX)                  #  extract opcode from rINST
22    .if $volatile
23    addu    a2, offStaticField_value       #  a2<- pointer to data
24    JAL(dvmQuasiAtomicSwap64Sync)          #  stores a0/a1 into addr a2
25    .else
26    STORE64_off(a0, a1, a2, offStaticField_value) #  field <- vAA/vAA+1
27    .endif
28    GOTO_OPCODE(rBIX)                      #  jump to next instruction
29%break
30
31    /*
32     * Continuation if the field has not yet been resolved.
33     *  a1:  BBBB field ref
34     *  rOBJ:  &fp[AA]
35     *  rBIX: dvmDex->pResFields
36     *
37     * Returns StaticField pointer in a2.
38     */
39.L${opcode}_resolve:
40    LOAD_rSELF_method(a2)                  #  a2 <- current method
41#if defined(WITH_JIT)
42    EAS2(rBIX, rBIX, a1)                   #  rBIX<- &dvmDex->pResFields[field]
43#endif
44    EXPORT_PC()                            #  resolve() could throw, so export now
45    LOAD_base_offMethod_clazz(a0, a2)      #  a0 <- method->clazz
46    JAL(dvmResolveStaticField)             #  v0 <- resolved StaticField ptr
47    # success ?
48    move      a0, v0
49    beqz      v0, common_exceptionThrown   #  no, handle exception
50#if defined(WITH_JIT)
51    /*
52     * If the JIT is actively building a trace we need to make sure
53     * that the field is fully resolved before including this instruction.
54     */
55    JAL(common_verifyField)
56#endif
57    move      a2, v0
58    b         .L${opcode}_finish           # resume
59