1%def invoke(helper="UndefinedInvokeHandler"):
2    /*
3     * Generic invoke handler wrapper.
4     */
5    /* op vB, {vD, vE, vF, vG, vA}, class@CCCC */
6    /* op {vCCCC..v(CCCC+AA-1)}, meth@BBBB */
7    .extern $helper
8    EXPORT_PC
9    mov     r0, rSELF
10    add     r1, rFP, #OFF_FP_SHADOWFRAME
11    mov     r2, rPC
12    mov     r3, rINST
13    bl      $helper
14    cmp     r0, #0
15    beq     MterpException
16    FETCH_ADVANCE_INST 3
17    ldr     r0, [rSELF, #THREAD_USE_MTERP_OFFSET]
18    cmp     r0, #0
19    beq     MterpFallback
20    GET_INST_OPCODE ip
21    GOTO_OPCODE ip
22
23
24%def invoke_polymorphic(helper="UndefinedInvokeHandler"):
25    /*
26     * invoke-polymorphic handler wrapper.
27     */
28    /* op {vC, vD, vE, vF, vG}, meth@BBBB, proto@HHHH */
29    /* op {vCCCC..v(CCCC+AA-1)}, meth@BBBB, proto@HHHH */
30    .extern $helper
31    EXPORT_PC
32    mov     r0, rSELF
33    add     r1, rFP, #OFF_FP_SHADOWFRAME
34    mov     r2, rPC
35    mov     r3, rINST
36    bl      $helper
37    cmp     r0, #0
38    beq     MterpException
39    FETCH_ADVANCE_INST 4
40    ldr     r0, [rSELF, #THREAD_USE_MTERP_OFFSET]
41    cmp     r0, #0
42    beq     MterpFallback
43    GET_INST_OPCODE ip
44    GOTO_OPCODE ip
45
46%def op_invoke_custom():
47%  invoke(helper="MterpInvokeCustom")
48    /*
49     * Handle an invoke-custom invocation.
50     *
51     * for: invoke-custom, invoke-custom/range
52     */
53    /* op vB, {vD, vE, vF, vG, vA}, call_site@BBBB */
54    /* op vAA, {vCCCC..v(CCCC+AA-1)}, call_site@BBBB */
55
56%def op_invoke_custom_range():
57%  invoke(helper="MterpInvokeCustomRange")
58
59%def op_invoke_direct():
60%  invoke(helper="MterpInvokeDirect")
61
62%def op_invoke_direct_range():
63%  invoke(helper="MterpInvokeDirectRange")
64
65%def op_invoke_interface():
66%  invoke(helper="MterpInvokeInterface")
67    /*
68     * Handle an interface method call.
69     *
70     * for: invoke-interface, invoke-interface/range
71     */
72    /* op vB, {vD, vE, vF, vG, vA}, class@CCCC */
73    /* op {vCCCC..v(CCCC+AA-1)}, meth@BBBB */
74
75%def op_invoke_interface_range():
76%  invoke(helper="MterpInvokeInterfaceRange")
77
78%def op_invoke_polymorphic():
79%  invoke_polymorphic(helper="MterpInvokePolymorphic")
80
81%def op_invoke_polymorphic_range():
82%  invoke_polymorphic(helper="MterpInvokePolymorphicRange")
83
84%def op_invoke_static():
85%  invoke(helper="MterpInvokeStatic")
86
87
88%def op_invoke_static_range():
89%  invoke(helper="MterpInvokeStaticRange")
90
91%def op_invoke_super():
92%  invoke(helper="MterpInvokeSuper")
93    /*
94     * Handle a "super" method call.
95     *
96     * for: invoke-super, invoke-super/range
97     */
98    /* op vB, {vD, vE, vF, vG, vA}, class@CCCC */
99    /* op vAA, {vCCCC..v(CCCC+AA-1)}, meth@BBBB */
100
101%def op_invoke_super_range():
102%  invoke(helper="MterpInvokeSuperRange")
103
104%def op_invoke_virtual():
105%  invoke(helper="MterpInvokeVirtual")
106    /*
107     * Handle a virtual method call.
108     *
109     * for: invoke-virtual, invoke-virtual/range
110     */
111    /* op vB, {vD, vE, vF, vG, vA}, class@CCCC */
112    /* op vAA, {vCCCC..v(CCCC+AA-1)}, meth@BBBB */
113
114%def op_invoke_virtual_quick():
115%  invoke(helper="MterpInvokeVirtualQuick")
116
117%def op_invoke_virtual_range():
118%  invoke(helper="MterpInvokeVirtualRange")
119
120%def op_invoke_virtual_range_quick():
121%  invoke(helper="MterpInvokeVirtualQuickRange")
122