1; Copyright (C) 2007 The Android Open Source Project
2;
3; Licensed under the Apache License, Version 2.0 (the "License");
4; you may not use this file except in compliance with the License.
5; You may obtain a copy of the License at
6;
7;      http://www.apache.org/licenses/LICENSE-2.0
8;
9; Unless required by applicable law or agreed to in writing, software
10; distributed under the License is distributed on an "AS IS" BASIS,
11; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12; See the License for the specific language governing permissions and
13; limitations under the License.
14
15.class Blort
16.super java/lang/Object
17
18; Methods to "consume" an int.
19.method public static consume1(I)V
20.limit stack 0
21.limit locals 1
22    nop
23    return
24.end method
25
26.method public static consume2(I)V
27.limit stack 0
28.limit locals 1
29    nop
30    return
31.end method
32
33.method public static consume3(I)V
34.limit stack 0
35.limit locals 1
36    nop
37    return
38.end method
39
40.method public static consume4(I)V
41.limit stack 0
42.limit locals 1
43    nop
44    return
45.end method
46
47.method public static consume5(I)V
48.limit stack 0
49.limit locals 1
50    nop
51    return
52.end method
53
54.method public static consume6(I)V
55.limit stack 0
56.limit locals 1
57    nop
58    return
59.end method
60
61; Methods to "consume" a long.
62.method public static consume1(J)V
63.limit stack 0
64.limit locals 2
65    nop
66    return
67.end method
68
69.method public static consume2(J)V
70.limit stack 0
71.limit locals 2
72    nop
73    return
74.end method
75
76.method public static consume3(J)V
77.limit stack 0
78.limit locals 2
79    nop
80    return
81.end method
82
83.method public static consume4(J)V
84.limit stack 0
85.limit locals 2
86    nop
87    return
88.end method
89
90; Test of "pop" opcode. This should end up causing a call to consume1(0).
91.method public static test_pop()V
92.limit stack 2
93.limit locals 0
94    iconst_0
95    iconst_1
96    pop          ; A1 -> (empty)
97    invokestatic Blort/consume1(I)V
98    return
99.end method
100
101; Test of "pop2" opcode, form 1. This should end up causing a call
102; to consume1(0).
103.method public static test_pop2_form1()V
104.limit stack 3
105.limit locals 0
106    iconst_0
107    iconst_1
108    iconst_2
109    pop2         ; A1 B1 -> (empty)
110    invokestatic Blort/consume1(I)V
111    return
112.end method
113
114; Test of "pop2" opcode, form 2. This should end up causing a call
115; to consume1(0).
116.method public static test_pop2_form2()V
117.limit stack 3
118.limit locals 0
119    iconst_0
120    lconst_0
121    pop2         ; A2 -> (empty)
122    invokestatic Blort/consume1(I)V
123    return
124.end method
125
126; Test of "dup" opcode. This should end up causing these calls in order:
127; consume1(0), consume2(0).
128.method public static test_dup()V
129.limit stack 2
130.limit locals 0
131    iconst_0
132    dup          ; A1 -> A1 A1
133    invokestatic Blort/consume1(I)V
134    invokestatic Blort/consume2(I)V
135    return
136.end method
137
138; Test of "dup_x1" opcode. This should end up causing these calls in order:
139; consume1(1), consume2(0), consume3(1).
140.method public static test_dup_x1()V
141.limit stack 3
142.limit locals 0
143    iconst_0
144    iconst_1
145    dup_x1       ; A1 B1 -> B1 A1 B1
146    invokestatic Blort/consume1(I)V
147    invokestatic Blort/consume2(I)V
148    invokestatic Blort/consume3(I)V
149    return
150.end method
151
152; Test of "dup_x2" opcode, form 1. This should end up causing these calls
153; in order: consume1(2), consume2(1), consume3(0), consume4(2).
154.method public static test_dup_x2_form1()V
155.limit stack 4
156.limit locals 0
157    iconst_0
158    iconst_1
159    iconst_2
160    dup_x2       ; A1 B1 C1 -> C1 A1 B1 C1
161    invokestatic Blort/consume1(I)V
162    invokestatic Blort/consume2(I)V
163    invokestatic Blort/consume3(I)V
164    invokestatic Blort/consume4(I)V
165    return
166.end method
167
168; Test of "dup_x2" opcode, form 2. This should end up causing these calls
169; in order: consume1(1), consume2(0L), consume3(1).
170.method public static test_dup_x2_form2()V
171.limit stack 4
172.limit locals 0
173    lconst_0
174    iconst_1
175    dup_x2       ; A2 B1 -> B1 A2 B1
176    invokestatic Blort/consume1(I)V
177    invokestatic Blort/consume2(J)V
178    invokestatic Blort/consume3(I)V
179    return
180.end method
181
182; Test of "dup2" opcode, form 1. This should end up causing these calls
183; in order: consume1(1), consume2(0), consume3(1), consume4(0).
184.method public static test_dup2_form1()V
185.limit stack 4
186.limit locals 0
187    iconst_0
188    iconst_1
189    dup2         ; A1 B1 -> A1 B1 A1 B1
190    invokestatic Blort/consume1(I)V
191    invokestatic Blort/consume2(I)V
192    invokestatic Blort/consume3(I)V
193    invokestatic Blort/consume4(I)V
194    return
195.end method
196
197; Test of "dup2" opcode, form 2. This should end up causing these calls
198; in order: consume1(0L), consume2(0L).
199.method public static test_dup2_form2()V
200.limit stack 4
201.limit locals 0
202    lconst_0
203    dup2         ; A2 -> A2 A2
204    invokestatic Blort/consume1(J)V
205    invokestatic Blort/consume2(J)V
206    return
207.end method
208
209; Test of "dup2_x1" opcode, form 1. This should end up causing these calls
210; in order: consume1(1), consume2(2), consume3(0), consume4(1), consume5(2).
211.method public static test_dup2_x1_form1()V
212.limit stack 5
213.limit locals 0
214    iconst_0
215    iconst_1
216    iconst_2
217    dup2_x1      ; A1 B1 C1 -> B1 C1 A1 B1 C1
218    invokestatic Blort/consume1(I)V
219    invokestatic Blort/consume2(I)V
220    invokestatic Blort/consume3(I)V
221    invokestatic Blort/consume4(I)V
222    invokestatic Blort/consume5(I)V
223    return
224.end method
225
226
227; Test of "dup2_x1" opcode, form 2. This should end up causing these calls
228; in order: consume1(1L), consume2(2), consume3(1L).
229.method public static test_dup2_x1_form2()V
230.limit stack 5
231.limit locals 0
232    iconst_0
233    lconst_1
234    dup2_x1      ; A1 B2 -> B2 A1 B2
235    invokestatic Blort/consume1(J)V
236    invokestatic Blort/consume2(I)V
237    invokestatic Blort/consume3(J)V
238    return
239.end method
240
241; Test of "dup2_x2" opcode, form 1. This should end up causing these calls
242; in order: consume1(3), consume2(2), consume3(1), consume4(0), consume5(3),
243; consume6(2).
244.method public static test_dup2_x2_form1()V
245.limit stack 6
246.limit locals 0
247    iconst_0
248    iconst_1
249    iconst_2
250    iconst_3
251    dup2_x2      ; A1 B1 C1 D1 -> C1 D1 A1 B1 C1 D1
252    invokestatic Blort/consume1(I)V
253    invokestatic Blort/consume2(I)V
254    invokestatic Blort/consume3(I)V
255    invokestatic Blort/consume4(I)V
256    invokestatic Blort/consume5(I)V
257    invokestatic Blort/consume6(I)V
258    return
259.end method
260
261; Test of "dup2_x2" opcode, form 2. This should end up causing these calls
262; in order: consume1(2L), consume2(1), consume3(0), consume4(2L).
263.method public static test_dup2_x2_form2()V
264.limit stack 6
265.limit locals 0
266    iconst_0
267    iconst_1
268    ldc2_w 2
269    dup2_x2      ; A1 B1 C2 -> C2 A1 B1 C2
270    invokestatic Blort/consume1(J)V
271    invokestatic Blort/consume2(I)V
272    invokestatic Blort/consume3(I)V
273    invokestatic Blort/consume4(J)V
274    return
275.end method
276
277; Test of "dup2_x2" opcode, form 3. This should end up causing these calls
278; in order: consume1(2), consume2(1), consume3(0L), consume4(2), consume5(1).
279.method public static test_dup2_x2_form3()V
280.limit stack 6
281.limit locals 0
282    lconst_0
283    iconst_1
284    iconst_2
285    dup2_x2      ; A2 B1 C1 -> B1 C1 A2 B1 C1
286    invokestatic Blort/consume1(I)V
287    invokestatic Blort/consume2(I)V
288    invokestatic Blort/consume3(J)V
289    invokestatic Blort/consume4(I)V
290    invokestatic Blort/consume5(I)V
291    return
292.end method
293
294; Test of "dup2_x2" opcode, form 4. This should end up causing these calls
295; in order: consume1(1L), consume2(0L), consume3(1L).
296.method public static test_dup2_x2_form4()V
297.limit stack 6
298.limit locals 0
299    lconst_0
300    lconst_1
301    dup2_x2      ; A2 B2 -> B2 A2 B2
302    invokestatic Blort/consume1(J)V
303    invokestatic Blort/consume2(J)V
304    invokestatic Blort/consume3(J)V
305    return
306.end method
307
308; Test of "swap" opcode. This should end up causing these calls
309; in order: consume1(0), consume2(1).
310.method public static test_swap()V
311.limit stack 2
312.limit locals 0
313    iconst_0
314    iconst_1
315    swap         ; A1 B1 -> B1 A1
316    invokestatic Blort/consume1(I)V
317    invokestatic Blort/consume2(I)V
318    return
319.end method
320