1 /************************* test/jctest.java ************************************
3 Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
5 See file COPYRIGHT for information on usage and disclaimer of warranties
7 Eine Klasse zum Testen (fast) aller JavaVM-Instruktionen
8 in verschiedenen Konstellationen.
10 Die Ausgabe, die dieses Programm generiert, sollte bei allen
11 verschiedenen Java-Interpreter/Compiler-Systemen gleich
12 sein. Wenn nicht, dann ist wahrscheinlich eines der Systeme
15 Authors: Reinhard Grafl EMAIL: cacao@complang.tuwien.ac.at
17 Last Change: 1996/12/03
19 *******************************************************************************/
22 public class jctest implements jcinterface {
24 static long l1=123456789,l2=987654321,l3=-99999999999999L;
25 static int i2,i3=-100;
26 static float f1=0.1F,f2=0.2F,f3=0.3F;
27 static double d1=0.001,d2=0.002,d3=0.003;
28 static String s1,s2="der konstante String";
31 long n_l1,n_l2,n_l3,n_l4;
32 float n_f1,n_f2,n_f3,n_f4;
34 double n_d1,n_d2,n_d3,n_d4;
37 public static void main(String[] s) {
38 p ("=================== JavaVM - Tester ========================");
40 p ("------------------- test arguments");
42 for (i=0; i<s.length; i++) p(s[i]);
47 testspecialnullpointers();
50 p ("------------------- test consts");
53 testconst (-24123, -4918923241323L);
54 testconst (-243511, -4423423234231423L);
55 testconst (0x7fffffff, 0x7fffffffffffffffL);
56 testconst (0x80000000, 0x8000000000000000L);
58 p ("------------------- test div and rem consts");
60 testdivremconst(12347);
61 testdivremconst(8893427);
62 testdivremconst(1005234562);
64 testdivremconst(-12347);
65 testdivremconst(-8893427);
66 testdivremconst(-1005234562);
69 testdivremconst(12347L);
70 testdivremconst(8893427L);
71 testdivremconst(1005234562L);
72 testdivremconst(12135005234562L);
73 testdivremconst(2343552355623464626L);
74 testdivremconst(-17L);
75 testdivremconst(-12347L);
76 testdivremconst(-8893427L);
77 testdivremconst(-1005234562L);
78 testdivremconst(-12135005234562L);
79 testdivremconst(-2343552355623464626L);
81 p ("------------------- test rem 0x10001");
87 testrem0x10001(13247);
88 testrem0x10001(563467);
89 testrem0x10001(7456774);
90 testrem0x10001(34523525);
91 testrem0x10001(234523456);
92 testrem0x10001(1005234562);
93 testrem0x10001(2147483647);
97 testrem0x10001(-1234);
98 testrem0x10001(-13247);
99 testrem0x10001(-563467);
100 testrem0x10001(-7456774);
101 testrem0x10001(-34523525);
102 testrem0x10001(-234523456);
103 testrem0x10001(-1005234562);
104 testrem0x10001(-2147483647);
105 testrem0x10001(-2147483648);
110 testrem0x10001(123L);
111 testrem0x10001(1234L);
112 testrem0x10001(13247L);
113 testrem0x10001(563467L);
114 testrem0x10001(7456774L);
115 testrem0x10001(34523525L);
116 testrem0x10001(234523456L);
117 testrem0x10001(1005234562L);
118 testrem0x10001(1983223864L);
119 testrem0x10001(2147483646L);
120 testrem0x10001(2147483647L);
121 testrem0x10001(2147483648L);
122 testrem0x10001(10052234562L);
123 testrem0x10001(561005234562L);
124 testrem0x10001(2100527345962L);
125 testrem0x10001(34600523456287L);
126 testrem0x10001(546805234456882L);
127 testrem0x10001(1360052334734722L);
128 testrem0x10001(23456705569626354L);
129 testrem0x10001(9223372036854775807L);
131 testrem0x10001(-17L);
132 testrem0x10001(-123L);
133 testrem0x10001(-1234L);
134 testrem0x10001(-13247L);
135 testrem0x10001(-563467L);
136 testrem0x10001(-7456774L);
137 testrem0x10001(-34523525L);
138 testrem0x10001(-234523456L);
139 testrem0x10001(-1005234562L);
140 testrem0x10001(-1983223864L);
141 testrem0x10001(-2147483647L);
142 testrem0x10001(-2147483648L);
143 testrem0x10001(-10052234562L);
144 testrem0x10001(-561005234562L);
145 testrem0x10001(-2100527345962L);
146 testrem0x10001(-34600523456287L);
147 testrem0x10001(-546805234456882L);
148 testrem0x10001(-1360052334734722L);
149 testrem0x10001(-23456705569626354L);
150 testrem0x10001(-9223372036854775807L);
151 testrem0x10001(-9223372036854775808L);
153 p ("------------------- test ints");
156 testint (-24351,24123);
157 testint (4918923,-441423);
160 testint (1423487,123444444);
161 testint (0x7fffffff,1);
162 testint (0,0x7fffffff);
163 testint (0x3333,143444);
164 testint (4444441,12342);
166 p ("------------------- test longs");
169 testlong (-24351,24123);
170 testlong (4918923241323L,-4423423234231423L);
173 testlong (1423487,123444442344L);
174 testlong (0x7fffffffffffffffL,1);
175 testlong (0,0x7fffffffffffffffL);
176 testlong (0x3333,143444);
177 testlong (4444441,12342);
179 p ("------------------- test floats");
180 testfloat ((float) 1,(float) 2.042);
181 testfloat ((float) -1.234,(float) 17.44);
182 testfloat ((float) -24351,(float) 24123);
183 testfloat ((float) 0.1,(float) 1243);
184 testfloat ((float) 0.0,(float) -555.4132);
185 testfloat ((float) 77.0,(float) -555);
186 testfloat ((float) 2147483000.0,(float) -555234);
188 p ("------------------- test doubles");
189 testdouble (1,2.042);
190 testdouble (-1.234,17.44);
191 testdouble (-24351,24123);
192 testdouble (0.1,1243);
193 testdouble (0.0,-555.4132);
194 testdouble (77.0,-555);
195 testdouble (2147483000.0,-555234);
198 p ("=================== end of test =========================");
203 p ("successful initialisation");
208 public static void testgeneral() {
211 // ******************** basic data types *******************************
213 p ("------------------- test int-PUSH-STORE-LOAD");
215 p(j); p (0); p(2); p(17); p(-100);
216 p (500); p(-32768); p(-32769); p(32767); p(32768);
217 p (90000); p(-1000000000);
219 p ("------------------- test long-PUSH-STORE-LOAD");
221 p ( l ); p ( 0L ); p ( 99L );
222 p (500L); p(-32768L); p(-32769L); p(32767L); p(32768L);
223 p ( 6900000000000L ); p ( 349827389478173274L );
225 p ("------------------- test float-PUSH-STORE-LOAD");
227 p ( f ); p (0.0F); p (1.0F); p (342323423478.2223434234232334F);
229 p ("------------------- test double-PUSH-STORE-LOAD");
230 double d = 99234.42D;
231 p ( d ); p (0.0D); p (1.0D); p (342323423478.2223434234232334D);
234 // ******************** static variables *******************************
236 p ("------------------- test static variables");
240 p (i1); p(i2); p(i3);
241 p (l1); p(l2); p(l3);
242 p (f1); p(f2); p(f3);
243 p (d1); p(d2); p(d3);
245 // ******************** arithmetic test ********************************
247 p ("------------------- test arithmetic");
253 l1 = 0x7fffffffffffffffL;
256 p (l1+0x7fffffffffffffffL);
259 // ******************** test method calls ******************************
261 p ("statische methode");
262 jctest ttt = new jctest ();
263 ttt.p_manyparam (19,18,17,16, 88,77,66,55,
264 0.1F,0.2F,0.3F,0.4F, -2.0D,-3.0D,-4.0D,-5.0D );
265 jcinterface ttt2 = ttt;
266 ttt2.p_nonstatic ("interface method");
272 // ************************ test tables ************************************
274 public static void testtables() {
277 p ("------------------- test tableswitch");
279 for (i = -5; i < 15; i++) {
281 case 2: p ("-> 2"); break;
282 case 3: p ("-> 3"); break;
283 case 5: p ("-> 5"); break;
284 case 6: p ("-> 6"); break;
285 case 7: p ("-> 7"); break;
286 case 8: p ("-> 8"); break;
287 case 10: p ("-> 10"); break;
288 default: p ("default"); break;
292 p ("------------------- test lookupswitch");
294 for (i = -5; i < 15; i++) {
296 case 2: p ("-> 2"); break;
297 case 8: p ("-> 8"); break;
298 case 14: p ("-> 14"); break;
299 case -4: p ("-> -4"); break;
300 default: p ("default"); break;
306 // ****************** test type casts and array stores *********************
308 public static void testcasts() {
309 Object o = new Object();
310 Object oi = new Integer(0);
311 Object[] oa = new Object [1];
312 Object[] oia = new Integer[1];
313 Integer i = new Integer(0);
315 java.io.DataOutput dataout = null;
316 Object od = new java.io.DataOutputStream(
317 (java.io.DataOutputStream)dataout);
319 p ("------------------- test casts");
321 p("Integer is instanceof Object: ", oi instanceof Object);
322 p("Integer is instanceof Integer: ", oi instanceof Integer);
323 p("Object is instanceof Integer: ", o instanceof Integer);
326 p ("type cast check: Integer = Object(Integer)");
328 p ("type cast check: Integer = Object");
330 p ("error: class cast exception not thrown");
332 catch (ClassCastException c) {
333 p ("exception: class cast");
336 p("DataOutputStream is instanceof DataOutput: ",
337 od instanceof java.io.DataOutput);
338 p("Object is instanceof DataOutput: ", o instanceof java.io.DataOutput);
341 p ("type cast check: DataOutput = Object(DataOutputStream)");
342 dataout = (java.io.DataOutput) od;
343 p ("type cast check: DataOutput = Object");
344 dataout = (java.io.DataOutput) o;
345 p ("error: class cast exception not thrown");
347 catch (ClassCastException c) {
348 p ("exception: class cast");
352 p ("type cast check: Integer[] = Object(Integer)[]");
353 ia = (Integer[]) oia;
354 p ("type cast check: Integer[] = Object[]");
356 p ("error: class cast exception not thrown");
358 catch (ClassCastException c) {
359 p ("exception: class cast");
363 p ("array store check: Object(Integer)[0] = Integer");
365 p ("array store check: Object(Integer)[0] = Object");
367 p ("error: array store exception not thrown");
369 catch (ArrayStoreException c) {
370 p ("exception: array store");
375 // ****************** test special null pointers ***************************
377 public static void testspecialnullpointers() {
380 jcinterface f = null;
382 p ("------------------- test special null pointers");
385 p ("null pointer check: put field");
387 p ("error: put field null pointer exception not thrown");
389 catch (NullPointerException x) {
390 p ("exception: null pointer");
394 p ("null pointer check: get field");
396 p ("error: get field null pointer exception not thrown");
398 catch (NullPointerException x) {
399 p ("exception: null pointer");
403 p ("null pointer check: invokevirtual");
404 c.p_nonstatic("invokevirtual");
405 p ("error: invokevirtual null pointer exception not thrown");
407 catch (NullPointerException x) {
408 p ("exception: null pointer");
412 p ("null pointer check: invokeinterface");
413 f.p_nonstatic("invokeinterface");
414 p ("error: invokeinterface null pointer exception not thrown");
416 catch (NullPointerException x) {
417 p ("exception: null pointer");
421 p ("null pointer check: monitorenter");
423 p ("error: monitorenter null pointer exception not thrown");
426 catch (NullPointerException x) {
427 p ("exception: null pointer");
432 // ************************ test array bounds ******************************
434 public static void testarraybounds(byte[] ba, int i) {
435 p ("testarraybounds: " + (i - 10));
437 p ("testarraybounds: " + (i - 5));
439 p ("testarraybounds: " + (i));
441 p ("testarraybounds: " + (i + 5));
443 p ("testarraybounds: " + (i + 10));
448 // ************************ test arrays ************************************
450 public static void testarrays() {
457 p ("------------------- test byte arrays");
462 p ("null pointer check: byte array store");
464 p ("error: null pointer exception not thrown");
466 catch (NullPointerException c) {
467 p ("exception: null pointer");
470 p ("null pointer check: byte array load");
472 p ("error: null pointer exception not thrown");
474 catch (NullPointerException c) {
475 p ("exception: null pointer");
479 p ("negative array size check: byte array");
481 p ("error: negative array size exception not thrown");
483 catch (NegativeArraySizeException c) {
484 p ("exception: negative array size");
491 p ("array bound check: byte array store");
493 p ("error: exception not thrown");
495 catch (ArrayIndexOutOfBoundsException c) {
496 p ("exception_1: out of bounds: "+(-1));
499 p ("array bound check: byte array load");
501 p ("error: exception not thrown");
503 catch (ArrayIndexOutOfBoundsException c) {
504 p ("exception_2: out of bounds: "+(-1));
508 testarraybounds(ba, 5);
510 catch (ArrayIndexOutOfBoundsException c) {
511 p ("exception_3: out of bounds: "+5);
514 testarraybounds(ba, 50);
516 catch (ArrayIndexOutOfBoundsException c) {
517 p ("exception_4: out of bounds: "+50);
520 testarraybounds(ba, 100);
522 catch (ArrayIndexOutOfBoundsException c) {
523 p ("exception_5: out of bounds: "+100);
529 catch (ArrayIndexOutOfBoundsException c) {
530 p ("exception_6: out of bounds: "+(-4));
535 catch (ArrayIndexOutOfBoundsException c) {
536 p ("exception_7: out of bounds: "+(-3));
538 System.out.println("starting 8. loop");
540 for (i=-2; i<102; i++) {
542 ba[i] = (byte) (i-50);
544 catch (ArrayIndexOutOfBoundsException c) {
545 p ("exception_8: out of bounds: "+i);
552 catch (ArrayIndexOutOfBoundsException c) {
553 p ("exception_9: out of bounds: "+102);
558 catch (ArrayIndexOutOfBoundsException c) {
559 p ("exception_10: out of bounds: "+103);
561 for (i=0; i<100; i++) p (ba[i]);
566 p ("-------- test short arrays");
571 p ("null pointer check: short array store");
573 p ("error: null pointer exception not thrown");
575 catch (NullPointerException c) {
576 p ("exception: null pointer");
579 p ("null pointer check: short array load");
581 p ("error: null pointer exception not thrown");
583 catch (NullPointerException c) {
584 p ("exception: null pointer");
587 sa = new short [100];
590 p ("array bound check: short array store");
592 p ("error: exception not thrown");
594 catch (ArrayIndexOutOfBoundsException c) {
595 p ("exception_11: out of bounds: "+(-1));
598 p ("array bound check: short array load");
600 p ("error: exception not thrown");
602 catch (ArrayIndexOutOfBoundsException c) {
603 p ("exception_12: out of bounds: "+(-1));
606 for (i=0; i<100; i++) sa[i] = (short) (i-50);
607 for (i=0; i<100; i++) p (sa[i]);
611 p ("-------- test int arrays");
616 p ("null pointer check: int array store");
618 p ("error: null pointer exception not thrown");
620 catch (NullPointerException c) {
621 p ("exception: null pointer");
624 p ("null pointer check: int array load");
626 p ("error: null pointer exception not thrown");
628 catch (NullPointerException c) {
629 p ("exception: null pointer");
635 p ("array bound check: int array store");
637 p ("error: exception not thrown");
639 catch (ArrayIndexOutOfBoundsException c) {
640 p ("exception: out of bounds: "+(-1));
643 p ("array bound check: int array load");
645 p ("error: exception not thrown");
647 catch (ArrayIndexOutOfBoundsException c) {
648 p ("exception: out of bounds: "+(-1));
651 for (i=0; i<10; i++) ia[i] = (123456 + i);
652 for (i=0; i<10; i++) p (ia[i]);
656 p ("-------- test long arrays");
661 p ("null pointer check: long array store");
663 p ("error: null pointer exception not thrown");
665 catch (NullPointerException c) {
666 p ("exception: null pointer");
669 p ("null pointer check: long array load");
671 p ("error: null pointer exception not thrown");
673 catch (NullPointerException c) {
674 p ("exception: null pointer");
680 p ("array bound check: long array store");
682 p ("error: exception not thrown");
684 catch (ArrayIndexOutOfBoundsException c) {
685 p ("exception: out of bounds: "+(-1));
688 p ("array bound check: long array load");
690 p ("error: exception not thrown");
692 catch (ArrayIndexOutOfBoundsException c) {
693 p ("exception: out of bounds: "+(-1));
696 for (i=0; i<10; i++) la[i] = (1234567890123L + i);
697 for (i=0; i<10; i++) p (la[i]);
700 p ("-------- test char arrays");
705 p ("null pointer check: char array store");
707 p ("error: null pointer exception not thrown");
709 catch (NullPointerException c) {
710 p ("exception: null pointer");
713 p ("null pointer check: char array load");
715 p ("error: null pointer exception not thrown");
717 catch (NullPointerException c) {
718 p ("exception: null pointer");
724 p ("array bound check: char array store");
726 p ("error: exception not thrown");
728 catch (ArrayIndexOutOfBoundsException c) {
729 p ("exception: out of bounds: "+(-1));
732 p ("array bound check: char array load");
734 p ("error: exception not thrown");
736 catch (ArrayIndexOutOfBoundsException c) {
737 p ("exception: out of bounds: "+(-1));
740 for (i=0; i<50; i++) ca[i] = (char) ('A' + i);
741 for (i=0; i<50; i++) p (ca[i]);
743 p ("-------- test address arrays");
748 p ("null pointer check: address array store");
750 p ("error: null pointer exception not thrown");
752 catch (NullPointerException c) {
753 p ("exception: null pointer");
756 p ("null pointer check: address array load");
758 p ("error: null pointer exception not thrown");
760 catch (NullPointerException c) {
761 p ("exception: null pointer");
765 p ("negative array size check: address array");
766 sta = new String[-3];
767 p ("error: negative array size exception not thrown");
769 catch (NegativeArraySizeException c) {
770 p ("exception: negative array size");
776 p ("array bound check: address array store");
778 p ("error: exception not thrown");
780 catch (ArrayIndexOutOfBoundsException c) {
781 p ("exception: out of bounds: "+(-1));
784 p ("array bound check: address array load");
786 p ("error: exception not thrown");
788 catch (ArrayIndexOutOfBoundsException c) {
789 p ("exception: out of bounds: "+(-1));
792 for (i=0; i<5; i++) sta[i] = Integer.toString(i) + ". Zeile";
793 for (i=0; i<5; i++) p (sta[i]);
795 p ("-------- test multi dimensional arrays");
797 int [][][] iaaa = null;
800 p ("negative array size check: multi dimensional array");
801 iaaa = new int[2][3][-4];
802 p ("error: negative array size exception not thrown");
804 catch (NegativeArraySizeException c) {
805 p ("exception: negative array size");
808 iaaa = new int[2][3][4];
809 long [][][] laaa = new long[2][3][6];
810 float [][][] faaa = new float[2][3][4];
811 double [][][] daaa = new double[3][4][7];
812 for (i=0; i<2; i++) {
813 int i2; for (i2=0; i2<3; i2++) {
814 int i3; for (i3=0; i3<4; i3++) {
815 iaaa[i][i2][i3] = i*i*i + i2*i2 + i3;
816 laaa[i][i2][i3] = i*i*i + i2*i2 + i3 + 7;
817 faaa[i][i2][i3] = i*i*i + i2*i2 + i3 + 0.4F;
818 daaa[i][i2][i3] = i*i*i + i2*i2 + i3 - 47.0001;
831 static public void testconst(int i, long l) {
832 p ("TESTCONST CALLED WITH ", i);
835 if (!(i == (0))) p("not IF_ICMPEQ", (0));
836 if (!(i != (0))) p("not IF_ICMPNE", (0));
837 if (!(i < (0))) p("not IF_ICMPLT", (0));
838 if (!(i <= (0))) p("not IF_ICMPLE", (0));
839 if (!(i > (0))) p("not IF_ICMPGT", (0));
840 if (!(i >= (0))) p("not IF_ICMPGE", (0));
842 if (!(l == (0))) p("not IF_LCMPEQ", (0));
843 if (!(l != (0))) p("not IF_LCMPNE", (0));
844 if (!(l < (0))) p("not IF_LCMPLT", (0));
845 if (!(l <= (0))) p("not IF_LCMPLE", (0));
846 if (!(l > (0))) p("not IF_LCMPGT", (0));
847 if (!(l >= (0))) p("not IF_LCMPGE", (0));
849 p("IADDCONST: ", i + (-1));
850 p("ISUBCONST: ", i - (-1));
851 p("IMULCONST: ", i * (-1));
852 p("ISHLCONST: ", i << (-1));
853 p("ISHRCONST: ", i >> (-1));
854 p("IUSHRCONST: ", i >>> (-1));
855 p("IANDCONST: ", i & (-1));
856 p("IORCONST: ", i | (-1));
857 p("IXORCONST: ", i ^ (-1));
859 if (!(i == (-1))) p("not IF_ICMPEQ", (-1));
860 if (!(i != (-1))) p("not IF_ICMPNE", (-1));
861 if (!(i < (-1))) p("not IF_ICMPLT", (-1));
862 if (!(i <= (-1))) p("not IF_ICMPLE", (-1));
863 if (!(i > (-1))) p("not IF_ICMPGT", (-1));
864 if (!(i >= (-1))) p("not IF_ICMPGE", (-1));
866 p("LADDCONST: ", l + (-1));
867 p("LSUBCONST: ", l - (-1));
868 p("LMULCONST: ", l * (-1));
869 p("LSHLCONST: ", l << (-1));
870 p("LSHRCONST: ", l >> (-1));
871 p("LUSHRCONST: ", l >>> (-1));
872 p("LANDCONST: ", l & (-1));
873 p("LORCONST: ", l | (-1));
874 p("LXORCONST: ", l ^ (-1));
876 if (!(l == (-1))) p("not IF_LCMPEQ", (-1));
877 if (!(l != (-1))) p("not IF_LCMPNE", (-1));
878 if (!(l < (-1))) p("not IF_LCMPLT", (-1));
879 if (!(l <= (-1))) p("not IF_LCMPLE", (-1));
880 if (!(l > (-1))) p("not IF_LCMPGT", (-1));
881 if (!(l >= (-1))) p("not IF_LCMPGE", (-1));
883 p("IADDCONST: ", i + (1));
884 p("ISUBCONST: ", i - (1));
885 p("IMULCONST: ", i * (1));
886 p("ISHLCONST: ", i << (1));
887 p("ISHRCONST: ", i >> (1));
888 p("IUSHRCONST: ", i >>> (1));
889 p("IANDCONST: ", i & (1));
890 p("IORCONST: ", i | (1));
891 p("IXORCONST: ", i ^ (1));
893 if (!(i == (1))) p("not IF_ICMPEQ", (1));
894 if (!(i != (1))) p("not IF_ICMPNE", (1));
895 if (!(i < (1))) p("not IF_ICMPLT", (1));
896 if (!(i <= (1))) p("not IF_ICMPLE", (1));
897 if (!(i > (1))) p("not IF_ICMPGT", (1));
898 if (!(i >= (1))) p("not IF_ICMPGE", (1));
900 p("LADDCONST: ", l + (1));
901 p("LSUBCONST: ", l - (1));
902 p("LMULCONST: ", l * (1));
903 p("LSHLCONST: ", l << (1));
904 p("LSHRCONST: ", l >> (1));
905 p("LUSHRCONST: ", l >>> (1));
906 p("LANDCONST: ", l & (1));
907 p("LORCONST: ", l | (1));
908 p("LXORCONST: ", l ^ (1));
910 if (!(l == (1))) p("not IF_LCMPEQ", (1));
911 if (!(l != (1))) p("not IF_LCMPNE", (1));
912 if (!(l < (1))) p("not IF_LCMPLT", (1));
913 if (!(l <= (1))) p("not IF_LCMPLE", (1));
914 if (!(l > (1))) p("not IF_LCMPGT", (1));
915 if (!(l >= (1))) p("not IF_LCMPGE", (1));
917 p("IADDCONST: ", i + (255));
918 p("ISUBCONST: ", i - (255));
919 p("IMULCONST: ", i * (255));
920 p("ISHLCONST: ", i << (255));
921 p("ISHRCONST: ", i >> (255));
922 p("IUSHRCONST: ", i >>> (255));
923 p("IANDCONST: ", i & (255));
924 p("IORCONST: ", i | (255));
925 p("IXORCONST: ", i ^ (255));
927 if (!(i == (255))) p("not IF_ICMPEQ", (255));
928 if (!(i != (255))) p("not IF_ICMPNE", (255));
929 if (!(i < (255))) p("not IF_ICMPLT", (255));
930 if (!(i <= (255))) p("not IF_ICMPLE", (255));
931 if (!(i > (255))) p("not IF_ICMPGT", (255));
932 if (!(i >= (255))) p("not IF_ICMPGE", (255));
934 p("LADDCONST: ", l + (255));
935 p("LSUBCONST: ", l - (255));
936 p("LMULCONST: ", l * (255));
937 p("LSHLCONST: ", l << (255));
938 p("LSHRCONST: ", l >> (255));
939 p("LUSHRCONST: ", l >>> (255));
940 p("LANDCONST: ", l & (255));
941 p("LORCONST: ", l | (255));
942 p("LXORCONST: ", l ^ (255));
944 if (!(l == (255))) p("not IF_LCMPEQ", (255));
945 if (!(l != (255))) p("not IF_LCMPNE", (255));
946 if (!(l < (255))) p("not IF_LCMPLT", (255));
947 if (!(l <= (255))) p("not IF_LCMPLE", (255));
948 if (!(l > (255))) p("not IF_LCMPGT", (255));
949 if (!(l >= (255))) p("not IF_LCMPGE", (255));
951 p("IADDCONST: ", i + (256));
952 p("ISUBCONST: ", i - (256));
953 p("IMULCONST: ", i * (256));
954 p("ISHLCONST: ", i << (256));
955 p("ISHRCONST: ", i >> (256));
956 p("IUSHRCONST: ", i >>> (256));
957 p("IANDCONST: ", i & (256));
958 p("IORCONST: ", i | (256));
959 p("IXORCONST: ", i ^ (256));
961 if (!(i == (256))) p("not IF_ICMPEQ", (256));
962 if (!(i != (256))) p("not IF_ICMPNE", (256));
963 if (!(i < (256))) p("not IF_ICMPLT", (256));
964 if (!(i <= (256))) p("not IF_ICMPLE", (256));
965 if (!(i > (256))) p("not IF_ICMPGT", (256));
966 if (!(i >= (256))) p("not IF_ICMPGE", (256));
968 p("LADDCONST: ", l + (256));
969 p("LSUBCONST: ", l - (256));
970 p("LMULCONST: ", l * (256));
971 p("LSHLCONST: ", l << (256));
972 p("LSHRCONST: ", l >> (256));
973 p("LUSHRCONST: ", l >>> (256));
974 p("LANDCONST: ", l & (256));
975 p("LORCONST: ", l | (256));
976 p("LXORCONST: ", l ^ (256));
978 if (!(l == (256))) p("not IF_LCMPEQ", (256));
979 if (!(l != (256))) p("not IF_LCMPNE", (256));
980 if (!(l < (256))) p("not IF_LCMPLT", (256));
981 if (!(l <= (256))) p("not IF_LCMPLE", (256));
982 if (!(l > (256))) p("not IF_LCMPGT", (256));
983 if (!(l >= (256))) p("not IF_LCMPGE", (256));
985 p("IADDCONST: ", i + (32767));
986 p("ISUBCONST: ", i - (32767));
987 p("IMULCONST: ", i * (32767));
988 p("ISHLCONST: ", i << (32767));
989 p("ISHRCONST: ", i >> (32767));
990 p("IUSHRCONST: ", i >>> (32767));
991 p("IANDCONST: ", i & (32767));
992 p("IORCONST: ", i | (32767));
993 p("IXORCONST: ", i ^ (32767));
995 if (!(i == (32767))) p("not IF_ICMPEQ", (32767));
996 if (!(i != (32767))) p("not IF_ICMPNE", (32767));
997 if (!(i < (32767))) p("not IF_ICMPLT", (32767));
998 if (!(i <= (32767))) p("not IF_ICMPLE", (32767));
999 if (!(i > (32767))) p("not IF_ICMPGT", (32767));
1000 if (!(i >= (32767))) p("not IF_ICMPGE", (32767));
1002 p("LADDCONST: ", l + (32767));
1003 p("LSUBCONST: ", l - (32767));
1004 p("LMULCONST: ", l * (32767));
1005 p("LSHLCONST: ", l << (32767));
1006 p("LSHRCONST: ", l >> (32767));
1007 p("LUSHRCONST: ", l >>> (32767));
1008 p("LANDCONST: ", l & (32767));
1009 p("LORCONST: ", l | (32767));
1010 p("LXORCONST: ", l ^ (32767));
1012 if (!(l == (32767))) p("not IF_LCMPEQ", (32767));
1013 if (!(l != (32767))) p("not IF_LCMPNE", (32767));
1014 if (!(l < (32767))) p("not IF_LCMPLT", (32767));
1015 if (!(l <= (32767))) p("not IF_LCMPLE", (32767));
1016 if (!(l > (32767))) p("not IF_LCMPGT", (32767));
1017 if (!(l >= (32767))) p("not IF_LCMPGE", (32767));
1019 p("IADDCONST: ", i + (32768));
1020 p("ISUBCONST: ", i - (32768));
1021 p("IMULCONST: ", i * (32768));
1022 p("ISHLCONST: ", i << (32768));
1023 p("ISHRCONST: ", i >> (32768));
1024 p("IUSHRCONST: ", i >>> (32768));
1025 p("IANDCONST: ", i & (32768));
1026 p("IORCONST: ", i | (32768));
1027 p("IXORCONST: ", i ^ (32768));
1029 if (!(i == (32768))) p("not IF_ICMPEQ", (32768));
1030 if (!(i != (32768))) p("not IF_ICMPNE", (32768));
1031 if (!(i < (32768))) p("not IF_ICMPLT", (32768));
1032 if (!(i <= (32768))) p("not IF_ICMPLE", (32768));
1033 if (!(i > (32768))) p("not IF_ICMPGT", (32768));
1034 if (!(i >= (32768))) p("not IF_ICMPGE", (32768));
1036 p("LADDCONST: ", l + (32768));
1037 p("LSUBCONST: ", l - (32768));
1038 p("LMULCONST: ", l * (32768));
1039 p("LSHLCONST: ", l << (32768));
1040 p("LSHRCONST: ", l >> (32768));
1041 p("LUSHRCONST: ", l >>> (32768));
1042 p("LANDCONST: ", l & (32768));
1043 p("LORCONST: ", l | (32768));
1044 p("LXORCONST: ", l ^ (32768));
1046 if (!(l == (32768))) p("not IF_LCMPEQ", (32768));
1047 if (!(l != (32768))) p("not IF_LCMPNE", (32768));
1048 if (!(l < (32768))) p("not IF_LCMPLT", (32768));
1049 if (!(l <= (32768))) p("not IF_LCMPLE", (32768));
1050 if (!(l > (32768))) p("not IF_LCMPGT", (32768));
1051 if (!(l >= (32768))) p("not IF_LCMPGE", (32768));
1053 p("IADDCONST: ", i + (-32768));
1054 p("ISUBCONST: ", i - (-32768));
1055 p("IMULCONST: ", i * (-32768));
1056 p("ISHLCONST: ", i << (-32768));
1057 p("ISHRCONST: ", i >> (-32768));
1058 p("IUSHRCONST: ", i >>> (-32768));
1059 p("IANDCONST: ", i & (-32768));
1060 p("IORCONST: ", i | (-32768));
1061 p("IXORCONST: ", i ^ (-32768));
1063 if (!(i == (-32768))) p("not IF_ICMPEQ", (-32768));
1064 if (!(i != (-32768))) p("not IF_ICMPNE", (-32768));
1065 if (!(i < (-32768))) p("not IF_ICMPLT", (-32768));
1066 if (!(i <= (-32768))) p("not IF_ICMPLE", (-32768));
1067 if (!(i > (-32768))) p("not IF_ICMPGT", (-32768));
1068 if (!(i >= (-32768))) p("not IF_ICMPGE", (-32768));
1070 p("LADDCONST: ", l + (-32768));
1071 p("LSUBCONST: ", l - (-32768));
1072 p("LMULCONST: ", l * (-32768));
1073 p("LSHLCONST: ", l << (-32768));
1074 p("LSHRCONST: ", l >> (-32768));
1075 p("LUSHRCONST: ", l >>> (-32768));
1076 p("LANDCONST: ", l & (-32768));
1077 p("LORCONST: ", l | (-32768));
1078 p("LXORCONST: ", l ^ (-32768));
1080 if (!(l == (-32768))) p("not IF_LCMPEQ", (-32768));
1081 if (!(l != (-32768))) p("not IF_LCMPNE", (-32768));
1082 if (!(l < (-32768))) p("not IF_LCMPLT", (-32768));
1083 if (!(l <= (-32768))) p("not IF_LCMPLE", (-32768));
1084 if (!(l > (-32768))) p("not IF_LCMPGT", (-32768));
1085 if (!(l >= (-32768))) p("not IF_LCMPGE", (-32768));
1087 p("IADDCONST: ", i + (-32769));
1088 p("ISUBCONST: ", i - (-32769));
1089 p("IMULCONST: ", i * (-32769));
1090 p("ISHLCONST: ", i << (-32769));
1091 p("ISHRCONST: ", i >> (-32769));
1092 p("IUSHRCONST: ", i >>> (-32769));
1093 p("IANDCONST: ", i & (-32769));
1094 p("IORCONST: ", i | (-32769));
1095 p("IXORCONST: ", i ^ (-32769));
1097 if (!(i == (-32769))) p("not IF_ICMPEQ", (-32769));
1098 if (!(i != (-32769))) p("not IF_ICMPNE", (-32769));
1099 if (!(i < (-32769))) p("not IF_ICMPLT", (-32769));
1100 if (!(i <= (-32769))) p("not IF_ICMPLE", (-32769));
1101 if (!(i > (-32769))) p("not IF_ICMPGT", (-32769));
1102 if (!(i >= (-32769))) p("not IF_ICMPGE", (-32769));
1104 p("LADDCONST: ", l + (-32769));
1105 p("LSUBCONST: ", l - (-32769));
1106 p("LMULCONST: ", l * (-32769));
1107 p("LSHLCONST: ", l << (-32769));
1108 p("LSHRCONST: ", l >> (-32769));
1109 p("LUSHRCONST: ", l >>> (-32769));
1110 p("LANDCONST: ", l & (-32769));
1111 p("LORCONST: ", l | (-32769));
1112 p("LXORCONST: ", l ^ (-32769));
1114 if (!(l == (-32769))) p("not IF_LCMPEQ", (-32769));
1115 if (!(l != (-32769))) p("not IF_LCMPNE", (-32769));
1116 if (!(l < (-32769))) p("not IF_LCMPLT", (-32769));
1117 if (!(l <= (-32769))) p("not IF_LCMPLE", (-32769));
1118 if (!(l > (-32769))) p("not IF_LCMPGT", (-32769));
1119 if (!(l >= (-32769))) p("not IF_LCMPGE", (-32769));
1123 static public void testrem0x10001(int a) {
1124 p("IREM0X10001 (" + a + " % 0x10001): ", a % 0x10001);
1127 static public void testrem0x10001(long a) {
1128 p("LREM0X10001 (" + a + " % 0x10001): ", a % 0x10001L);
1131 static public void testdivremconst(int a) {
1132 p("IDIVPOW2 (" + a + " / 0x00000002): ", a / 0x00000002);
1133 p("IDIVPOW2 (" + a + " / 0x00000004): ", a / 0x00000004);
1134 p("IDIVPOW2 (" + a + " / 0x00000008): ", a / 0x00000008);
1135 p("IDIVPOW2 (" + a + " / 0x00000010): ", a / 0x00000010);
1136 p("IDIVPOW2 (" + a + " / 0x00000020): ", a / 0x00000020);
1137 p("IDIVPOW2 (" + a + " / 0x00000040): ", a / 0x00000040);
1138 p("IDIVPOW2 (" + a + " / 0x00000080): ", a / 0x00000080);
1139 p("IDIVPOW2 (" + a + " / 0x00000100): ", a / 0x00000100);
1140 p("IDIVPOW2 (" + a + " / 0x00000200): ", a / 0x00000200);
1141 p("IDIVPOW2 (" + a + " / 0x00000400): ", a / 0x00000400);
1142 p("IDIVPOW2 (" + a + " / 0x00000800): ", a / 0x00000800);
1143 p("IDIVPOW2 (" + a + " / 0x00001000): ", a / 0x00001000);
1144 p("IDIVPOW2 (" + a + " / 0x00002000): ", a / 0x00002000);
1145 p("IDIVPOW2 (" + a + " / 0x00004000): ", a / 0x00004000);
1146 p("IDIVPOW2 (" + a + " / 0x00008000): ", a / 0x00008000);
1147 p("IDIVPOW2 (" + a + " / 0x00010000): ", a / 0x00010000);
1148 p("IDIVPOW2 (" + a + " / 0x00020000): ", a / 0x00020000);
1149 p("IDIVPOW2 (" + a + " / 0x00040000): ", a / 0x00040000);
1150 p("IDIVPOW2 (" + a + " / 0x00080000): ", a / 0x00080000);
1151 p("IDIVPOW2 (" + a + " / 0x00100000): ", a / 0x00100000);
1152 p("IDIVPOW2 (" + a + " / 0x00200000): ", a / 0x00200000);
1153 p("IDIVPOW2 (" + a + " / 0x00400000): ", a / 0x00400000);
1154 p("IDIVPOW2 (" + a + " / 0x00800000): ", a / 0x00800000);
1155 p("IDIVPOW2 (" + a + " / 0x01000000): ", a / 0x01000000);
1156 p("IDIVPOW2 (" + a + " / 0x02000000): ", a / 0x02000000);
1157 p("IDIVPOW2 (" + a + " / 0x04000000): ", a / 0x04000000);
1158 p("IDIVPOW2 (" + a + " / 0x08000000): ", a / 0x08000000);
1159 p("IDIVPOW2 (" + a + " / 0x10000000): ", a / 0x10000000);
1160 p("IDIVPOW2 (" + a + " / 0x20000000): ", a / 0x20000000);
1161 p("IDIVPOW2 (" + a + " / 0x40000000): ", a / 0x40000000);
1162 p("IDIVPOW2 (" + a + " / 0x80000000): ", a / 0x80000000);
1164 p("IREMPOW2 (" + a + " % 0x00000002): ", a % 0x00000002);
1165 p("IREMPOW2 (" + a + " % 0x00000004): ", a % 0x00000004);
1166 p("IREMPOW2 (" + a + " % 0x00000008): ", a % 0x00000008);
1167 p("IREMPOW2 (" + a + " % 0x00000010): ", a % 0x00000010);
1168 p("IREMPOW2 (" + a + " % 0x00000020): ", a % 0x00000020);
1169 p("IREMPOW2 (" + a + " % 0x00000040): ", a % 0x00000040);
1170 p("IREMPOW2 (" + a + " % 0x00000080): ", a % 0x00000080);
1171 p("IREMPOW2 (" + a + " % 0x00000100): ", a % 0x00000100);
1172 p("IREMPOW2 (" + a + " % 0x00000200): ", a % 0x00000200);
1173 p("IREMPOW2 (" + a + " % 0x00000400): ", a % 0x00000400);
1174 p("IREMPOW2 (" + a + " % 0x00000800): ", a % 0x00000800);
1175 p("IREMPOW2 (" + a + " % 0x00001000): ", a % 0x00001000);
1176 p("IREMPOW2 (" + a + " % 0x00002000): ", a % 0x00002000);
1177 p("IREMPOW2 (" + a + " % 0x00004000): ", a % 0x00004000);
1178 p("IREMPOW2 (" + a + " % 0x00008000): ", a % 0x00008000);
1179 p("IREMPOW2 (" + a + " % 0x00010000): ", a % 0x00010000);
1180 p("IREMPOW2 (" + a + " % 0x00020000): ", a % 0x00020000);
1181 p("IREMPOW2 (" + a + " % 0x00040000): ", a % 0x00040000);
1182 p("IREMPOW2 (" + a + " % 0x00080000): ", a % 0x00080000);
1183 p("IREMPOW2 (" + a + " % 0x00100000): ", a % 0x00100000);
1184 p("IREMPOW2 (" + a + " % 0x00200000): ", a % 0x00200000);
1185 p("IREMPOW2 (" + a + " % 0x00400000): ", a % 0x00400000);
1186 p("IREMPOW2 (" + a + " % 0x00800000): ", a % 0x00800000);
1187 p("IREMPOW2 (" + a + " % 0x01000000): ", a % 0x01000000);
1188 p("IREMPOW2 (" + a + " % 0x02000000): ", a % 0x02000000);
1189 p("IREMPOW2 (" + a + " % 0x04000000): ", a % 0x04000000);
1190 p("IREMPOW2 (" + a + " % 0x08000000): ", a % 0x08000000);
1191 p("IREMPOW2 (" + a + " % 0x10000000): ", a % 0x10000000);
1192 p("IREMPOW2 (" + a + " % 0x20000000): ", a % 0x20000000);
1193 p("IREMPOW2 (" + a + " % 0x40000000): ", a % 0x40000000);
1194 p("IREMPOW2 (" + a + " % 0x80000000): ", a % 0x80000000);
1197 static public void testdivremconst(long a) {
1198 p("LDIVPOW2 (" + a + " / 0x00000002): ", a / 0x00000002);
1199 p("LDIVPOW2 (" + a + " / 0x00000004): ", a / 0x00000004);
1200 p("LDIVPOW2 (" + a + " / 0x00000008): ", a / 0x00000008);
1201 p("LDIVPOW2 (" + a + " / 0x00000010): ", a / 0x00000010);
1202 p("LDIVPOW2 (" + a + " / 0x00000020): ", a / 0x00000020);
1203 p("LDIVPOW2 (" + a + " / 0x00000040): ", a / 0x00000040);
1204 p("LDIVPOW2 (" + a + " / 0x00000080): ", a / 0x00000080);
1205 p("LDIVPOW2 (" + a + " / 0x00000100): ", a / 0x00000100);
1206 p("LDIVPOW2 (" + a + " / 0x00000200): ", a / 0x00000200);
1207 p("LDIVPOW2 (" + a + " / 0x00000400): ", a / 0x00000400);
1208 p("LDIVPOW2 (" + a + " / 0x00000800): ", a / 0x00000800);
1209 p("LDIVPOW2 (" + a + " / 0x00001000): ", a / 0x00001000);
1210 p("LDIVPOW2 (" + a + " / 0x00002000): ", a / 0x00002000);
1211 p("LDIVPOW2 (" + a + " / 0x00004000): ", a / 0x00004000);
1212 p("LDIVPOW2 (" + a + " / 0x00008000): ", a / 0x00008000);
1213 p("LDIVPOW2 (" + a + " / 0x00010000): ", a / 0x00010000);
1214 p("LDIVPOW2 (" + a + " / 0x00020000): ", a / 0x00020000);
1215 p("LDIVPOW2 (" + a + " / 0x00040000): ", a / 0x00040000);
1216 p("LDIVPOW2 (" + a + " / 0x00080000): ", a / 0x00080000);
1217 p("LDIVPOW2 (" + a + " / 0x00100000): ", a / 0x00100000);
1218 p("LDIVPOW2 (" + a + " / 0x00200000): ", a / 0x00200000);
1219 p("LDIVPOW2 (" + a + " / 0x00400000): ", a / 0x00400000);
1220 p("LDIVPOW2 (" + a + " / 0x00800000): ", a / 0x00800000);
1221 p("LDIVPOW2 (" + a + " / 0x01000000): ", a / 0x01000000);
1222 p("LDIVPOW2 (" + a + " / 0x02000000): ", a / 0x02000000);
1223 p("LDIVPOW2 (" + a + " / 0x04000000): ", a / 0x04000000);
1224 p("LDIVPOW2 (" + a + " / 0x08000000): ", a / 0x08000000);
1225 p("LDIVPOW2 (" + a + " / 0x10000000): ", a / 0x10000000);
1226 p("LDIVPOW2 (" + a + " / 0x20000000): ", a / 0x20000000);
1227 p("LDIVPOW2 (" + a + " / 0x40000000): ", a / 0x40000000);
1228 p("LDIVPOW2 (" + a + " / 0x80000000): ", a / 0x80000000);
1230 p("LREMPOW2 (" + a + " % 0x00000002): ", a % 0x00000002L);
1231 p("LREMPOW2 (" + a + " % 0x00000004): ", a % 0x00000004L);
1232 p("LREMPOW2 (" + a + " % 0x00000008): ", a % 0x00000008L);
1233 p("LREMPOW2 (" + a + " % 0x00000010): ", a % 0x00000010L);
1234 p("LREMPOW2 (" + a + " % 0x00000020): ", a % 0x00000020L);
1235 p("LREMPOW2 (" + a + " % 0x00000040): ", a % 0x00000040L);
1236 p("LREMPOW2 (" + a + " % 0x00000080): ", a % 0x00000080L);
1237 p("LREMPOW2 (" + a + " % 0x00000100): ", a % 0x00000100L);
1238 p("LREMPOW2 (" + a + " % 0x00000200): ", a % 0x00000200L);
1239 p("LREMPOW2 (" + a + " % 0x00000400): ", a % 0x00000400L);
1240 p("LREMPOW2 (" + a + " % 0x00000800): ", a % 0x00000800L);
1241 p("LREMPOW2 (" + a + " % 0x00001000): ", a % 0x00001000L);
1242 p("LREMPOW2 (" + a + " % 0x00002000): ", a % 0x00002000L);
1243 p("LREMPOW2 (" + a + " % 0x00004000): ", a % 0x00004000L);
1244 p("LREMPOW2 (" + a + " % 0x00008000): ", a % 0x00008000L);
1245 p("LREMPOW2 (" + a + " % 0x00010000): ", a % 0x00010000L);
1246 p("LREMPOW2 (" + a + " % 0x00020000): ", a % 0x00020000L);
1247 p("LREMPOW2 (" + a + " % 0x00040000): ", a % 0x00040000L);
1248 p("LREMPOW2 (" + a + " % 0x00080000): ", a % 0x00080000L);
1249 p("LREMPOW2 (" + a + " % 0x00100000): ", a % 0x00100000L);
1250 p("LREMPOW2 (" + a + " % 0x00200000): ", a % 0x00200000L);
1251 p("LREMPOW2 (" + a + " % 0x00400000): ", a % 0x00400000L);
1252 p("LREMPOW2 (" + a + " % 0x00800000): ", a % 0x00800000L);
1253 p("LREMPOW2 (" + a + " % 0x01000000): ", a % 0x01000000L);
1254 p("LREMPOW2 (" + a + " % 0x02000000): ", a % 0x02000000L);
1255 p("LREMPOW2 (" + a + " % 0x04000000): ", a % 0x04000000L);
1256 p("LREMPOW2 (" + a + " % 0x08000000): ", a % 0x08000000L);
1257 p("LREMPOW2 (" + a + " % 0x10000000): ", a % 0x10000000L);
1258 p("LREMPOW2 (" + a + " % 0x20000000): ", a % 0x20000000L);
1259 p("LREMPOW2 (" + a + " % 0x40000000): ", a % 0x40000000L);
1260 p("LREMPOW2 (" + a + " % 0x80000000): ", a % 0x80000000L);
1264 static public void testint(int a, int b) {
1265 p ("TESTINT CALLED WITH ", a);
1271 try { p("IDIV: ", a/b); }
1272 catch (ArithmeticException e) { p("divison by zero"); }
1273 try { p("IREM: ", a%b); }
1274 catch (ArithmeticException e) { p("divison by zero"); }
1278 p("IUSHR: ", a>>>b);
1283 p("I2L: ", (long) a);
1284 p("I2F: ", (float) a);
1285 p("I2D: ", (double) a);
1286 p("INT2BYTE: ", (byte) a);
1287 p("INT2CHAR: ", (char) a);
1288 p("INT2SHORT: ", (short) a);
1290 if (!(a==0)) p("not IFEQ");
1291 if (!(a!=0)) p("not IFNE");
1292 if (!(a<0)) p("not IFLT");
1293 if (!(a<=0)) p("not IFLE");
1294 if (!(a>0)) p("not IFGT");
1295 if (!(a>=0)) p("not IFGE");
1297 if (!(a==b)) p("not IF_ICMPEQ");
1298 if (!(a!=b)) p("not IF_ICMPNE");
1299 if (!(a<b)) p("not IF_ICMPLT");
1300 if (!(a<=b)) p("not IF_ICMPLE");
1301 if (!(a>b)) p("not IF_ICMPGT");
1302 if (!(a>=b)) p("not IF_ICMPGE");
1304 p("COND_ICMPEQ " + a + " == 0: " + ((a == 0) ? 0 : 1));
1305 p("COND_ICMPNE " + a + " != 0: " + ((a != 0) ? 0 : 1));
1306 p("COND_ICMPLT " + a + " < 0: " + ((a < 0) ? 0 : 1));
1307 p("COND_ICMPLE " + a + " <= 0: " + ((a <= 0) ? 0 : 1));
1308 p("COND_ICMPGT " + a + " > 0: " + ((a > 0) ? 0 : 1));
1309 p("COND_ICMPGE " + a + " >= 0: " + ((a >= 0) ? 0 : 1));
1311 p("COND_ICMPEQ " + a + " == 0: " + ((a == 0) ? 1 : 0));
1312 p("COND_ICMPNE " + a + " != 0: " + ((a != 0) ? 1 : 0));
1313 p("COND_ICMPLT " + a + " < 0: " + ((a < 0) ? 1 : 0));
1314 p("COND_ICMPLE " + a + " <= 0: " + ((a <= 0) ? 1 : 0));
1315 p("COND_ICMPGT " + a + " > 0: " + ((a > 0) ? 1 : 0));
1316 p("COND_ICMPGE " + a + " >= 0: " + ((a >= 0) ? 1 : 0));
1318 p("COND_ICMPEQ " + a + " == 0: " + ((a == 0) ? 2 : 3));
1319 p("COND_ICMPNE " + a + " != 0: " + ((a != 0) ? 2 : 3));
1320 p("COND_ICMPLT " + a + " < 0: " + ((a < 0) ? 2 : 3));
1321 p("COND_ICMPLE " + a + " <= 0: " + ((a <= 0) ? 2 : 3));
1322 p("COND_ICMPGT " + a + " > 0: " + ((a > 0) ? 2 : 3));
1323 p("COND_ICMPGE " + a + " >= 0: " + ((a >= 0) ? 2 : 3));
1325 p("COND_ICMPEQ " + a + " == " + b + ": " + (a == b));
1326 p("COND_ICMPNE " + a + " != " + b + ": " + (a != b));
1327 p("COND_ICMPLT " + a + " < " + b + ": " + (a < b));
1328 p("COND_ICMPLE " + a + " <= " + b + ": " + (a <= b));
1329 p("COND_ICMPGT " + a + " > " + b + ": " + (a > b));
1330 p("COND_ICMPGE " + a + " >= " + b + ": " + (a >= b));
1334 static public void testlong(long a, long b) {
1335 p ("TESTLONG called with ", a);
1341 try { p("LDIV: ", a / b); }
1342 catch (ArithmeticException e) { p("divison by zero"); }
1343 try { p("LREM: ", a % b); }
1344 catch (ArithmeticException e) { p("divison by zero"); }
1346 p("LSHL: ", a << b);
1347 p("LSHR: ", a >> b);
1348 p("LUSHR: ", a >>>b);
1353 p("L2I: ", (int) a);
1354 p("L2F: ", (float) a);
1355 p("L2D: ", (double) a);
1357 p("LCMP a == b : ", a == b);
1358 p("LCMP a != b : ", a != b);
1359 p("LCMP a < b : ", a < b);
1360 p("LCMP a <= b : ", a <= b);
1361 p("LCMP a > b : ", a > b);
1362 p("LCMP a >= b : ", a >= b);
1364 if ((a==b)) p("not IF_LCMPEQ");
1365 if ((a!=b)) p("not IF_LCMPNE");
1366 if ((a<b)) p("not IF_LCMPLT");
1367 if ((a<=b)) p("not IF_LCMPLE");
1368 if ((a>b)) p("not IF_LCMPGT");
1369 if ((a>=b)) p("not IF_LCMPGE");
1372 static public void testfloat(float a, float b) {
1373 p ("TESTFLOAT called with ", a);
1382 p("F2I: ", (int) a);
1383 p("F2L: ", (long) a);
1384 p("F2D: ", (double) a);
1386 if ((a==b)) p("FCMP a=b");
1387 if ((a!=b)) p("FCMP a!=b");
1388 if ((a<b)) p("FCMP a<b");
1389 if ((a<=b)) p("FCMP a<=b");
1390 if ((a>b)) p("FCMP a>b");
1391 if ((a>=b)) p("FCMP a>=b");
1394 static public void testdouble(double a, double b) {
1395 p ("TESTDOUBLE called with ", a);
1404 p("D2I: ", (int) a);
1405 p("D2L: ", (long) a);
1406 p("D2F: ", (float) a);
1408 if ((a==b)) p("DCMP a=b");
1409 if ((a!=b)) p("DCMP a!=b");
1410 if ((a<b)) p("DCMP a<b");
1411 if ((a<=b)) p("DCMP a<=b");
1412 if ((a>b)) p("DCMP a>b");
1413 if ((a>=b)) p("DCMP a>=b");
1417 // ********************* output methods ****************************
1419 public static int linenum = 0;
1420 public static void pnl() {
1421 System.out.println ();
1422 System.out.print (linenum);
1423 System.out.print (". ");
1427 public static void p(String a) { System.out.print(a); pnl(); }
1428 public static void p(boolean a) {System.out.print(a);
1430 public static void p(int a) { System.out.print ("int: ");
1431 System.out.print(a);
1433 public static void p(long a) { System.out.print ("long: ");
1434 System.out.print(a);
1436 public static void p(short a) { System.out.print ("short: ");
1437 System.out.print(a);
1439 public static void p(byte a) { System.out.print ("byte: ");
1440 System.out.print(a);
1442 public static void p(char a) { System.out.print ("char: ");
1443 System.out.print((int)a);
1445 public static void p(float a) { System.out.print ("float: ");
1446 System.out.print ( java.lang.Float.floatToIntBits(a) );
1448 public static void p(double a) { System.out.print ("double: ");
1449 System.out.print( java.lang.Double.doubleToLongBits(a) );
1452 public static void p(String s,boolean i) {
1453 System.out.print(s); p(i);
1455 public static void p(String s,int i) {
1456 System.out.print(s); p(i);
1458 public static void p(String s,byte i) {
1459 System.out.print(s); p(i);
1461 public static void p(String s,char i) {
1462 System.out.print(s); p(i);
1464 public static void p(String s,short i) {
1465 System.out.print(s); p(i);
1467 public static void p(String s,long l) {
1468 System.out.print(s); p(l);
1470 public static void p(String s,float f) {
1471 System.out.print(s); p(f);
1473 public static void p(String s,double d) {
1474 System.out.print(s); p(d);
1480 // methods for testing interface and method calls
1482 public void jctest() { p (" <init> wird aktiviert"); };
1483 public void p_manyparam (int p_i1,int p_i2,
1485 long p_l1,long p_l2,
1486 long p_l3,long p_l4,
1487 float p_f1, float p_f2,
1488 float p_f3, float p_f4,
1489 double p_d1, double p_d2,
1490 double p_d3, double p_d4) {
1509 public void p_nonstatic (String a) {
1533 interface jcinterface {
1534 public void p_nonstatic (String a);