author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Fri, 24 May 2013 17:55:42 +0100 | |
branch | builtin-class-support |
changeset 2629 | cedb88626902 |
parent 2578 | fc6186a4961f |
child 2711 | a00302fe5083 |
permissions | -rw-r--r-- |
749 | 1 |
" |
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
3 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
4 |
New code and modifications done at SWING Research Group [1]: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
5 |
|
749 | 6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
7 |
SWING Research Group, Czech Technical University in Prague |
|
8 |
||
9 |
This software is furnished under a license and may be used |
|
10 |
only in accordance with the terms of that license and with the |
|
11 |
inclusion of the above copyright notice. This software may not |
|
12 |
be provided or otherwise made available to, or used by, any |
|
13 |
other person. No title to or ownership of the software is |
|
14 |
hereby transferred. |
|
15 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
16 |
[1] Code written at SWING Research Group contains a signature |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
17 |
of one of the above copright owners. For exact set of such code, |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
18 |
see the differences between this version and version stx:libjava |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
19 |
as of 1.9.2010 |
749 | 20 |
" |
21 |
"{ Package: 'stx:libjava' }" |
|
22 |
||
23 |
JavaByteCodeProcessorTests subclass:#JavaByteCodeDisassemblerTests |
|
24 |
instanceVariableNames:'' |
|
25 |
classVariableNames:'' |
|
26 |
poolDictionaries:'' |
|
27 |
category:'Languages-Java-Tests' |
|
28 |
! |
|
29 |
||
30 |
!JavaByteCodeDisassemblerTests class methodsFor:'documentation'! |
|
31 |
||
32 |
copyright |
|
33 |
" |
|
34 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
35 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
36 |
New code and modifications done at SWING Research Group [1]: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
37 |
|
749 | 38 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
39 |
SWING Research Group, Czech Technical University in Prague |
|
40 |
||
41 |
This software is furnished under a license and may be used |
|
42 |
only in accordance with the terms of that license and with the |
|
43 |
inclusion of the above copyright notice. This software may not |
|
44 |
be provided or otherwise made available to, or used by, any |
|
45 |
other person. No title to or ownership of the software is |
|
46 |
hereby transferred. |
|
47 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
48 |
[1] Code written at SWING Research Group contains a signature |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
49 |
of one of the above copright owners. For exact set of such code, |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
50 |
see the differences between this version and version stx:libjava |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
51 |
as of 1.9.2010 |
749 | 52 |
|
53 |
" |
|
54 |
! ! |
|
55 |
||
56 |
!JavaByteCodeDisassemblerTests class methodsFor:'resources'! |
|
57 |
||
58 |
resources |
|
59 |
||
60 |
^ Array with: JavaInitializedResource with: JavaTestsResource. |
|
61 |
||
62 |
"Created: / 15-03-2011 / 17:29:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
63 |
"Modified: / 16-03-2011 / 14:43:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
64 |
! ! |
|
65 |
||
66 |
!JavaByteCodeDisassemblerTests methodsFor:'tests'! |
|
67 |
||
68 |
testAnd |
|
69 |
| result | |
|
70 |
self shouldnt: |
|
71 |
[ result := self |
|
72 |
invoke: #'and(II)I' |
|
73 |
class: self loadSimpleMathJavaClass |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
74 |
args: #( 255 149 ) |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
75 |
] raise: Error. |
749 | 76 |
|
77 |
"static method |
|
78 |
||
79 |
0 iload_0 |
|
80 |
1 iload_1 |
|
81 |
2 iand |
|
82 |
3 ireturn" |
|
83 |
||
84 |
"Created: / 14-03-2011 / 17:02:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
85 |
"Modified: / 20-03-2011 / 21:49:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
86 |
"Modified (format): / 21-12-2012 / 18:43:34 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>" |
749 | 87 |
! |
88 |
||
89 |
testBitShiftLeft |
|
90 |
| | |
|
91 |
||
92 |
self shouldnt: |
|
93 |
[ self |
|
94 |
invoke: #'bitShiftLeft(II)I' |
|
95 |
class: self loadSimpleMathJavaClass |
|
96 |
args: #( 21 4 )] |
|
97 |
raise: Error. |
|
98 |
"static method |
|
99 |
||
100 |
0 iload_0 |
|
101 |
1 iload_1 |
|
102 |
2 ishl |
|
103 |
3 ireturn" |
|
104 |
||
105 |
"Created: / 14-03-2011 / 16:56:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
106 |
"Modified: / 20-03-2011 / 21:50:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
107 |
! |
|
108 |
||
109 |
testBitShiftRight |
|
110 |
| | |
|
111 |
||
112 |
self shouldnt: |
|
113 |
[ self |
|
114 |
invoke: #'bitShiftRight(II)I' |
|
115 |
class: self loadSimpleMathJavaClass |
|
116 |
args: #( 439 4 )] |
|
117 |
raise: Error. |
|
118 |
||
119 |
"static method |
|
120 |
||
121 |
0 iload_0 |
|
122 |
1 iload_1 |
|
123 |
2 ishr |
|
124 |
3 ireturn" |
|
125 |
||
126 |
"Created: / 14-03-2011 / 16:57:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
127 |
"Modified: / 20-03-2011 / 21:50:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
128 |
! |
|
129 |
||
130 |
testDec2 |
|
131 |
self shouldnt: |
|
132 |
||
133 |
||
134 |
[ self |
|
135 |
invoke: #'dec2(I)I' |
|
136 |
class: self loadSimpleMathJavaClass |
|
137 |
args: #( 3 ). ] raise: Error. |
|
138 |
||
139 |
||
140 |
"static method |
|
141 |
||
142 |
0 iinc 0 -1 |
|
143 |
3 iinc 0 -1 |
|
144 |
6 iload_0 |
|
145 |
7 ireturn" |
|
146 |
||
147 |
"Created: / 14-03-2011 / 16:58:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
148 |
"Modified: / 20-03-2011 / 22:59:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
149 |
! |
|
150 |
||
151 |
testDiv |
|
152 |
| | |
|
153 |
||
154 |
self shouldnt: |
|
155 |
[ self |
|
156 |
invoke: #'div(II)I' |
|
157 |
class: self loadSimpleMathJavaClass |
|
158 |
args: #( 101 10 ) ] |
|
159 |
raise: Error. |
|
160 |
||
161 |
"static method |
|
162 |
||
163 |
0 iload_0 |
|
164 |
1 iload_1 |
|
165 |
2 irem |
|
166 |
3 ireturn" |
|
167 |
||
168 |
"Created: / 14-03-2011 / 16:54:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
169 |
"Modified: / 20-03-2011 / 21:51:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
170 |
! |
|
171 |
||
172 |
testDivision |
|
173 |
| | |
|
174 |
||
175 |
self shouldnt: |
|
176 |
[ self |
|
177 |
invoke: #'division(II)I' |
|
178 |
class: self loadSimpleMathJavaClass |
|
179 |
args: #( 101 10 ) ] |
|
180 |
raise: Error. |
|
181 |
"static method |
|
182 |
||
183 |
0 iload_0 |
|
184 |
1 iload_1 |
|
185 |
2 idiv |
|
186 |
3 ireturn" |
|
187 |
||
188 |
"Created: / 14-03-2011 / 16:57:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
189 |
"Modified: / 20-03-2011 / 21:51:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
190 |
! |
|
191 |
||
192 |
testInc2 |
|
193 |
| | |
|
194 |
||
195 |
self shouldnt: |
|
196 |
[ self |
|
197 |
invoke: #'inc2(I)I' |
|
198 |
class: self loadSimpleMathJavaClass |
|
199 |
args: #( 3 ) ] |
|
200 |
raise: Error. |
|
201 |
"static method |
|
202 |
||
203 |
0 iinc 0 1 |
|
204 |
3 iinc 0 1 |
|
205 |
6 iload_0 |
|
206 |
7 ireturn" |
|
207 |
||
208 |
"Created: / 14-03-2011 / 16:58:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
209 |
"Modified: / 20-03-2011 / 21:51:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
210 |
! |
|
211 |
||
212 |
testInheritedMethodCall |
|
213 |
self shouldnt: [ |
|
214 |
||
215 |
self |
|
216 |
invoke: #'foo()Ljava/lang/String;' |
|
217 |
class: self loadSimpleInheritingJavaClass |
|
218 |
args: nil. |
|
219 |
||
220 |
] raise: Error. |
|
221 |
"0 ldc1 2 ['foo'] |
|
222 |
2 areturn" |
|
223 |
||
224 |
"Created: / 14-03-2011 / 16:21:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
225 |
"Modified: / 20-03-2011 / 23:01:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
226 |
! |
|
227 |
||
228 |
testJustLoadConstants |
|
229 |
self shouldnt: [ |
|
230 |
||
231 |
self |
|
232 |
invoke: #'justUseConstants()V' |
|
233 |
class: self loadSimpleMathJavaClass |
|
234 |
args: #(). |
|
235 |
||
236 |
] raise: Error. |
|
237 |
"static method |
|
238 |
||
239 |
0 lconst_0 |
|
240 |
1 lstore_0 |
|
241 |
2 lconst_1 |
|
242 |
3 lstore_2 |
|
243 |
4 fconst_0 |
|
244 |
5 fstore 4 |
|
245 |
7 fconst_1 |
|
246 |
8 fstore 5 |
|
247 |
10 fconst_2 |
|
248 |
11 fstore 6 |
|
249 |
13 dconst_0 |
|
250 |
14 dstore 7 |
|
251 |
16 dconst_1 |
|
252 |
17 dstore 9 |
|
253 |
19 return" |
|
254 |
||
255 |
"Created: / 14-03-2011 / 17:05:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
256 |
"Modified: / 20-03-2011 / 23:02:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
257 |
! |
|
258 |
||
259 |
testLookupSwitch |
|
260 |
self shouldnt: [ |
|
261 |
||
262 |
self |
|
263 |
invoke: #'switchInt(I)I' |
|
264 |
class: self loadSwitchExamplesClass |
|
265 |
receiver: self loadSwitchExamplesClass new |
|
266 |
args: #( -1000 ) |
|
267 |
||
268 |
] raise: Error. |
|
269 |
||
270 |
"Created: / 21-03-2011 / 13:51:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
271 |
"Modified: / 21-03-2011 / 15:12:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
272 |
! |
|
273 |
||
274 |
testMultipy |
|
275 |
self shouldnt: |
|
276 |
[ self |
|
277 |
invoke: #'multiply(II)I' |
|
278 |
class: self loadSimpleMathJavaClass |
|
279 |
args: (Array with: 20 with: 10)] |
|
280 |
raise: Error. |
|
281 |
||
282 |
"static method |
|
283 |
||
284 |
0 iload_0 |
|
285 |
1 iload_1 |
|
286 |
2 imul |
|
287 |
3 ireturn" |
|
288 |
||
289 |
"Created: / 06-03-2011 / 14:17:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
290 |
"Modified: / 20-03-2011 / 21:53:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
291 |
! |
|
292 |
||
293 |
testNegateInt |
|
294 |
self shouldnt: |
|
295 |
[ self |
|
296 |
invoke: #'negateInt(I)I' |
|
297 |
class: self loadSimpleMathJavaClass |
|
298 |
args: #( 55 )] |
|
299 |
raise: Error. |
|
300 |
||
301 |
"0 iload_0 |
|
302 |
1 iconst_m1 |
|
303 |
2 ixor |
|
304 |
3 ireturn" |
|
305 |
||
306 |
"Created: / 14-03-2011 / 16:55:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
307 |
"Modified: / 20-03-2011 / 21:53:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
308 |
! |
|
309 |
||
310 |
testOr |
|
311 |
| | |
|
312 |
||
313 |
self shouldnt: |
|
314 |
[ self |
|
315 |
invoke: #'or(II)I' |
|
316 |
class: self loadSimpleMathJavaClass |
|
317 |
args: #( 55 66 )] |
|
318 |
raise: Error. |
|
319 |
||
320 |
"0 iload_0 |
|
321 |
1 iload_1 |
|
322 |
2 ior |
|
323 |
3 ireturn" |
|
324 |
||
325 |
"Created: / 14-03-2011 / 17:02:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
326 |
"Modified: / 20-03-2011 / 21:53:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
327 |
! |
|
328 |
||
329 |
testOverridenMethodCall |
|
330 |
self shouldnt: |
|
331 |
[ self |
|
332 |
invoke: #'bar()Ljava/lang/String;' |
|
333 |
class: self loadSimpleInheritingJavaClass |
|
334 |
args: nil.] |
|
335 |
raise: Error. |
|
336 |
||
337 |
"0 ldc1 2 ['bar'] |
|
338 |
2 areturn" |
|
339 |
||
340 |
"Modified: / 20-03-2011 / 21:53:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
341 |
! |
|
342 |
||
343 |
testPower |
|
344 |
self shouldnt: |
|
345 |
[ self |
|
346 |
invoke: #'power(II)I' |
|
347 |
class: self loadSimpleMathJavaClass |
|
348 |
args: (Array with: 2 with: 10)] |
|
349 |
raise: Error. |
|
350 |
||
351 |
"0 iload_0 |
|
352 |
1 iload_1 |
|
353 |
2 iconst_1 |
|
354 |
3 invokestatic 2 [JavaMethod(stx.libjava.tests.simpleClasses.SimpleMath::int powerAcc (int int int))] |
|
355 |
6 ireturn" |
|
356 |
||
357 |
"Created: / 06-03-2011 / 14:18:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
358 |
"Modified: / 20-03-2011 / 21:54:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
359 |
! |
|
360 |
||
361 |
testReturnArrayOfLongs |
|
362 |
||
363 |
||
364 |
self shouldnt: |
|
365 |
[ self |
|
366 |
invoke: #'giveMeArrayOfLongs()[J' |
|
367 |
class: self loadSimpleMathJavaClass |
|
368 |
args: #(). ] |
|
369 |
raise: Error. |
|
370 |
||
371 |
"0 bipush 100 |
|
372 |
2 newarray 11 [T_LONG] |
|
373 |
4 areturn" |
|
374 |
||
375 |
"Created: / 14-03-2011 / 17:08:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
376 |
"Modified: / 20-03-2011 / 21:54:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
377 |
! |
|
378 |
||
379 |
testSimpleAdd |
|
380 |
self shouldnt: |
|
381 |
[ self |
|
382 |
invoke: #'add2To2000Expect2002()I' |
|
383 |
class: self loadSimpleMathJavaClass |
|
384 |
args: nil ] |
|
385 |
raise: Error. |
|
386 |
||
387 |
"static method |
|
388 |
||
389 |
0 iconst_2 |
|
390 |
1 istore_0 |
|
391 |
2 sipush 2000 |
|
392 |
5 istore_1 |
|
393 |
6 iload_0 |
|
394 |
7 iload_1 |
|
395 |
8 iadd |
|
396 |
9 istore_2 |
|
397 |
10 iload_2 |
|
398 |
11 ireturn" |
|
399 |
||
400 |
"Created: / 06-03-2011 / 14:18:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
401 |
"Modified: / 20-03-2011 / 21:55:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
402 |
! |
|
403 |
||
404 |
testSimpleAdd2 |
|
405 |
self shouldnt: |
|
406 |
[ self |
|
407 |
invoke: #'addMinus5ToArg(I)I' |
|
408 |
class: self loadSimpleMathJavaClass |
|
409 |
args: (Array with: 10) ] |
|
410 |
raise: Error. |
|
411 |
||
412 |
"static method |
|
413 |
||
414 |
0 iload_0 |
|
415 |
1 bipush -5 |
|
416 |
3 iadd |
|
417 |
4 ireturn" |
|
418 |
||
419 |
"Created: / 06-03-2011 / 14:18:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
420 |
"Modified: / 20-03-2011 / 21:55:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
421 |
! |
|
422 |
||
423 |
testStackCreation |
|
424 |
self shouldnt: |
|
425 |
[ self |
|
426 |
invoke: #'isYourStackCreatedCorrectly()I' |
|
427 |
class: self loadSimpleMathJavaClass |
|
428 |
args: #()] |
|
429 |
raise: Error. |
|
430 |
||
431 |
"0 iconst_0 |
|
432 |
1 istore_0 |
|
433 |
2 iconst_1 |
|
434 |
3 istore_1 |
|
435 |
4 iconst_2 |
|
436 |
5 istore_0 |
|
437 |
6 iconst_3 |
|
438 |
7 istore_1 |
|
439 |
8 iconst_4 |
|
440 |
9 istore_0 |
|
441 |
10 iconst_5 |
|
442 |
11 istore_0 |
|
443 |
12 bipush 6 |
|
444 |
14 istore_1 |
|
445 |
15 bipush 7 |
|
446 |
17 istore_0 |
|
447 |
18 bipush 8 |
|
448 |
20 istore_1 |
|
449 |
21 bipush 9 |
|
450 |
23 istore_1 |
|
451 |
24 iload_0 |
|
452 |
25 ireturn" |
|
453 |
||
454 |
"Created: / 14-03-2011 / 17:03:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
455 |
"Modified: / 20-03-2011 / 21:55:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
456 |
! |
|
457 |
||
458 |
testSumArray |
|
459 |
self shouldnt: [ |
|
460 |
||
461 |
self |
|
462 |
invoke: #'sumArray([I)I' |
|
463 |
class: self loadSimpleMathJavaClass |
|
464 |
args: #( #(1 2 3 4 5) ) |
|
465 |
||
466 |
] raise: Error. |
|
467 |
" |
|
468 |
Decompiled source: |
|
469 |
Static method |
|
470 |
0 iconst_0 |
|
471 |
1 istore_1 |
|
472 |
2 iconst_0 |
|
473 |
3 istore_2 |
|
474 |
4 iload_2 |
|
475 |
5 aload_0 |
|
476 |
6 arraylength |
|
477 |
7 if_icmpge 15 [22] |
|
478 |
10 iload_1 |
|
479 |
11 aload_0 |
|
480 |
12 iload_2 |
|
481 |
13 iaload |
|
482 |
14 iadd |
|
483 |
15 istore_1 |
|
484 |
16 iinc 2 1 |
|
485 |
19 goto -15 [4] |
|
486 |
22 iload_1 |
|
487 |
23 ireturn" |
|
488 |
||
489 |
"Created: / 14-03-2011 / 17:06:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
490 |
"Modified: / 20-03-2011 / 23:05:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
491 |
! |
|
492 |
||
493 |
testSumArrayOfDoubles |
|
494 |
self shouldnt: |
|
495 |
[self |
|
496 |
invoke: #'sumArrayOfDoubles([D)D' |
|
497 |
class: self loadSimpleMathJavaClass |
|
498 |
args: #( #(1.1 2.2 3.3 4.4 5.5) ) ] |
|
499 |
raise: Error. |
|
500 |
"0 dconst_0 |
|
501 |
1 dstore_1 |
|
502 |
2 iconst_0 |
|
503 |
3 istore_3 |
|
504 |
4 iload_3 |
|
505 |
5 aload_0 |
|
506 |
6 arraylength |
|
507 |
7 if_icmpge 15 [22] |
|
508 |
10 dload_1 |
|
509 |
11 aload_0 |
|
510 |
12 iload_3 |
|
511 |
13 daload |
|
512 |
14 dadd |
|
513 |
15 dstore_1 |
|
514 |
16 iinc 3 1 |
|
515 |
19 goto -15 [4] |
|
516 |
22 dload_1 |
|
517 |
23 dreturn" |
|
518 |
||
519 |
"Created: / 14-03-2011 / 17:07:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
520 |
"Modified: / 20-03-2011 / 21:55:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
521 |
! |
|
522 |
||
523 |
testTableSwitch |
|
524 |
self shouldnt: [ |
|
525 |
||
526 |
self |
|
527 |
invoke: #'switchChar(C)I' |
|
528 |
class: self loadSwitchExamplesClass |
|
529 |
receiver: self loadSwitchExamplesClass new |
|
530 |
args: #( $b ). |
|
531 |
||
532 |
] raise: Error. |
|
533 |
||
534 |
"Created: / 21-03-2011 / 13:51:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
535 |
"Modified: / 21-03-2011 / 15:02:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
536 |
! |
|
537 |
||
538 |
testUnsignedBitShiftLeft |
|
539 |
self shouldnt: |
|
540 |
[ self |
|
541 |
invoke: #'unsignedBitShiftRight(II)I' |
|
542 |
class: self loadSimpleMathJavaClass |
|
543 |
args: #( 1234 5 ) ] |
|
544 |
raise: Error. |
|
545 |
||
546 |
"0 iload_0 |
|
547 |
1 iload_1 |
|
548 |
2 iushr |
|
549 |
3 ireturn" |
|
550 |
||
551 |
"Created: / 14-03-2011 / 17:01:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
552 |
"Modified: / 20-03-2011 / 21:56:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
553 |
! |
|
554 |
||
555 |
testXor |
|
556 |
self shouldnt: |
|
557 |
[ self |
|
558 |
invoke: #'xor(II)I' |
|
559 |
class: self loadSimpleMathJavaClass |
|
560 |
args: #( 1234 5 )] |
|
561 |
raise: Error. |
|
562 |
||
563 |
"0 iload_0 |
|
564 |
1 iload_1 |
|
565 |
2 ixor |
|
566 |
3 ireturn" |
|
567 |
||
568 |
"Modified: / 06-03-2011 / 15:11:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
569 |
"Created: / 14-03-2011 / 17:02:40 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
570 |
"Modified: / 20-03-2011 / 21:56:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
571 |
! ! |
|
572 |
||
573 |
!JavaByteCodeDisassemblerTests methodsFor:'tests - manual'! |
|
574 |
||
575 |
diassembleAll |
|
576 |
| fails | |
|
577 |
||
578 |
fails := OrderedCollection new. |
|
579 |
JavaMethod allSubInstances do: |
|
580 |
[:method | |
|
581 |
method isNative |
|
582 |
ifFalse: |
|
583 |
[ [ JavaByteCodeDisassembler new diassemble: method to: String new writeStream ] |
|
584 |
on: Error |
|
585 |
do: [ fails add: method ] ] ]. |
|
586 |
fails size ~~ 0 |
|
587 |
ifTrue: [ self error: 'Some java methods failed to disassemble' ]. |
|
588 |
||
589 |
" |
|
590 |
JavaByteCodeDisassemblerTests new diassembleAll" |
|
591 |
||
592 |
"Created: / 21-03-2011 / 21:13:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
593 |
"Modified: / 22-03-2011 / 21:05:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
594 |
"Modified: / 23-03-2011 / 16:54:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
595 |
! ! |
|
596 |
||
597 |
!JavaByteCodeDisassemblerTests methodsFor:'tests-helpers'! |
|
598 |
||
599 |
invoke:methodName class:aClass receiver:receiver args:args |
|
600 |
|method result| |
|
601 |
||
602 |
method := aClass lookupMethodFor:methodName. |
|
603 |
result := JavaByteCodeDisassembler diassemble:method. |
|
604 |
||
605 |
"Created: / 10-03-2011 / 23:30:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
606 |
"Modified: / 20-03-2011 / 17:42:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
607 |
"Modified: / 22-03-2011 / 21:05:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
608 |
! ! |
|
609 |
||
610 |
!JavaByteCodeDisassemblerTests methodsFor:'tests2'! |
|
611 |
||
612 |
testGetBoolean |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
613 |
self |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
614 |
invoke: #'getBoolean()Z' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
615 |
class: self loadSimpleClassWithManyReferences |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
616 |
receiver: self loadSimpleClassWithManyReferences new |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
617 |
args: nil. |
749 | 618 |
|
619 |
" |
|
620 |
Deassembling getBoolean |
|
621 |
1: ALOAD_0 (42) ARGS: [] STACK: [.. -> FIELD 0: stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences] |
|
622 |
2: GETFIELD (180) ARGS: [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)] STACK: [objectRef -> objectRef] |
|
623 |
5: BIPUSH (16) ARGS: [9] STACK: [.. -> value] |
|
624 |
7: AALOAD (50) ARGS: [] STACK: [arrayRef, index -> value] |
|
625 |
8: CHECKCAST (192) ARGS: [java.lang.Boolean] STACK: [objectRef -> objectRef] |
|
626 |
11: INVVIRT (182) ARGS: [JavaMethodRef (java.lang.Boolean 'booleanValue'()Z)] STACK: [objectRef, [arg1, arg2, ...] -> ..] |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
627 |
14: IRETURN (172) ARGS: [] STACK: [value -> EMPTY]" |
749 | 628 |
"Created: / 14-03-2011 / 21:36:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
629 |
"Modified: / 22-03-2011 / 16:06:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
630 |
! |
|
631 |
||
632 |
testGetByte |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
633 |
self |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
634 |
shouldnt: [ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
635 |
self |
749 | 636 |
invoke: #'getByte()B' |
637 |
class: self loadSimpleClassWithManyReferences |
|
638 |
receiver: self loadSimpleClassWithManyReferences new |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
639 |
args: nil |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
640 |
] |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
641 |
raise: Error. |
749 | 642 |
|
643 |
"0 aload_0 |
|
644 |
1 getfield 3 [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)] |
|
645 |
4 bipush 7 |
|
646 |
6 aaload |
|
647 |
7 checkcast 17 [java.lang.Byte] |
|
648 |
10 invokevirtual 31 [JavaMethodRef (java.lang.Byte 'byteValue'()B)] |
|
649 |
13 ireturn" |
|
650 |
"Created: / 14-03-2011 / 21:34:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
651 |
"Modified: / 21-03-2011 / 15:38:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
652 |
! |
|
653 |
||
654 |
testGetChar |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
655 |
self |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
656 |
shouldnt: [ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
657 |
self |
749 | 658 |
invoke: #'getChar()C' |
659 |
class: self loadSimpleClassWithManyReferences |
|
660 |
receiver: self loadSimpleClassWithManyReferences new |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
661 |
args: nil |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
662 |
] |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
663 |
raise: Error. |
749 | 664 |
|
665 |
"0 aload_0 |
|
666 |
1 getfield 3 [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)] |
|
667 |
4 iconst_3 |
|
668 |
5 aaload |
|
669 |
6 checkcast 25 [java.lang.Character] |
|
670 |
9 invokevirtual 26 [JavaMethodRef (java.lang.Character 'charValue'()C)] |
|
671 |
12 ireturn" |
|
672 |
"Created: / 14-03-2011 / 21:31:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
673 |
"Modified: / 21-03-2011 / 15:39:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
674 |
! |
|
675 |
||
676 |
testGetDateArray |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
677 |
self |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
678 |
shouldnt: [ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
679 |
self |
749 | 680 |
invoke: #'getDateArray()[Ljava/util/Date;' |
681 |
class: self loadSimpleClassWithManyReferences |
|
682 |
receiver: self loadSimpleClassWithManyReferences new |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
683 |
args: nil |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
684 |
] |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
685 |
raise: Error. |
749 | 686 |
|
687 |
"0 aload_0 |
|
688 |
1 getfield 3 [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)] |
|
689 |
4 bipush 8 |
|
690 |
6 aaload |
|
691 |
7 checkcast 32 [UnresolvedClass([Ljava.util.Date;)] |
|
692 |
10 checkcast 32 [UnresolvedClass([Ljava.util.Date;)] |
|
693 |
13 areturn" |
|
694 |
"Created: / 14-03-2011 / 21:35:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
695 |
"Modified: / 21-03-2011 / 15:39:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
696 |
! |
|
697 |
||
698 |
testGetDouble |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
699 |
self |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
700 |
shouldnt: [ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
701 |
self |
749 | 702 |
invoke: #'getDouble()Ljava/lang/Double;' |
703 |
class: self loadSimpleClassWithManyReferences |
|
704 |
receiver: self loadSimpleClassWithManyReferences new |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
705 |
args: nil |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
706 |
] |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
707 |
raise: Error. |
749 | 708 |
|
709 |
"0 aload_0 |
|
710 |
1 getfield 3 [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)] |
|
711 |
4 iconst_2 |
|
712 |
5 aaload |
|
713 |
6 checkcast 24 [java.lang.Double] |
|
714 |
9 areturn" |
|
715 |
"Created: / 14-03-2011 / 21:30:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
716 |
"Modified: / 21-03-2011 / 15:39:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
717 |
! |
|
718 |
||
719 |
testGetInt |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
720 |
self |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
721 |
shouldnt: [ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
722 |
self |
749 | 723 |
invoke: #'getInt()I' |
724 |
class: self loadSimpleClassWithManyReferences |
|
725 |
receiver: self loadSimpleClassWithManyReferences new |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
726 |
args: nil |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
727 |
] |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
728 |
raise: Error. |
749 | 729 |
|
730 |
"0 aload_0 |
|
731 |
1 getfield 3 [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)] |
|
732 |
4 iconst_1 |
|
733 |
5 aaload |
|
734 |
6 checkcast 13 [java.lang.Integer] |
|
735 |
9 invokevirtual 23 [JavaMethodRef (java.lang.Integer 'intValue'()I)] |
|
736 |
12 ireturn" |
|
737 |
"Created: / 14-03-2011 / 21:30:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
738 |
"Modified: / 21-03-2011 / 15:39:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
739 |
! |
|
740 |
||
741 |
testGetIntArray |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
742 |
self |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
743 |
shouldnt: [ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
744 |
self |
749 | 745 |
invoke: #'getIntArray()[I' |
746 |
class: self loadSimpleClassWithManyReferences |
|
747 |
receiver: self loadSimpleClassWithManyReferences new |
|
748 |
args: nil. |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
749 |
] |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
750 |
raise: Error. |
749 | 751 |
|
752 |
"0 aload_0 |
|
753 |
1 getfield 3 [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)] |
|
754 |
4 iconst_5 |
|
755 |
5 aaload |
|
756 |
6 checkcast 29 [JavaBuiltInClassPointerRef(class:IntegerArray ; name&type: '[I')] |
|
757 |
9 checkcast 29 [JavaBuiltInClassPointerRef(class:IntegerArray ; name&type: '[I')] |
|
758 |
12 areturn" |
|
759 |
"Created: / 14-03-2011 / 21:33:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
760 |
"Modified: / 21-03-2011 / 15:40:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
761 |
! |
|
762 |
||
763 |
testGetLong |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
764 |
self |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
765 |
shouldnt: [ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
766 |
self |
749 | 767 |
invoke: #'getLong()J' |
768 |
class: self loadSimpleClassWithManyReferences |
|
769 |
receiver: self loadSimpleClassWithManyReferences new |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
770 |
args: nil |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
771 |
] |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
772 |
raise: Error. |
749 | 773 |
|
774 |
"0 aload_0 |
|
775 |
1 getfield 3 [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)] |
|
776 |
4 iconst_4 |
|
777 |
5 aaload |
|
778 |
6 checkcast 27 [java.lang.Long] |
|
779 |
9 invokevirtual 28 [JavaMethodRef (java.lang.Long 'longValue'()J)] |
|
780 |
12 lreturn" |
|
781 |
"Created: / 14-03-2011 / 21:32:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
782 |
"Modified: / 21-03-2011 / 15:40:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
783 |
! |
|
784 |
||
785 |
testGetShort |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
786 |
self |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
787 |
shouldnt: [ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
788 |
self |
749 | 789 |
invoke: #'getShort()S' |
790 |
class: self loadSimpleClassWithManyReferences |
|
791 |
receiver: self loadSimpleClassWithManyReferences new |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
792 |
args: nil |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
793 |
] |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
794 |
raise: Error. |
749 | 795 |
|
796 |
"0 aload_0 |
|
797 |
1 getfield 3 [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)] |
|
798 |
4 bipush 6 |
|
799 |
6 aaload |
|
800 |
7 checkcast 14 [java.lang.Short] |
|
801 |
10 invokevirtual 30 [JavaMethodRef (java.lang.Short 'shortValue'()S)] |
|
802 |
13 ireturn" |
|
803 |
"Created: / 14-03-2011 / 21:33:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
804 |
"Modified: / 21-03-2011 / 15:40:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
805 |
! |
|
806 |
||
807 |
testGetString |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
808 |
self |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
809 |
shouldnt: [ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
810 |
self |
749 | 811 |
invoke: #'getString()Ljava/lang/String;' |
812 |
class: self loadSimpleClassWithManyReferences |
|
813 |
receiver: self loadSimpleClassWithManyReferences new |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
814 |
args: nil |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
815 |
] |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
816 |
raise: Error. |
749 | 817 |
|
818 |
"0 aload_0 |
|
819 |
1 getfield 3 [JavaFieldRef (stx.libjava.tests.simpleClasses.SimpleClassWithManyReferences 'values'[Ljava/lang/Object; offs=1)] |
|
820 |
4 iconst_0 |
|
821 |
5 aaload |
|
822 |
6 checkcast 22 [java.lang.String] |
|
823 |
9 areturn" |
|
824 |
"Created: / 14-03-2011 / 21:27:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
825 |
"Modified: / 21-03-2011 / 15:40:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
826 |
! |
|
827 |
||
828 |
testMultiBytePrintString |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
829 |
<skip> |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
830 |
| badClass | |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
831 |
badClass := Java classForName: 'java.nio.charset.CharsetDecoder'. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
832 |
self |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
833 |
invoke: #'<init>(Ljava/nio/charset/Charset;FF)V' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
834 |
class: badClass |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
835 |
args: #( 21 4 ). |
749 | 836 |
|
837 |
"Created: / 23-03-2011 / 16:58:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
838 |
"Modified (format): / 06-07-2012 / 21:57:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
839 |
"Modified: / 01-12-2012 / 14:04:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
749 | 840 |
! |
841 |
||
842 |
testSetBoolean |
|
843 |
self |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
844 |
shouldnt: [ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
845 |
self |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
846 |
invoke: #'setBoolean(I)V' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
847 |
class: self loadSimpleClassWithManyReferences |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
848 |
receiver: self loadSimpleClassWithManyReferences new |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
849 |
args: nil. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
850 |
] |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
851 |
raise: Error. |
749 | 852 |
|
853 |
"Created: / 22-03-2011 / 12:17:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
854 |
! ! |
|
855 |
||
856 |
!JavaByteCodeDisassemblerTests class methodsFor:'documentation'! |
|
857 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
858 |
version_CVS |
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
859 |
^ '$Header: /cvs/stx/stx/libjava/JavaByteCodeDisassemblerTests.st,v 1.3 2013-02-25 11:15:31 vrany Exp $' |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
860 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
861 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
862 |
version_HG |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
863 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
864 |
^ '$Changeset: <not expanded> $' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
865 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
866 |
|
749 | 867 |
version_SVN |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
868 |
^ '§Id§' |
2152 | 869 |
! ! |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
870 |