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     x0, xSELF
10    add     x1, xFP, #OFF_FP_SHADOWFRAME
11    mov     x2, xPC
12    mov     x3, xINST
13    bl      $helper
14    cbz     w0, MterpException
15    FETCH_ADVANCE_INST 3
16    ldr     w0, [xSELF, #THREAD_USE_MTERP_OFFSET]
17    cbz     w0, MterpFallback
18    GET_INST_OPCODE ip
19    GOTO_OPCODE ip
20
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    EXPORT_PC
30    mov     x0, xSELF
31    add     x1, xFP, #OFF_FP_SHADOWFRAME
32    mov     x2, xPC
33    mov     x3, xINST
34    bl      $helper
35    cbz     w0, MterpException
36    FETCH_ADVANCE_INST 4
37    ldr     w0, [xSELF, #THREAD_USE_MTERP_OFFSET]
38    cbz     w0, MterpFallback
39    GET_INST_OPCODE ip
40    GOTO_OPCODE ip
41
42%def op_invoke_custom():
43%  invoke(helper="MterpInvokeCustom")
44
45%def op_invoke_custom_range():
46%  invoke(helper="MterpInvokeCustomRange")
47
48%def op_invoke_direct():
49%  invoke(helper="MterpInvokeDirect")
50
51%def op_invoke_direct_range():
52%  invoke(helper="MterpInvokeDirectRange")
53
54%def op_invoke_interface():
55%  invoke(helper="MterpInvokeInterface")
56    /*
57     * Handle an interface method call.
58     *
59     * for: invoke-interface, invoke-interface/range
60     */
61    /* op vB, {vD, vE, vF, vG, vA}, class@CCCC */
62    /* op {vCCCC..v(CCCC+AA-1)}, meth@BBBB */
63
64%def op_invoke_interface_range():
65%  invoke(helper="MterpInvokeInterfaceRange")
66
67%def op_invoke_polymorphic():
68%  invoke_polymorphic(helper="MterpInvokePolymorphic")
69
70%def op_invoke_polymorphic_range():
71%  invoke_polymorphic(helper="MterpInvokePolymorphicRange")
72
73%def op_invoke_static():
74%  invoke(helper="MterpInvokeStatic")
75
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