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