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) {
436 p ("testarraybounds: " + (i - 10));
438 p ("testarraybounds: " + (i - 5));
440 p ("testarraybounds: " + (i));
442 p ("testarraybounds: " + (i + 5));
444 p ("testarraybounds: " + (i + 10));
449 // ************************ test arrays ************************************
451 public static void testarrays() {
458 p ("------------------- test byte arrays");
463 p ("null pointer check: byte array store");
465 p ("error: null pointer exception not thrown");
467 catch (NullPointerException c) {
468 p ("exception: null pointer");
471 p ("null pointer check: byte array load");
473 p ("error: null pointer exception not thrown");
475 catch (NullPointerException c) {
476 p ("exception: null pointer");
480 p ("negative array size check: byte array");
482 p ("error: negative array size exception not thrown");
484 catch (NegativeArraySizeException c) {
485 p ("exception: negative array size");
492 p ("array bound check: byte array store");
494 p ("error: exception not thrown");
496 catch (ArrayIndexOutOfBoundsException c) {
497 p ("exception: out of bounds: "+(-1));
500 p ("array bound check: byte array load");
502 p ("error: exception not thrown");
504 catch (ArrayIndexOutOfBoundsException c) {
505 p ("exception: out of bounds: "+(-1));
509 testarraybounds(ba, 5);
511 catch (ArrayIndexOutOfBoundsException c) {
512 p ("exception: out of bounds: "+5);
515 testarraybounds(ba, 50);
517 catch (ArrayIndexOutOfBoundsException c) {
518 p ("exception: out of bounds: "+50);
521 testarraybounds(ba, 100);
523 catch (ArrayIndexOutOfBoundsException c) {
524 p ("exception: out of bounds: "+100);
530 catch (ArrayIndexOutOfBoundsException c) {
531 p ("exception: out of bounds: "+(-4));
536 catch (ArrayIndexOutOfBoundsException c) {
537 p ("exception: out of bounds: "+(-3));
539 for (i=-2; i<102; i++) {
541 ba[i] = (byte) (i-50);
543 catch (ArrayIndexOutOfBoundsException c) {
544 p ("exception: out of bounds: "+i);
550 catch (ArrayIndexOutOfBoundsException c) {
551 p ("exception: out of bounds: "+102);
556 catch (ArrayIndexOutOfBoundsException c) {
557 p ("exception: out of bounds: "+103);
559 for (i=0; i<100; i++) p (ba[i]);
562 p ("-------- test short arrays");
567 p ("null pointer check: short array store");
569 p ("error: null pointer exception not thrown");
571 catch (NullPointerException c) {
572 p ("exception: null pointer");
575 p ("null pointer check: short array load");
577 p ("error: null pointer exception not thrown");
579 catch (NullPointerException c) {
580 p ("exception: null pointer");
583 sa = new short [100];
586 p ("array bound check: short array store");
588 p ("error: exception not thrown");
590 catch (ArrayIndexOutOfBoundsException c) {
591 p ("exception: out of bounds: "+(-1));
594 p ("array bound check: short array load");
596 p ("error: exception not thrown");
598 catch (ArrayIndexOutOfBoundsException c) {
599 p ("exception: out of bounds: "+(-1));
602 for (i=0; i<100; i++) sa[i] = (short) (i-50);
603 for (i=0; i<100; i++) p (sa[i]);
606 p ("-------- test int arrays");
611 p ("null pointer check: int array store");
613 p ("error: null pointer exception not thrown");
615 catch (NullPointerException c) {
616 p ("exception: null pointer");
619 p ("null pointer check: int array load");
621 p ("error: null pointer exception not thrown");
623 catch (NullPointerException c) {
624 p ("exception: null pointer");
630 p ("array bound check: int array store");
632 p ("error: exception not thrown");
634 catch (ArrayIndexOutOfBoundsException c) {
635 p ("exception: out of bounds: "+(-1));
638 p ("array bound check: int array load");
640 p ("error: exception not thrown");
642 catch (ArrayIndexOutOfBoundsException c) {
643 p ("exception: out of bounds: "+(-1));
646 for (i=0; i<10; i++) ia[i] = (123456 + i);
647 for (i=0; i<10; i++) p (ia[i]);
651 p ("-------- test long arrays");
656 p ("null pointer check: long array store");
658 p ("error: null pointer exception not thrown");
660 catch (NullPointerException c) {
661 p ("exception: null pointer");
664 p ("null pointer check: long array load");
666 p ("error: null pointer exception not thrown");
668 catch (NullPointerException c) {
669 p ("exception: null pointer");
675 p ("array bound check: long array store");
677 p ("error: exception not thrown");
679 catch (ArrayIndexOutOfBoundsException c) {
680 p ("exception: out of bounds: "+(-1));
683 p ("array bound check: long array load");
685 p ("error: exception not thrown");
687 catch (ArrayIndexOutOfBoundsException c) {
688 p ("exception: out of bounds: "+(-1));
691 for (i=0; i<10; i++) la[i] = (1234567890123L + i);
692 for (i=0; i<10; i++) p (la[i]);
695 p ("-------- test char arrays");
700 p ("null pointer check: char array store");
702 p ("error: null pointer exception not thrown");
704 catch (NullPointerException c) {
705 p ("exception: null pointer");
708 p ("null pointer check: char array load");
710 p ("error: null pointer exception not thrown");
712 catch (NullPointerException c) {
713 p ("exception: null pointer");
719 p ("array bound check: char array store");
721 p ("error: exception not thrown");
723 catch (ArrayIndexOutOfBoundsException c) {
724 p ("exception: out of bounds: "+(-1));
727 p ("array bound check: char array load");
729 p ("error: exception not thrown");
731 catch (ArrayIndexOutOfBoundsException c) {
732 p ("exception: out of bounds: "+(-1));
735 for (i=0; i<50; i++) ca[i] = (char) ('A' + i);
736 for (i=0; i<50; i++) p (ca[i]);
738 p ("-------- test address arrays");
743 p ("null pointer check: address array store");
745 p ("error: null pointer exception not thrown");
747 catch (NullPointerException c) {
748 p ("exception: null pointer");
751 p ("null pointer check: address array load");
753 p ("error: null pointer exception not thrown");
755 catch (NullPointerException c) {
756 p ("exception: null pointer");
760 p ("negative array size check: address array");
761 sta = new String[-3];
762 p ("error: negative array size exception not thrown");
764 catch (NegativeArraySizeException c) {
765 p ("exception: negative array size");
771 p ("array bound check: address array store");
773 p ("error: exception not thrown");
775 catch (ArrayIndexOutOfBoundsException c) {
776 p ("exception: out of bounds: "+(-1));
779 p ("array bound check: address array load");
781 p ("error: exception not thrown");
783 catch (ArrayIndexOutOfBoundsException c) {
784 p ("exception: out of bounds: "+(-1));
787 for (i=0; i<5; i++) sta[i] = Integer.toString(i) + ". Zeile";
788 for (i=0; i<5; i++) p (sta[i]);
790 p ("-------- test multi dimensional arrays");
792 int [][][] iaaa = null;
795 p ("negative array size check: multi dimensional array");
796 iaaa = new int[2][3][-4];
797 p ("error: negative array size exception not thrown");
799 catch (NegativeArraySizeException c) {
800 p ("exception: negative array size");
803 iaaa = new int[2][3][4];
804 long [][][] laaa = new long[2][3][6];
805 float [][][] faaa = new float[2][3][4];
806 double [][][] daaa = new double[3][4][7];
807 for (i=0; i<2; i++) {
808 int i2; for (i2=0; i2<3; i2++) {
809 int i3; for (i3=0; i3<4; i3++) {
810 iaaa[i][i2][i3] = i*i*i + i2*i2 + i3;
811 laaa[i][i2][i3] = i*i*i + i2*i2 + i3 + 7;
812 faaa[i][i2][i3] = i*i*i + i2*i2 + i3 + 0.4F;
813 daaa[i][i2][i3] = i*i*i + i2*i2 + i3 - 47.0001;
827 static public void testconst(int i, long l) {
828 p ("TESTCONST CALLED WITH ", i);
831 if (!(i == (0))) p("not IF_ICMPEQ", (0));
832 if (!(i != (0))) p("not IF_ICMPNE", (0));
833 if (!(i < (0))) p("not IF_ICMPLT", (0));
834 if (!(i <= (0))) p("not IF_ICMPLE", (0));
835 if (!(i > (0))) p("not IF_ICMPGT", (0));
836 if (!(i >= (0))) p("not IF_ICMPGE", (0));
838 if (!(l == (0))) p("not IF_LCMPEQ", (0));
839 if (!(l != (0))) p("not IF_LCMPNE", (0));
840 if (!(l < (0))) p("not IF_LCMPLT", (0));
841 if (!(l <= (0))) p("not IF_LCMPLE", (0));
842 if (!(l > (0))) p("not IF_LCMPGT", (0));
843 if (!(l >= (0))) p("not IF_LCMPGE", (0));
845 p("IADDCONST: ", i + (-1));
846 p("ISUBCONST: ", i - (-1));
847 p("IMULCONST: ", i * (-1));
848 p("ISHLCONST: ", i << (-1));
849 p("ISHRCONST: ", i >> (-1));
850 p("IUSHRCONST: ", i >>> (-1));
851 p("IANDCONST: ", i & (-1));
852 p("IORCONST: ", i | (-1));
853 p("IXORCONST: ", i ^ (-1));
855 if (!(i == (-1))) p("not IF_ICMPEQ", (-1));
856 if (!(i != (-1))) p("not IF_ICMPNE", (-1));
857 if (!(i < (-1))) p("not IF_ICMPLT", (-1));
858 if (!(i <= (-1))) p("not IF_ICMPLE", (-1));
859 if (!(i > (-1))) p("not IF_ICMPGT", (-1));
860 if (!(i >= (-1))) p("not IF_ICMPGE", (-1));
862 p("LADDCONST: ", l + (-1));
863 p("LSUBCONST: ", l - (-1));
864 p("LMULCONST: ", l * (-1));
865 p("LSHLCONST: ", l << (-1));
866 p("LSHRCONST: ", l >> (-1));
867 p("LUSHRCONST: ", l >>> (-1));
868 p("LANDCONST: ", l & (-1));
869 p("LORCONST: ", l | (-1));
870 p("LXORCONST: ", l ^ (-1));
872 if (!(l == (-1))) p("not IF_LCMPEQ", (-1));
873 if (!(l != (-1))) p("not IF_LCMPNE", (-1));
874 if (!(l < (-1))) p("not IF_LCMPLT", (-1));
875 if (!(l <= (-1))) p("not IF_LCMPLE", (-1));
876 if (!(l > (-1))) p("not IF_LCMPGT", (-1));
877 if (!(l >= (-1))) p("not IF_LCMPGE", (-1));
879 p("IADDCONST: ", i + (1));
880 p("ISUBCONST: ", i - (1));
881 p("IMULCONST: ", i * (1));
882 p("ISHLCONST: ", i << (1));
883 p("ISHRCONST: ", i >> (1));
884 p("IUSHRCONST: ", i >>> (1));
885 p("IANDCONST: ", i & (1));
886 p("IORCONST: ", i | (1));
887 p("IXORCONST: ", i ^ (1));
889 if (!(i == (1))) p("not IF_ICMPEQ", (1));
890 if (!(i != (1))) p("not IF_ICMPNE", (1));
891 if (!(i < (1))) p("not IF_ICMPLT", (1));
892 if (!(i <= (1))) p("not IF_ICMPLE", (1));
893 if (!(i > (1))) p("not IF_ICMPGT", (1));
894 if (!(i >= (1))) p("not IF_ICMPGE", (1));
896 p("LADDCONST: ", l + (1));
897 p("LSUBCONST: ", l - (1));
898 p("LMULCONST: ", l * (1));
899 p("LSHLCONST: ", l << (1));
900 p("LSHRCONST: ", l >> (1));
901 p("LUSHRCONST: ", l >>> (1));
902 p("LANDCONST: ", l & (1));
903 p("LORCONST: ", l | (1));
904 p("LXORCONST: ", l ^ (1));
906 if (!(l == (1))) p("not IF_LCMPEQ", (1));
907 if (!(l != (1))) p("not IF_LCMPNE", (1));
908 if (!(l < (1))) p("not IF_LCMPLT", (1));
909 if (!(l <= (1))) p("not IF_LCMPLE", (1));
910 if (!(l > (1))) p("not IF_LCMPGT", (1));
911 if (!(l >= (1))) p("not IF_LCMPGE", (1));
913 p("IADDCONST: ", i + (255));
914 p("ISUBCONST: ", i - (255));
915 p("IMULCONST: ", i * (255));
916 p("ISHLCONST: ", i << (255));
917 p("ISHRCONST: ", i >> (255));
918 p("IUSHRCONST: ", i >>> (255));
919 p("IANDCONST: ", i & (255));
920 p("IORCONST: ", i | (255));
921 p("IXORCONST: ", i ^ (255));
923 if (!(i == (255))) p("not IF_ICMPEQ", (255));
924 if (!(i != (255))) p("not IF_ICMPNE", (255));
925 if (!(i < (255))) p("not IF_ICMPLT", (255));
926 if (!(i <= (255))) p("not IF_ICMPLE", (255));
927 if (!(i > (255))) p("not IF_ICMPGT", (255));
928 if (!(i >= (255))) p("not IF_ICMPGE", (255));
930 p("LADDCONST: ", l + (255));
931 p("LSUBCONST: ", l - (255));
932 p("LMULCONST: ", l * (255));
933 p("LSHLCONST: ", l << (255));
934 p("LSHRCONST: ", l >> (255));
935 p("LUSHRCONST: ", l >>> (255));
936 p("LANDCONST: ", l & (255));
937 p("LORCONST: ", l | (255));
938 p("LXORCONST: ", l ^ (255));
940 if (!(l == (255))) p("not IF_LCMPEQ", (255));
941 if (!(l != (255))) p("not IF_LCMPNE", (255));
942 if (!(l < (255))) p("not IF_LCMPLT", (255));
943 if (!(l <= (255))) p("not IF_LCMPLE", (255));
944 if (!(l > (255))) p("not IF_LCMPGT", (255));
945 if (!(l >= (255))) p("not IF_LCMPGE", (255));
947 p("IADDCONST: ", i + (256));
948 p("ISUBCONST: ", i - (256));
949 p("IMULCONST: ", i * (256));
950 p("ISHLCONST: ", i << (256));
951 p("ISHRCONST: ", i >> (256));
952 p("IUSHRCONST: ", i >>> (256));
953 p("IANDCONST: ", i & (256));
954 p("IORCONST: ", i | (256));
955 p("IXORCONST: ", i ^ (256));
957 if (!(i == (256))) p("not IF_ICMPEQ", (256));
958 if (!(i != (256))) p("not IF_ICMPNE", (256));
959 if (!(i < (256))) p("not IF_ICMPLT", (256));
960 if (!(i <= (256))) p("not IF_ICMPLE", (256));
961 if (!(i > (256))) p("not IF_ICMPGT", (256));
962 if (!(i >= (256))) p("not IF_ICMPGE", (256));
964 p("LADDCONST: ", l + (256));
965 p("LSUBCONST: ", l - (256));
966 p("LMULCONST: ", l * (256));
967 p("LSHLCONST: ", l << (256));
968 p("LSHRCONST: ", l >> (256));
969 p("LUSHRCONST: ", l >>> (256));
970 p("LANDCONST: ", l & (256));
971 p("LORCONST: ", l | (256));
972 p("LXORCONST: ", l ^ (256));
974 if (!(l == (256))) p("not IF_LCMPEQ", (256));
975 if (!(l != (256))) p("not IF_LCMPNE", (256));
976 if (!(l < (256))) p("not IF_LCMPLT", (256));
977 if (!(l <= (256))) p("not IF_LCMPLE", (256));
978 if (!(l > (256))) p("not IF_LCMPGT", (256));
979 if (!(l >= (256))) p("not IF_LCMPGE", (256));
981 p("IADDCONST: ", i + (32767));
982 p("ISUBCONST: ", i - (32767));
983 p("IMULCONST: ", i * (32767));
984 p("ISHLCONST: ", i << (32767));
985 p("ISHRCONST: ", i >> (32767));
986 p("IUSHRCONST: ", i >>> (32767));
987 p("IANDCONST: ", i & (32767));
988 p("IORCONST: ", i | (32767));
989 p("IXORCONST: ", i ^ (32767));
991 if (!(i == (32767))) p("not IF_ICMPEQ", (32767));
992 if (!(i != (32767))) p("not IF_ICMPNE", (32767));
993 if (!(i < (32767))) p("not IF_ICMPLT", (32767));
994 if (!(i <= (32767))) p("not IF_ICMPLE", (32767));
995 if (!(i > (32767))) p("not IF_ICMPGT", (32767));
996 if (!(i >= (32767))) p("not IF_ICMPGE", (32767));
998 p("LADDCONST: ", l + (32767));
999 p("LSUBCONST: ", l - (32767));
1000 p("LMULCONST: ", l * (32767));
1001 p("LSHLCONST: ", l << (32767));
1002 p("LSHRCONST: ", l >> (32767));
1003 p("LUSHRCONST: ", l >>> (32767));
1004 p("LANDCONST: ", l & (32767));
1005 p("LORCONST: ", l | (32767));
1006 p("LXORCONST: ", l ^ (32767));
1008 if (!(l == (32767))) p("not IF_LCMPEQ", (32767));
1009 if (!(l != (32767))) p("not IF_LCMPNE", (32767));
1010 if (!(l < (32767))) p("not IF_LCMPLT", (32767));
1011 if (!(l <= (32767))) p("not IF_LCMPLE", (32767));
1012 if (!(l > (32767))) p("not IF_LCMPGT", (32767));
1013 if (!(l >= (32767))) p("not IF_LCMPGE", (32767));
1015 p("IADDCONST: ", i + (32768));
1016 p("ISUBCONST: ", i - (32768));
1017 p("IMULCONST: ", i * (32768));
1018 p("ISHLCONST: ", i << (32768));
1019 p("ISHRCONST: ", i >> (32768));
1020 p("IUSHRCONST: ", i >>> (32768));
1021 p("IANDCONST: ", i & (32768));
1022 p("IORCONST: ", i | (32768));
1023 p("IXORCONST: ", i ^ (32768));
1025 if (!(i == (32768))) p("not IF_ICMPEQ", (32768));
1026 if (!(i != (32768))) p("not IF_ICMPNE", (32768));
1027 if (!(i < (32768))) p("not IF_ICMPLT", (32768));
1028 if (!(i <= (32768))) p("not IF_ICMPLE", (32768));
1029 if (!(i > (32768))) p("not IF_ICMPGT", (32768));
1030 if (!(i >= (32768))) p("not IF_ICMPGE", (32768));
1032 p("LADDCONST: ", l + (32768));
1033 p("LSUBCONST: ", l - (32768));
1034 p("LMULCONST: ", l * (32768));
1035 p("LSHLCONST: ", l << (32768));
1036 p("LSHRCONST: ", l >> (32768));
1037 p("LUSHRCONST: ", l >>> (32768));
1038 p("LANDCONST: ", l & (32768));
1039 p("LORCONST: ", l | (32768));
1040 p("LXORCONST: ", l ^ (32768));
1042 if (!(l == (32768))) p("not IF_LCMPEQ", (32768));
1043 if (!(l != (32768))) p("not IF_LCMPNE", (32768));
1044 if (!(l < (32768))) p("not IF_LCMPLT", (32768));
1045 if (!(l <= (32768))) p("not IF_LCMPLE", (32768));
1046 if (!(l > (32768))) p("not IF_LCMPGT", (32768));
1047 if (!(l >= (32768))) p("not IF_LCMPGE", (32768));
1049 p("IADDCONST: ", i + (-32768));
1050 p("ISUBCONST: ", i - (-32768));
1051 p("IMULCONST: ", i * (-32768));
1052 p("ISHLCONST: ", i << (-32768));
1053 p("ISHRCONST: ", i >> (-32768));
1054 p("IUSHRCONST: ", i >>> (-32768));
1055 p("IANDCONST: ", i & (-32768));
1056 p("IORCONST: ", i | (-32768));
1057 p("IXORCONST: ", i ^ (-32768));
1059 if (!(i == (-32768))) p("not IF_ICMPEQ", (-32768));
1060 if (!(i != (-32768))) p("not IF_ICMPNE", (-32768));
1061 if (!(i < (-32768))) p("not IF_ICMPLT", (-32768));
1062 if (!(i <= (-32768))) p("not IF_ICMPLE", (-32768));
1063 if (!(i > (-32768))) p("not IF_ICMPGT", (-32768));
1064 if (!(i >= (-32768))) p("not IF_ICMPGE", (-32768));
1066 p("LADDCONST: ", l + (-32768));
1067 p("LSUBCONST: ", l - (-32768));
1068 p("LMULCONST: ", l * (-32768));
1069 p("LSHLCONST: ", l << (-32768));
1070 p("LSHRCONST: ", l >> (-32768));
1071 p("LUSHRCONST: ", l >>> (-32768));
1072 p("LANDCONST: ", l & (-32768));
1073 p("LORCONST: ", l | (-32768));
1074 p("LXORCONST: ", l ^ (-32768));
1076 if (!(l == (-32768))) p("not IF_LCMPEQ", (-32768));
1077 if (!(l != (-32768))) p("not IF_LCMPNE", (-32768));
1078 if (!(l < (-32768))) p("not IF_LCMPLT", (-32768));
1079 if (!(l <= (-32768))) p("not IF_LCMPLE", (-32768));
1080 if (!(l > (-32768))) p("not IF_LCMPGT", (-32768));
1081 if (!(l >= (-32768))) p("not IF_LCMPGE", (-32768));
1083 p("IADDCONST: ", i + (-32769));
1084 p("ISUBCONST: ", i - (-32769));
1085 p("IMULCONST: ", i * (-32769));
1086 p("ISHLCONST: ", i << (-32769));
1087 p("ISHRCONST: ", i >> (-32769));
1088 p("IUSHRCONST: ", i >>> (-32769));
1089 p("IANDCONST: ", i & (-32769));
1090 p("IORCONST: ", i | (-32769));
1091 p("IXORCONST: ", i ^ (-32769));
1093 if (!(i == (-32769))) p("not IF_ICMPEQ", (-32769));
1094 if (!(i != (-32769))) p("not IF_ICMPNE", (-32769));
1095 if (!(i < (-32769))) p("not IF_ICMPLT", (-32769));
1096 if (!(i <= (-32769))) p("not IF_ICMPLE", (-32769));
1097 if (!(i > (-32769))) p("not IF_ICMPGT", (-32769));
1098 if (!(i >= (-32769))) p("not IF_ICMPGE", (-32769));
1100 p("LADDCONST: ", l + (-32769));
1101 p("LSUBCONST: ", l - (-32769));
1102 p("LMULCONST: ", l * (-32769));
1103 p("LSHLCONST: ", l << (-32769));
1104 p("LSHRCONST: ", l >> (-32769));
1105 p("LUSHRCONST: ", l >>> (-32769));
1106 p("LANDCONST: ", l & (-32769));
1107 p("LORCONST: ", l | (-32769));
1108 p("LXORCONST: ", l ^ (-32769));
1110 if (!(l == (-32769))) p("not IF_LCMPEQ", (-32769));
1111 if (!(l != (-32769))) p("not IF_LCMPNE", (-32769));
1112 if (!(l < (-32769))) p("not IF_LCMPLT", (-32769));
1113 if (!(l <= (-32769))) p("not IF_LCMPLE", (-32769));
1114 if (!(l > (-32769))) p("not IF_LCMPGT", (-32769));
1115 if (!(l >= (-32769))) p("not IF_LCMPGE", (-32769));
1119 static public void testrem0x10001(int a) {
1120 p("IREM0X10001 (" + a + " % 0x10001): ", a % 0x10001);
1123 static public void testrem0x10001(long a) {
1124 p("LREM0X10001 (" + a + " % 0x10001): ", a % 0x10001L);
1127 static public void testdivremconst(int a) {
1128 p("IDIVPOW2 (" + a + " / 0x00000002): ", a / 0x00000002);
1129 p("IDIVPOW2 (" + a + " / 0x00000004): ", a / 0x00000004);
1130 p("IDIVPOW2 (" + a + " / 0x00000008): ", a / 0x00000008);
1131 p("IDIVPOW2 (" + a + " / 0x00000010): ", a / 0x00000010);
1132 p("IDIVPOW2 (" + a + " / 0x00000020): ", a / 0x00000020);
1133 p("IDIVPOW2 (" + a + " / 0x00000040): ", a / 0x00000040);
1134 p("IDIVPOW2 (" + a + " / 0x00000080): ", a / 0x00000080);
1135 p("IDIVPOW2 (" + a + " / 0x00000100): ", a / 0x00000100);
1136 p("IDIVPOW2 (" + a + " / 0x00000200): ", a / 0x00000200);
1137 p("IDIVPOW2 (" + a + " / 0x00000400): ", a / 0x00000400);
1138 p("IDIVPOW2 (" + a + " / 0x00000800): ", a / 0x00000800);
1139 p("IDIVPOW2 (" + a + " / 0x00001000): ", a / 0x00001000);
1140 p("IDIVPOW2 (" + a + " / 0x00002000): ", a / 0x00002000);
1141 p("IDIVPOW2 (" + a + " / 0x00004000): ", a / 0x00004000);
1142 p("IDIVPOW2 (" + a + " / 0x00008000): ", a / 0x00008000);
1143 p("IDIVPOW2 (" + a + " / 0x00010000): ", a / 0x00010000);
1144 p("IDIVPOW2 (" + a + " / 0x00020000): ", a / 0x00020000);
1145 p("IDIVPOW2 (" + a + " / 0x00040000): ", a / 0x00040000);
1146 p("IDIVPOW2 (" + a + " / 0x00080000): ", a / 0x00080000);
1147 p("IDIVPOW2 (" + a + " / 0x00100000): ", a / 0x00100000);
1148 p("IDIVPOW2 (" + a + " / 0x00200000): ", a / 0x00200000);
1149 p("IDIVPOW2 (" + a + " / 0x00400000): ", a / 0x00400000);
1150 p("IDIVPOW2 (" + a + " / 0x00800000): ", a / 0x00800000);
1151 p("IDIVPOW2 (" + a + " / 0x01000000): ", a / 0x01000000);
1152 p("IDIVPOW2 (" + a + " / 0x02000000): ", a / 0x02000000);
1153 p("IDIVPOW2 (" + a + " / 0x04000000): ", a / 0x04000000);
1154 p("IDIVPOW2 (" + a + " / 0x08000000): ", a / 0x08000000);
1155 p("IDIVPOW2 (" + a + " / 0x10000000): ", a / 0x10000000);
1156 p("IDIVPOW2 (" + a + " / 0x20000000): ", a / 0x20000000);
1157 p("IDIVPOW2 (" + a + " / 0x40000000): ", a / 0x40000000);
1158 p("IDIVPOW2 (" + a + " / 0x80000000): ", a / 0x80000000);
1160 p("IREMPOW2 (" + a + " % 0x00000002): ", a % 0x00000002);
1161 p("IREMPOW2 (" + a + " % 0x00000004): ", a % 0x00000004);
1162 p("IREMPOW2 (" + a + " % 0x00000008): ", a % 0x00000008);
1163 p("IREMPOW2 (" + a + " % 0x00000010): ", a % 0x00000010);
1164 p("IREMPOW2 (" + a + " % 0x00000020): ", a % 0x00000020);
1165 p("IREMPOW2 (" + a + " % 0x00000040): ", a % 0x00000040);
1166 p("IREMPOW2 (" + a + " % 0x00000080): ", a % 0x00000080);
1167 p("IREMPOW2 (" + a + " % 0x00000100): ", a % 0x00000100);
1168 p("IREMPOW2 (" + a + " % 0x00000200): ", a % 0x00000200);
1169 p("IREMPOW2 (" + a + " % 0x00000400): ", a % 0x00000400);
1170 p("IREMPOW2 (" + a + " % 0x00000800): ", a % 0x00000800);
1171 p("IREMPOW2 (" + a + " % 0x00001000): ", a % 0x00001000);
1172 p("IREMPOW2 (" + a + " % 0x00002000): ", a % 0x00002000);
1173 p("IREMPOW2 (" + a + " % 0x00004000): ", a % 0x00004000);
1174 p("IREMPOW2 (" + a + " % 0x00008000): ", a % 0x00008000);
1175 p("IREMPOW2 (" + a + " % 0x00010000): ", a % 0x00010000);
1176 p("IREMPOW2 (" + a + " % 0x00020000): ", a % 0x00020000);
1177 p("IREMPOW2 (" + a + " % 0x00040000): ", a % 0x00040000);
1178 p("IREMPOW2 (" + a + " % 0x00080000): ", a % 0x00080000);
1179 p("IREMPOW2 (" + a + " % 0x00100000): ", a % 0x00100000);
1180 p("IREMPOW2 (" + a + " % 0x00200000): ", a % 0x00200000);
1181 p("IREMPOW2 (" + a + " % 0x00400000): ", a % 0x00400000);
1182 p("IREMPOW2 (" + a + " % 0x00800000): ", a % 0x00800000);
1183 p("IREMPOW2 (" + a + " % 0x01000000): ", a % 0x01000000);
1184 p("IREMPOW2 (" + a + " % 0x02000000): ", a % 0x02000000);
1185 p("IREMPOW2 (" + a + " % 0x04000000): ", a % 0x04000000);
1186 p("IREMPOW2 (" + a + " % 0x08000000): ", a % 0x08000000);
1187 p("IREMPOW2 (" + a + " % 0x10000000): ", a % 0x10000000);
1188 p("IREMPOW2 (" + a + " % 0x20000000): ", a % 0x20000000);
1189 p("IREMPOW2 (" + a + " % 0x40000000): ", a % 0x40000000);
1190 p("IREMPOW2 (" + a + " % 0x80000000): ", a % 0x80000000);
1193 static public void testdivremconst(long a) {
1194 p("LDIVPOW2 (" + a + " / 0x00000002): ", a / 0x00000002);
1195 p("LDIVPOW2 (" + a + " / 0x00000004): ", a / 0x00000004);
1196 p("LDIVPOW2 (" + a + " / 0x00000008): ", a / 0x00000008);
1197 p("LDIVPOW2 (" + a + " / 0x00000010): ", a / 0x00000010);
1198 p("LDIVPOW2 (" + a + " / 0x00000020): ", a / 0x00000020);
1199 p("LDIVPOW2 (" + a + " / 0x00000040): ", a / 0x00000040);
1200 p("LDIVPOW2 (" + a + " / 0x00000080): ", a / 0x00000080);
1201 p("LDIVPOW2 (" + a + " / 0x00000100): ", a / 0x00000100);
1202 p("LDIVPOW2 (" + a + " / 0x00000200): ", a / 0x00000200);
1203 p("LDIVPOW2 (" + a + " / 0x00000400): ", a / 0x00000400);
1204 p("LDIVPOW2 (" + a + " / 0x00000800): ", a / 0x00000800);
1205 p("LDIVPOW2 (" + a + " / 0x00001000): ", a / 0x00001000);
1206 p("LDIVPOW2 (" + a + " / 0x00002000): ", a / 0x00002000);
1207 p("LDIVPOW2 (" + a + " / 0x00004000): ", a / 0x00004000);
1208 p("LDIVPOW2 (" + a + " / 0x00008000): ", a / 0x00008000);
1209 p("LDIVPOW2 (" + a + " / 0x00010000): ", a / 0x00010000);
1210 p("LDIVPOW2 (" + a + " / 0x00020000): ", a / 0x00020000);
1211 p("LDIVPOW2 (" + a + " / 0x00040000): ", a / 0x00040000);
1212 p("LDIVPOW2 (" + a + " / 0x00080000): ", a / 0x00080000);
1213 p("LDIVPOW2 (" + a + " / 0x00100000): ", a / 0x00100000);
1214 p("LDIVPOW2 (" + a + " / 0x00200000): ", a / 0x00200000);
1215 p("LDIVPOW2 (" + a + " / 0x00400000): ", a / 0x00400000);
1216 p("LDIVPOW2 (" + a + " / 0x00800000): ", a / 0x00800000);
1217 p("LDIVPOW2 (" + a + " / 0x01000000): ", a / 0x01000000);
1218 p("LDIVPOW2 (" + a + " / 0x02000000): ", a / 0x02000000);
1219 p("LDIVPOW2 (" + a + " / 0x04000000): ", a / 0x04000000);
1220 p("LDIVPOW2 (" + a + " / 0x08000000): ", a / 0x08000000);
1221 p("LDIVPOW2 (" + a + " / 0x10000000): ", a / 0x10000000);
1222 p("LDIVPOW2 (" + a + " / 0x20000000): ", a / 0x20000000);
1223 p("LDIVPOW2 (" + a + " / 0x40000000): ", a / 0x40000000);
1224 p("LDIVPOW2 (" + a + " / 0x80000000): ", a / 0x80000000);
1226 p("LREMPOW2 (" + a + " % 0x00000002): ", a % 0x00000002L);
1227 p("LREMPOW2 (" + a + " % 0x00000004): ", a % 0x00000004L);
1228 p("LREMPOW2 (" + a + " % 0x00000008): ", a % 0x00000008L);
1229 p("LREMPOW2 (" + a + " % 0x00000010): ", a % 0x00000010L);
1230 p("LREMPOW2 (" + a + " % 0x00000020): ", a % 0x00000020L);
1231 p("LREMPOW2 (" + a + " % 0x00000040): ", a % 0x00000040L);
1232 p("LREMPOW2 (" + a + " % 0x00000080): ", a % 0x00000080L);
1233 p("LREMPOW2 (" + a + " % 0x00000100): ", a % 0x00000100L);
1234 p("LREMPOW2 (" + a + " % 0x00000200): ", a % 0x00000200L);
1235 p("LREMPOW2 (" + a + " % 0x00000400): ", a % 0x00000400L);
1236 p("LREMPOW2 (" + a + " % 0x00000800): ", a % 0x00000800L);
1237 p("LREMPOW2 (" + a + " % 0x00001000): ", a % 0x00001000L);
1238 p("LREMPOW2 (" + a + " % 0x00002000): ", a % 0x00002000L);
1239 p("LREMPOW2 (" + a + " % 0x00004000): ", a % 0x00004000L);
1240 p("LREMPOW2 (" + a + " % 0x00008000): ", a % 0x00008000L);
1241 p("LREMPOW2 (" + a + " % 0x00010000): ", a % 0x00010000L);
1242 p("LREMPOW2 (" + a + " % 0x00020000): ", a % 0x00020000L);
1243 p("LREMPOW2 (" + a + " % 0x00040000): ", a % 0x00040000L);
1244 p("LREMPOW2 (" + a + " % 0x00080000): ", a % 0x00080000L);
1245 p("LREMPOW2 (" + a + " % 0x00100000): ", a % 0x00100000L);
1246 p("LREMPOW2 (" + a + " % 0x00200000): ", a % 0x00200000L);
1247 p("LREMPOW2 (" + a + " % 0x00400000): ", a % 0x00400000L);
1248 p("LREMPOW2 (" + a + " % 0x00800000): ", a % 0x00800000L);
1249 p("LREMPOW2 (" + a + " % 0x01000000): ", a % 0x01000000L);
1250 p("LREMPOW2 (" + a + " % 0x02000000): ", a % 0x02000000L);
1251 p("LREMPOW2 (" + a + " % 0x04000000): ", a % 0x04000000L);
1252 p("LREMPOW2 (" + a + " % 0x08000000): ", a % 0x08000000L);
1253 p("LREMPOW2 (" + a + " % 0x10000000): ", a % 0x10000000L);
1254 p("LREMPOW2 (" + a + " % 0x20000000): ", a % 0x20000000L);
1255 p("LREMPOW2 (" + a + " % 0x40000000): ", a % 0x40000000L);
1256 p("LREMPOW2 (" + a + " % 0x80000000): ", a % 0x80000000L);
1260 static public void testint(int a, int b) {
1261 p ("TESTINT CALLED WITH ", a);
1267 try { p("IDIV: ", a/b); }
1268 catch (ArithmeticException e) { p("divison by zero"); }
1269 try { p("IREM: ", a%b); }
1270 catch (ArithmeticException e) { p("divison by zero"); }
1274 p("IUSHR: ", a>>>b);
1279 p("I2L: ", (long) a);
1280 p("I2F: ", (float) a);
1281 p("I2D: ", (double) a);
1282 p("INT2BYTE: ", (byte) a);
1283 p("INT2CHAR: ", (char) a);
1284 p("INT2SHORT: ", (short) a);
1286 if (!(a==0)) p("not IFEQ");
1287 if (!(a!=0)) p("not IFNE");
1288 if (!(a<0)) p("not IFLT");
1289 if (!(a<=0)) p("not IFLE");
1290 if (!(a>0)) p("not IFGT");
1291 if (!(a>=0)) p("not IFGE");
1293 if (!(a==b)) p("not IF_ICMPEQ");
1294 if (!(a!=b)) p("not IF_ICMPNE");
1295 if (!(a<b)) p("not IF_ICMPLT");
1296 if (!(a<=b)) p("not IF_ICMPLE");
1297 if (!(a>b)) p("not IF_ICMPGT");
1298 if (!(a>=b)) p("not IF_ICMPGE");
1300 p("COND_ICMPEQ " + a + " == 0: " + ((a == 0) ? 0 : 1));
1301 p("COND_ICMPNE " + a + " != 0: " + ((a != 0) ? 0 : 1));
1302 p("COND_ICMPLT " + a + " < 0: " + ((a < 0) ? 0 : 1));
1303 p("COND_ICMPLE " + a + " <= 0: " + ((a <= 0) ? 0 : 1));
1304 p("COND_ICMPGT " + a + " > 0: " + ((a > 0) ? 0 : 1));
1305 p("COND_ICMPGE " + a + " >= 0: " + ((a >= 0) ? 0 : 1));
1307 p("COND_ICMPEQ " + a + " == 0: " + ((a == 0) ? 1 : 0));
1308 p("COND_ICMPNE " + a + " != 0: " + ((a != 0) ? 1 : 0));
1309 p("COND_ICMPLT " + a + " < 0: " + ((a < 0) ? 1 : 0));
1310 p("COND_ICMPLE " + a + " <= 0: " + ((a <= 0) ? 1 : 0));
1311 p("COND_ICMPGT " + a + " > 0: " + ((a > 0) ? 1 : 0));
1312 p("COND_ICMPGE " + a + " >= 0: " + ((a >= 0) ? 1 : 0));
1314 p("COND_ICMPEQ " + a + " == 0: " + ((a == 0) ? 2 : 3));
1315 p("COND_ICMPNE " + a + " != 0: " + ((a != 0) ? 2 : 3));
1316 p("COND_ICMPLT " + a + " < 0: " + ((a < 0) ? 2 : 3));
1317 p("COND_ICMPLE " + a + " <= 0: " + ((a <= 0) ? 2 : 3));
1318 p("COND_ICMPGT " + a + " > 0: " + ((a > 0) ? 2 : 3));
1319 p("COND_ICMPGE " + a + " >= 0: " + ((a >= 0) ? 2 : 3));
1321 p("COND_ICMPEQ " + a + " == " + b + ": " + (a == b));
1322 p("COND_ICMPNE " + a + " != " + b + ": " + (a != b));
1323 p("COND_ICMPLT " + a + " < " + b + ": " + (a < b));
1324 p("COND_ICMPLE " + a + " <= " + b + ": " + (a <= b));
1325 p("COND_ICMPGT " + a + " > " + b + ": " + (a > b));
1326 p("COND_ICMPGE " + a + " >= " + b + ": " + (a >= b));
1330 static public void testlong(long a, long b) {
1331 p ("TESTLONG called with ", a);
1337 try { p("LDIV: ", a / b); }
1338 catch (ArithmeticException e) { p("divison by zero"); }
1339 try { p("LREM: ", a % b); }
1340 catch (ArithmeticException e) { p("divison by zero"); }
1342 p("LSHL: ", a << b);
1343 p("LSHR: ", a >> b);
1344 p("LUSHR: ", a >>>b);
1349 p("L2I: ", (int) a);
1350 p("L2F: ", (float) a);
1351 p("L2D: ", (double) a);
1353 p("LCMP a == b : ", a == b);
1354 p("LCMP a != b : ", a != b);
1355 p("LCMP a < b : ", a < b);
1356 p("LCMP a <= b : ", a <= b);
1357 p("LCMP a > b : ", a > b);
1358 p("LCMP a >= b : ", a >= b);
1360 if ((a==b)) p("not IF_LCMPEQ");
1361 if ((a!=b)) p("not IF_LCMPNE");
1362 if ((a<b)) p("not IF_LCMPLT");
1363 if ((a<=b)) p("not IF_LCMPLE");
1364 if ((a>b)) p("not IF_LCMPGT");
1365 if ((a>=b)) p("not IF_LCMPGE");
1368 static public void testfloat(float a, float b) {
1369 p ("TESTFLOAT called with ", a);
1378 p("F2I: ", (int) a);
1379 p("F2L: ", (long) a);
1380 p("F2D: ", (double) a);
1382 if ((a==b)) p("FCMP a=b");
1383 if ((a!=b)) p("FCMP a!=b");
1384 if ((a<b)) p("FCMP a<b");
1385 if ((a<=b)) p("FCMP a<=b");
1386 if ((a>b)) p("FCMP a>b");
1387 if ((a>=b)) p("FCMP a>=b");
1390 static public void testdouble(double a, double b) {
1391 p ("TESTDOUBLE called with ", a);
1400 p("D2I: ", (int) a);
1401 p("D2L: ", (long) a);
1402 p("D2F: ", (float) a);
1404 if ((a==b)) p("DCMP a=b");
1405 if ((a!=b)) p("DCMP a!=b");
1406 if ((a<b)) p("DCMP a<b");
1407 if ((a<=b)) p("DCMP a<=b");
1408 if ((a>b)) p("DCMP a>b");
1409 if ((a>=b)) p("DCMP a>=b");
1413 // ********************* output methods ****************************
1415 public static int linenum = 0;
1416 public static void pnl() {
1417 System.out.println ();
1418 System.out.print (linenum);
1419 System.out.print (". ");
1423 public static void p(String a) { System.out.print(a); pnl(); }
1424 public static void p(boolean a) {System.out.print(a);
1426 public static void p(int a) { System.out.print ("int: ");
1427 System.out.print(a);
1429 public static void p(long a) { System.out.print ("long: ");
1430 System.out.print(a);
1432 public static void p(short a) { System.out.print ("short: ");
1433 System.out.print(a);
1435 public static void p(byte a) { System.out.print ("byte: ");
1436 System.out.print(a);
1438 public static void p(char a) { System.out.print ("char: ");
1439 System.out.print((int)a);
1441 public static void p(float a) { System.out.print ("float: ");
1442 System.out.print ( java.lang.Float.floatToIntBits(a) );
1444 public static void p(double a) { System.out.print ("double: ");
1445 System.out.print( java.lang.Double.doubleToLongBits(a) );
1448 public static void p(String s,boolean i) {
1449 System.out.print(s); p(i);
1451 public static void p(String s,int i) {
1452 System.out.print(s); p(i);
1454 public static void p(String s,byte i) {
1455 System.out.print(s); p(i);
1457 public static void p(String s,char i) {
1458 System.out.print(s); p(i);
1460 public static void p(String s,short i) {
1461 System.out.print(s); p(i);
1463 public static void p(String s,long l) {
1464 System.out.print(s); p(l);
1466 public static void p(String s,float f) {
1467 System.out.print(s); p(f);
1469 public static void p(String s,double d) {
1470 System.out.print(s); p(d);
1476 // methods for testing interface and method calls
1478 public void jctest() { p (" <init> wird aktiviert"); };
1479 public void p_manyparam (int p_i1,int p_i2,
1481 long p_l1,long p_l2,
1482 long p_l3,long p_l4,
1483 float p_f1, float p_f2,
1484 float p_f3, float p_f4,
1485 double p_d1, double p_d2,
1486 double p_d3, double p_d4) {
1505 public void p_nonstatic (String a) {
1529 interface jcinterface {
1530 public void p_nonstatic (String a);