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