1a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham%default { "isrange":"0", "routine":"NoRange" }
2a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham%verify "executed"
3a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham%verify "unknown method"
4a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    /*
5a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham     * Handle a direct method call.
6a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham     *
7a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham     * (We could defer the "is 'this' pointer null" test to the common
8a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham     * method invocation code, and use a flag to indicate that static
9a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham     * calls don't count.  If we do this as part of copying the arguments
10a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham     * out we could avoiding loading the first arg twice.)
11a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham     *
12a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham     * for: invoke-direct, invoke-direct/range
13a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham     */
14a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    # op vB, {vD, vE, vF, vG, vA}, class   /* CCCC */
15a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    # op {vCCCC..v(CCCC+AA-1)}, meth       /* BBBB */
16a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    LOAD_rSELF_methodClassDex(a3)          #  a3 <- pDvmDex
17a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    FETCH(a1, 1)                           #  a1 <- BBBB
18a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    LOAD_base_offDvmDex_pResMethods(a3, a3) #  a3 <- pDvmDex->pResMethods
19a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    FETCH(rBIX, 2)                         #  rBIX <- GFED or CCCC
20a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    LOAD_eas2(a0, a3, a1)                  #  a0 <- resolved methodToCall
21a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    .if (!$isrange)
22a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    and       rBIX, rBIX, 15               #  rBIX <- D (or stays CCCC)
23a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    .endif
24a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    EXPORT_PC()                            #  must export for invoke
25a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    GET_VREG(rOBJ, rBIX)                   #  rOBJ <- "this" ptr
26a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    # already resolved?
27a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    bnez      a0, 1f                       #  resolved, call the function
28a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham
29a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    lw        a3, offThread_method(rSELF)  #  a3 <- self->method
30a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    LOAD_base_offMethod_clazz(a0, a3)      #  a0 <- method->clazz
31a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    li        a2, METHOD_DIRECT            #  resolver method type
32a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    JAL(dvmResolveMethod)                  #  v0 <- call(clazz, ref, flags)
33a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    move      a0, v0
34a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    # got null?
35a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    beqz      v0, common_exceptionThrown   #  yes, handle exception
36a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham
37a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham1:
38a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    bnez      rOBJ, common_invokeMethod${routine} #  a0=method, rOBJ="this"
39a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham    b         common_errNullObject         #  yes, throw exception
40a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham
41a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham
42a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham
43