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    movl    rSELF, %ecx
10    movl    %ecx, OUT_ARG0(%esp)
11    leal    OFF_FP_SHADOWFRAME(rFP), %eax
12    movl    %eax, OUT_ARG1(%esp)
13    movl    rPC, OUT_ARG2(%esp)
14    REFRESH_INST ${opnum}
15    movl    rINST, OUT_ARG3(%esp)
16    call    SYMBOL($helper)
17    testb   %al, %al
18    jz      MterpException
19    ADVANCE_PC 3
20    movl    rSELF, %eax
21    cmpb    LITERAL(0), THREAD_USE_MTERP_OFFSET(%eax)
22    jz      MterpFallback
23    RESTORE_IBASE
24    FETCH_INST
25    GOTO_NEXT
26
27%def invoke_polymorphic(helper="UndefinedInvokeHandler"):
28    /*
29     * invoke-polymorphic handler wrapper.
30     */
31    /* op {vC, vD, vE, vF, vG}, meth@BBBB, proto@HHHH */
32    /* op {vCCCC..v(CCCC+AA-1)}, meth@BBBB, proto@HHHH */
33    .extern $helper
34    EXPORT_PC
35    movl    rSELF, %ecx
36    movl    %ecx, OUT_ARG0(%esp)
37    leal    OFF_FP_SHADOWFRAME(rFP), %eax
38    movl    %eax, OUT_ARG1(%esp)
39    movl    rPC, OUT_ARG2(%esp)
40    REFRESH_INST ${opnum}
41    movl    rINST, OUT_ARG3(%esp)
42    call    SYMBOL($helper)
43    testb   %al, %al
44    jz      MterpException
45    ADVANCE_PC 4
46    movl    rSELF, %eax
47    cmpb    LITERAL(0), THREAD_USE_MTERP_OFFSET(%eax)
48    jz      MterpFallback
49    RESTORE_IBASE
50    FETCH_INST
51    GOTO_NEXT
52
53%def op_invoke_custom():
54%  invoke(helper="MterpInvokeCustom")
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