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    .extern MterpShouldSwitchInterpreters
9    EXPORT_PC
10    move    a0, rSELF
11    daddu   a1, rFP, OFF_FP_SHADOWFRAME
12    move    a2, rPC
13    move    a3, rINST
14    jal     $helper
15    beqzc   v0, MterpException
16    FETCH_ADVANCE_INST 3
17    jal     MterpShouldSwitchInterpreters
18    bnezc   v0, MterpFallback
19    GET_INST_OPCODE v0
20    GOTO_OPCODE v0
21
22%def invoke_polymorphic(helper="UndefinedInvokeHandler"):
23    /*
24     * invoke-polymorphic handler wrapper.
25     */
26    /* op {vC, vD, vE, vF, vG}, meth@BBBB, proto@HHHH */
27    /* op {vCCCC..v(CCCC+AA-1)}, meth@BBBB, proto@HHHH */
28    .extern $helper
29    .extern MterpShouldSwitchInterpreters
30    EXPORT_PC
31    move    a0, rSELF
32    daddu   a1, rFP, OFF_FP_SHADOWFRAME
33    move    a2, rPC
34    move    a3, rINST
35    jal     $helper
36    beqzc   v0, MterpException
37    FETCH_ADVANCE_INST 4
38    jal     MterpShouldSwitchInterpreters
39    bnezc   v0, MterpFallback
40    GET_INST_OPCODE v0
41    GOTO_OPCODE v0
42
43%def op_invoke_custom():
44%  invoke(helper="MterpInvokeCustom")
45
46%def op_invoke_custom_range():
47%  invoke(helper="MterpInvokeCustomRange")
48
49%def op_invoke_direct():
50%  invoke(helper="MterpInvokeDirect")
51
52%def op_invoke_direct_range():
53%  invoke(helper="MterpInvokeDirectRange")
54
55%def op_invoke_interface():
56%  invoke(helper="MterpInvokeInterface")
57    /*
58     * Handle an interface method call.
59     *
60     * for: invoke-interface, invoke-interface/range
61     */
62    /* op vB, {vD, vE, vF, vG, vA}, class@CCCC */
63    /* op {vCCCC..v(CCCC+AA-1)}, meth@BBBB */
64
65%def op_invoke_interface_range():
66%  invoke(helper="MterpInvokeInterfaceRange")
67
68%def op_invoke_polymorphic():
69%  invoke_polymorphic(helper="MterpInvokePolymorphic")
70
71%def op_invoke_polymorphic_range():
72%  invoke_polymorphic(helper="MterpInvokePolymorphicRange")
73
74%def op_invoke_static():
75%  invoke(helper="MterpInvokeStatic")
76
77%def op_invoke_static_range():
78%  invoke(helper="MterpInvokeStaticRange")
79
80%def op_invoke_super():
81%  invoke(helper="MterpInvokeSuper")
82    /*
83     * Handle a "super" method call.
84     *
85     * for: invoke-super, invoke-super/range
86     */
87    /* op vB, {vD, vE, vF, vG, vA}, class@CCCC */
88    /* op vAA, {vCCCC..v(CCCC+AA-1)}, meth@BBBB */
89
90%def op_invoke_super_range():
91%  invoke(helper="MterpInvokeSuperRange")
92
93%def op_invoke_virtual():
94%  invoke(helper="MterpInvokeVirtual")
95    /*
96     * Handle a virtual method call.
97     *
98     * for: invoke-virtual, invoke-virtual/range
99     */
100    /* op vB, {vD, vE, vF, vG, vA}, class@CCCC */
101    /* op vAA, {vCCCC..v(CCCC+AA-1)}, meth@BBBB */
102
103%def op_invoke_virtual_quick():
104%  invoke(helper="MterpInvokeVirtualQuick")
105
106%def op_invoke_virtual_range():
107%  invoke(helper="MterpInvokeVirtualRange")
108
109%def op_invoke_virtual_range_quick():
110%  invoke(helper="MterpInvokeVirtualQuickRange")
111