108
|
1 |
"{ Package: 'exept:regression' }"
|
|
2 |
|
|
3 |
TestCase subclass:#JITTest
|
|
4 |
instanceVariableNames:'i1 i2 i3'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'tests'
|
|
8 |
!
|
|
9 |
|
|
10 |
Object subclass:#BarClass
|
|
11 |
instanceVariableNames:''
|
|
12 |
classVariableNames:''
|
|
13 |
poolDictionaries:''
|
|
14 |
privateIn:JITTest
|
|
15 |
!
|
|
16 |
|
|
17 |
Object subclass:#FooClass
|
|
18 |
instanceVariableNames:''
|
|
19 |
classVariableNames:''
|
|
20 |
poolDictionaries:''
|
|
21 |
privateIn:JITTest
|
|
22 |
!
|
|
23 |
|
|
24 |
|
|
25 |
!JITTest class methodsFor:'tests'!
|
|
26 |
|
|
27 |
cond1:arg
|
|
28 |
arg == 0 ifTrue:[
|
|
29 |
^ 'zero'
|
|
30 |
].
|
|
31 |
^ 'not zero'
|
|
32 |
|
|
33 |
"
|
|
34 |
JITTest cond1:0
|
|
35 |
"
|
|
36 |
|
|
37 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
38 |
!
|
|
39 |
|
|
40 |
cond2:arg
|
|
41 |
self size.
|
|
42 |
arg == 0 ifTrue:[
|
|
43 |
^ 'zero'
|
|
44 |
].
|
|
45 |
^ 'not zero'
|
|
46 |
|
|
47 |
"
|
|
48 |
JITTest cond2:0
|
|
49 |
"
|
|
50 |
|
|
51 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
52 |
!
|
|
53 |
|
|
54 |
send1:arg
|
|
55 |
^ self send1:arg with:(Association new) with:thisContext sender
|
|
56 |
|
|
57 |
"
|
|
58 |
JITTest send1:1
|
|
59 |
"
|
|
60 |
|
|
61 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
62 |
!
|
|
63 |
|
|
64 |
send1:arg1 with:arg2 with:arg3
|
|
65 |
self halt
|
|
66 |
|
|
67 |
"
|
|
68 |
JITTest send1:1
|
|
69 |
"
|
|
70 |
|
|
71 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
72 |
!
|
|
73 |
|
|
74 |
test1
|
|
75 |
^ 5
|
|
76 |
|
|
77 |
"
|
|
78 |
JITTest test1
|
|
79 |
"
|
|
80 |
|
|
81 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
82 |
!
|
|
83 |
|
|
84 |
test2
|
|
85 |
^ [5]
|
|
86 |
|
|
87 |
"
|
|
88 |
JITTest test2 value
|
|
89 |
"
|
|
90 |
|
|
91 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
92 |
!
|
|
93 |
|
|
94 |
test2b
|
|
95 |
^ [:a | a]
|
|
96 |
|
|
97 |
"
|
|
98 |
JITTest test2b value:1
|
|
99 |
"
|
|
100 |
|
|
101 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
102 |
!
|
|
103 |
|
|
104 |
test3
|
|
105 |
^ 256
|
|
106 |
|
|
107 |
"
|
|
108 |
JITTest test3
|
|
109 |
"
|
|
110 |
|
|
111 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
112 |
!
|
|
113 |
|
|
114 |
test4
|
|
115 |
^ 16r7FFF
|
|
116 |
|
|
117 |
"
|
|
118 |
JITTest test4
|
|
119 |
"
|
|
120 |
|
|
121 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
122 |
!
|
|
123 |
|
|
124 |
test5
|
|
125 |
^ 16rFFFF
|
|
126 |
|
|
127 |
"
|
|
128 |
JITTest test5
|
|
129 |
"
|
|
130 |
|
|
131 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
132 |
!
|
|
133 |
|
|
134 |
test5b
|
|
135 |
^ -16rFFFF
|
|
136 |
|
|
137 |
"
|
|
138 |
JITTest test5b
|
|
139 |
"
|
|
140 |
|
|
141 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
142 |
!
|
|
143 |
|
|
144 |
test5c
|
|
145 |
^ -1
|
|
146 |
|
|
147 |
"
|
|
148 |
JITTest test5c
|
|
149 |
"
|
|
150 |
|
|
151 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
152 |
!
|
|
153 |
|
|
154 |
test6
|
|
155 |
^ #hello
|
|
156 |
|
|
157 |
"
|
|
158 |
JITTest test6
|
|
159 |
"
|
|
160 |
|
|
161 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
162 |
!
|
|
163 |
|
|
164 |
test6b
|
|
165 |
^ #fooBarBazThisIsANonCommonSymbol
|
|
166 |
|
|
167 |
"
|
|
168 |
JITTest test6b
|
|
169 |
"
|
|
170 |
|
|
171 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
172 |
!
|
|
173 |
|
|
174 |
test6c
|
|
175 |
^ 123456789
|
|
176 |
|
|
177 |
"
|
|
178 |
JITTest test6c
|
|
179 |
"
|
|
180 |
|
|
181 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
182 |
!
|
|
183 |
|
|
184 |
test6d
|
|
185 |
^ 1234567890
|
|
186 |
|
|
187 |
"
|
|
188 |
JITTest test6d
|
|
189 |
"
|
|
190 |
|
|
191 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
192 |
!
|
|
193 |
|
|
194 |
test7
|
|
195 |
^ true
|
|
196 |
|
|
197 |
"
|
|
198 |
JITTest test7
|
|
199 |
"
|
|
200 |
|
|
201 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
202 |
!
|
|
203 |
|
|
204 |
test8:arg1 a:arg2 a:arg3 a:arg4
|
|
205 |
^ arg1
|
|
206 |
|
|
207 |
"
|
|
208 |
JITTest test8:1 a:2 a:3 a:4
|
|
209 |
"
|
|
210 |
|
|
211 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
212 |
!
|
|
213 |
|
|
214 |
test8b:arg1 a:arg2 a:arg3 a:arg4
|
|
215 |
^ arg2
|
|
216 |
|
|
217 |
"
|
|
218 |
JITTest test8b:1 a:2 a:3 a:4
|
|
219 |
"
|
|
220 |
|
|
221 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
222 |
!
|
|
223 |
|
|
224 |
test8c:arg1 a:arg2 a:arg3 a:arg4
|
|
225 |
^ arg3
|
|
226 |
|
|
227 |
"
|
|
228 |
JITTest test8c:1 a:2 a:3 a:4
|
|
229 |
"
|
|
230 |
|
|
231 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
232 |
!
|
|
233 |
|
|
234 |
test9:arg1
|
|
235 |
^ arg1 + 1
|
|
236 |
|
|
237 |
"
|
|
238 |
JITTest test9:0
|
|
239 |
"
|
|
240 |
|
|
241 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
242 |
! !
|
|
243 |
|
109
|
244 |
!JITTest methodsFor:'public - test - arithmetic'!
|
|
245 |
|
|
246 |
testAdd1
|
|
247 |
self assert:( (JITTest new add1:-1000) == -999 ).
|
|
248 |
self assert:( (JITTest new add1:-1) == 0 ).
|
|
249 |
self assert:( (JITTest new add1:0) == 1 ).
|
|
250 |
self assert:( (JITTest new add1:1) == 2 ).
|
|
251 |
self assert:( (JITTest new add1:1000) == 1001 ).
|
|
252 |
|
|
253 |
self assert:( (JITTest new add1:SmallInteger maxVal) class == LargeInteger ).
|
|
254 |
self assert:( ((JITTest new add1:SmallInteger maxVal) - 1) class == SmallInteger ).
|
|
255 |
|
|
256 |
self assert:( (JITTest new add1:-1000.0) = -999.0 ).
|
|
257 |
self assert:( (JITTest new add1:-1.0) = 0.0 ).
|
|
258 |
self assert:( (JITTest new add1:0.0) = 1.0 ).
|
|
259 |
self assert:( (JITTest new add1:1.0) = 2.0 ).
|
|
260 |
self assert:( (JITTest new add1:1000.0) = 1001.0 ).
|
|
261 |
|
|
262 |
|
|
263 |
self assert:( (JITTest new add2:-1000) = -999 ).
|
|
264 |
self assert:( (JITTest new add2:-1) = 0 ).
|
|
265 |
self assert:( (JITTest new add2:0) = 1 ).
|
|
266 |
self assert:( (JITTest new add2:1) = 2 ).
|
|
267 |
self assert:( (JITTest new add2:1000) = 1001 ).
|
|
268 |
|
|
269 |
self assert:( (JITTest new add2:-1000.0) = -999.0 ).
|
|
270 |
self assert:( (JITTest new add2:-1.0) = 0.0 ).
|
|
271 |
self assert:( (JITTest new add2:0.0) = 1.0 ).
|
|
272 |
self assert:( (JITTest new add2:1.0) = 2.0 ).
|
|
273 |
self assert:( (JITTest new add2:1000.0) = 1001.0 ).
|
|
274 |
|
|
275 |
"
|
|
276 |
self basicNew testAdd1
|
|
277 |
"
|
|
278 |
! !
|
|
279 |
|
|
280 |
!JITTest methodsFor:'public - test - blocks'!
|
|
281 |
|
|
282 |
testFindFirst
|
110
|
283 |
self assert:(self findFirst1:1) == 1.
|
|
284 |
self assert:(self findFirst1:2) == 2.
|
|
285 |
self assert:(self findFirst1:3) == 3.
|
|
286 |
self assert:(self findFirst1:4) == 4.
|
|
287 |
self assert:(self findFirst1:0) == 0.
|
|
288 |
self assert:(self findFirst1:10) == 0.
|
|
289 |
self assert:(self findFirst1:4.0) == 0.
|
|
290 |
|
|
291 |
self assert:(self findFirst2:1) == 1.
|
|
292 |
self assert:(self findFirst2:2) == 2.
|
|
293 |
self assert:(self findFirst2:3) == 3.
|
|
294 |
self assert:(self findFirst2:4) == 4.
|
|
295 |
self assert:(self findFirst2:0) == 0.
|
|
296 |
self assert:(self findFirst2:10) == 0.
|
|
297 |
self assert:(self findFirst2:4.0) == 4.
|
109
|
298 |
|
|
299 |
"
|
|
300 |
self basicNew testFindFirst
|
|
301 |
"
|
|
302 |
! !
|
|
303 |
|
|
304 |
!JITTest methodsFor:'public - test - ifs'!
|
|
305 |
|
|
306 |
testOr1
|
|
307 |
self assert:(self tstOr1:#Foo) == true.
|
|
308 |
self assert:(self tstOr1:#Bar) == true.
|
|
309 |
self assert:(self tstOr1:#Baz) == false.
|
|
310 |
|
|
311 |
self assert:(self tstOr1:#foo) == false.
|
|
312 |
self assert:(self tstOr1:#bar) == false.
|
|
313 |
self assert:(self tstOr1:#baz) == false.
|
|
314 |
|
|
315 |
self assert:(self tstOr2:#Foo) == true.
|
|
316 |
self assert:(self tstOr2:#Bar) == true.
|
|
317 |
self assert:(self tstOr2:#Baz) == true.
|
|
318 |
|
|
319 |
self assert:(self tstOr2:#foo) == false.
|
|
320 |
self assert:(self tstOr2:#bar) == false.
|
|
321 |
self assert:(self tstOr2:#baz) == false.
|
|
322 |
|
|
323 |
"
|
|
324 |
self basicNew testOr1
|
|
325 |
"
|
|
326 |
! !
|
|
327 |
|
108
|
328 |
!JITTest methodsFor:'test - arithmetic'!
|
|
329 |
|
|
330 |
add1:arg
|
|
331 |
^ 1 + arg
|
|
332 |
|
|
333 |
"
|
|
334 |
JITTest new add1:-1000
|
|
335 |
JITTest new add1:-1
|
|
336 |
JITTest new add1:0
|
|
337 |
JITTest new add1:1
|
|
338 |
JITTest new add1:1000
|
|
339 |
JITTest new add1:SmallInteger maxVal
|
|
340 |
|
|
341 |
JITTest new add1:-1.0
|
|
342 |
JITTest new add1:0.0
|
|
343 |
JITTest new add1:1.0
|
|
344 |
"
|
|
345 |
|
|
346 |
"Modified: / 3.6.1998 / 16:15:36 / cg"
|
|
347 |
!
|
|
348 |
|
|
349 |
add2:arg
|
|
350 |
^ 1.0 + arg
|
|
351 |
|
|
352 |
"
|
|
353 |
JITTest new add2:-1000
|
|
354 |
JITTest new add2:-1
|
|
355 |
JITTest new add2:0
|
|
356 |
JITTest new add2:1
|
|
357 |
JITTest new add2:1000
|
|
358 |
|
|
359 |
JITTest new add2:-1.0
|
|
360 |
JITTest new add2:0.0
|
|
361 |
JITTest new add2:1.0
|
|
362 |
"
|
|
363 |
!
|
|
364 |
|
|
365 |
add3:arg
|
|
366 |
^ arg + 1
|
|
367 |
|
|
368 |
"
|
|
369 |
JITTest new add3:-1000
|
|
370 |
JITTest new add3:-1
|
|
371 |
JITTest new add3:0
|
|
372 |
JITTest new add3:1
|
|
373 |
JITTest new add3:1000
|
|
374 |
|
|
375 |
JITTest new add3:-1.0
|
|
376 |
JITTest new add3:0.0
|
|
377 |
JITTest new add3:1.0
|
|
378 |
"
|
|
379 |
!
|
|
380 |
|
|
381 |
add4:arg
|
|
382 |
^ arg + 1.0
|
|
383 |
|
|
384 |
"
|
|
385 |
JITTest new add4:-1000
|
|
386 |
JITTest new add4:-1
|
|
387 |
JITTest new add4:0
|
|
388 |
JITTest new add4:1
|
|
389 |
JITTest new add4:1000
|
|
390 |
|
|
391 |
JITTest new add4:-1.0
|
|
392 |
JITTest new add4:0.0
|
|
393 |
JITTest new add4:1.0
|
|
394 |
"
|
|
395 |
!
|
|
396 |
|
|
397 |
add5:arg
|
|
398 |
^ arg + arg
|
|
399 |
|
|
400 |
"
|
|
401 |
JITTest new add5:-1000
|
|
402 |
JITTest new add5:-1
|
|
403 |
JITTest new add5:0
|
|
404 |
JITTest new add5:1
|
|
405 |
JITTest new add5:1000
|
|
406 |
|
|
407 |
JITTest new add5:-1.0
|
|
408 |
JITTest new add5:0.0
|
|
409 |
JITTest new add5:1.0
|
|
410 |
JITTest new add5:SmallInteger maxVal
|
|
411 |
JITTest new add5:SmallInteger minVal
|
|
412 |
JITTest new add5:nil
|
|
413 |
"
|
|
414 |
!
|
|
415 |
|
|
416 |
mul1:arg
|
|
417 |
^ arg * 2
|
|
418 |
|
|
419 |
"
|
|
420 |
JITTest new mul1:0
|
|
421 |
JITTest new mul1:-1
|
|
422 |
JITTest new mul1:1
|
|
423 |
JITTest new mul1:1000
|
|
424 |
JITTest new mul1:-1000
|
|
425 |
JITTest new mul1:(SmallInteger maxVal // 2 - 1)
|
|
426 |
JITTest new mul1:(SmallInteger maxVal // 2)
|
|
427 |
JITTest new mul1:(SmallInteger maxVal // 2 + 1)
|
|
428 |
JITTest new mul1:(SmallInteger maxVal // 2 + 2)
|
|
429 |
JITTest new mul1:(SmallInteger maxVal + 1)
|
|
430 |
JITTest new mul1:(SmallInteger maxVal)
|
|
431 |
JITTest new mul1:(SmallInteger minVal // 2 - 1)
|
|
432 |
JITTest new mul1:(SmallInteger minVal // 2)
|
|
433 |
JITTest new mul1:(SmallInteger minVal // 2 + 1)
|
|
434 |
JITTest new mul1:(SmallInteger minVal // 2 + 2)
|
|
435 |
JITTest new mul1:(SmallInteger minVal - 1)
|
|
436 |
JITTest new mul1:(SmallInteger minVal)
|
|
437 |
|
|
438 |
JITTest new mul1:-1.0
|
|
439 |
JITTest new mul1:0.0
|
|
440 |
JITTest new mul1:1.0
|
|
441 |
"
|
|
442 |
|
|
443 |
"Modified: / 3.6.1998 / 16:15:36 / cg"
|
|
444 |
!
|
|
445 |
|
|
446 |
mul2:arg
|
|
447 |
^ arg * 4
|
|
448 |
|
|
449 |
"
|
|
450 |
JITTest new mul2:0
|
|
451 |
JITTest new mul2:-1
|
|
452 |
JITTest new mul2:1
|
|
453 |
JITTest new mul2:1000
|
|
454 |
JITTest new mul2:-1000
|
|
455 |
JITTest new mul2:(SmallInteger maxVal // 2 - 1)
|
|
456 |
JITTest new mul2:(SmallInteger maxVal // 2)
|
|
457 |
JITTest new mul2:(SmallInteger maxVal // 2 + 1)
|
|
458 |
JITTest new mul2:(SmallInteger maxVal // 2 + 2)
|
|
459 |
JITTest new mul2:(SmallInteger maxVal + 1)
|
|
460 |
JITTest new mul2:(SmallInteger maxVal)
|
|
461 |
JITTest new mul2:(SmallInteger minVal // 2 - 1)
|
|
462 |
JITTest new mul2:(SmallInteger minVal // 2)
|
|
463 |
JITTest new mul2:(SmallInteger minVal // 2 + 1)
|
|
464 |
JITTest new mul2:(SmallInteger minVal // 2 + 2)
|
|
465 |
JITTest new mul2:(SmallInteger minVal - 1)
|
|
466 |
JITTest new mul2:(SmallInteger minVal)
|
|
467 |
|
|
468 |
JITTest new mul2:-1.0
|
|
469 |
JITTest new mul2:0.0
|
|
470 |
JITTest new mul2:1.0
|
|
471 |
"
|
|
472 |
|
|
473 |
"Modified: / 3.6.1998 / 16:15:36 / cg"
|
|
474 |
!
|
|
475 |
|
|
476 |
subtract1:arg
|
|
477 |
^ 1 - arg
|
|
478 |
|
|
479 |
"
|
|
480 |
JITTest new subtract1:-1000
|
|
481 |
JITTest new subtract1:-1
|
|
482 |
JITTest new subtract1:0
|
|
483 |
JITTest new subtract1:1
|
|
484 |
JITTest new subtract1:1000
|
|
485 |
|
|
486 |
JITTest new subtract1:-1.0
|
|
487 |
JITTest new subtract1:0.0
|
|
488 |
JITTest new subtract1:1.0
|
|
489 |
JITTest new subtract1:SmallInteger maxVal negated
|
|
490 |
JITTest new subtract1:nil
|
|
491 |
"
|
|
492 |
!
|
|
493 |
|
|
494 |
subtract2:arg
|
|
495 |
^ 1.0 - arg
|
|
496 |
|
|
497 |
"
|
|
498 |
JITTest new subtract2:-1000
|
|
499 |
JITTest new subtract2:-1
|
|
500 |
JITTest new subtract2:0
|
|
501 |
JITTest new subtract2:1
|
|
502 |
JITTest new subtract2:1000
|
|
503 |
|
|
504 |
JITTest new subtract2:-1.0
|
|
505 |
JITTest new subtract2:0.0
|
|
506 |
JITTest new subtract2:1.0
|
|
507 |
"
|
|
508 |
! !
|
|
509 |
|
|
510 |
!JITTest methodsFor:'test - bits'!
|
|
511 |
|
|
512 |
and1:arg
|
|
513 |
^ arg bitAnd:1
|
|
514 |
|
|
515 |
"
|
|
516 |
JITTest new and1:1
|
|
517 |
JITTest new and1:0
|
|
518 |
"
|
|
519 |
|
|
520 |
"Modified: / 3.6.1998 / 16:15:36 / cg"
|
|
521 |
!
|
|
522 |
|
|
523 |
or1:arg
|
|
524 |
^ arg bitOr:1
|
|
525 |
|
|
526 |
"
|
|
527 |
JITTest new or1:1
|
|
528 |
JITTest new or1:2
|
|
529 |
"
|
|
530 |
|
|
531 |
"Modified: / 3.6.1998 / 16:15:36 / cg"
|
|
532 |
!
|
|
533 |
|
|
534 |
xor1:arg
|
|
535 |
^ arg bitXor:1
|
|
536 |
|
|
537 |
"
|
|
538 |
JITTest new xor1:1
|
|
539 |
JITTest new xor1:2
|
|
540 |
"
|
|
541 |
|
|
542 |
"Modified: / 3.6.1998 / 16:15:36 / cg"
|
|
543 |
! !
|
|
544 |
|
|
545 |
!JITTest methodsFor:'test - blocks'!
|
|
546 |
|
|
547 |
block1
|
|
548 |
^ [:a | a == 0]
|
|
549 |
|
|
550 |
"
|
|
551 |
JITTest new block1
|
|
552 |
JITTest new block1 value
|
|
553 |
JITTest new block1 value:1
|
|
554 |
JITTest new block1 value:0
|
|
555 |
"
|
|
556 |
!
|
|
557 |
|
|
558 |
block10
|
|
559 |
|l|
|
|
560 |
|
|
561 |
l := 1.
|
|
562 |
^ [ [l] ]
|
|
563 |
|
|
564 |
"
|
|
565 |
JITTest new block10
|
|
566 |
"
|
|
567 |
!
|
|
568 |
|
|
569 |
block11
|
|
570 |
|l|
|
|
571 |
|
|
572 |
l := [1].
|
|
573 |
^ [ l value ]
|
|
574 |
|
|
575 |
"
|
|
576 |
JITTest new block11
|
|
577 |
"
|
|
578 |
!
|
|
579 |
|
|
580 |
block12
|
|
581 |
|b|
|
|
582 |
|
|
583 |
b := [:a | ^ a].
|
|
584 |
b value:1.
|
|
585 |
|
|
586 |
"
|
|
587 |
JITTest new block12
|
|
588 |
"
|
|
589 |
!
|
|
590 |
|
|
591 |
block2
|
|
592 |
^ [:a | 'hello']
|
|
593 |
|
|
594 |
"
|
|
595 |
JITTest new block2
|
|
596 |
JITTest new block2 value:nil
|
|
597 |
"
|
|
598 |
!
|
|
599 |
|
|
600 |
block2Arg
|
|
601 |
|b|
|
|
602 |
|
|
603 |
b := [:a :b | a].
|
|
604 |
(b value:1 value:2) printCR.
|
|
605 |
|
|
606 |
"
|
|
607 |
JITTest new block2Arg
|
|
608 |
"
|
|
609 |
!
|
|
610 |
|
|
611 |
block2ArgB
|
|
612 |
|b|
|
|
613 |
|
|
614 |
b := [:a :b | b].
|
|
615 |
(b value:1 value:2) printCR.
|
|
616 |
|
|
617 |
"
|
|
618 |
JITTest new block2ArgB
|
|
619 |
"
|
|
620 |
!
|
|
621 |
|
|
622 |
block2ArgC
|
|
623 |
|printA scale|
|
|
624 |
|
|
625 |
scale := 1.
|
|
626 |
|
|
627 |
printA :=
|
|
628 |
[:iter1 :time1 |
|
|
629 |
'block-arg1: ' print. iter1 printCR.
|
|
630 |
'block-arg2: ' print. time1 printCR.
|
|
631 |
Transcript cr.
|
|
632 |
Transcript nextPutAll: (iter1 / scale) rounded printString.
|
|
633 |
Transcript nextPutAll: ' '.
|
|
634 |
Transcript nextPutAll: time1 printString.
|
|
635 |
Transcript nextPutAll: ' '].
|
|
636 |
|
|
637 |
printA value:1 value:2.
|
|
638 |
|
|
639 |
"
|
|
640 |
JITTest new block2ArgC
|
|
641 |
"
|
|
642 |
!
|
|
643 |
|
|
644 |
block2bArg
|
|
645 |
|b|
|
|
646 |
|
|
647 |
b := [:a :b | a printCR].
|
|
648 |
b value:1 value:2.
|
|
649 |
|
|
650 |
"
|
|
651 |
JITTest new block2bArg
|
|
652 |
"
|
|
653 |
!
|
|
654 |
|
|
655 |
block2bArgB
|
|
656 |
|b|
|
|
657 |
|
|
658 |
b := [:a :b | b printCR].
|
|
659 |
b value:1 value:2.
|
|
660 |
|
|
661 |
"
|
|
662 |
JITTest new block2bArgB
|
|
663 |
"
|
|
664 |
!
|
|
665 |
|
|
666 |
block3
|
|
667 |
^ [:a | a]
|
|
668 |
|
|
669 |
"
|
|
670 |
JITTest new block3
|
|
671 |
"
|
|
672 |
!
|
|
673 |
|
|
674 |
block4
|
|
675 |
|a|
|
|
676 |
|
|
677 |
a := 5.
|
|
678 |
^ [a]
|
|
679 |
|
|
680 |
"
|
|
681 |
JITTest new block4
|
|
682 |
JITTest new block4 value
|
|
683 |
"
|
|
684 |
!
|
|
685 |
|
|
686 |
block5
|
|
687 |
^ [self foo]
|
|
688 |
|
|
689 |
"
|
|
690 |
JITTest new block5
|
|
691 |
"
|
|
692 |
!
|
|
693 |
|
|
694 |
block6
|
|
695 |
^ [^ self]
|
|
696 |
|
|
697 |
"
|
|
698 |
JITTest new block6
|
|
699 |
"
|
|
700 |
!
|
|
701 |
|
|
702 |
block7
|
|
703 |
^ [^ [^ self]]
|
|
704 |
|
|
705 |
"
|
|
706 |
JITTest new block7
|
|
707 |
"
|
|
708 |
!
|
|
709 |
|
|
710 |
block8
|
|
711 |
^ [ [^ self] ]
|
|
712 |
|
|
713 |
"
|
|
714 |
JITTest new block8
|
|
715 |
"
|
|
716 |
!
|
|
717 |
|
|
718 |
block9
|
|
719 |
|l|
|
|
720 |
|
|
721 |
l := 1.
|
|
722 |
^ [ [^ l] ]
|
|
723 |
|
|
724 |
"
|
|
725 |
JITTest new block9
|
|
726 |
"
|
|
727 |
!
|
|
728 |
|
|
729 |
falseBlock1
|
|
730 |
^ [true]
|
|
731 |
|
|
732 |
"
|
|
733 |
JITTest new falseBlock1
|
|
734 |
"
|
|
735 |
!
|
|
736 |
|
|
737 |
falseBlock2
|
|
738 |
^ [:arg | true]
|
|
739 |
|
|
740 |
"
|
|
741 |
JITTest new falseBlock2
|
|
742 |
"
|
|
743 |
!
|
|
744 |
|
110
|
745 |
findFirst1:arg
|
|
746 |
|idx|
|
|
747 |
|
|
748 |
i1 := #(1 2 3 4) asOrderedCollection.
|
|
749 |
^ i1 findFirst:[:el | el == arg]
|
|
750 |
|
|
751 |
"
|
|
752 |
self new findFirst1:1
|
|
753 |
self new findFirst1:2
|
|
754 |
self new findFirst1:3
|
|
755 |
self new findFirst1:4
|
|
756 |
self new findFirst1:0
|
|
757 |
self new findFirst1:10
|
|
758 |
self new findFirst1:4.0
|
|
759 |
"
|
|
760 |
!
|
|
761 |
|
|
762 |
findFirst2:arg
|
|
763 |
|idx|
|
|
764 |
|
|
765 |
i1 := #(1 2 3 4) asOrderedCollection.
|
|
766 |
^ i1 findFirst:[:el | el = arg]
|
|
767 |
|
|
768 |
"
|
|
769 |
self new findFirst2:1
|
|
770 |
self new findFirst2:2
|
|
771 |
self new findFirst2:3
|
|
772 |
self new findFirst2:4
|
|
773 |
self new findFirst2:0
|
|
774 |
self new findFirst2:10
|
|
775 |
self new findFirst2:4.0
|
|
776 |
"
|
|
777 |
!
|
|
778 |
|
108
|
779 |
nilBlock1
|
|
780 |
^ []
|
|
781 |
|
|
782 |
"
|
|
783 |
JITTest new nilBlock1
|
|
784 |
"
|
|
785 |
!
|
|
786 |
|
|
787 |
nilBlock2:arg
|
|
788 |
^ arg indexOf:4 ifAbsent:[]
|
|
789 |
|
|
790 |
|
|
791 |
"
|
|
792 |
JITTest new nilBlock2:#(1 2 3)
|
|
793 |
JITTest new nilBlock2:#(1 2 3 4)
|
|
794 |
JITTest new nilBlock2:#(1 2 3 4 5)
|
|
795 |
"
|
|
796 |
!
|
|
797 |
|
|
798 |
trueBlock1
|
|
799 |
^ [true]
|
|
800 |
|
|
801 |
"
|
|
802 |
JITTest new trueBlock1
|
|
803 |
"
|
|
804 |
!
|
|
805 |
|
|
806 |
zeroBlock1
|
|
807 |
^ [0]
|
|
808 |
|
|
809 |
"
|
|
810 |
JITTest new zeroBlock1
|
|
811 |
"
|
|
812 |
!
|
|
813 |
|
|
814 |
zeroBlock2:arg
|
|
815 |
^ arg indexOf:4 ifAbsent:[0]
|
|
816 |
|
|
817 |
|
|
818 |
"
|
|
819 |
JITTest new zeroBlock2:#(1 2 3)
|
|
820 |
JITTest new zeroBlock2:#(1 2 3 4)
|
|
821 |
JITTest new zeroBlock2:#(1 2 3 4 5)
|
|
822 |
"
|
|
823 |
! !
|
|
824 |
|
|
825 |
!JITTest methodsFor:'test - compare'!
|
|
826 |
|
|
827 |
compare10:arg
|
|
828 |
arg = 10 ifTrue:[
|
|
829 |
^ 11
|
|
830 |
].
|
|
831 |
^ nil
|
|
832 |
|
|
833 |
"
|
|
834 |
JITTest new compare10:nil
|
|
835 |
JITTest new compare10:9
|
|
836 |
JITTest new compare10:10
|
|
837 |
JITTest new compare10:11
|
|
838 |
JITTest new compare10:9.0
|
|
839 |
JITTest new compare10:10.0
|
|
840 |
JITTest new compare10:11.0
|
|
841 |
JITTest new compare10:false
|
|
842 |
"
|
|
843 |
!
|
|
844 |
|
|
845 |
compare11:arg
|
|
846 |
^ arg = 1
|
|
847 |
|
|
848 |
"
|
|
849 |
JITTest new compare11:-1000
|
|
850 |
JITTest new compare11:-1
|
|
851 |
JITTest new compare11:0
|
|
852 |
JITTest new compare11:1
|
|
853 |
JITTest new compare11:2
|
|
854 |
JITTest new compare11:1000
|
|
855 |
|
|
856 |
JITTest new compare11:-1.0
|
|
857 |
JITTest new compare11:0.0
|
|
858 |
JITTest new compare11:1.0
|
|
859 |
JITTest new compare11:2.0
|
|
860 |
JITTest new compare11:3.0
|
|
861 |
"
|
|
862 |
!
|
|
863 |
|
|
864 |
compare12:arg
|
|
865 |
^ arg == 1
|
|
866 |
|
|
867 |
"
|
|
868 |
JITTest new compare12:-1000
|
|
869 |
JITTest new compare12:-1
|
|
870 |
JITTest new compare12:0
|
|
871 |
JITTest new compare12:1
|
|
872 |
JITTest new compare12:2
|
|
873 |
JITTest new compare12:1000
|
|
874 |
|
|
875 |
JITTest new compare12:-1.0
|
|
876 |
JITTest new compare12:0.0
|
|
877 |
JITTest new compare12:1.0
|
|
878 |
JITTest new compare12:2.0
|
|
879 |
JITTest new compare12:3.0
|
|
880 |
"
|
|
881 |
!
|
|
882 |
|
|
883 |
compare1:arg
|
|
884 |
^ arg > 0
|
|
885 |
|
|
886 |
"
|
|
887 |
JITTest new compare1:-1000
|
|
888 |
JITTest new compare1:-1
|
|
889 |
JITTest new compare1:0
|
|
890 |
JITTest new compare1:1
|
|
891 |
JITTest new compare1:1000
|
|
892 |
|
|
893 |
JITTest new compare1:-1.0
|
|
894 |
JITTest new compare1:0.0
|
|
895 |
JITTest new compare1:1.0
|
|
896 |
"
|
|
897 |
!
|
|
898 |
|
|
899 |
compare2:arg
|
|
900 |
^ arg < 0
|
|
901 |
|
|
902 |
"
|
|
903 |
JITTest new compare2:-1000
|
|
904 |
JITTest new compare2:-1
|
|
905 |
JITTest new compare2:0
|
|
906 |
JITTest new compare2:1
|
|
907 |
JITTest new compare2:1000
|
|
908 |
|
|
909 |
JITTest new compare2:-1.0
|
|
910 |
JITTest new compare2:0.0
|
|
911 |
JITTest new compare2:1.0
|
|
912 |
"
|
|
913 |
!
|
|
914 |
|
|
915 |
compare3:arg
|
|
916 |
^ arg <= 0
|
|
917 |
|
|
918 |
"
|
|
919 |
JITTest new compare3:-1000
|
|
920 |
JITTest new compare3:-1
|
|
921 |
JITTest new compare3:0
|
|
922 |
JITTest new compare3:1
|
|
923 |
JITTest new compare3:1000
|
|
924 |
|
|
925 |
JITTest new compare3:-1.0
|
|
926 |
JITTest new compare3:0.0
|
|
927 |
JITTest new compare3:1.0
|
|
928 |
"
|
|
929 |
!
|
|
930 |
|
|
931 |
compare4:arg
|
|
932 |
^ arg >= 0
|
|
933 |
|
|
934 |
"
|
|
935 |
JITTest new compare4:-1000
|
|
936 |
JITTest new compare4:-1
|
|
937 |
JITTest new compare4:0
|
|
938 |
JITTest new compare4:1
|
|
939 |
JITTest new compare4:1000
|
|
940 |
|
|
941 |
JITTest new compare4:-1.0
|
|
942 |
JITTest new compare4:0.0
|
|
943 |
JITTest new compare4:1.0
|
|
944 |
"
|
|
945 |
!
|
|
946 |
|
|
947 |
compare5:arg
|
|
948 |
^ arg > 1
|
|
949 |
|
|
950 |
"
|
|
951 |
JITTest new compare5:-1000
|
|
952 |
JITTest new compare5:-1
|
|
953 |
JITTest new compare5:0
|
|
954 |
JITTest new compare5:1
|
|
955 |
JITTest new compare5:2
|
|
956 |
JITTest new compare5:1000
|
|
957 |
|
|
958 |
JITTest new compare5:-1.0
|
|
959 |
JITTest new compare5:0.0
|
|
960 |
JITTest new compare5:1.0
|
|
961 |
JITTest new compare5:2.0
|
|
962 |
JITTest new compare5:3.0
|
|
963 |
"
|
|
964 |
!
|
|
965 |
|
|
966 |
compare6:arg
|
|
967 |
^ arg <= 1
|
|
968 |
|
|
969 |
"
|
|
970 |
JITTest new compare6:-1000
|
|
971 |
JITTest new compare6:-1
|
|
972 |
JITTest new compare6:0
|
|
973 |
JITTest new compare6:1
|
|
974 |
JITTest new compare6:2
|
|
975 |
JITTest new compare6:1000
|
|
976 |
|
|
977 |
JITTest new compare6:-1.0
|
|
978 |
JITTest new compare6:0.0
|
|
979 |
JITTest new compare6:1.0
|
|
980 |
JITTest new compare6:2.0
|
|
981 |
JITTest new compare6:3.0
|
|
982 |
"
|
|
983 |
!
|
|
984 |
|
|
985 |
compare7:arg
|
|
986 |
^ arg < 1
|
|
987 |
|
|
988 |
"
|
|
989 |
JITTest new compare7:-1000
|
|
990 |
JITTest new compare7:-1
|
|
991 |
JITTest new compare7:0
|
|
992 |
JITTest new compare7:1
|
|
993 |
JITTest new compare7:2
|
|
994 |
JITTest new compare7:1000
|
|
995 |
|
|
996 |
JITTest new compare7:-1.0
|
|
997 |
JITTest new compare7:0.0
|
|
998 |
JITTest new compare7:1.0
|
|
999 |
JITTest new compare7:2.0
|
|
1000 |
JITTest new compare7:3.0
|
|
1001 |
"
|
|
1002 |
!
|
|
1003 |
|
|
1004 |
compare8:arg
|
|
1005 |
^ arg >= 1
|
|
1006 |
|
|
1007 |
"
|
|
1008 |
JITTest new compare8:-1000
|
|
1009 |
JITTest new compare8:-1
|
|
1010 |
JITTest new compare8:0
|
|
1011 |
JITTest new compare8:1
|
|
1012 |
JITTest new compare8:2
|
|
1013 |
JITTest new compare8:1000
|
|
1014 |
|
|
1015 |
JITTest new compare8:-1.0
|
|
1016 |
JITTest new compare8:0.0
|
|
1017 |
JITTest new compare8:1.0
|
|
1018 |
JITTest new compare8:2.0
|
|
1019 |
JITTest new compare8:3.0
|
|
1020 |
"
|
|
1021 |
!
|
|
1022 |
|
|
1023 |
compare9:arg
|
|
1024 |
arg == 10 ifTrue:[
|
|
1025 |
^ 11
|
|
1026 |
].
|
|
1027 |
^ nil
|
|
1028 |
|
|
1029 |
"
|
|
1030 |
JITTest new compare9:nil
|
|
1031 |
JITTest new compare9:9
|
|
1032 |
JITTest new compare9:10
|
|
1033 |
JITTest new compare9:11
|
|
1034 |
JITTest new compare9:false
|
|
1035 |
"
|
|
1036 |
! !
|
|
1037 |
|
|
1038 |
!JITTest methodsFor:'test - globals'!
|
|
1039 |
|
|
1040 |
g1
|
|
1041 |
^ Array
|
|
1042 |
|
|
1043 |
"
|
|
1044 |
JITTest new g1
|
|
1045 |
"
|
|
1046 |
!
|
|
1047 |
|
|
1048 |
g1b
|
|
1049 |
^ Time
|
|
1050 |
|
|
1051 |
"
|
|
1052 |
JITTest new g1b
|
|
1053 |
"
|
|
1054 |
!
|
|
1055 |
|
|
1056 |
g2
|
|
1057 |
^ JITTest
|
|
1058 |
|
|
1059 |
"
|
|
1060 |
JITTest new g2
|
|
1061 |
"
|
|
1062 |
|
|
1063 |
"Modified: / 3.6.1998 / 15:43:14 / cg"
|
|
1064 |
!
|
|
1065 |
|
|
1066 |
g2b
|
|
1067 |
^ NonExistingClass
|
|
1068 |
|
|
1069 |
"
|
|
1070 |
JITTest new g2b
|
|
1071 |
"
|
|
1072 |
|
|
1073 |
!
|
|
1074 |
|
|
1075 |
g3
|
|
1076 |
Foo := 1.
|
|
1077 |
|
|
1078 |
"
|
|
1079 |
Smalltalk at:#Foo put:nil.
|
|
1080 |
JITTest new g3
|
|
1081 |
"
|
|
1082 |
!
|
|
1083 |
|
|
1084 |
g3b
|
|
1085 |
NonExistingGlobal := 2.
|
|
1086 |
|
|
1087 |
"
|
|
1088 |
JITTest new g3b
|
|
1089 |
"
|
|
1090 |
!
|
|
1091 |
|
|
1092 |
send1
|
|
1093 |
^ Time now
|
|
1094 |
|
|
1095 |
"
|
|
1096 |
JITTest new send1
|
|
1097 |
"
|
|
1098 |
!
|
|
1099 |
|
|
1100 |
send2
|
|
1101 |
self halt
|
|
1102 |
|
|
1103 |
"
|
|
1104 |
JITTest new send2
|
|
1105 |
"
|
|
1106 |
!
|
|
1107 |
|
|
1108 |
send3
|
|
1109 |
self send2
|
|
1110 |
|
|
1111 |
"
|
|
1112 |
JITTest new send3
|
|
1113 |
"
|
|
1114 |
!
|
|
1115 |
|
|
1116 |
send4
|
|
1117 |
self send3
|
|
1118 |
|
|
1119 |
"
|
|
1120 |
JITTest new send4
|
|
1121 |
"
|
|
1122 |
!
|
|
1123 |
|
|
1124 |
send5
|
|
1125 |
self send4
|
|
1126 |
|
|
1127 |
"
|
|
1128 |
JITTest new send5
|
|
1129 |
"
|
|
1130 |
! !
|
|
1131 |
|
|
1132 |
!JITTest methodsFor:'test - ifs'!
|
|
1133 |
|
|
1134 |
if1:aTime
|
|
1135 |
|sec min hr hrTick|
|
|
1136 |
|
|
1137 |
aTime isNil ifTrue:[^ self].
|
|
1138 |
hr := aTime hours.
|
|
1139 |
|
|
1140 |
"
|
|
1141 |
JITTest new if1:nil
|
|
1142 |
"
|
|
1143 |
!
|
|
1144 |
|
|
1145 |
tstEQ1
|
|
1146 |
^ i1 == 0
|
|
1147 |
|
|
1148 |
"
|
|
1149 |
JITTest new testEQ1
|
|
1150 |
(JITTest new) instVarAt:1 put:0; testEQ1
|
|
1151 |
"
|
|
1152 |
|
|
1153 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
1154 |
!
|
|
1155 |
|
|
1156 |
tstEQ2
|
|
1157 |
^ i1 = 0
|
|
1158 |
|
|
1159 |
"
|
|
1160 |
JITTest new testEQ2
|
|
1161 |
"
|
|
1162 |
|
|
1163 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
1164 |
!
|
|
1165 |
|
|
1166 |
tstEQ3
|
|
1167 |
i1 == 0 ifTrue:[^ 0] ifFalse:[
|
|
1168 |
^ 1
|
|
1169 |
|
|
1170 |
"
|
|
1171 |
JITTest new testEQ3
|
|
1172 |
(JITTest new) instVarAt:1 put:0; testEQ3
|
|
1173 |
"
|
|
1174 |
|
|
1175 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
1176 |
]
|
|
1177 |
!
|
|
1178 |
|
|
1179 |
tstEQ4
|
|
1180 |
i1 == 0 ifTrue:[^ 0].
|
|
1181 |
^ 1
|
|
1182 |
|
|
1183 |
"
|
|
1184 |
JITTest new testEQ4
|
|
1185 |
(JITTest new) instVarAt:1 put:0; testEQ4
|
|
1186 |
"
|
|
1187 |
!
|
|
1188 |
|
|
1189 |
tstEQ5
|
|
1190 |
i1 = 0 ifTrue:[^ 0].
|
|
1191 |
^ 1
|
|
1192 |
|
|
1193 |
"
|
|
1194 |
JITTest new testEQ5
|
|
1195 |
"
|
|
1196 |
|
|
1197 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
1198 |
!
|
|
1199 |
|
|
1200 |
tstNilAndNil
|
|
1201 |
(i1 isNil and:[i2 isNil]) ifTrue:[
|
|
1202 |
Transcript showCR:'both nil'.
|
|
1203 |
^ self
|
|
1204 |
].
|
|
1205 |
Transcript showCR:'any nonNil'
|
|
1206 |
|
|
1207 |
"
|
|
1208 |
JITTest new testNilAndNil
|
|
1209 |
|
|
1210 |
|j|
|
|
1211 |
j := JITTest new.
|
|
1212 |
j instVarNamed:'i1' put:1.
|
|
1213 |
j testNilAndNil
|
|
1214 |
|
|
1215 |
|j|
|
|
1216 |
j := JITTest new.
|
|
1217 |
j instVarNamed:'i2' put:1.
|
|
1218 |
j testNilAndNil
|
|
1219 |
|
|
1220 |
|j|
|
|
1221 |
j := JITTest new.
|
|
1222 |
j instVarNamed:'i1' put:1.
|
|
1223 |
j instVarNamed:'i2' put:1.
|
|
1224 |
j testNilAndNil
|
|
1225 |
|
|
1226 |
"
|
|
1227 |
|
|
1228 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
1229 |
!
|
|
1230 |
|
|
1231 |
tstNilOrNil
|
|
1232 |
(i1 isNil or:[i2 isNil]) ifTrue:[
|
|
1233 |
Transcript showCR:'any nil'.
|
|
1234 |
^ self
|
|
1235 |
].
|
|
1236 |
Transcript showCR:'both nonNil'
|
|
1237 |
|
|
1238 |
"
|
|
1239 |
JITTest new testNilOrNil
|
|
1240 |
|
|
1241 |
|j|
|
|
1242 |
j := JITTest new.
|
|
1243 |
j instVarNamed:'i1' put:1.
|
|
1244 |
j testNilOrNil
|
|
1245 |
|
|
1246 |
|j|
|
|
1247 |
j := JITTest new.
|
|
1248 |
j instVarNamed:'i2' put:1.
|
|
1249 |
j testNilOrNil
|
|
1250 |
|
|
1251 |
|j|
|
|
1252 |
j := JITTest new.
|
|
1253 |
j instVarNamed:'i1' put:1.
|
|
1254 |
j instVarNamed:'i2' put:1.
|
|
1255 |
j testNilOrNil
|
|
1256 |
|
|
1257 |
"
|
|
1258 |
|
|
1259 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
1260 |
!
|
|
1261 |
|
|
1262 |
tstNotNilAndNotNil
|
|
1263 |
(i1 notNil and:[i2 notNil]) ifTrue:[
|
|
1264 |
Transcript showCR:'both notNil'.
|
|
1265 |
^ self
|
|
1266 |
].
|
|
1267 |
Transcript showCR:'any isNil'
|
|
1268 |
|
|
1269 |
"
|
|
1270 |
JITTest new testNotNilAndNotNil
|
|
1271 |
|
|
1272 |
|j|
|
|
1273 |
j := JITTest new.
|
|
1274 |
j instVarNamed:'i1' put:1.
|
|
1275 |
j testNotNilAndNotNil
|
|
1276 |
|
|
1277 |
|j|
|
|
1278 |
j := JITTest new.
|
|
1279 |
j instVarNamed:'i1' put:1.
|
|
1280 |
j instVarNamed:'i2' put:1.
|
|
1281 |
j testNotNilAndNotNil
|
|
1282 |
|
|
1283 |
"
|
|
1284 |
|
|
1285 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
1286 |
!
|
|
1287 |
|
|
1288 |
tstNotNilOrNotNil
|
|
1289 |
(i1 notNil or:[i2 notNil]) ifTrue:[
|
|
1290 |
Transcript showCR:'any notNil'.
|
|
1291 |
^ self
|
|
1292 |
].
|
|
1293 |
Transcript showCR:'both nil'.
|
|
1294 |
^ 0
|
|
1295 |
|
|
1296 |
"
|
|
1297 |
JITTest new testNotNilOrNotNil
|
|
1298 |
|
|
1299 |
|j|
|
|
1300 |
j := JITTest new.
|
|
1301 |
j instVarNamed:'i1' put:1.
|
|
1302 |
j testNotNilOrNotNil
|
|
1303 |
|
|
1304 |
|j|
|
|
1305 |
j := JITTest new.
|
|
1306 |
j instVarNamed:'i1' put:1.
|
|
1307 |
j instVarNamed:'i2' put:1.
|
|
1308 |
j testNotNilOrNotNil
|
|
1309 |
|
|
1310 |
"
|
|
1311 |
|
|
1312 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
1313 |
!
|
|
1314 |
|
|
1315 |
tstOr1:arg
|
|
1316 |
^ arg == #Foo or:[arg == #Bar]
|
|
1317 |
!
|
|
1318 |
|
|
1319 |
tstOr2:arg
|
|
1320 |
^ arg == #Foo or:[arg == #Bar or:[arg == #Baz]]
|
|
1321 |
! !
|
|
1322 |
|
|
1323 |
!JITTest methodsFor:'test - loops'!
|
|
1324 |
|
|
1325 |
loop1
|
|
1326 |
[true] whileTrue:[
|
|
1327 |
]
|
|
1328 |
|
|
1329 |
"
|
|
1330 |
JITTest new loop1
|
|
1331 |
"
|
|
1332 |
|
|
1333 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
1334 |
|
|
1335 |
|
|
1336 |
!
|
|
1337 |
|
|
1338 |
loop1b
|
|
1339 |
[false] whileFalse:[
|
|
1340 |
]
|
|
1341 |
|
|
1342 |
"
|
|
1343 |
JITTest new loop1b
|
|
1344 |
"
|
|
1345 |
|
|
1346 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
1347 |
|
|
1348 |
|
|
1349 |
!
|
|
1350 |
|
|
1351 |
loop1c
|
|
1352 |
[true] whileFalse:[
|
|
1353 |
]
|
|
1354 |
|
|
1355 |
"
|
|
1356 |
JITTest new loop1c
|
|
1357 |
"
|
|
1358 |
|
|
1359 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
1360 |
|
|
1361 |
|
|
1362 |
!
|
|
1363 |
|
|
1364 |
loop1d
|
|
1365 |
[false] whileTrue:[
|
|
1366 |
]
|
|
1367 |
|
|
1368 |
"
|
|
1369 |
JITTest new loop1d
|
|
1370 |
"
|
|
1371 |
|
|
1372 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
1373 |
|
|
1374 |
|
|
1375 |
!
|
|
1376 |
|
|
1377 |
loop1e
|
|
1378 |
[true] whileTrue
|
|
1379 |
|
|
1380 |
"
|
|
1381 |
JITTest new loop1e
|
|
1382 |
"
|
|
1383 |
|
|
1384 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
1385 |
|
|
1386 |
|
|
1387 |
!
|
|
1388 |
|
|
1389 |
loop1f
|
|
1390 |
[false] whileTrue
|
|
1391 |
|
|
1392 |
"
|
|
1393 |
JITTest new loop1f
|
|
1394 |
"
|
|
1395 |
|
|
1396 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
1397 |
|
|
1398 |
|
|
1399 |
!
|
|
1400 |
|
|
1401 |
loop1g
|
|
1402 |
[false] whileFalse
|
|
1403 |
|
|
1404 |
"
|
|
1405 |
JITTest new loop1g
|
|
1406 |
"
|
|
1407 |
|
|
1408 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
1409 |
|
|
1410 |
|
|
1411 |
!
|
|
1412 |
|
|
1413 |
loop1h
|
|
1414 |
[true] whileFalse
|
|
1415 |
|
|
1416 |
"
|
|
1417 |
JITTest new loop1h
|
|
1418 |
"
|
|
1419 |
|
|
1420 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
1421 |
|
|
1422 |
|
|
1423 |
!
|
|
1424 |
|
|
1425 |
loop2
|
|
1426 |
|i|
|
|
1427 |
|
|
1428 |
i := 5.
|
|
1429 |
[i > 0] whileTrue:[
|
|
1430 |
i printCR.
|
|
1431 |
i := i - 1.
|
|
1432 |
]
|
|
1433 |
|
|
1434 |
"
|
|
1435 |
JITTest new loop2
|
|
1436 |
"
|
|
1437 |
|
|
1438 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
1439 |
|
|
1440 |
|
|
1441 |
!
|
|
1442 |
|
|
1443 |
loop2a
|
|
1444 |
|i|
|
|
1445 |
|
|
1446 |
i := 5.
|
|
1447 |
[i > 0] whileTrue:[
|
|
1448 |
i := i - 1.
|
|
1449 |
]
|
|
1450 |
|
|
1451 |
"
|
|
1452 |
JITTest new loop2a
|
|
1453 |
"
|
|
1454 |
|
|
1455 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
1456 |
|
|
1457 |
|
|
1458 |
!
|
|
1459 |
|
|
1460 |
loop3
|
|
1461 |
|i|
|
|
1462 |
|
|
1463 |
i := 5.
|
|
1464 |
[i >= 0] whileTrue:[
|
|
1465 |
i printCR.
|
|
1466 |
i := i - 1.
|
|
1467 |
]
|
|
1468 |
|
|
1469 |
"
|
|
1470 |
(Delay waitForSeconds:5). JITTest new loop3
|
|
1471 |
JITTest new loop3
|
|
1472 |
"
|
|
1473 |
|
|
1474 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
1475 |
|
|
1476 |
|
|
1477 |
!
|
|
1478 |
|
|
1479 |
loop4
|
|
1480 |
|i|
|
|
1481 |
|
|
1482 |
i := 5.
|
|
1483 |
[i >= 1] whileTrue:[
|
|
1484 |
i printCR.
|
|
1485 |
i := i - 1.
|
|
1486 |
]
|
|
1487 |
|
|
1488 |
"
|
|
1489 |
JITTest new loop4
|
|
1490 |
"
|
|
1491 |
|
|
1492 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
1493 |
|
|
1494 |
|
|
1495 |
!
|
|
1496 |
|
|
1497 |
loop5
|
|
1498 |
5 timesRepeat:[
|
|
1499 |
'loop' printCR.
|
|
1500 |
]
|
|
1501 |
|
|
1502 |
"
|
|
1503 |
JITTest new loop5
|
|
1504 |
"
|
|
1505 |
|
|
1506 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
1507 |
|
|
1508 |
|
|
1509 |
!
|
|
1510 |
|
|
1511 |
loop6
|
|
1512 |
|i|
|
|
1513 |
|
|
1514 |
i := 5.
|
|
1515 |
5 timesRepeat:[
|
|
1516 |
i := i - 1.
|
|
1517 |
'loop' print. i printCR.
|
|
1518 |
]
|
|
1519 |
|
|
1520 |
"
|
|
1521 |
JITTest new loop6
|
|
1522 |
"
|
|
1523 |
|
|
1524 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
1525 |
|
|
1526 |
|
|
1527 |
!
|
|
1528 |
|
|
1529 |
loop7
|
|
1530 |
|j|
|
|
1531 |
|
|
1532 |
j := 0.
|
|
1533 |
1 to:10000 do:[:i |
|
|
1534 |
j := j + 1.
|
|
1535 |
].
|
|
1536 |
^ j.
|
|
1537 |
|
|
1538 |
"
|
|
1539 |
JITTest new loop7
|
|
1540 |
"
|
|
1541 |
|
|
1542 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
1543 |
|
|
1544 |
|
|
1545 |
!
|
|
1546 |
|
|
1547 |
loop8
|
|
1548 |
|j|
|
|
1549 |
|
|
1550 |
j := 0.
|
|
1551 |
1 to:10000 do:[:i |
|
|
1552 |
j := j + i.
|
|
1553 |
].
|
|
1554 |
^ j.
|
|
1555 |
|
|
1556 |
"
|
|
1557 |
JITTest new loop8
|
|
1558 |
"
|
|
1559 |
|
|
1560 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
1561 |
!
|
|
1562 |
|
|
1563 |
whileLoop1
|
|
1564 |
|i|
|
|
1565 |
|
|
1566 |
i := -7.
|
|
1567 |
[i <= 16] whileTrue: [
|
|
1568 |
(i >= 1 and: [i <= 8]) ifTrue:[ 'a' printCR.].
|
|
1569 |
i >= 2 ifTrue: ['b' printCR.].
|
|
1570 |
i <= 7 ifTrue: ['c' printCR.].
|
|
1571 |
i := i + 1
|
|
1572 |
].
|
|
1573 |
|
|
1574 |
"
|
|
1575 |
self new whileLoop1
|
|
1576 |
"
|
|
1577 |
! !
|
|
1578 |
|
|
1579 |
!JITTest methodsFor:'test - misc'!
|
|
1580 |
|
|
1581 |
tstAsFloat:arg
|
|
1582 |
|foo|
|
|
1583 |
|
|
1584 |
foo := arg asFloat.
|
|
1585 |
^ foo
|
|
1586 |
|
|
1587 |
"
|
|
1588 |
self new testAsFloat:1
|
|
1589 |
self new testAsFloat:1.0
|
|
1590 |
self new testAsFloat:(1.0 asShortFloat)
|
|
1591 |
"
|
|
1592 |
|
|
1593 |
"Created: / 9.6.1998 / 20:21:51 / cg"
|
|
1594 |
"Modified: / 9.6.1998 / 20:22:40 / cg"
|
|
1595 |
!
|
|
1596 |
|
|
1597 |
tstAsInteger:arg
|
|
1598 |
|foo|
|
|
1599 |
|
|
1600 |
foo := arg asInteger.
|
|
1601 |
^ foo
|
|
1602 |
|
|
1603 |
"
|
|
1604 |
self new testAsInteger:1
|
|
1605 |
self new testAsInteger:1.0
|
|
1606 |
self new testAsInteger:(1.0 asShortFloat)
|
|
1607 |
"
|
|
1608 |
|
|
1609 |
"Created: / 9.6.1998 / 20:21:51 / cg"
|
|
1610 |
!
|
|
1611 |
|
|
1612 |
tstEven:arg
|
|
1613 |
^ arg even
|
|
1614 |
|
|
1615 |
"
|
|
1616 |
self new testEven:1
|
|
1617 |
self new testEven:2
|
|
1618 |
self new testEven:1.0
|
|
1619 |
self new testEven:2.0
|
|
1620 |
self new testEven:(SmallInteger maxVal + 1)
|
|
1621 |
self new testEven:(SmallInteger maxVal + 2)
|
|
1622 |
self new testEven:(1.0 asShortFloat)
|
|
1623 |
self new testEven:(2.0 asShortFloat)
|
|
1624 |
self new testEven:(Object new)
|
|
1625 |
"
|
|
1626 |
!
|
|
1627 |
|
|
1628 |
tstIsInteger:arg
|
|
1629 |
^ arg isInteger
|
|
1630 |
|
|
1631 |
"
|
|
1632 |
self new testIsInteger:1
|
|
1633 |
self new testIsInteger:1.0
|
|
1634 |
self new testIsInteger:(1.0 asShortFloat)
|
|
1635 |
"
|
|
1636 |
|
|
1637 |
"Modified: / 9.6.1998 / 20:22:24 / cg"
|
|
1638 |
!
|
|
1639 |
|
|
1640 |
tstIsReal:arg
|
|
1641 |
^ arg isReal
|
|
1642 |
|
|
1643 |
"
|
|
1644 |
self new testIsReal:1
|
|
1645 |
self new testIsReal:1.0
|
|
1646 |
self new testIsReal:(1.0 asShortFloat)
|
|
1647 |
"
|
|
1648 |
|
|
1649 |
"Modified: / 9.6.1998 / 20:22:24 / cg"
|
|
1650 |
"Created: / 9.6.1998 / 20:23:16 / cg"
|
|
1651 |
!
|
|
1652 |
|
|
1653 |
tstOdd:arg
|
|
1654 |
^ arg odd
|
|
1655 |
|
|
1656 |
"
|
|
1657 |
self new testOdd:1
|
|
1658 |
self new testOdd:2
|
|
1659 |
self new testOdd:1.0
|
|
1660 |
self new testOdd:2.0
|
|
1661 |
self new testOdd:(SmallInteger maxVal + 1)
|
|
1662 |
self new testOdd:(SmallInteger maxVal + 2)
|
|
1663 |
self new testOdd:(1.0 asShortFloat)
|
|
1664 |
self new testOdd:(2.0 asShortFloat)
|
|
1665 |
self new testOdd:(Object new)
|
|
1666 |
"
|
|
1667 |
!
|
|
1668 |
|
|
1669 |
tstOddEven1
|
|
1670 |
|x|
|
|
1671 |
|
|
1672 |
x := 0.
|
|
1673 |
1 to:100 do:[:i |
|
|
1674 |
i odd ifTrue:[
|
|
1675 |
x := x + 1
|
|
1676 |
] ifFalse:[x := x - 1]
|
|
1677 |
].
|
|
1678 |
^ x
|
|
1679 |
|
|
1680 |
"
|
|
1681 |
self new testOddEven1
|
|
1682 |
"
|
|
1683 |
! !
|
|
1684 |
|
|
1685 |
!JITTest methodsFor:'tests - args'!
|
|
1686 |
|
|
1687 |
runPerformTestArg
|
|
1688 |
(self perform:#'tstargs9:_:_:_:_:_:_:_:_:'
|
|
1689 |
withArguments:#(1 2 3 4 5 6 7 8 9)) ~~ 9 ifTrue:[
|
|
1690 |
self halt
|
|
1691 |
].
|
|
1692 |
(self perform:#'tstargs9_l:_:_:_:_:_:_:_:_:'
|
|
1693 |
withArguments:#(1 2 3 4 5 6 7 8 9)) ~~ 9 ifTrue:[
|
|
1694 |
self halt
|
|
1695 |
|
|
1696 |
"
|
|
1697 |
JITTest new runPerformTestArg
|
|
1698 |
"
|
|
1699 |
|
|
1700 |
"Modified: / 19.4.1999 / 22:05:29 / cg"
|
|
1701 |
]
|
|
1702 |
!
|
|
1703 |
|
|
1704 |
runTestArg
|
|
1705 |
(self tstargs1:1) ~~ 1 ifTrue:[
|
|
1706 |
self halt
|
|
1707 |
].
|
|
1708 |
(self tstargs1:nil) ~~ nil ifTrue:[
|
|
1709 |
self halt
|
|
1710 |
].
|
|
1711 |
(self tstargs2:1 _:2) ~~ 2 ifTrue:[
|
|
1712 |
self halt
|
|
1713 |
].
|
|
1714 |
(self tstargs2:2 _:1) ~~ 1 ifTrue:[
|
|
1715 |
self halt
|
|
1716 |
].
|
|
1717 |
(self
|
|
1718 |
tstargs3:1
|
|
1719 |
_:2
|
|
1720 |
_:3) ~~ 3 ifTrue:[
|
|
1721 |
self halt
|
|
1722 |
].
|
|
1723 |
(self
|
|
1724 |
tstargs3:3
|
|
1725 |
_:2
|
|
1726 |
_:1) ~~ 1 ifTrue:[
|
|
1727 |
self halt
|
|
1728 |
].
|
|
1729 |
(self
|
|
1730 |
tstargs4:1
|
|
1731 |
_:2
|
|
1732 |
_:3
|
|
1733 |
_:4) ~~ 4 ifTrue:[
|
|
1734 |
self halt
|
|
1735 |
].
|
|
1736 |
(self
|
|
1737 |
tstargs4:4
|
|
1738 |
_:3
|
|
1739 |
_:2
|
|
1740 |
_:1) ~~ 1 ifTrue:[
|
|
1741 |
self halt
|
|
1742 |
].
|
|
1743 |
(self
|
|
1744 |
tstargs5:1
|
|
1745 |
_:2
|
|
1746 |
_:3
|
|
1747 |
_:4
|
|
1748 |
_:5) ~~ 5 ifTrue:[
|
|
1749 |
self halt
|
|
1750 |
].
|
|
1751 |
(self
|
|
1752 |
tstargs5:5
|
|
1753 |
_:4
|
|
1754 |
_:3
|
|
1755 |
_:2
|
|
1756 |
_:1) ~~ 1 ifTrue:[
|
|
1757 |
self halt
|
|
1758 |
].
|
|
1759 |
(self
|
|
1760 |
tstargs6:1
|
|
1761 |
_:2
|
|
1762 |
_:3
|
|
1763 |
_:4
|
|
1764 |
_:5
|
|
1765 |
_:6) ~~ 6 ifTrue:[
|
|
1766 |
self halt
|
|
1767 |
].
|
|
1768 |
(self
|
|
1769 |
tstargs6:6
|
|
1770 |
_:5
|
|
1771 |
_:4
|
|
1772 |
_:3
|
|
1773 |
_:2
|
|
1774 |
_:1) ~~ 1 ifTrue:[
|
|
1775 |
self halt
|
|
1776 |
].
|
|
1777 |
(self
|
|
1778 |
tstargs7:1
|
|
1779 |
_:2
|
|
1780 |
_:3
|
|
1781 |
_:4
|
|
1782 |
_:5
|
|
1783 |
_:6
|
|
1784 |
_:7) ~~ 7 ifTrue:[
|
|
1785 |
self halt
|
|
1786 |
].
|
|
1787 |
(self
|
|
1788 |
tstargs7:7
|
|
1789 |
_:6
|
|
1790 |
_:5
|
|
1791 |
_:4
|
|
1792 |
_:3
|
|
1793 |
_:2
|
|
1794 |
_:1) ~~ 1 ifTrue:[
|
|
1795 |
self halt
|
|
1796 |
].
|
|
1797 |
(self
|
|
1798 |
tstargs8:1
|
|
1799 |
_:2
|
|
1800 |
_:3
|
|
1801 |
_:4
|
|
1802 |
_:5
|
|
1803 |
_:6
|
|
1804 |
_:7
|
|
1805 |
_:8) ~~ 8 ifTrue:[
|
|
1806 |
self halt
|
|
1807 |
].
|
|
1808 |
(self
|
|
1809 |
tstargs8:8
|
|
1810 |
_:7
|
|
1811 |
_:6
|
|
1812 |
_:5
|
|
1813 |
_:4
|
|
1814 |
_:3
|
|
1815 |
_:2
|
|
1816 |
_:1) ~~ 1 ifTrue:[
|
|
1817 |
self halt
|
|
1818 |
].
|
|
1819 |
(self
|
|
1820 |
tstargs9:1
|
|
1821 |
_:2
|
|
1822 |
_:3
|
|
1823 |
_:4
|
|
1824 |
_:5
|
|
1825 |
_:6
|
|
1826 |
_:7
|
|
1827 |
_:8
|
|
1828 |
_:9) ~~ 9 ifTrue:[
|
|
1829 |
self halt
|
|
1830 |
].
|
|
1831 |
(self
|
|
1832 |
tstargs9:9
|
|
1833 |
_:8
|
|
1834 |
_:7
|
|
1835 |
_:6
|
|
1836 |
_:5
|
|
1837 |
_:4
|
|
1838 |
_:3
|
|
1839 |
_:2
|
|
1840 |
_:1) ~~ 1 ifTrue:[
|
|
1841 |
self halt
|
|
1842 |
|
|
1843 |
"
|
|
1844 |
JITTest new runTestArg
|
|
1845 |
"
|
|
1846 |
|
|
1847 |
"Modified: / 19.4.1999 / 22:02:09 / cg"
|
|
1848 |
]
|
|
1849 |
!
|
|
1850 |
|
|
1851 |
runTestArg_l
|
|
1852 |
(self tstargs1_l:1) ~~ 1 ifTrue:[
|
|
1853 |
self halt
|
|
1854 |
].
|
|
1855 |
(self tstargs1_l:nil) ~~ nil ifTrue:[
|
|
1856 |
self halt
|
|
1857 |
].
|
|
1858 |
(self tstargs2_l:1 _:2) ~~ 2 ifTrue:[
|
|
1859 |
self halt
|
|
1860 |
].
|
|
1861 |
(self tstargs2_l:2 _:1) ~~ 1 ifTrue:[
|
|
1862 |
self halt
|
|
1863 |
].
|
|
1864 |
(self
|
|
1865 |
tstargs3_l:1
|
|
1866 |
_:2
|
|
1867 |
_:3) ~~ 3 ifTrue:[
|
|
1868 |
self halt
|
|
1869 |
].
|
|
1870 |
(self
|
|
1871 |
tstargs3_l:3
|
|
1872 |
_:2
|
|
1873 |
_:1) ~~ 1 ifTrue:[
|
|
1874 |
self halt
|
|
1875 |
].
|
|
1876 |
(self
|
|
1877 |
tstargs4_l:1
|
|
1878 |
_:2
|
|
1879 |
_:3
|
|
1880 |
_:4) ~~ 4 ifTrue:[
|
|
1881 |
self halt
|
|
1882 |
].
|
|
1883 |
(self
|
|
1884 |
tstargs4_l:4
|
|
1885 |
_:3
|
|
1886 |
_:2
|
|
1887 |
_:1) ~~ 1 ifTrue:[
|
|
1888 |
self halt
|
|
1889 |
].
|
|
1890 |
(self
|
|
1891 |
tstargs5_l:1
|
|
1892 |
_:2
|
|
1893 |
_:3
|
|
1894 |
_:4
|
|
1895 |
_:5) ~~ 5 ifTrue:[
|
|
1896 |
self halt
|
|
1897 |
].
|
|
1898 |
(self
|
|
1899 |
tstargs5_l:5
|
|
1900 |
_:4
|
|
1901 |
_:3
|
|
1902 |
_:2
|
|
1903 |
_:1) ~~ 1 ifTrue:[
|
|
1904 |
self halt
|
|
1905 |
].
|
|
1906 |
(self
|
|
1907 |
tstargs6_l:1
|
|
1908 |
_:2
|
|
1909 |
_:3
|
|
1910 |
_:4
|
|
1911 |
_:5
|
|
1912 |
_:6) ~~ 6 ifTrue:[
|
|
1913 |
self halt
|
|
1914 |
].
|
|
1915 |
(self
|
|
1916 |
tstargs6_l:6
|
|
1917 |
_:5
|
|
1918 |
_:4
|
|
1919 |
_:3
|
|
1920 |
_:2
|
|
1921 |
_:1) ~~ 1 ifTrue:[
|
|
1922 |
self halt
|
|
1923 |
].
|
|
1924 |
(self
|
|
1925 |
tstargs7_l:1
|
|
1926 |
_:2
|
|
1927 |
_:3
|
|
1928 |
_:4
|
|
1929 |
_:5
|
|
1930 |
_:6
|
|
1931 |
_:7) ~~ 7 ifTrue:[
|
|
1932 |
self halt
|
|
1933 |
].
|
|
1934 |
(self
|
|
1935 |
tstargs7_l:7
|
|
1936 |
_:6
|
|
1937 |
_:5
|
|
1938 |
_:4
|
|
1939 |
_:3
|
|
1940 |
_:2
|
|
1941 |
_:1) ~~ 1 ifTrue:[
|
|
1942 |
self halt
|
|
1943 |
].
|
|
1944 |
(self
|
|
1945 |
tstargs8_l:1
|
|
1946 |
_:2
|
|
1947 |
_:3
|
|
1948 |
_:4
|
|
1949 |
_:5
|
|
1950 |
_:6
|
|
1951 |
_:7
|
|
1952 |
_:8) ~~ 8 ifTrue:[
|
|
1953 |
self halt
|
|
1954 |
].
|
|
1955 |
(self
|
|
1956 |
tstargs8_l:8
|
|
1957 |
_:7
|
|
1958 |
_:6
|
|
1959 |
_:5
|
|
1960 |
_:4
|
|
1961 |
_:3
|
|
1962 |
_:2
|
|
1963 |
_:1) ~~ 1 ifTrue:[
|
|
1964 |
self halt
|
|
1965 |
].
|
|
1966 |
(self
|
|
1967 |
tstargs9_l:1
|
|
1968 |
_:2
|
|
1969 |
_:3
|
|
1970 |
_:4
|
|
1971 |
_:5
|
|
1972 |
_:6
|
|
1973 |
_:7
|
|
1974 |
_:8
|
|
1975 |
_:9) ~~ 9 ifTrue:[
|
|
1976 |
self halt
|
|
1977 |
].
|
|
1978 |
(self
|
|
1979 |
tstargs9_l:9
|
|
1980 |
_:8
|
|
1981 |
_:7
|
|
1982 |
_:6
|
|
1983 |
_:5
|
|
1984 |
_:4
|
|
1985 |
_:3
|
|
1986 |
_:2
|
|
1987 |
_:1) ~~ 1 ifTrue:[
|
|
1988 |
self halt
|
|
1989 |
|
|
1990 |
"
|
|
1991 |
JITTest new runTestArg_l
|
|
1992 |
"
|
|
1993 |
|
|
1994 |
"Modified: / 19.4.1999 / 22:02:09 / cg"
|
|
1995 |
"Created: / 19.4.1999 / 22:03:13 / cg"
|
|
1996 |
]
|
|
1997 |
!
|
|
1998 |
|
|
1999 |
tstArgEQ:arg
|
|
2000 |
arg == #'==' ifTrue:[
|
|
2001 |
^ true
|
|
2002 |
].
|
|
2003 |
arg == #'~~' ifTrue:[
|
|
2004 |
^ true
|
|
2005 |
].
|
|
2006 |
arg == #'=' ifTrue:[
|
|
2007 |
^ true
|
|
2008 |
].
|
|
2009 |
^ false
|
|
2010 |
|
|
2011 |
"
|
|
2012 |
JITTest new testArgEQ:1
|
|
2013 |
JITTest new testArgEQ:#==
|
|
2014 |
JITTest new testArgEQ:#~~
|
|
2015 |
JITTest new testArgEQ:#=
|
|
2016 |
JITTest new testArgEQ:#foo
|
|
2017 |
"
|
|
2018 |
|
|
2019 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2020 |
!
|
|
2021 |
|
|
2022 |
tstarg1:arg
|
|
2023 |
^ arg
|
|
2024 |
|
|
2025 |
"
|
|
2026 |
JITTest new testarg1:1
|
|
2027 |
JITTest new testarg1:0
|
|
2028 |
"
|
|
2029 |
|
|
2030 |
"Created: / 16.8.1996 / 17:39:44 / cg"
|
|
2031 |
"Modified: / 3.6.1998 / 15:49:29 / cg"
|
|
2032 |
!
|
|
2033 |
|
|
2034 |
tstarg2:arg1 arg:arg2
|
|
2035 |
^ arg2
|
|
2036 |
|
|
2037 |
"
|
|
2038 |
JITTest new testarg2:1 arg:2
|
|
2039 |
JITTest new testarg2:0 arg:1
|
|
2040 |
"
|
|
2041 |
|
|
2042 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2043 |
!
|
|
2044 |
|
|
2045 |
tstarg3:arg
|
|
2046 |
|l1|
|
|
2047 |
|
|
2048 |
l1 := 1.
|
|
2049 |
^ arg
|
|
2050 |
|
|
2051 |
"
|
|
2052 |
JITTest new testarg3:1
|
|
2053 |
JITTest new testarg3:0
|
|
2054 |
"
|
|
2055 |
|
|
2056 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2057 |
!
|
|
2058 |
|
|
2059 |
tstarg4:arg1 arg:arg2
|
|
2060 |
|l1|
|
|
2061 |
|
|
2062 |
l1 := 1.
|
|
2063 |
^ arg1
|
|
2064 |
|
|
2065 |
"
|
|
2066 |
JITTest new testarg4:1 arg:2
|
|
2067 |
JITTest new testarg4:0 arg:1
|
|
2068 |
"
|
|
2069 |
|
|
2070 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2071 |
!
|
|
2072 |
|
|
2073 |
tstarg5:arg1 arg:arg2
|
|
2074 |
|l1|
|
|
2075 |
|
|
2076 |
l1 := 1.
|
|
2077 |
^ arg2
|
|
2078 |
|
|
2079 |
"
|
|
2080 |
JITTest new testarg5:1 arg:2
|
|
2081 |
JITTest new testarg5:0 arg:1
|
|
2082 |
"
|
|
2083 |
|
|
2084 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2085 |
!
|
|
2086 |
|
|
2087 |
tstargs1:a1
|
|
2088 |
^ a1
|
|
2089 |
|
|
2090 |
"
|
|
2091 |
JITTest new testargs1:1
|
|
2092 |
"
|
|
2093 |
|
|
2094 |
"Created: / 3.6.1998 / 21:04:31 / cg"
|
|
2095 |
!
|
|
2096 |
|
|
2097 |
tstargs1_l:a1
|
|
2098 |
|l|
|
|
2099 |
|
|
2100 |
l := 1.
|
|
2101 |
^ a1
|
|
2102 |
|
|
2103 |
"
|
|
2104 |
JITTest new testargs1_l:1
|
|
2105 |
"
|
|
2106 |
|
|
2107 |
"Created: / 3.6.1998 / 21:04:31 / cg"
|
|
2108 |
"Modified: / 3.6.1998 / 23:36:57 / cg"
|
|
2109 |
!
|
|
2110 |
|
|
2111 |
tstargs2:a1 _:a2
|
|
2112 |
^ a2
|
|
2113 |
|
|
2114 |
"
|
|
2115 |
JITTest new testargs2:1 _:2
|
|
2116 |
"
|
|
2117 |
|
|
2118 |
"Created: / 3.6.1998 / 21:04:42 / cg"
|
|
2119 |
"Modified: / 3.6.1998 / 21:05:56 / cg"
|
|
2120 |
!
|
|
2121 |
|
|
2122 |
tstargs2_l:a1 _:a2
|
|
2123 |
|l|
|
|
2124 |
|
|
2125 |
l := 1.
|
|
2126 |
^ a2
|
|
2127 |
|
|
2128 |
"
|
|
2129 |
JITTest new testargs2_l:1 _:2
|
|
2130 |
"
|
|
2131 |
|
|
2132 |
"Created: / 3.6.1998 / 23:37:03 / cg"
|
|
2133 |
"Modified: / 3.6.1998 / 23:37:41 / cg"
|
|
2134 |
!
|
|
2135 |
|
|
2136 |
tstargs3:a1 _:a2 _:a3
|
|
2137 |
^ a3
|
|
2138 |
|
|
2139 |
"
|
|
2140 |
JITTest new testargs3:1 _:2 _:3
|
|
2141 |
"
|
|
2142 |
|
|
2143 |
"Created: / 3.6.1998 / 21:05:14 / cg"
|
|
2144 |
!
|
|
2145 |
|
|
2146 |
tstargs3_l:a1 _:a2 _:a3
|
|
2147 |
|l|
|
|
2148 |
|
|
2149 |
l := 1.
|
|
2150 |
^ a3
|
|
2151 |
|
|
2152 |
"
|
|
2153 |
JITTest new testargs3_l:1 _:2 _:3
|
|
2154 |
"
|
|
2155 |
|
|
2156 |
"Created: / 3.6.1998 / 23:37:07 / cg"
|
|
2157 |
"Modified: / 3.6.1998 / 23:37:44 / cg"
|
|
2158 |
!
|
|
2159 |
|
|
2160 |
tstargs4:a1 _:a2 _:a3 _:a4
|
|
2161 |
^ a4
|
|
2162 |
|
|
2163 |
"
|
|
2164 |
JITTest new testargs4:1 _:2 _:3 _:4
|
|
2165 |
"
|
|
2166 |
|
|
2167 |
"Created: / 3.6.1998 / 21:05:07 / cg"
|
|
2168 |
"Modified: / 3.6.1998 / 21:05:50 / cg"
|
|
2169 |
!
|
|
2170 |
|
|
2171 |
tstargs4_l:a1 _:a2 _:a3 _:a4
|
|
2172 |
|l|
|
|
2173 |
|
|
2174 |
l := 1.
|
|
2175 |
^ a4
|
|
2176 |
|
|
2177 |
"
|
|
2178 |
JITTest new testargs4_l:1 _:2 _:3 _:4
|
|
2179 |
"
|
|
2180 |
|
|
2181 |
"Created: / 3.6.1998 / 23:37:11 / cg"
|
|
2182 |
"Modified: / 3.6.1998 / 23:37:48 / cg"
|
|
2183 |
!
|
|
2184 |
|
|
2185 |
tstargs5:a1 _:a2 _:a3 _:a4 _:a5
|
|
2186 |
^ a5
|
|
2187 |
|
|
2188 |
"
|
|
2189 |
JITTest new testargs5:1 _:2 _:3 _:4 _:5
|
|
2190 |
"
|
|
2191 |
|
|
2192 |
"Created: / 3.6.1998 / 21:05:28 / cg"
|
|
2193 |
"Modified: / 3.6.1998 / 21:05:47 / cg"
|
|
2194 |
!
|
|
2195 |
|
|
2196 |
tstargs5_l:a1 _:a2 _:a3 _:a4 _:a5
|
|
2197 |
|l|
|
|
2198 |
|
|
2199 |
l := 1.
|
|
2200 |
^ a5
|
|
2201 |
|
|
2202 |
"
|
|
2203 |
JITTest new testargs5_l:1 _:2 _:3 _:4 _:5
|
|
2204 |
"
|
|
2205 |
|
|
2206 |
"Created: / 3.6.1998 / 23:37:17 / cg"
|
|
2207 |
"Modified: / 3.6.1998 / 23:37:50 / cg"
|
|
2208 |
!
|
|
2209 |
|
|
2210 |
tstargs6:a1 _:a2 _:a3 _:a4 _:a5 _:a6
|
|
2211 |
^ a6
|
|
2212 |
|
|
2213 |
"
|
|
2214 |
JITTest new testargs6:1 _:2 _:3 _:4 _:5 _:6
|
|
2215 |
"
|
|
2216 |
|
|
2217 |
"Created: / 3.6.1998 / 21:05:44 / cg"
|
|
2218 |
!
|
|
2219 |
|
|
2220 |
tstargs6_l:a1 _:a2 _:a3 _:a4 _:a5 _:a6
|
|
2221 |
|l|
|
|
2222 |
|
|
2223 |
l := 1.
|
|
2224 |
^ a6
|
|
2225 |
|
|
2226 |
"
|
|
2227 |
JITTest new testargs6_l:1 _:2 _:3 _:4 _:5 _:6
|
|
2228 |
"
|
|
2229 |
|
|
2230 |
"Created: / 3.6.1998 / 23:37:20 / cg"
|
|
2231 |
"Modified: / 3.6.1998 / 23:37:54 / cg"
|
|
2232 |
!
|
|
2233 |
|
|
2234 |
tstargs7:a1 _:a2 _:a3 _:a4 _:a5 _:a6 _:a7
|
|
2235 |
^ a7
|
|
2236 |
|
|
2237 |
"
|
|
2238 |
JITTest new testargs7:1 _:2 _:3 _:4 _:5 _:6 _:7
|
|
2239 |
"
|
|
2240 |
|
|
2241 |
"Created: / 3.6.1998 / 21:05:44 / cg"
|
|
2242 |
"Modified: / 3.6.1998 / 21:15:35 / cg"
|
|
2243 |
!
|
|
2244 |
|
|
2245 |
tstargs7_l:a1 _:a2 _:a3 _:a4 _:a5 _:a6 _:a7
|
|
2246 |
|l|
|
|
2247 |
|
|
2248 |
l := 1.
|
|
2249 |
^ a7
|
|
2250 |
|
|
2251 |
"
|
|
2252 |
JITTest new testargs7_l:1 _:2 _:3 _:4 _:5 _:6 _:7
|
|
2253 |
"
|
|
2254 |
|
|
2255 |
"Created: / 3.6.1998 / 23:37:23 / cg"
|
|
2256 |
"Modified: / 3.6.1998 / 23:37:57 / cg"
|
|
2257 |
!
|
|
2258 |
|
|
2259 |
tstargs8:a1 _:a2 _:a3 _:a4 _:a5 _:a6 _:a7 _:a8
|
|
2260 |
^ a8
|
|
2261 |
|
|
2262 |
"
|
|
2263 |
JITTest new testargs8:1 _:2 _:3 _:4 _:5 _:6 _:7 _:8
|
|
2264 |
"
|
|
2265 |
|
|
2266 |
"Created: / 3.6.1998 / 21:15:52 / cg"
|
|
2267 |
!
|
|
2268 |
|
|
2269 |
tstargs8_l:a1 _:a2 _:a3 _:a4 _:a5 _:a6 _:a7 _:a8
|
|
2270 |
|l|
|
|
2271 |
|
|
2272 |
l := 1.
|
|
2273 |
^ a8
|
|
2274 |
|
|
2275 |
"
|
|
2276 |
JITTest new testargs8_l:1 _:2 _:3 _:4 _:5 _:6 _:7 _:8
|
|
2277 |
"
|
|
2278 |
|
|
2279 |
"Created: / 3.6.1998 / 23:37:28 / cg"
|
|
2280 |
"Modified: / 3.6.1998 / 23:38:01 / cg"
|
|
2281 |
!
|
|
2282 |
|
|
2283 |
tstargs9:a1 _:a2 _:a3 _:a4 _:a5 _:a6 _:a7 _:a8 _:a9
|
|
2284 |
^ a9
|
|
2285 |
|
|
2286 |
"
|
|
2287 |
JITTest new testargs9:1 _:2 _:3 _:4 _:5 _:6 _:7 _:8 _:9
|
|
2288 |
"
|
|
2289 |
|
|
2290 |
"Created: / 3.6.1998 / 21:05:44 / cg"
|
|
2291 |
"Modified: / 3.6.1998 / 21:16:55 / cg"
|
|
2292 |
!
|
|
2293 |
|
|
2294 |
tstargs9_l:a1 _:a2 _:a3 _:a4 _:a5 _:a6 _:a7 _:a8 _:a9
|
|
2295 |
|l|
|
|
2296 |
|
|
2297 |
l := 1.
|
|
2298 |
^ a9
|
|
2299 |
|
|
2300 |
"
|
|
2301 |
JITTest new testargs9_l:1 _:2 _:3 _:4 _:5 _:6 _:7 _:8 _:9
|
|
2302 |
"
|
|
2303 |
|
|
2304 |
"Created: / 3.6.1998 / 23:37:33 / cg"
|
|
2305 |
"Modified: / 3.6.1998 / 23:38:03 / cg"
|
|
2306 |
! !
|
|
2307 |
|
|
2308 |
!JITTest methodsFor:'tests - consts'!
|
|
2309 |
|
|
2310 |
tst10b
|
|
2311 |
^ 'hello'
|
|
2312 |
|
|
2313 |
"
|
|
2314 |
JITTest new test10b
|
|
2315 |
"
|
|
2316 |
|
|
2317 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2318 |
!
|
|
2319 |
|
|
2320 |
tst10c
|
|
2321 |
^ 'world'
|
|
2322 |
|
|
2323 |
"
|
|
2324 |
JITTest new test10c
|
|
2325 |
JITTest new test10b
|
|
2326 |
"
|
|
2327 |
|
|
2328 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2329 |
!
|
|
2330 |
|
|
2331 |
tst11
|
|
2332 |
i1 := 0
|
|
2333 |
|
|
2334 |
"
|
|
2335 |
JITTest new test11
|
|
2336 |
"
|
|
2337 |
|
|
2338 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2339 |
! !
|
|
2340 |
|
|
2341 |
!JITTest methodsFor:'tests - contexts'!
|
|
2342 |
|
|
2343 |
tstContext1
|
|
2344 |
^ thisContext
|
|
2345 |
|
|
2346 |
"
|
|
2347 |
JITTest new testContext1
|
|
2348 |
ObjectMemory dumpObject: JITTest new testContext1
|
|
2349 |
"
|
|
2350 |
|
|
2351 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2352 |
!
|
|
2353 |
|
|
2354 |
tstContext2
|
|
2355 |
^ thisContext sender
|
|
2356 |
|
|
2357 |
"
|
|
2358 |
JITTest new testContext2
|
|
2359 |
ObjectMemory dumpObject: JITTest new testContext2
|
|
2360 |
"
|
|
2361 |
|
|
2362 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2363 |
! !
|
|
2364 |
|
|
2365 |
!JITTest methodsFor:'tests - floats'!
|
|
2366 |
|
|
2367 |
abs1:arg
|
|
2368 |
^ arg abs
|
|
2369 |
|
|
2370 |
"
|
|
2371 |
self new abs1:1
|
|
2372 |
self new abs1:-1
|
|
2373 |
self new abs1:0
|
|
2374 |
self new abs1:1.0
|
|
2375 |
self new abs1:-1.0
|
|
2376 |
self new abs1:0.0
|
|
2377 |
"
|
|
2378 |
|
|
2379 |
"Created: / 3.11.1998 / 16:14:04 / cg"
|
|
2380 |
! !
|
|
2381 |
|
|
2382 |
!JITTest methodsFor:'tests - instvars'!
|
|
2383 |
|
|
2384 |
tst10
|
|
2385 |
^ i2
|
|
2386 |
|
|
2387 |
"
|
|
2388 |
JITTest new tst10
|
|
2389 |
(JITTest new) instVarAt:2 put:555; tst10
|
|
2390 |
"
|
|
2391 |
|
|
2392 |
"Created: / 16.8.1996 / 17:39:44 / cg"
|
|
2393 |
"Modified: / 3.6.1998 / 15:49:54 / cg"
|
|
2394 |
!
|
|
2395 |
|
|
2396 |
tst12:arg
|
|
2397 |
i1 := arg.
|
|
2398 |
i2 := 0
|
|
2399 |
|
|
2400 |
"
|
|
2401 |
JITTest new tst12:1
|
|
2402 |
"
|
|
2403 |
|
|
2404 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2405 |
!
|
|
2406 |
|
|
2407 |
tst13
|
|
2408 |
i1 := nil.
|
|
2409 |
i2 := 1
|
|
2410 |
|
|
2411 |
"
|
|
2412 |
JITTest new tst13
|
|
2413 |
(JITTest new tst12:1) tst13
|
|
2414 |
"
|
|
2415 |
|
|
2416 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2417 |
!
|
|
2418 |
|
|
2419 |
tst13b
|
|
2420 |
i1 := nil.
|
|
2421 |
i2 := 0
|
|
2422 |
|
|
2423 |
"
|
|
2424 |
JITTest new tst13b
|
|
2425 |
"
|
|
2426 |
|
|
2427 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2428 |
!
|
|
2429 |
|
|
2430 |
tst13c
|
|
2431 |
i1 := i2 := i3 := 0.
|
|
2432 |
i1 := nil.
|
|
2433 |
i2 := 0.
|
|
2434 |
i3 := nil
|
|
2435 |
|
|
2436 |
"
|
|
2437 |
JITTest new tst13c
|
|
2438 |
"
|
|
2439 |
|
|
2440 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2441 |
!
|
|
2442 |
|
|
2443 |
tst14
|
|
2444 |
i1 := 1.
|
|
2445 |
i2 := 2.
|
|
2446 |
i3 := 3
|
|
2447 |
|
|
2448 |
"
|
|
2449 |
JITTest new tst14
|
|
2450 |
"
|
|
2451 |
|
|
2452 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2453 |
!
|
|
2454 |
|
|
2455 |
tst14b
|
|
2456 |
i1 := 1.
|
|
2457 |
i2 := 1.
|
|
2458 |
i3 := 1
|
|
2459 |
|
|
2460 |
"
|
|
2461 |
JITTest new tst14b
|
|
2462 |
"
|
|
2463 |
|
|
2464 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2465 |
!
|
|
2466 |
|
|
2467 |
tst14c
|
|
2468 |
i1 := 0.
|
|
2469 |
^ 0
|
|
2470 |
|
|
2471 |
"
|
|
2472 |
JITTest new tst14c
|
|
2473 |
"
|
|
2474 |
|
|
2475 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2476 |
!
|
|
2477 |
|
|
2478 |
tst14d
|
|
2479 |
i1 := 1.
|
|
2480 |
i2 := 3.
|
|
2481 |
i3 := 5
|
|
2482 |
|
|
2483 |
"
|
|
2484 |
JITTest new tst14d
|
|
2485 |
"
|
|
2486 |
|
|
2487 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2488 |
!
|
|
2489 |
|
|
2490 |
tst14e
|
|
2491 |
i1 := 1.
|
|
2492 |
i2 := 3.
|
|
2493 |
i3 := 5.
|
|
2494 |
i1 := 3.
|
|
2495 |
i2 := 1.
|
|
2496 |
i3 := 0
|
|
2497 |
|
|
2498 |
"
|
|
2499 |
JITTest new tst14e
|
|
2500 |
"
|
|
2501 |
|
|
2502 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2503 |
!
|
|
2504 |
|
|
2505 |
tst14f
|
|
2506 |
i1 := true.
|
|
2507 |
i2 := false.
|
|
2508 |
i3 := true
|
|
2509 |
|
|
2510 |
"
|
|
2511 |
JITTest new tst14f
|
|
2512 |
"
|
|
2513 |
|
|
2514 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2515 |
!
|
|
2516 |
|
|
2517 |
tst14g
|
|
2518 |
i1 := true.
|
|
2519 |
i2 := false.
|
|
2520 |
i3 := true.
|
|
2521 |
^ true
|
|
2522 |
|
|
2523 |
"
|
|
2524 |
JITTest new tst14g
|
|
2525 |
"
|
|
2526 |
|
|
2527 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2528 |
!
|
|
2529 |
|
|
2530 |
tst14h
|
|
2531 |
i1 := true.
|
|
2532 |
i2 := false.
|
|
2533 |
i3 := true.
|
|
2534 |
^ false
|
|
2535 |
|
|
2536 |
"
|
|
2537 |
JITTest new tst14h
|
|
2538 |
"
|
|
2539 |
|
|
2540 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2541 |
!
|
|
2542 |
|
|
2543 |
tst14i
|
|
2544 |
i1 := true.
|
|
2545 |
^ false
|
|
2546 |
|
|
2547 |
"
|
|
2548 |
JITTest new tst14i
|
|
2549 |
"
|
|
2550 |
|
|
2551 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2552 |
!
|
|
2553 |
|
|
2554 |
tst15
|
|
2555 |
i1 := 1.
|
|
2556 |
i2 := i1.
|
|
2557 |
i3 := i2
|
|
2558 |
|
|
2559 |
"
|
|
2560 |
JITTest new tst15
|
|
2561 |
"
|
|
2562 |
|
|
2563 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2564 |
!
|
|
2565 |
|
|
2566 |
tst16
|
|
2567 |
i1 := 1.
|
|
2568 |
i2 := 1.
|
|
2569 |
i3 := 1
|
|
2570 |
|
|
2571 |
"
|
|
2572 |
JITTest new tst16
|
|
2573 |
"
|
|
2574 |
|
|
2575 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2576 |
!
|
|
2577 |
|
|
2578 |
tst17
|
|
2579 |
i1 := 1.
|
|
2580 |
i2 := 10.
|
|
2581 |
i3 := 100
|
|
2582 |
|
|
2583 |
"
|
|
2584 |
JITTest new tst17
|
|
2585 |
"
|
|
2586 |
|
|
2587 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2588 |
!
|
|
2589 |
|
|
2590 |
tst17b
|
|
2591 |
i1 := 1.
|
|
2592 |
i2 := 10.
|
|
2593 |
i3 := 100.
|
|
2594 |
i1 := 1000
|
|
2595 |
|
|
2596 |
"
|
|
2597 |
JITTest new tst17b
|
|
2598 |
"
|
|
2599 |
|
|
2600 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2601 |
!
|
|
2602 |
|
|
2603 |
tst17c
|
|
2604 |
i1 := 1.
|
|
2605 |
i2 := 10.
|
|
2606 |
i3 := 100.
|
|
2607 |
i1 := 1000.
|
|
2608 |
i2 := 10000
|
|
2609 |
|
|
2610 |
"
|
|
2611 |
JITTest new tst17c
|
|
2612 |
"
|
|
2613 |
|
|
2614 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2615 |
!
|
|
2616 |
|
|
2617 |
tst17d
|
|
2618 |
i1 := 0.
|
|
2619 |
i2 := -1.
|
|
2620 |
i3 := 1
|
|
2621 |
|
|
2622 |
"
|
|
2623 |
JITTest new tst17d
|
|
2624 |
"
|
|
2625 |
|
|
2626 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2627 |
!
|
|
2628 |
|
|
2629 |
tst17e
|
|
2630 |
i1 := nil.
|
|
2631 |
i2 := -1
|
|
2632 |
|
|
2633 |
"
|
|
2634 |
JITTest new tst17e
|
|
2635 |
"
|
|
2636 |
|
|
2637 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2638 |
!
|
|
2639 |
|
|
2640 |
tst17f
|
|
2641 |
i2 := -1.
|
|
2642 |
i1 := nil
|
|
2643 |
|
|
2644 |
"
|
|
2645 |
JITTest new tst17f
|
|
2646 |
"
|
|
2647 |
|
|
2648 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2649 |
!
|
|
2650 |
|
|
2651 |
tst9
|
|
2652 |
^ i1
|
|
2653 |
|
|
2654 |
"
|
|
2655 |
JITTest new tst9
|
|
2656 |
"
|
|
2657 |
|
|
2658 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2659 |
!
|
|
2660 |
|
|
2661 |
tstInstStore1
|
|
2662 |
i1 := nil
|
|
2663 |
|
|
2664 |
"
|
|
2665 |
JITTest new tstInstStore1
|
|
2666 |
"
|
|
2667 |
|
|
2668 |
"Created: / 17.7.1998 / 16:42:02 / cg"
|
|
2669 |
!
|
|
2670 |
|
|
2671 |
tstInstStore2
|
|
2672 |
i1 := 1
|
|
2673 |
|
|
2674 |
"
|
|
2675 |
JITTest new tstInstStore2
|
|
2676 |
"
|
|
2677 |
|
|
2678 |
"Created: / 17.7.1998 / 16:45:51 / cg"
|
|
2679 |
!
|
|
2680 |
|
|
2681 |
tstInstStore3
|
|
2682 |
i1 := true
|
|
2683 |
|
|
2684 |
"
|
|
2685 |
JITTest new tstInstStore3
|
|
2686 |
"
|
|
2687 |
|
|
2688 |
"Created: / 17.7.1998 / 16:46:02 / cg"
|
|
2689 |
!
|
|
2690 |
|
|
2691 |
tstInstStore4
|
|
2692 |
i1 := false
|
|
2693 |
|
|
2694 |
"
|
|
2695 |
JITTest new tstInstStore4
|
|
2696 |
"
|
|
2697 |
|
|
2698 |
"Created: / 17.7.1998 / 16:46:32 / cg"
|
|
2699 |
!
|
|
2700 |
|
|
2701 |
tstInstStore5
|
|
2702 |
i1 := #at:put:
|
|
2703 |
|
|
2704 |
"
|
|
2705 |
JITTest new tstInstStore5
|
|
2706 |
"
|
|
2707 |
|
|
2708 |
"Created: / 17.7.1998 / 16:47:02 / cg"
|
|
2709 |
! !
|
|
2710 |
|
|
2711 |
!JITTest methodsFor:'tests - locals'!
|
|
2712 |
|
|
2713 |
tstLocal1
|
|
2714 |
|l1|
|
|
2715 |
|
|
2716 |
^ thisContext
|
|
2717 |
|
|
2718 |
"
|
|
2719 |
JITTest new testLocal1
|
|
2720 |
"
|
|
2721 |
|
|
2722 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2723 |
!
|
|
2724 |
|
|
2725 |
tstLocal2
|
|
2726 |
|l1 l2 l3|
|
|
2727 |
|
|
2728 |
l1 := 1.
|
|
2729 |
l2 := 2.
|
|
2730 |
l3 := 3.
|
|
2731 |
^ thisContext
|
|
2732 |
|
|
2733 |
"
|
|
2734 |
JITTest new testLocal2
|
|
2735 |
"
|
|
2736 |
|
|
2737 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2738 |
!
|
|
2739 |
|
|
2740 |
tstLocal3
|
|
2741 |
|l1|
|
|
2742 |
|
|
2743 |
^ l1
|
|
2744 |
|
|
2745 |
"
|
|
2746 |
JITTest new testLocal3
|
|
2747 |
"
|
|
2748 |
|
|
2749 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2750 |
!
|
|
2751 |
|
|
2752 |
tstLocal4
|
|
2753 |
|l1|
|
|
2754 |
|
|
2755 |
l1 := 1.
|
|
2756 |
^ l1
|
|
2757 |
|
|
2758 |
"
|
|
2759 |
JITTest new testLocal4
|
|
2760 |
"
|
|
2761 |
|
|
2762 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
2763 |
!
|
|
2764 |
|
|
2765 |
tstLocal5
|
|
2766 |
|l1 l2|
|
|
2767 |
|
|
2768 |
l1 := nil.
|
|
2769 |
l2 := nil
|
|
2770 |
|
|
2771 |
"
|
|
2772 |
JITTest new testLocal5
|
|
2773 |
|
|
2774 |
|t|
|
|
2775 |
t := self new.
|
|
2776 |
Time millisecondsToRun:[
|
|
2777 |
1000000 timesRepeat:[t testLocal5]
|
|
2778 |
] 798 809 808 808 801 798 835
|
|
2779 |
"
|
|
2780 |
!
|
|
2781 |
|
|
2782 |
tstLocal6
|
|
2783 |
|l1 l2|
|
|
2784 |
|
|
2785 |
1000000 timesRepeat:[
|
|
2786 |
l1 := nil.
|
|
2787 |
l2 := nil
|
|
2788 |
]
|
|
2789 |
|
|
2790 |
"
|
|
2791 |
JITTest new testLocal5
|
|
2792 |
|
|
2793 |
|t|
|
|
2794 |
t := self new.
|
|
2795 |
Time millisecondsToRun:[
|
|
2796 |
t testLocal6
|
|
2797 |
] 38 37 38 38 38 61
|
|
2798 |
"
|
|
2799 |
! !
|
|
2800 |
|
|
2801 |
!JITTest methodsFor:'tests - return'!
|
|
2802 |
|
|
2803 |
tstBlock0
|
|
2804 |
^ [
|
|
2805 |
|l1|
|
|
2806 |
|
|
2807 |
l1 := 1.
|
|
2808 |
1
|
|
2809 |
|
|
2810 |
|
|
2811 |
"
|
|
2812 |
JITTest new testBlock0 value
|
|
2813 |
"
|
|
2814 |
|
|
2815 |
"Modified: / 3.6.1998 / 21:18:37 / cg"
|
|
2816 |
"Created: / 3.6.1998 / 21:45:26 / cg"
|
|
2817 |
]
|
|
2818 |
!
|
|
2819 |
|
|
2820 |
tstBlock1
|
|
2821 |
^ [:arg |
|
|
2822 |
|l1|
|
|
2823 |
|
|
2824 |
l1 := arg.
|
|
2825 |
arg
|
|
2826 |
|
|
2827 |
|
|
2828 |
"
|
|
2829 |
JITTest new testBlock1 value:1
|
|
2830 |
"
|
|
2831 |
|
|
2832 |
"Modified: / 3.6.1998 / 21:18:37 / cg"
|
|
2833 |
"Created: / 3.6.1998 / 21:44:26 / cg"
|
|
2834 |
]
|
|
2835 |
!
|
|
2836 |
|
|
2837 |
tstBlock10
|
|
2838 |
^ [:arg1 :arg2 :arg3 :arg4 :arg5 :arg6 :arg7 :arg8 :arg9 :arg10 |
|
|
2839 |
|l1|
|
|
2840 |
|
|
2841 |
l1 := arg10.
|
|
2842 |
arg10
|
|
2843 |
|
|
2844 |
|
|
2845 |
"
|
|
2846 |
JITTest new testBlock10
|
|
2847 |
valueWithArguments:#(1 2 3 4 5 6 7 8 9 10)
|
|
2848 |
"
|
|
2849 |
|
|
2850 |
"Modified: / 3.6.1998 / 23:22:04 / cg"
|
|
2851 |
"Created: / 3.6.1998 / 23:22:23 / cg"
|
|
2852 |
]
|
|
2853 |
!
|
|
2854 |
|
|
2855 |
tstBlock11
|
|
2856 |
^ [:arg1 :arg2 :arg3 :arg4 :arg5 :arg6 :arg7 :arg8 :arg9 :arg10 :arg11 |
|
|
2857 |
|l1|
|
|
2858 |
|
|
2859 |
l1 := arg11.
|
|
2860 |
arg11
|
|
2861 |
|
|
2862 |
|
|
2863 |
"
|
|
2864 |
JITTest new testBlock11
|
|
2865 |
valueWithArguments:#(1 2 3 4 5 6 7 8 9 10 11)
|
|
2866 |
"
|
|
2867 |
|
|
2868 |
"Modified: / 3.6.1998 / 23:22:04 / cg"
|
|
2869 |
"Created: / 3.6.1998 / 23:22:43 / cg"
|
|
2870 |
]
|
|
2871 |
!
|
|
2872 |
|
|
2873 |
tstBlock12
|
|
2874 |
^ [:arg1 :arg2 :arg3 :arg4 :arg5 :arg6 :arg7 :arg8 :arg9 :arg10 :arg11 :arg12 |
|
|
2875 |
|l1|
|
|
2876 |
|
|
2877 |
l1 := arg12.
|
|
2878 |
arg12
|
|
2879 |
|
|
2880 |
|
|
2881 |
"
|
|
2882 |
JITTest new testBlock12
|
|
2883 |
valueWithArguments:#(1 2 3 4 5 6 7 8 9 10 11 12)
|
|
2884 |
"
|
|
2885 |
|
|
2886 |
"Modified: / 3.6.1998 / 23:22:04 / cg"
|
|
2887 |
"Created: / 3.6.1998 / 23:23:01 / cg"
|
|
2888 |
]
|
|
2889 |
!
|
|
2890 |
|
|
2891 |
tstBlock13
|
|
2892 |
^ [:arg1 :arg2 :arg3 :arg4 :arg5 :arg6 :arg7 :arg8 :arg9 :arg10 :arg11 :arg12 :arg13 |
|
|
2893 |
|l1|
|
|
2894 |
|
|
2895 |
l1 := arg13.
|
|
2896 |
arg13
|
|
2897 |
|
|
2898 |
|
|
2899 |
"
|
|
2900 |
JITTest new testBlock13
|
|
2901 |
valueWithArguments:#(1 2 3 4 5 6 7 8 9 10 11 12 13)
|
|
2902 |
"
|
|
2903 |
|
|
2904 |
"Modified: / 3.6.1998 / 23:22:04 / cg"
|
|
2905 |
"Created: / 3.6.1998 / 23:23:21 / cg"
|
|
2906 |
]
|
|
2907 |
!
|
|
2908 |
|
|
2909 |
tstBlock2
|
|
2910 |
^ [:arg1 :arg2 |
|
|
2911 |
|l1|
|
|
2912 |
|
|
2913 |
l1 := arg2.
|
|
2914 |
arg2
|
|
2915 |
|
|
2916 |
|
|
2917 |
"
|
|
2918 |
JITTest new testBlock2 value:1 value:2
|
|
2919 |
"
|
|
2920 |
|
|
2921 |
"Created: / 3.6.1998 / 21:46:35 / cg"
|
|
2922 |
"Modified: / 3.6.1998 / 21:46:53 / cg"
|
|
2923 |
]
|
|
2924 |
!
|
|
2925 |
|
|
2926 |
tstBlock3
|
|
2927 |
^ [:arg1 :arg2 :arg3 |
|
|
2928 |
|l1|
|
|
2929 |
|
|
2930 |
l1 := arg3.
|
|
2931 |
arg3
|
|
2932 |
|
|
2933 |
|
|
2934 |
"
|
|
2935 |
JITTest new testBlock3 value:1 value:2 value:3
|
|
2936 |
"
|
|
2937 |
|
|
2938 |
"Modified: / 3.6.1998 / 21:18:37 / cg"
|
|
2939 |
"Created: / 3.6.1998 / 21:46:49 / cg"
|
|
2940 |
]
|
|
2941 |
!
|
|
2942 |
|
|
2943 |
tstBlock4
|
|
2944 |
^ [:arg1 :arg2 :arg3 :arg4 |
|
|
2945 |
|l1|
|
|
2946 |
|
|
2947 |
l1 := arg4.
|
|
2948 |
arg4
|
|
2949 |
|
|
2950 |
|
|
2951 |
"
|
|
2952 |
JITTest new testBlock4 value:1 value:2 value:3 value:4
|
|
2953 |
"
|
|
2954 |
|
|
2955 |
"Modified: / 3.6.1998 / 21:18:37 / cg"
|
|
2956 |
"Created: / 3.6.1998 / 21:47:07 / cg"
|
|
2957 |
]
|
|
2958 |
!
|
|
2959 |
|
|
2960 |
tstBlock5
|
|
2961 |
^ [:arg1 :arg2 :arg3 :arg4 :arg5 |
|
|
2962 |
|l1|
|
|
2963 |
|
|
2964 |
l1 := arg5.
|
|
2965 |
arg5
|
|
2966 |
|
|
2967 |
|
|
2968 |
"
|
|
2969 |
JITTest new testBlock5 value:1 value:2 value:3 value:4 value:5
|
|
2970 |
"
|
|
2971 |
|
|
2972 |
"Modified: / 3.6.1998 / 21:18:37 / cg"
|
|
2973 |
"Created: / 3.6.1998 / 21:47:23 / cg"
|
|
2974 |
]
|
|
2975 |
!
|
|
2976 |
|
|
2977 |
tstBlock7
|
|
2978 |
^ [:arg1 :arg2 :arg3 :arg4 :arg5 :arg6 :arg7 |
|
|
2979 |
|l1|
|
|
2980 |
|
|
2981 |
l1 := arg7.
|
|
2982 |
arg7
|
|
2983 |
|
|
2984 |
|
|
2985 |
"
|
|
2986 |
JITTest new testBlock7 value:1 value:2 value:3 value:4 value:5 value:6 value:7
|
|
2987 |
"
|
|
2988 |
|
|
2989 |
"Modified: / 3.6.1998 / 21:18:37 / cg"
|
|
2990 |
"Created: / 3.6.1998 / 21:47:53 / cg"
|
|
2991 |
]
|
|
2992 |
!
|
|
2993 |
|
|
2994 |
tstBlock8
|
|
2995 |
^ [:arg1 :arg2 :arg3 :arg4 :arg5 :arg6 :arg7 :arg8 |
|
|
2996 |
|l1|
|
|
2997 |
|
|
2998 |
l1 := arg8.
|
|
2999 |
arg8
|
|
3000 |
|
|
3001 |
|
|
3002 |
"
|
|
3003 |
JITTest new testBlock8 value:1 value:2 value:3 value:4 value:5 value:6 value:7 value:8
|
|
3004 |
"
|
|
3005 |
|
|
3006 |
"Created: / 3.6.1998 / 21:46:49 / cg"
|
|
3007 |
"Modified: / 3.6.1998 / 22:41:58 / cg"
|
|
3008 |
]
|
|
3009 |
!
|
|
3010 |
|
|
3011 |
tstBlock9
|
|
3012 |
^ [:arg1 :arg2 :arg3 :arg4 :arg5 :arg6 :arg7 :arg8 :arg9 |
|
|
3013 |
|l1|
|
|
3014 |
|
|
3015 |
l1 := arg9.
|
|
3016 |
arg9
|
|
3017 |
|
|
3018 |
|
|
3019 |
"
|
|
3020 |
JITTest new testBlock9
|
|
3021 |
valueWithArguments:#(1 2 3 4 5 6 7 8 9)
|
|
3022 |
"
|
|
3023 |
|
|
3024 |
"Created: / 3.6.1998 / 21:46:49 / cg"
|
|
3025 |
"Modified: / 3.6.1998 / 23:22:04 / cg"
|
|
3026 |
]
|
|
3027 |
!
|
|
3028 |
|
|
3029 |
tstBlockRet
|
|
3030 |
1 to:10 do:[:i |
|
|
3031 |
i == 5 ifTrue:[^ i]
|
|
3032 |
|
|
3033 |
|
|
3034 |
"
|
|
3035 |
JITTest new testBlockRet
|
|
3036 |
"
|
|
3037 |
|
|
3038 |
"Modified: / 3.6.1998 / 23:22:04 / cg"
|
|
3039 |
"Created: / 3.6.1998 / 23:23:21 / cg"
|
|
3040 |
]
|
|
3041 |
!
|
|
3042 |
|
|
3043 |
tstSelf1:a1 arg:a2 arg:a3 arg:a4
|
|
3044 |
^ self
|
|
3045 |
|
|
3046 |
"
|
|
3047 |
JITTest new testSelf1:1 arg:2 arg:3 arg:4
|
|
3048 |
JITTest new testSelf1:0 arg:1 arg:2 arg:3
|
|
3049 |
"
|
|
3050 |
|
|
3051 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
3052 |
!
|
|
3053 |
|
|
3054 |
tstSelf2:a1 arg:a2 arg:a3 arg:a4
|
|
3055 |
|local1|
|
|
3056 |
|
|
3057 |
^ self
|
|
3058 |
|
|
3059 |
"
|
|
3060 |
JITTest new testSelf2:1 arg:2 arg:3 arg:4
|
|
3061 |
JITTest new testSelf2:0 arg:1 arg:2 arg:3
|
|
3062 |
"
|
|
3063 |
|
|
3064 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
3065 |
!
|
|
3066 |
|
|
3067 |
tstSelf3:a1 arg:a2 arg:a3 arg:a4
|
|
3068 |
|local1|
|
|
3069 |
|
|
3070 |
local1 := 1.
|
|
3071 |
^ self
|
|
3072 |
|
|
3073 |
"
|
|
3074 |
JITTest new testSelf3:1 arg:2 arg:3 arg:4
|
|
3075 |
JITTest new testSelf3:0 arg:1 arg:2 arg:3
|
|
3076 |
"
|
|
3077 |
|
|
3078 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
3079 |
!
|
|
3080 |
|
|
3081 |
tstSelf3_1:a1 arg:a2 arg:a3
|
|
3082 |
^ self
|
|
3083 |
|
|
3084 |
"
|
|
3085 |
JITTest new testSelf3_1:1 arg:2 arg:3
|
|
3086 |
JITTest new testSelf3_1:0 arg:1 arg:2
|
|
3087 |
"
|
|
3088 |
|
|
3089 |
"Modified: / 3.6.1998 / 21:18:37 / cg"
|
|
3090 |
"Created: / 3.6.1998 / 21:19:14 / cg"
|
|
3091 |
!
|
|
3092 |
|
|
3093 |
tstSelf3_2:a1 arg:a2 arg:a3
|
|
3094 |
|local1|
|
|
3095 |
|
|
3096 |
^ self
|
|
3097 |
|
|
3098 |
"
|
|
3099 |
JITTest new testSelf3_2:1 arg:2 arg:3
|
|
3100 |
JITTest new testSelf3_2:0 arg:1 arg:2
|
|
3101 |
"
|
|
3102 |
|
|
3103 |
"Created: / 3.6.1998 / 21:19:23 / cg"
|
|
3104 |
!
|
|
3105 |
|
|
3106 |
tstSelf3_3:a1 arg:a2 arg:a3
|
|
3107 |
|local1|
|
|
3108 |
|
|
3109 |
local1 := 1.
|
|
3110 |
^ self
|
|
3111 |
|
|
3112 |
"
|
|
3113 |
JITTest new testSelf3_3:1 arg:2 arg:3
|
|
3114 |
JITTest new testSelf3_3:0 arg:1 arg:2
|
|
3115 |
"
|
|
3116 |
|
|
3117 |
"Created: / 3.6.1998 / 21:19:34 / cg"
|
|
3118 |
!
|
|
3119 |
|
|
3120 |
tstSelf3_4:a1 arg:a2 arg:a3
|
|
3121 |
|local1|
|
|
3122 |
|
|
3123 |
local1 := self.
|
|
3124 |
^ local1
|
|
3125 |
|
|
3126 |
"
|
|
3127 |
JITTest new testSelf3_4:1 arg:2 arg:3
|
|
3128 |
JITTest new testSelf3_4:0 arg:1 arg:2
|
|
3129 |
"
|
|
3130 |
|
|
3131 |
"Created: / 3.6.1998 / 21:19:44 / cg"
|
|
3132 |
!
|
|
3133 |
|
|
3134 |
tstSelf4:a1 arg:a2 arg:a3 arg:a4
|
|
3135 |
|local1|
|
|
3136 |
|
|
3137 |
local1 := self.
|
|
3138 |
^ local1
|
|
3139 |
|
|
3140 |
"
|
|
3141 |
JITTest new testSelf4:1 arg:2 arg:3 arg:4
|
|
3142 |
JITTest new testSelf4:0 arg:1 arg:2 arg:3
|
|
3143 |
"
|
|
3144 |
|
|
3145 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
3146 |
!
|
|
3147 |
|
|
3148 |
tstSelf4_1:a1 arg:a2 arg:a3 arg:a4
|
|
3149 |
^ self
|
|
3150 |
|
|
3151 |
"
|
|
3152 |
JITTest new testSelf4_1:1 arg:2 arg:3 arg:4
|
|
3153 |
JITTest new testSelf4_1:0 arg:1 arg:2 arg:3
|
|
3154 |
"
|
|
3155 |
|
|
3156 |
"Created: / 3.6.1998 / 21:18:26 / cg"
|
|
3157 |
"Modified: / 3.6.1998 / 21:18:37 / cg"
|
|
3158 |
!
|
|
3159 |
|
|
3160 |
tstSelf4_2:a1 arg:a2 arg:a3 arg:a4
|
|
3161 |
|local1|
|
|
3162 |
|
|
3163 |
^ self
|
|
3164 |
|
|
3165 |
"
|
|
3166 |
JITTest new testSelf4_2:1 arg:2 arg:3 arg:4
|
|
3167 |
JITTest new testSelf4_2:0 arg:1 arg:2 arg:3
|
|
3168 |
"
|
|
3169 |
|
|
3170 |
"Created: / 3.6.1998 / 21:18:33 / cg"
|
|
3171 |
!
|
|
3172 |
|
|
3173 |
tstSelf4_3:a1 arg:a2 arg:a3 arg:a4
|
|
3174 |
|local1|
|
|
3175 |
|
|
3176 |
local1 := 1.
|
|
3177 |
^ self
|
|
3178 |
|
|
3179 |
"
|
|
3180 |
JITTest new testSelf4_3:1 arg:2 arg:3 arg:4
|
|
3181 |
JITTest new testSelf4_3:0 arg:1 arg:2 arg:3
|
|
3182 |
"
|
|
3183 |
|
|
3184 |
"Created: / 3.6.1998 / 21:18:42 / cg"
|
|
3185 |
!
|
|
3186 |
|
|
3187 |
tstSelf4_4:a1 arg:a2 arg:a3 arg:a4
|
|
3188 |
|local1|
|
|
3189 |
|
|
3190 |
local1 := self.
|
|
3191 |
^ local1
|
|
3192 |
|
|
3193 |
"
|
|
3194 |
JITTest new testSelf4_4:1 arg:2 arg:3 arg:4
|
|
3195 |
JITTest new testSelf4_4:0 arg:1 arg:2 arg:3
|
|
3196 |
"
|
|
3197 |
|
|
3198 |
"Created: / 3.6.1998 / 21:18:46 / cg"
|
|
3199 |
! !
|
|
3200 |
|
|
3201 |
!JITTest methodsFor:'tests - sends'!
|
|
3202 |
|
|
3203 |
ilcTest1
|
|
3204 |
"check ilc caching"
|
|
3205 |
|
|
3206 |
|arr i|
|
|
3207 |
|
|
3208 |
arr := Array new:10000.
|
|
3209 |
1 to:10000 do:[:i |
|
|
3210 |
i odd ifTrue:[
|
|
3211 |
arr at:i put:FooClass new
|
|
3212 |
] ifFalse:[
|
|
3213 |
arr at:i put:BarClass new.
|
|
3214 |
]
|
|
3215 |
].
|
|
3216 |
|
|
3217 |
i := 1.
|
|
3218 |
[i <= 10] whileTrue:[
|
|
3219 |
|el expect|
|
|
3220 |
|
|
3221 |
i printCR.
|
|
3222 |
el := arr at:i.
|
|
3223 |
el printCR.
|
|
3224 |
|
|
3225 |
i odd ifTrue:[
|
|
3226 |
expect := #Foo
|
|
3227 |
] ifFalse:[
|
|
3228 |
expect := #Bar
|
|
3229 |
].
|
|
3230 |
expect printCR.
|
|
3231 |
el whatAreYou ~~ expect ifTrue:[
|
|
3232 |
"/ self halt
|
|
3233 |
].
|
|
3234 |
i print. ' ' print. el printCR.
|
|
3235 |
i := i + 1.
|
|
3236 |
].
|
|
3237 |
|
|
3238 |
"/ i := 1.
|
|
3239 |
"/ [i <= arr size] whileTrue:[
|
|
3240 |
"/ |el expect|
|
|
3241 |
"/
|
|
3242 |
"/ el := arr at:i.
|
|
3243 |
"/
|
|
3244 |
"/ i odd ifTrue:[
|
|
3245 |
"/ expect := #Foo
|
|
3246 |
"/ ] ifFalse:[
|
|
3247 |
"/ expect := #Bar
|
|
3248 |
"/ ].
|
|
3249 |
"/ el whatAreYou ~~ expect ifTrue:[
|
|
3250 |
"/ self halt
|
|
3251 |
"/ ].
|
|
3252 |
"/i print. ' ' print. el printCR.
|
|
3253 |
"/ i := i + 1.
|
|
3254 |
"/ ].
|
|
3255 |
"/
|
|
3256 |
"/ 1 to:arr size do:[:i |
|
|
3257 |
"/ |el expect|
|
|
3258 |
"/
|
|
3259 |
"/ el := arr at:i.
|
|
3260 |
"/
|
|
3261 |
"/ i odd ifTrue:[
|
|
3262 |
"/ expect := #Foo
|
|
3263 |
"/ ] ifFalse:[
|
|
3264 |
"/ expect := #Bar
|
|
3265 |
"/ ].
|
|
3266 |
"/ el whatAreYou ~~ expect ifTrue:[
|
|
3267 |
"/ self halt
|
|
3268 |
"/ ].
|
|
3269 |
"/i print. ' ' print. el printCR.
|
|
3270 |
"/ ].
|
|
3271 |
"/
|
|
3272 |
"/ arr keysAndValuesDo:[:i :el |
|
|
3273 |
"/ |expect|
|
|
3274 |
"/
|
|
3275 |
"/ i odd ifTrue:[
|
|
3276 |
"/ expect := #Foo
|
|
3277 |
"/ ] ifFalse:[
|
|
3278 |
"/ expect := #Bar
|
|
3279 |
"/ ].
|
|
3280 |
"/ el whatAreYou ~~ expect ifTrue:[
|
|
3281 |
"/ self halt
|
|
3282 |
"/ ].
|
|
3283 |
"/i print. ' ' print. el printCR.
|
|
3284 |
"/ ].
|
|
3285 |
|
|
3286 |
"
|
|
3287 |
JITTest new ilcTest1
|
|
3288 |
Time millisecondsToRun:[self new ilcTest1]
|
|
3289 |
"
|
|
3290 |
|
|
3291 |
"Modified: / 4.6.1998 / 12:13:27 / cg"
|
|
3292 |
!
|
|
3293 |
|
|
3294 |
ilcTest1b
|
|
3295 |
"check ilc caching"
|
|
3296 |
|
|
3297 |
|el1 el2|
|
|
3298 |
|
|
3299 |
el1 := FooClass new.
|
|
3300 |
el2 := BarClass new.
|
|
3301 |
|
|
3302 |
el1 whatAreYou printCR. el2 whatAreYou printCR. el1 whatAreYou printCR. el2 whatAreYou printCR.
|
|
3303 |
|
|
3304 |
"
|
|
3305 |
JITTest new ilcTest1b
|
|
3306 |
"
|
|
3307 |
|
|
3308 |
"Modified: / 4.6.1998 / 12:13:27 / cg"
|
|
3309 |
!
|
|
3310 |
|
|
3311 |
ilcTest1c
|
|
3312 |
"check simple send"
|
|
3313 |
|
|
3314 |
|el|
|
|
3315 |
|
|
3316 |
el := FooClass new.
|
|
3317 |
el whatAreYou printCR.
|
|
3318 |
el whatAreYou printCR.
|
|
3319 |
|
|
3320 |
"
|
|
3321 |
JITTest new ilcTest1c
|
|
3322 |
"
|
|
3323 |
|
|
3324 |
"Modified: / 4.6.1998 / 12:13:27 / cg"
|
|
3325 |
!
|
|
3326 |
|
|
3327 |
ilcTest1d
|
|
3328 |
"check simple send"
|
|
3329 |
|
|
3330 |
|el1 el2|
|
|
3331 |
|
|
3332 |
el1 := FooClass new.
|
|
3333 |
el2 := BarClass new.
|
|
3334 |
el1 whatAreYou printCR.
|
|
3335 |
el2 whatAreYou printCR.
|
|
3336 |
el1 whatAreYou printCR.
|
|
3337 |
el2 whatAreYou printCR.
|
|
3338 |
|
|
3339 |
"
|
|
3340 |
JITTest new ilcTest1d
|
|
3341 |
"
|
|
3342 |
|
|
3343 |
"Modified: / 4.6.1998 / 12:13:27 / cg"
|
|
3344 |
!
|
|
3345 |
|
|
3346 |
tst44:arg
|
|
3347 |
|l1 l2|
|
|
3348 |
|
|
3349 |
l1 := 1.
|
|
3350 |
l2 := 2.
|
|
3351 |
^ l1 + l2 + arg + 1
|
|
3352 |
|
|
3353 |
"
|
|
3354 |
JITTest new tst44:3
|
|
3355 |
"
|
|
3356 |
|
|
3357 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
3358 |
!
|
|
3359 |
|
|
3360 |
tst50
|
|
3361 |
self tst51
|
|
3362 |
|
|
3363 |
"
|
|
3364 |
JITTest new tst50
|
|
3365 |
"
|
|
3366 |
|
|
3367 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
3368 |
!
|
|
3369 |
|
|
3370 |
tst51
|
|
3371 |
self abs
|
|
3372 |
|
|
3373 |
"
|
|
3374 |
JITTest new tst51
|
|
3375 |
"
|
|
3376 |
|
|
3377 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
3378 |
!
|
|
3379 |
|
|
3380 |
tst52
|
|
3381 |
^ self abs
|
|
3382 |
|
|
3383 |
"
|
|
3384 |
JITTest new tst52
|
|
3385 |
"
|
|
3386 |
|
|
3387 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
3388 |
!
|
|
3389 |
|
|
3390 |
tst53:arg1 with:arg2
|
|
3391 |
^ arg1 abs + arg2 abs
|
|
3392 |
|
|
3393 |
"
|
|
3394 |
JITTest new tst53:5 with:7
|
|
3395 |
JITTest new tst53:-5 with:7
|
|
3396 |
JITTest new tst53:5 with:-7
|
|
3397 |
JITTest new tst53:-5 with:-7
|
|
3398 |
"
|
|
3399 |
|
|
3400 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
3401 |
!
|
|
3402 |
|
|
3403 |
tst54
|
|
3404 |
'hello' printCR
|
|
3405 |
|
|
3406 |
"
|
|
3407 |
JITTest new tst54
|
|
3408 |
"
|
|
3409 |
|
|
3410 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
3411 |
!
|
|
3412 |
|
|
3413 |
tstILC1
|
|
3414 |
|x|
|
|
3415 |
|
|
3416 |
1 to:4 do:[:i |
|
|
3417 |
i == 1 ifTrue:[
|
|
3418 |
x := self
|
|
3419 |
].
|
|
3420 |
i == 2 ifTrue:[
|
|
3421 |
x := nil
|
|
3422 |
].
|
|
3423 |
i == 3 ifTrue:[x := 1].
|
|
3424 |
i == 4 ifTrue:[
|
|
3425 |
x := true
|
|
3426 |
].
|
|
3427 |
x tstInstStore1
|
|
3428 |
|
|
3429 |
"
|
|
3430 |
JITTest new tstILC1
|
|
3431 |
"
|
|
3432 |
|
|
3433 |
"Created: / 16.8.1996 / 17:39:44 / cg"
|
|
3434 |
"Modified: / 17.7.1998 / 16:45:27 / cg"
|
|
3435 |
]
|
|
3436 |
!
|
|
3437 |
|
|
3438 |
tstPlus1
|
|
3439 |
|l1 l2|
|
|
3440 |
|
|
3441 |
l1 := 1.
|
|
3442 |
l2 := 2.
|
|
3443 |
^ l1 + l2
|
|
3444 |
|
|
3445 |
"
|
|
3446 |
JITTest new tstPlus1
|
|
3447 |
"
|
|
3448 |
|
|
3449 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
3450 |
!
|
|
3451 |
|
|
3452 |
tstPlusArg1:arg
|
|
3453 |
^ arg + 1
|
|
3454 |
|
|
3455 |
"
|
|
3456 |
JITTest new tstPlusArg1:1
|
|
3457 |
JITTest new tstPlusArg1:SmallInteger maxVal
|
|
3458 |
"
|
|
3459 |
|
|
3460 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
3461 |
!
|
|
3462 |
|
|
3463 |
tstPlusUndef1
|
|
3464 |
|l1 l2|
|
|
3465 |
|
|
3466 |
^ l1 + l2
|
|
3467 |
|
|
3468 |
"
|
|
3469 |
JITTest new tstPlusUndef1
|
|
3470 |
"
|
|
3471 |
|
|
3472 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
3473 |
!
|
|
3474 |
|
|
3475 |
tstPlusUndef2
|
|
3476 |
|l1 l2|
|
|
3477 |
|
|
3478 |
l1 := 1.
|
|
3479 |
^ l1 + l2
|
|
3480 |
|
|
3481 |
"
|
|
3482 |
JITTest new tstPlusUndef2
|
|
3483 |
"
|
|
3484 |
|
|
3485 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
3486 |
!
|
|
3487 |
|
|
3488 |
tstPlusUndef3
|
|
3489 |
|l1 l2|
|
|
3490 |
|
|
3491 |
l1 := 1.
|
|
3492 |
^ l1 + l2
|
|
3493 |
|
|
3494 |
"
|
|
3495 |
JITTest new tstPlusUndef3
|
|
3496 |
"
|
|
3497 |
|
|
3498 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
3499 |
!
|
|
3500 |
|
|
3501 |
tstSend2
|
|
3502 |
^ self tstSend2Helper:1 with:2
|
|
3503 |
|
|
3504 |
"
|
|
3505 |
JITTest new tstSend2
|
|
3506 |
JITTest new tstSend3
|
|
3507 |
JITTest new tstSend2Helper:1 with:2
|
|
3508 |
JITTest new tstSend2Helper2:1 with:2
|
|
3509 |
"
|
|
3510 |
|
|
3511 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
3512 |
!
|
|
3513 |
|
|
3514 |
tstSend2Helper2:arg1 with:arg2
|
|
3515 |
^ arg2
|
|
3516 |
|
|
3517 |
"
|
|
3518 |
JITTest new tstSend3
|
|
3519 |
"
|
|
3520 |
|
|
3521 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
3522 |
!
|
|
3523 |
|
|
3524 |
tstSend2Helper:arg1 with:arg2
|
|
3525 |
^ arg1
|
|
3526 |
|
|
3527 |
"
|
|
3528 |
JITTest new tstSend2
|
|
3529 |
"
|
|
3530 |
|
|
3531 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
3532 |
!
|
|
3533 |
|
|
3534 |
tstSend3
|
|
3535 |
^ self tstSend2Helper2:1 with:2
|
|
3536 |
|
|
3537 |
"
|
|
3538 |
JITTest new tstSend3
|
|
3539 |
"
|
|
3540 |
|
|
3541 |
"Created: 16.8.1996 / 17:39:44 / cg"
|
|
3542 |
! !
|
|
3543 |
|
|
3544 |
!JITTest::BarClass methodsFor:'queries'!
|
|
3545 |
|
|
3546 |
whatAreYou
|
|
3547 |
^ #Bar
|
|
3548 |
|
|
3549 |
"Created: / 4.6.1998 / 12:05:50 / cg"
|
|
3550 |
!
|
|
3551 |
|
|
3552 |
whatAreYou2
|
|
3553 |
^ (self class nameWithoutPrefix copyWithoutLast:5) asSymbol
|
|
3554 |
|
|
3555 |
"Created: / 4.6.1998 / 12:08:34 / cg"
|
|
3556 |
"Modified: / 4.6.1998 / 12:10:15 / cg"
|
|
3557 |
! !
|
|
3558 |
|
|
3559 |
!JITTest::FooClass methodsFor:'queries'!
|
|
3560 |
|
|
3561 |
whatAreYou
|
|
3562 |
^ #Foo
|
|
3563 |
|
|
3564 |
"Created: / 4.6.1998 / 12:05:58 / cg"
|
|
3565 |
!
|
|
3566 |
|
|
3567 |
whatAreYou2
|
|
3568 |
^ (self class nameWithoutPrefix copyWithoutLast:5) asSymbol
|
|
3569 |
|
|
3570 |
"Created: / 4.6.1998 / 12:08:59 / cg"
|
|
3571 |
"Modified: / 4.6.1998 / 12:10:19 / cg"
|
|
3572 |
! !
|
|
3573 |
|
|
3574 |
!JITTest class methodsFor:'documentation'!
|
|
3575 |
|
|
3576 |
version
|
|
3577 |
^ '$Header$'
|
|
3578 |
! !
|