blob: 05cecce0b2497d144560642dc5d82faee15a2afe [file] [log] [blame]
Brian Carlstrom9f30b382011-08-28 22:41:38 -07001// Copyright 2011 Google Inc. All Rights Reserved.
2
3class IntMath {
4
5 public static boolean mBoolean1, mBoolean2;
6 public static byte mByte1, mByte2;
7 public static char mChar1, mChar2;
8 public static short mShort1, mShort2;
9 public static int mInt1, mInt2;
10 public static float mFloat1, mFloat2;
11 public static long mLong1, mLong2;
12 public static double mDouble1, mDouble2;
13 public static volatile long mVolatileLong1, mVolatileLong2;
14
15
16 private int foo_;
17
18 public IntMath(int stuff) {
19 foo_ = stuff;
20 }
21
22 public IntMath() {
23 foo_ = 123;
24 }
25
buzbee561227c2011-09-02 15:28:19 -070026 static int constClassTest(int x) {
27 Class c = String.class;
28 if (c != null) {
29 return x * 2;
30 } else {
31 return x;
32 }
33 }
34
buzbee1b4c8592011-08-31 10:43:51 -070035 static int constStringTest(int x) {
36 /* TODO: flesh this test out when we can call string library */
37 String str = "Hello World!";
38 return x * 2;
39 }
40
41 static void throwNullPointerException() {
42 throw new NullPointerException();
43 }
44
45 static int catchBlock(int x) {
46 try {
47 x += 123;
48 throwNullPointerException();
49 } catch (NullPointerException npe) {
50 x += 456;
51 }
52 return x;
53 }
54
Brian Carlstrom9f30b382011-08-28 22:41:38 -070055 static int staticFieldTest(int x) {
56 mBoolean1 = true;
57 mBoolean2 = false;
58 mByte1 = 127;
59 mByte2 = -128;
60 mChar1 = 32767;
61 mChar2 = 65535;
62 mShort1 = 32767;
63 mShort2 = -32768;
64 mInt1 = 65537;
65 mInt2 = -65537;
66 mFloat1 = 3.1415f;
67 mFloat2 = -1.0f / 0.0f; // -inf
68 mLong1 = 1234605616436508552L; // 0x1122334455667788
69 mLong2 = -1234605616436508552L;
70 mDouble1 = 3.1415926535;
71 mDouble2 = 1.0 / 0.0; // +inf
72 mVolatileLong1 = mLong1 - 1;
73 mVolatileLong2 = mLong2 + 1;
74
75 if (!mBoolean1) { return 10; }
76 if (mBoolean2) { return 11; }
77 if (mByte1 != 127) { return 12; }
78 if (mByte2 != -128) { return 13; }
79 if (mChar1 != 32767) { return 14; }
80 if (mChar2 != 65535) { return 15; }
81 if (mShort1 != 32767) { return 16; }
82 if (mShort2 != -32768) { return 17; }
83 if (mInt1 != 65537) { return 18; }
84 if (mInt2 != -65537) { return 19; }
85 if (!(mFloat1 > 3.141f && mFloat1 < 3.142f)) { return 20; }
86 if (mFloat2 >= mFloat1) { return 21; }
87 if (mLong1 != 1234605616436508552L) { return 22; }
88 if (mLong2 != -1234605616436508552L) { return 23; }
89 if (!(mDouble1 > 3.141592653 && mDouble1 < 3.141592654)) { return 24; }
90 if (mDouble2 <= mDouble1) { return 25; }
91 if (mVolatileLong1 != 1234605616436508551L) { return 26; }
92 if (mVolatileLong2 != -1234605616436508551L) { return 27; }
93
94 return 1000 + x;
95 }
96
97 /*
98 * Try to cause some unary operations.
99 */
100 static int unopTest(int x) {
101 x = -x;
102 x ^= 0xffffffff;
103 return x;
104 }
105
106 static int shiftTest1() {
107 final int[] mBytes = {
108 0x11, 0x22, 0x33, 0x44, 0x88, 0x99, 0xaa, 0xbb
109 };
110 long l;
111 int i1, i2;
112
113 if (mBytes[0] != 0x11) return 20;
114 if (mBytes[1] != 0x22) return 21;
115 if (mBytes[2] != 0x33) return 22;
116 if (mBytes[3] != 0x44) return 23;
117 if (mBytes[4] != 0x88) return 24;
118 if (mBytes[5] != 0x99) return 25;
119 if (mBytes[6] != 0xaa) return 26;
120 if (mBytes[7] != 0xbb) return 27;
121
122 i1 = mBytes[0] | mBytes[1] << 8 | mBytes[2] << 16 | mBytes[3] << 24;
123 i2 = mBytes[4] | mBytes[5] << 8 | mBytes[6] << 16 | mBytes[7] << 24;
124 l = i1 | ((long)i2 << 32);
125
126 if (i1 != 0x44332211) { return 0x80000000 | i1; }
127 if (i2 != 0xbbaa9988) { return 2; }
128 if (l != 0xbbaa998844332211L) { return 3; }
129
130 l = (long)mBytes[0]
131 | (long)mBytes[1] << 8
132 | (long)mBytes[2] << 16
133 | (long)mBytes[3] << 24
134 | (long)mBytes[4] << 32
135 | (long)mBytes[5] << 40
136 | (long)mBytes[6] << 48
137 | (long)mBytes[7] << 56;
138
139 if (l != 0xbbaa998844332211L) { return 4; }
140 return 0;
141 }
142
143 static int shiftTest2() {
144
145 long a = 0x11;
146 long b = 0x22;
147 long c = 0x33;
148 long d = 0x44;
149 long e = 0x55;
150 long f = 0x66;
151 long g = 0x77;
152 long h = 0x88;
153
154 long result = ((a << 56) | (b << 48) | (c << 40) | (d << 32) |
155 (e << 24) | (f << 16) | (g << 8) | h);
156
157 if (result != 0x1122334455667788L) { return 1; }
158 return 0;
159 }
160
161 static int unsignedShiftTest() {
162 byte b = -4;
163 short s = -4;
164 char c = 0xfffc;
165 int i = -4;
166
167 b >>>= 4;
168 s >>>= 4;
169 c >>>= 4;
170 i >>>= 4;
171
172 if ((int) b != -1) { return 1; }
173 if ((int) s != -1) { return 2; }
174 if ((int) c != 0x0fff) { return 3; }
175 if (i != 268435455) { return 4; }
176 return 0;
177 }
178
179 static int convTest() {
180
181 float f;
182 double d;
183 int i;
184 long l;
185
186 /* int --> long */
187 i = 7654;
188 l = (long) i;
189 if (l != 7654L) { return 1; }
190
191 i = -7654;
192 l = (long) i;
193 if (l != -7654L) { return 2; }
194
195 /* long --> int (with truncation) */
196 l = 5678956789L;
197 i = (int) l;
198 if (i != 1383989493) { return 3; }
199
200 l = -5678956789L;
201 i = (int) l;
202 if (i != -1383989493) { return 4; }
203 return 0;
204 }
205
206 static int charSubTest() {
207
208 char char1 = 0x00e9;
209 char char2 = 0xffff;
210 int i;
211
212 /* chars are unsigned-expanded to ints before subtraction */
213 i = char1 - char2;
214 if (i != 0xffff00ea) { return 1; }
215 return 0;
216 }
217
218 /*
219 * We pass in the arguments and return the results so the compiler
220 * doesn't do the math for us. (x=70000, y=-3)
221 */
222 static int intOperTest(int x, int y) {
223 int[] results = new int[10];
224
225 /* this seems to generate "op-int" instructions */
226 results[0] = x + y;
227 results[1] = x - y;
228 results[2] = x * y;
229 results[3] = x * x;
230 results[4] = x / y;
231 results[5] = x % -y;
232 results[6] = x & y;
233 results[7] = x | y;
234 results[8] = x ^ y;
235
236 /* this seems to generate "op-int/2addr" instructions */
237 results[9] = x + ((((((((x + y) - y) * y) / y) % y) & y) | y) ^ y);
238
239 /* check this edge case while we're here (div-int/2addr) */
240 int minInt = -2147483648;
241 int negOne = -results[5];
242 int plusOne = 1;
243 int result = (((minInt + plusOne) - plusOne) / negOne) / negOne;
244
245 if (result != minInt) { return 1;};
246 if (results[0] != 69997) { return 2;};
247 if (results[1] != 70003) { return 3;};
248 if (results[2] != -210000) { return 4;};
249 if (results[3] != 605032704) { return 5;};
250 if (results[4] != -23333) { return 6;};
251 if (results[5] != 1) { return 7;};
252 if (results[6] != 70000) { return 8;};
253 if (results[7] != -3) { return 9;};
254 if (results[8] != -70003) { return 10;};
255 if (results[9] != 70000) { return 11;};
256
257 return 0;
258 }
259
260 /*
261 * More operations, this time with 16-bit constants. (x=77777)
262 */
263 static int lit16Test(int x) {
264
265 int[] results = new int[8];
266
267 /* try to generate op-int/lit16" instructions */
268 results[0] = x + 1000;
269 results[1] = 1000 - x;
270 results[2] = x * 1000;
271 results[3] = x / 1000;
272 results[4] = x % 1000;
273 results[5] = x & 1000;
274 results[6] = x | -1000;
275 results[7] = x ^ -1000;
276
277 if (results[0] != 78777) { return 1; }
278 if (results[1] != -76777) { return 2; }
279 if (results[2] != 77777000) { return 3; }
280 if (results[3] != 77) { return 4; }
281 if (results[4] != 777) { return 5; }
282 if (results[5] != 960) { return 6; }
283 if (results[6] != -39) { return 7; }
284 if (results[7] != -76855) { return 8; }
285 return 0;
286 }
287
288 /*
289 * More operations, this time with 8-bit constants. (x=-55555)
290 */
291 static int lit8Test(int x) {
292
293 int[] results = new int[8];
294
295 /* try to generate op-int/lit8" instructions */
296 results[0] = x + 10;
297 results[1] = 10 - x;
298 results[2] = x * 10;
299 results[3] = x / 10;
300 results[4] = x % 10;
301 results[5] = x & 10;
302 results[6] = x | -10;
303 results[7] = x ^ -10;
304 int minInt = -2147483648;
305 int result = minInt / -1;
306 if (result != minInt) {return 1; }
307 if (results[0] != -55545) {return 2; }
308 if (results[1] != 55565) {return 3; }
309 if (results[2] != -555550) {return 4; }
310 if (results[3] != -5555) {return 5; }
311 if (results[4] != -5) {return 6; }
312 if (results[5] != 8) {return 7; }
313 if (results[6] != -1) {return 8; }
314 if (results[7] != 55563) {return 9; }
315 return 0;
316 }
317
318
319 /*
320 * Shift some data. (value=0xff00aa01, dist=8)
321 */
322 static int intShiftTest(int value, int dist) {
323 int results[] = new int[4];
324 results[0] = value << dist;
325 results[1] = value >> dist;
326 results[2] = value >>> dist;
327 results[3] = (((value << dist) >> dist) >>> dist) << dist;
328 if (results[0] != 0x00aa0100) {return 1; }
329 if (results[1] != 0xffff00aa) {return 2; }
330 if (results[2] != 0x00ff00aa) {return 3; }
331 if (results[3] != 0xaa00) {return 4; }
332 return 0;
333 }
334
335 /*
336 * We pass in the arguments and return the results so the compiler
337 * doesn't do the math for us. (x=70000000000, y=-3)
338 */
339 static int longOperTest(long x, long y) {
340 long[] results = new long[10];
341
342 /* this seems to generate "op-long" instructions */
343 results[0] = x + y;
344 results[1] = x - y;
345 results[2] = x * y;
346 results[3] = x * x;
347 results[4] = x / y;
348 results[5] = x % -y;
349 results[6] = x & y;
350 results[7] = x | y;
351 results[8] = x ^ y;
352 /* this seems to generate "op-long/2addr" instructions */
353 results[9] = x + ((((((((x + y) - y) * y) / y) % y) & y) | y) ^ y);
354 /* check this edge case while we're here (div-long/2addr) */
355 long minLong = -9223372036854775808L;
356 long negOne = -results[5];
357 long plusOne = 1;
358 long result = (((minLong + plusOne) - plusOne) / negOne) / negOne;
359 if (result != minLong) { return 1; }
360 if (results[0] != 69999999997L) { return 2; }
361 if (results[1] != 70000000003L) { return 3; }
362 if (results[2] != -210000000000L) { return 4; }
363 if (results[3] != -6833923606740729856L) { return 5; } // overflow
364 if (results[4] != -23333333333L) { return 6; }
365 if (results[5] != 1) { return 7; }
366 if (results[6] != 70000000000L) { return 8; }
367 if (results[7] != -3) { return 9; }
368 if (results[8] != -70000000003L) { return 10; }
369 if (results[9] != 70000000000L) { return 11; }
370 if (results.length != 10) { return 12; }
371 return 0;
372 }
373
374 /*
375 * Shift some data. (value=0xd5aa96deff00aa01, dist=16)
376 */
377 static long longShiftTest(long value, int dist) {
378 long results[] = new long[4];
379 results[0] = value << dist;
380 results[1] = value >> dist;
381 results[2] = value >>> dist;
382 results[3] = (((value << dist) >> dist) >>> dist) << dist;
383 if (results[0] != 0x96deff00aa010000L) { return results[0]; }
384 if (results[1] != 0xffffd5aa96deff00L) { return results[1]; }
385 if (results[2] != 0x0000d5aa96deff00L) { return results[2]; }
386 if (results[3] != 0xffff96deff000000L) { return results[3]; }
387 if (results.length != 4) { return 5; }
388
389 return results[0]; // test return-long
390 }
391
392 static int switchTest(int a) {
393 int res = 1234;
394
395 switch (a) {
396 case -1: res = 1; return res;
397 case 0: res = 2; return res;
398 case 1: /*correct*/ break;
399 case 2: res = 3; return res;
400 case 3: res = 4; return res;
401 case 4: res = 5; return res;
402 default: res = 6; return res;
403 }
404 switch (a) {
405 case 3: res = 7; return res;
406 case 4: res = 8; return res;
407 default: /*correct*/ break;
408 }
409
410 a = 0x12345678;
411
412 switch (a) {
413 case 0x12345678: /*correct*/ break;
414 case 0x12345679: res = 9; return res;
415 default: res = 1; return res;
416 }
417 switch (a) {
418 case 57: res = 10; return res;
419 case -6: res = 11; return res;
420 case 0x12345678: /*correct*/ break;
421 case 22: res = 12; return res;
422 case 3: res = 13; return res;
423 default: res = 14; return res;
424 }
425 switch (a) {
426 case -6: res = 15; return res;
427 case 3: res = 16; return res;
428 default: /*correct*/ break;
429 }
430
431 a = -5;
432 switch (a) {
433 case 12: res = 17; return res;
434 case -5: /*correct*/ break;
435 case 0: res = 18; return res;
436 default: res = 19; return res;
437 }
438
439 switch (a) {
440 default: /*correct*/ break;
441 }
442 return res;
443 }
444 /*
445 * Test the integer comparisons in various ways.
446 */
447 static int testIntCompare(int minus, int plus, int plus2, int zero) {
448 int res = 1111;
449
450 if (minus > plus)
451 return 1;
452 if (minus >= plus)
453 return 2;
454 if (plus < minus)
455 return 3;
456 if (plus <= minus)
457 return 4;
458 if (plus == minus)
459 return 5;
460 if (plus != plus2)
461 return 6;
462
463 /* try a branch-taken */
464 if (plus != minus) {
465 res = res;
466 } else {
467 return 7;
468 }
469
470 if (minus > 0)
471 return 8;
472 if (minus >= 0)
473 return 9;
474 if (plus < 0)
475 return 10;
476 if (plus <= 0)
477 return 11;
478 if (plus == 0)
479 return 12;
480 if (zero != 0)
481 return 13;
482
483 if (zero == 0) {
484 res = res;
485 } else {
486 return 14;
487 }
488 return res;
489 }
490
491 /*
492 * Test cmp-long.
493 *
494 * minus=-5, alsoMinus=0xFFFFFFFF00000009, plus=4, alsoPlus=8
495 */
496 static int testLongCompare(long minus, long alsoMinus, long plus,
497 long alsoPlus) {
498 int res = 2222;
499
500 if (minus > plus)
501 return 2;
502 if (plus < minus)
503 return 3;
504 if (plus == minus)
505 return 4;
506
507 if (plus >= plus+1)
508 return 5;
509 if (minus >= minus+1)
510 return 6;
511
512 /* try a branch-taken */
513 if (plus != minus) {
514 res = res;
515 } else {
516 return 7;
517 }
518
519 /* compare when high words are equal but low words differ */
520 if (plus > alsoPlus)
521 return 8;
522 if (alsoPlus < plus)
523 return 9;
524 if (alsoPlus == plus)
525 return 10;
526
527 /* high words are equal, low words have apparently different signs */
528 if (minus < alsoMinus) // bug!
529 return 11;
530 if (alsoMinus > minus)
531 return 12;
532 if (alsoMinus == minus)
533 return 13;
534
535 return res;
536 }
537
538 /*
539 * Test cmpl-float and cmpg-float.
540 */
541 static int testFloatCompare(float minus, float plus, float plus2,
542 float nan) {
543
544 int res = 3333;
545 if (minus > plus)
546 res = 1;
547 if (plus < minus)
548 res = 2;
549 if (plus == minus)
550 res = 3;
551 if (plus != plus2)
552 res = 4;
553
554 if (plus <= nan)
555 res = 5;
556 if (plus >= nan)
557 res = 6;
558 if (minus <= nan)
559 res = 7;
560 if (minus >= nan)
561 res = 8;
562 if (nan >= plus)
563 res = 9;
564 if (nan <= plus)
565 res = 10;
566
567 if (nan == nan)
568 res = 1212;
569
570 return res;
571 }
572
573 static int testDoubleCompare(double minus, double plus, double plus2,
574 double nan) {
575
576 int res = 4444;
577
578 if (minus > plus)
579 return 1;
580 if (plus < minus)
581 return 2;
582 if (plus == minus)
583 return 3;
584 if (plus != plus2)
585 return 4;
586
587 if (plus <= nan)
588 return 5;
589 if (plus >= nan)
590 return 6;
591 if (minus <= nan)
592 return 7;
593 if (minus >= nan)
594 return 8;
595 if (nan >= plus)
596 return 9;
597 if (nan <= plus)
598 return 10;
599
600 if (nan == nan)
601 return 11;
602 return res;
603 }
604
605 static int fibonacci(int n) {
606 if (n == 0) {
607 return 0;
608 } else if (n == 1) {
609 return 1;
610 } else {
611 return fibonacci(n - 1) + fibonacci(n - 2);
612 }
613 }
614
615 /*
616 static void throwNullPointerException() {
617 throw new NullPointerException("first throw");
618 }
619
620 static int throwAndCatch() {
621 try {
622 throwNullPointerException();
623 return 1;
624 } catch (NullPointerException npe) {
625 return 0;
626 }
627 }
628 */
629
630 static int manyArgs(int a0, long a1, int a2, long a3, int a4, long a5,
631 int a6, int a7, double a8, float a9, double a10, short a11, int a12,
632 char a13, int a14, int a15, byte a16, boolean a17, int a18, int a19,
633 long a20, long a21, int a22, int a23, int a24, int a25, int a26)
634 {
635 if (a0 != 0) return 0;
636 if (a1 != 1L) return 1;
637 if (a2 != 2) return 2;
638 if (a3 != 3L) return 3;
639 if (a4 != 4) return 4;
640 if (a5 != 5L) return 5;
641 if (a6 != 6) return 6;
642 if (a7 != 7) return 7;
643 if (a8 != 8.0) return 8;
644 if (a9 != 9.0f) return 9;
645 if (a10 != 10.0) return 10;
646 if (a11 != (short)11) return 11;
647 if (a12 != 12) return 12;
648 if (a13 != (char)13) return 13;
649 if (a14 != 14) return 14;
650 if (a15 != 15) return 15;
651 if (a16 != (byte)-16) return 16;
652 if (a17 != true) return 17;
653 if (a18 != 18) return 18;
654 if (a19 != 19) return 19;
655 if (a20 != 20L) return 20;
656 if (a21 != 21L) return 21;
657 if (a22 != 22) return 22;
658 if (a23 != 23) return 23;
659 if (a24 != 24) return 24;
660 if (a25 != 25) return 25;
661 if (a26 != 26) return 26;
662 return -1;
663 }
664
665 int virtualCall(int a)
666 {
667 return a * 2;
668 }
669
670 void setFoo(int a)
671 {
672 foo_ = a;
673 }
674
675 int getFoo()
676 {
677 return foo_;
678 }
679
680 static int staticCall(int a)
681 {
682 IntMath foo = new IntMath();
683 return foo.virtualCall(a);
684 }
685
686 static int testIGetPut(int a)
687 {
688 IntMath foo = new IntMath(99);
689 IntMath foo123 = new IntMath();
690 int z = foo.getFoo();
691 z += a;
692 z += foo123.getFoo();
693 foo.setFoo(z);
694 return foo.getFoo();
695 }
696
697 public static void main(String[] args) {
698 int res = unopTest(38);
699 if (res == 37) {
700 System.out.printf("unopTest PASSED\n");
701 } else {
702 System.out.printf("unopTest FAILED: %d\n", res);
703 }
704 res = shiftTest1();
705 if (res == 0) {
706 System.out.printf("shiftTest1 PASSED\n");
707 } else {
708 System.out.printf("shiftTest1 FAILED: %d\n", res);
709 }
710 res = shiftTest2();
711 if (res == 0) {
712 System.out.printf("shiftTest2 PASSED\n");
713 } else {
714 System.out.printf("shiftTest2 FAILED: %d\n", res);
715 }
716 res = unsignedShiftTest();
717 if (res == 0) {
718 System.out.printf("unsignedShiftTest PASSED\n");
719 } else {
720 System.out.printf("unsignedShiftTest FAILED: %d\n", res);
721 }
722 res = convTest();
723 if (res == 0) {
724 System.out.printf("convTest PASSED\n");
725 } else {
726 System.out.printf("convTest FAILED: %d\n", res);
727 }
728 res = charSubTest();
729 if (res == 0) {
730 System.out.printf("charSubTest PASSED\n");
731 } else {
732 System.out.printf("charSubTest FAILED: %d\n", res);
733 }
734 res = intOperTest(70000, -3);
735 if (res == 0) {
736 System.out.printf("intOperTest PASSED\n");
737 } else {
738 System.out.printf("intOperTest FAILED: %d\n", res);
739 }
740 res = longOperTest(70000000000L, -3L);
741 if (res == 0) {
742 System.out.printf("longOperTest PASSED\n");
743 } else {
744 System.out.printf("longOperTest FAILED: %d\n", res);
745 }
746 long lres = longShiftTest(0xd5aa96deff00aa01L, 16);
747 if (lres == 0x96deff00aa010000L) {
748 System.out.printf("longShiftTest PASSED\n");
749 } else {
750 System.out.printf("longShiftTest FAILED: %d\n", res);
751 }
752
753 res = switchTest(1);
754 if (res == 1234) {
755 System.out.printf("switchTest PASSED\n");
756 } else {
757 System.out.printf("switchTest FAILED: %d\n", res);
758 }
759
760 res = testIntCompare(-5, 4, 4, 0);
761 if (res == 1111) {
762 System.out.printf("testIntCompare PASSED\n");
763 } else {
764 System.out.printf("testIntCompare FAILED: %d\n", res);
765 }
766
767 res = testLongCompare(-5L, -4294967287L, 4L, 8L);
768 if (res == 2222) {
769 System.out.printf("testLongCompare PASSED\n");
770 } else {
771 System.out.printf("testLongCompare FAILED: %d\n", res);
772 }
773
774 res = testFloatCompare(-5.0f, 4.0f, 4.0f, (1.0f/0.0f) / (1.0f/0.0f));
775 if (res == 3333) {
776 System.out.printf("testFloatCompare PASSED\n");
777 } else {
778 System.out.printf("testFloatCompare FAILED: %d\n", res);
779 }
780
781 res = testDoubleCompare(-5.0, 4.0, 4.0, (1.0/0.0) / (1.0/0.0));
782 if (res == 4444) {
783 System.out.printf("testDoubleCompare PASSED\n");
784 } else {
785 System.out.printf("testDoubleCompare FAILED: %d\n", res);
786 }
787
788 res = fibonacci(10);
789 if (res == 55) {
790 System.out.printf("fibonacci PASSED\n");
791 } else {
792 System.out.printf("fibonacci FAILED: %d\n", res);
793 }
794
795 /*
796 res = throwAndCatch();
797 if (res == 0) {
798 System.out.printf("throwAndCatch PASSED\n");
799 } else {
800 System.out.printf("throwAndCatch FAILED: %d\n", res);
801 }
802 */
803
804 res = manyArgs(0, 1L, 2, 3L, 4, 5L, 6, 7, 8.0, 9.0f, 10.0,
805 (short)11, 12, (char)13, 14, 15, (byte)-16, true, 18,
806 19, 20L, 21L, 22, 23, 24, 25, 26);
807 if (res == -1) {
808 System.out.printf("manyArgs PASSED\n");
809 } else {
810 System.out.printf("manyArgs FAILED: %d\n", res);
811 }
812
813 res = staticCall(3);
814 if (res == 6) {
815 System.out.printf("virtualCall PASSED\n");
816 } else {
817 System.out.printf("virtualCall FAILED: %d\n", res);
818 }
819
820 res = testIGetPut(111);
821 if (res == 333) {
822 System.out.printf("testGetPut PASSED\n");
823 } else {
824 System.out.printf("testGetPut FAILED: %d\n", res);
825 }
826
827 res = staticFieldTest(404);
828 if (res == 1404) {
829 System.out.printf("staticFieldTest PASSED\n");
830 } else {
831 System.out.printf("staticFieldTest FAILED: %d\n", res);
832 }
buzbee1b4c8592011-08-31 10:43:51 -0700833
834 res = catchBlock(1000);
835 if (res == 1579) {
836 System.out.printf("catchBlock PASSED\n");
837 } else {
838 System.out.printf("catchBlock FAILED: %d\n", res);
839 }
Brian Carlstrom9f30b382011-08-28 22:41:38 -0700840 }
841}