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    movq    rSELF, OUT_ARG0
10    leaq    OFF_FP_SHADOWFRAME(rFP), OUT_ARG1
11    movq    rPC, OUT_ARG2
12    REFRESH_INST ${opnum}
13    movl    rINST, OUT_32_ARG3
14    call    SYMBOL($helper)
15    testb   %al, %al
16    jz      MterpException
17    ADVANCE_PC 3
18    movq    rSELF, %rax
19    cmpb    LITERAL(0), THREAD_USE_MTERP_OFFSET(%rax)
20    jz      MterpFallback
21    FETCH_INST
22    GOTO_NEXT
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    movq    rSELF, OUT_ARG0
33    leaq    OFF_FP_SHADOWFRAME(rFP), OUT_ARG1
34    movq    rPC, OUT_ARG2
35    REFRESH_INST ${opnum}
36    movl    rINST, OUT_32_ARG3
37    call    SYMBOL($helper)
38    testb   %al, %al
39    jz      MterpException
40    ADVANCE_PC 4
41    movq    rSELF, %rax
42    cmpb    LITERAL(0), THREAD_USE_MTERP_OFFSET(%rax)
43    jz      MterpFallback
44    FETCH_INST
45    GOTO_NEXT
46
47%def op_invoke_custom():
48%  invoke(helper="MterpInvokeCustom")
49
50%def op_invoke_custom_range():
51%  invoke(helper="MterpInvokeCustomRange")
52
53%def op_invoke_direct():
54%  invoke(helper="MterpInvokeDirect")
55
56%def op_invoke_direct_range():
57%  invoke(helper="MterpInvokeDirectRange")
58
59%def op_invoke_interface():
60%  invoke(helper="MterpInvokeInterface")
61/*
62 * Handle an interface method call.
63 *
64 * for: invoke-interface, invoke-interface/range
65 */
66    /* op vB, {vD, vE, vF, vG, vA}, class@CCCC */
67    /* op {vCCCC..v(CCCC+AA-1)}, meth@BBBB */
68
69%def op_invoke_interface_range():
70%  invoke(helper="MterpInvokeInterfaceRange")
71
72%def op_invoke_polymorphic():
73%  invoke_polymorphic(helper="MterpInvokePolymorphic")
74
75%def op_invoke_polymorphic_range():
76%  invoke_polymorphic(helper="MterpInvokePolymorphicRange")
77
78%def op_invoke_static():
79%  invoke(helper="MterpInvokeStatic")
80
81
82%def op_invoke_static_range():
83%  invoke(helper="MterpInvokeStaticRange")
84
85%def op_invoke_super():
86%  invoke(helper="MterpInvokeSuper")
87/*
88 * Handle a "super" method call.
89 *
90 * for: invoke-super, invoke-super/range
91 */
92    /* op vB, {vD, vE, vF, vG, vA}, class@CCCC */
93    /* op vAA, {vCCCC..v(CCCC+AA-1)}, meth@BBBB */
94
95%def op_invoke_super_range():
96%  invoke(helper="MterpInvokeSuperRange")
97
98%def op_invoke_virtual():
99%  invoke(helper="MterpInvokeVirtual")
100/*
101 * Handle a virtual method call.
102 *
103 * for: invoke-virtual, invoke-virtual/range
104 */
105    /* op vB, {vD, vE, vF, vG, vA}, class@CCCC */
106    /* op vAA, {vCCCC..v(CCCC+AA-1)}, meth@BBBB */
107
108%def op_invoke_virtual_quick():
109%  invoke(helper="MterpInvokeVirtualQuick")
110
111%def op_invoke_virtual_range():
112%  invoke(helper="MterpInvokeVirtualRange")
113
114%def op_invoke_virtual_range_quick():
115%  invoke(helper="MterpInvokeVirtualQuickRange")
116