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