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