13599cdd1b4e72f4cb047fc31bf7c579764fa93d2Elliott Hughes%default { "cccc":"2" }
2a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham%verify "executed"
3a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham%verify "finalizable class"
4a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    /*
5a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham     * Invoke Object.<init> on an object.  In practice we know that
6a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham     * Object's nullary constructor doesn't do anything, so we just
7a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham     * skip it unless a debugger is active.
8a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham     */
9a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    FETCH(a1, ${cccc})                  # a1<- CCCC
10a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    GET_VREG(a0, a1)                    # a0<- "this" ptr
11a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    # check for NULL
12a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    beqz    a0, common_errNullObject    # export PC and throw NPE
13a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    LOAD_base_offObject_clazz(a1, a0)   # a1<- obj->clazz
14a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    LOAD_base_offClassObject_accessFlags(a2, a1) # a2<- clazz->accessFlags
15a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    and     a2, CLASS_ISFINALIZABLE     # is this class finalizable?
16a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    beqz    a2, .L${opcode}_finish      # no, go
17a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham
18a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham.L${opcode}_setFinal:
19a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    EXPORT_PC()                         # can throw
20a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    JAL(dvmSetFinalizable)              # call dvmSetFinalizable(obj)
21a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    LOAD_offThread_exception(a0, rSELF)	# a0<- self->exception
22a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    # exception pending?
23a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    bnez    a0, common_exceptionThrown  # yes, handle it
24a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham
25a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham.L${opcode}_finish:
26a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    lhu     a1, offThread_subMode(rSELF)
27a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    and     a1, kSubModeDebuggerActive  # debugger active?
28a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    bnez    a1, .L${opcode}_debugger    # Yes - skip optimization
29a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    FETCH_ADVANCE_INST(${cccc}+1)       # advance to next instr, load rINST
30a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    GET_INST_OPCODE(t0)                 # t0<- opcode from rINST
31a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    GOTO_OPCODE(t0)                     # execute it
32a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham
33a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham%break
34a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    /*
35a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham     * A debugger is attached, so we need to go ahead and do
36a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham     * this.  For simplicity, we'll just jump directly to the
37a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham     * corresponding handler.  Note that we can't use
38a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham     * rIBASE here because it may be in single-step mode.
39a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham     * Load the primary table base directly.
40a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham     */
41a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham.L${opcode}_debugger:
42a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    lw      a1, offThread_mainHandlerTable(rSELF)
43a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    li      t0, OP_INVOKE_DIRECT_RANGE
44a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    GOTO_OPCODE_BASE(a1, t0)            # execute it
45