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);
57 p ("------------------- test ints");
60 testint (-24351,24123);
61 testint (4918923,-441423);
64 testint (1423487,123444444);
65 testint (0x7fffffff,1);
66 testint (0,0x7fffffff);
67 testint (0x3333,143444);
68 testint (4444441,12342);
70 p ("------------------- test longs");
73 testlong (-24351,24123);
74 testlong (4918923241323L,-4423423234231423L);
77 testlong (1423487,123444442344L);
78 testlong (0x7fffffffffffffffL,1);
79 testlong (0,0x7fffffffffffffffL);
80 testlong (0x3333,143444);
81 testlong (4444441,12342);
83 p ("------------------- test floats");
84 testfloat ((float) 1,(float) 2.042);
85 testfloat ((float) -1.234,(float) 17.44);
86 testfloat ((float) -24351,(float) 24123);
87 testfloat ((float) 0.1,(float) 1243);
88 testfloat ((float) 0.0,(float) -555.4132);
89 testfloat ((float) 77.0,(float) -555);
90 testfloat ((float) 2147483000.0,(float) -555234);
92 p ("------------------- test doubles");
94 testdouble (-1.234,17.44);
95 testdouble (-24351,24123);
96 testdouble (0.1,1243);
97 testdouble (0.0,-555.4132);
98 testdouble (77.0,-555);
99 testdouble (2147483000.0,-555234);
102 p ("=================== end of test =========================");
107 p ("successful initialisation");
112 public static void testgeneral() {
115 // ******************** basic data types *******************************
117 p ("------------------- test int-PUSH-STORE-LOAD");
119 p(j); p (0); p(2); p(17); p(-100);
120 p (500); p(-32768); p(-32769); p(32767); p(32768);
121 p (90000); p(-1000000000);
123 p ("------------------- test long-PUSH-STORE-LOAD");
125 p ( l ); p ( 0L ); p ( 99L );
126 p (500L); p(-32768L); p(-32769L); p(32767L); p(32768L);
127 p ( 6900000000000L ); p ( 349827389478173274L );
129 p ("------------------- test float-PUSH-STORE-LOAD");
131 p ( f ); p (0.0F); p (1.0F); p (342323423478.2223434234232334F);
133 p ("------------------- test double-PUSH-STORE-LOAD");
134 double d = 99234.42D;
135 p ( d ); p (0.0D); p (1.0D); p (342323423478.2223434234232334D);
138 // ******************** static variables *******************************
140 p ("------------------- test static variables");
144 p (i1); p(i2); p(i3);
145 p (l1); p(l2); p(l3);
146 p (f1); p(f2); p(f3);
147 p (d1); p(d2); p(d3);
149 // ******************** arithmetic test ********************************
151 p ("------------------- test arithmetic");
157 l1 = 0x7fffffffffffffffL;
160 p (l1+0x7fffffffffffffffL);
163 // ******************** test method calls ******************************
165 p ("statische methode");
166 jctest ttt = new jctest ();
167 ttt.p_manyparam (19,18,17,16, 88,77,66,55,
168 0.1F,0.2F,0.3F,0.4F, -2.0D,-3.0D,-4.0D,-5.0D );
169 jcinterface ttt2 = ttt;
170 ttt2.p_nonstatic ("interface method");
176 // ************************ test tables ************************************
178 public static void testtables() {
181 p ("------------------- test tableswitch");
183 for (i = -5; i < 15; i++) {
185 case 2: p ("-> 2"); break;
186 case 3: p ("-> 3"); break;
187 case 5: p ("-> 5"); break;
188 case 6: p ("-> 6"); break;
189 case 7: p ("-> 7"); break;
190 case 8: p ("-> 8"); break;
191 case 10: p ("-> 10"); break;
192 default: p ("default"); break;
196 p ("------------------- test lookupswitch");
198 for (i = -5; i < 15; i++) {
200 case 2: p ("-> 2"); break;
201 case 8: p ("-> 8"); break;
202 case 14: p ("-> 14"); break;
203 case -4: p ("-> -4"); break;
204 default: p ("default"); break;
210 // ****************** test type casts and array stores *********************
212 public static void testcasts() {
213 Object o = new Object();
214 Object oi = new Integer(0);
215 Object[] oa = new Object [1];
216 Object[] oia = new Integer[1];
217 Integer i = new Integer(0);
220 p ("------------------- test casts");
223 p ("type cast check: Integer = Object(Integer)");
225 p ("type cast check: Integer = Object");
227 p ("error: class cast exception not thrown");
229 catch (ClassCastException c) {
230 p ("exception: class cast");
234 p ("type cast check: Integer[] = Object(Integer)[]");
235 ia = (Integer[]) oia;
236 p ("type cast check: Integer[] = Object[]");
238 p ("error: class cast exception not thrown");
240 catch (ClassCastException c) {
241 p ("exception: class cast");
245 p ("array store check: Object(Integer)[0] = Integer");
247 p ("array store check: Object(Integer)[0] = Object");
249 p ("error: array store exception not thrown");
251 catch (ArrayStoreException c) {
252 p ("exception: array store");
257 // ****************** test special null pointers ***************************
259 public static void testspecialnullpointers() {
262 jcinterface f = null;
264 p ("------------------- test special null pointers");
267 p ("null pointer check: put field");
269 p ("error: put field null pointer exception not thrown");
271 catch (NullPointerException x) {
272 p ("exception: null pointer");
276 p ("null pointer check: get field");
278 p ("error: get field null pointer exception not thrown");
280 catch (NullPointerException x) {
281 p ("exception: null pointer");
285 p ("null pointer check: invokevirtual");
286 c.p_nonstatic("invokevirtual");
287 p ("error: invokevirtual null pointer exception not thrown");
289 catch (NullPointerException x) {
290 p ("exception: null pointer");
294 p ("null pointer check: invokeinterface");
295 f.p_nonstatic("invokeinterface");
296 p ("error: invokeinterface null pointer exception not thrown");
298 catch (NullPointerException x) {
299 p ("exception: null pointer");
303 p ("null pointer check: monitorenter");
305 p ("error: monitorenter null pointer exception not thrown");
308 catch (NullPointerException x) {
309 p ("exception: null pointer");
314 // ************************ test array bounds ******************************
316 public static void testarraybounds(byte[] ba, int i) {
318 p ("testarraybounds: " + (i - 10));
320 p ("testarraybounds: " + (i - 5));
322 p ("testarraybounds: " + (i));
324 p ("testarraybounds: " + (i + 5));
326 p ("testarraybounds: " + (i + 10));
331 // ************************ test arrays ************************************
333 public static void testarrays() {
340 p ("------------------- test byte arrays");
345 p ("null pointer check: byte array store");
347 p ("error: null pointer exception not thrown");
349 catch (NullPointerException c) {
350 p ("exception: null pointer");
353 p ("null pointer check: byte array load");
355 p ("error: null pointer exception not thrown");
357 catch (NullPointerException c) {
358 p ("exception: null pointer");
362 p ("negative array size check: byte array");
364 p ("error: negative array size exception not thrown");
366 catch (NegativeArraySizeException c) {
367 p ("exception: negative array size");
374 p ("array bound check: byte array store");
376 p ("error: exception not thrown");
378 catch (ArrayIndexOutOfBoundsException c) {
379 p ("exception: out of bounds: "+(-1));
382 p ("array bound check: byte array load");
384 p ("error: exception not thrown");
386 catch (ArrayIndexOutOfBoundsException c) {
387 p ("exception: out of bounds: "+(-1));
391 testarraybounds(ba, 5);
393 catch (ArrayIndexOutOfBoundsException c) {
394 p ("exception: out of bounds: "+5);
397 testarraybounds(ba, 50);
399 catch (ArrayIndexOutOfBoundsException c) {
400 p ("exception: out of bounds: "+50);
403 testarraybounds(ba, 100);
405 catch (ArrayIndexOutOfBoundsException c) {
406 p ("exception: out of bounds: "+100);
412 catch (ArrayIndexOutOfBoundsException c) {
413 p ("exception: out of bounds: "+(-4));
418 catch (ArrayIndexOutOfBoundsException c) {
419 p ("exception: out of bounds: "+(-3));
421 for (i=-2; i<102; i++) {
423 ba[i] = (byte) (i-50);
425 catch (ArrayIndexOutOfBoundsException c) {
426 p ("exception: out of bounds: "+i);
432 catch (ArrayIndexOutOfBoundsException c) {
433 p ("exception: out of bounds: "+102);
438 catch (ArrayIndexOutOfBoundsException c) {
439 p ("exception: out of bounds: "+103);
441 for (i=0; i<100; i++) p (ba[i]);
444 p ("-------- test short arrays");
449 p ("null pointer check: short array store");
451 p ("error: null pointer exception not thrown");
453 catch (NullPointerException c) {
454 p ("exception: null pointer");
457 p ("null pointer check: short array load");
459 p ("error: null pointer exception not thrown");
461 catch (NullPointerException c) {
462 p ("exception: null pointer");
465 sa = new short [100];
468 p ("array bound check: short array store");
470 p ("error: exception not thrown");
472 catch (ArrayIndexOutOfBoundsException c) {
473 p ("exception: out of bounds: "+(-1));
476 p ("array bound check: short array load");
478 p ("error: exception not thrown");
480 catch (ArrayIndexOutOfBoundsException c) {
481 p ("exception: out of bounds: "+(-1));
484 for (i=0; i<100; i++) sa[i] = (short) (i-50);
485 for (i=0; i<100; i++) p (sa[i]);
488 p ("-------- test int arrays");
493 p ("null pointer check: int array store");
495 p ("error: null pointer exception not thrown");
497 catch (NullPointerException c) {
498 p ("exception: null pointer");
501 p ("null pointer check: int array load");
503 p ("error: null pointer exception not thrown");
505 catch (NullPointerException c) {
506 p ("exception: null pointer");
512 p ("array bound check: int array store");
514 p ("error: exception not thrown");
516 catch (ArrayIndexOutOfBoundsException c) {
517 p ("exception: out of bounds: "+(-1));
520 p ("array bound check: int array load");
522 p ("error: exception not thrown");
524 catch (ArrayIndexOutOfBoundsException c) {
525 p ("exception: out of bounds: "+(-1));
528 for (i=0; i<10; i++) ia[i] = (123456 + i);
529 for (i=0; i<10; i++) p (ia[i]);
533 p ("-------- test long arrays");
538 p ("null pointer check: long array store");
540 p ("error: null pointer exception not thrown");
542 catch (NullPointerException c) {
543 p ("exception: null pointer");
546 p ("null pointer check: long array load");
548 p ("error: null pointer exception not thrown");
550 catch (NullPointerException c) {
551 p ("exception: null pointer");
557 p ("array bound check: long array store");
559 p ("error: exception not thrown");
561 catch (ArrayIndexOutOfBoundsException c) {
562 p ("exception: out of bounds: "+(-1));
565 p ("array bound check: long array load");
567 p ("error: exception not thrown");
569 catch (ArrayIndexOutOfBoundsException c) {
570 p ("exception: out of bounds: "+(-1));
573 for (i=0; i<10; i++) la[i] = (1234567890123L + i);
574 for (i=0; i<10; i++) p (la[i]);
577 p ("-------- test char arrays");
582 p ("null pointer check: char array store");
584 p ("error: null pointer exception not thrown");
586 catch (NullPointerException c) {
587 p ("exception: null pointer");
590 p ("null pointer check: char array load");
592 p ("error: null pointer exception not thrown");
594 catch (NullPointerException c) {
595 p ("exception: null pointer");
601 p ("array bound check: char array store");
603 p ("error: exception not thrown");
605 catch (ArrayIndexOutOfBoundsException c) {
606 p ("exception: out of bounds: "+(-1));
609 p ("array bound check: char array load");
611 p ("error: exception not thrown");
613 catch (ArrayIndexOutOfBoundsException c) {
614 p ("exception: out of bounds: "+(-1));
617 for (i=0; i<50; i++) ca[i] = (char) ('A' + i);
618 for (i=0; i<50; i++) p (ca[i]);
620 p ("-------- test address arrays");
625 p ("null pointer check: address array store");
627 p ("error: null pointer exception not thrown");
629 catch (NullPointerException c) {
630 p ("exception: null pointer");
633 p ("null pointer check: address array load");
635 p ("error: null pointer exception not thrown");
637 catch (NullPointerException c) {
638 p ("exception: null pointer");
642 p ("negative array size check: address array");
643 sta = new String[-3];
644 p ("error: negative array size exception not thrown");
646 catch (NegativeArraySizeException c) {
647 p ("exception: negative array size");
653 p ("array bound check: address array store");
655 p ("error: exception not thrown");
657 catch (ArrayIndexOutOfBoundsException c) {
658 p ("exception: out of bounds: "+(-1));
661 p ("array bound check: address array load");
663 p ("error: exception not thrown");
665 catch (ArrayIndexOutOfBoundsException c) {
666 p ("exception: out of bounds: "+(-1));
669 for (i=0; i<5; i++) sta[i] = Integer.toString(i) + ". Zeile";
670 for (i=0; i<5; i++) p (sta[i]);
672 p ("-------- test multi dimensional arrays");
674 int [][][] iaaa = null;
677 p ("negative array size check: multi dimensional array");
678 iaaa = new int[2][3][-4];
679 p ("error: negative array size exception not thrown");
681 catch (NegativeArraySizeException c) {
682 p ("exception: negative array size");
685 iaaa = new int[2][3][4];
686 long [][][] laaa = new long[2][3][6];
687 float [][][] faaa = new float[2][3][4];
688 double [][][] daaa = new double[3][4][7];
689 for (i=0; i<2; i++) {
690 int i2; for (i2=0; i2<3; i2++) {
691 int i3; for (i3=0; i3<4; i3++) {
692 iaaa[i][i2][i3] = i*i*i + i2*i2 + i3;
693 laaa[i][i2][i3] = i*i*i + i2*i2 + i3 + 7;
694 faaa[i][i2][i3] = i*i*i + i2*i2 + i3 + 0.4F;
695 daaa[i][i2][i3] = i*i*i + i2*i2 + i3 - 47.0001;
709 static public void testconst(int i, long l) {
710 p ("TESTCONST CALLED WITH ", i);
713 if (!(i == (0))) p("not IF_ICMPEQ", (0));
714 if (!(i != (0))) p("not IF_ICMPNE", (0));
715 if (!(i < (0))) p("not IF_ICMPLT", (0));
716 if (!(i <= (0))) p("not IF_ICMPLE", (0));
717 if (!(i > (0))) p("not IF_ICMPGT", (0));
718 if (!(i >= (0))) p("not IF_ICMPGE", (0));
720 if (!(l == (0))) p("not IF_LCMPEQ", (0));
721 if (!(l != (0))) p("not IF_LCMPNE", (0));
722 if (!(l < (0))) p("not IF_LCMPLT", (0));
723 if (!(l <= (0))) p("not IF_LCMPLE", (0));
724 if (!(l > (0))) p("not IF_LCMPGT", (0));
725 if (!(l >= (0))) p("not IF_LCMPGE", (0));
727 p("IADDCONST: ", i + (-1));
728 p("ISUBCONST: ", i - (-1));
729 p("IMULCONST: ", i * (-1));
730 p("ISHLCONST: ", i << (-1));
731 p("ISHRCONST: ", i >> (-1));
732 p("IUSHRCONST: ", i >>> (-1));
733 p("IANDCONST: ", i & (-1));
734 p("IORCONST: ", i | (-1));
735 p("IXORCONST: ", i ^ (-1));
737 if (!(i == (-1))) p("not IF_ICMPEQ", (-1));
738 if (!(i != (-1))) p("not IF_ICMPNE", (-1));
739 if (!(i < (-1))) p("not IF_ICMPLT", (-1));
740 if (!(i <= (-1))) p("not IF_ICMPLE", (-1));
741 if (!(i > (-1))) p("not IF_ICMPGT", (-1));
742 if (!(i >= (-1))) p("not IF_ICMPGE", (-1));
744 p("LADDCONST: ", l + (-1));
745 p("LSUBCONST: ", l - (-1));
746 p("LMULCONST: ", l * (-1));
747 p("LSHLCONST: ", l << (-1));
748 p("LSHRCONST: ", l >> (-1));
749 p("LUSHRCONST: ", l >>> (-1));
750 p("LANDCONST: ", l & (-1));
751 p("LORCONST: ", l | (-1));
752 p("LXORCONST: ", l ^ (-1));
754 if (!(l == (-1))) p("not IF_LCMPEQ", (-1));
755 if (!(l != (-1))) p("not IF_LCMPNE", (-1));
756 if (!(l < (-1))) p("not IF_LCMPLT", (-1));
757 if (!(l <= (-1))) p("not IF_LCMPLE", (-1));
758 if (!(l > (-1))) p("not IF_LCMPGT", (-1));
759 if (!(l >= (-1))) p("not IF_LCMPGE", (-1));
761 p("IADDCONST: ", i + (1));
762 p("ISUBCONST: ", i - (1));
763 p("IMULCONST: ", i * (1));
764 p("ISHLCONST: ", i << (1));
765 p("ISHRCONST: ", i >> (1));
766 p("IUSHRCONST: ", i >>> (1));
767 p("IANDCONST: ", i & (1));
768 p("IORCONST: ", i | (1));
769 p("IXORCONST: ", i ^ (1));
771 if (!(i == (1))) p("not IF_ICMPEQ", (1));
772 if (!(i != (1))) p("not IF_ICMPNE", (1));
773 if (!(i < (1))) p("not IF_ICMPLT", (1));
774 if (!(i <= (1))) p("not IF_ICMPLE", (1));
775 if (!(i > (1))) p("not IF_ICMPGT", (1));
776 if (!(i >= (1))) p("not IF_ICMPGE", (1));
778 p("LADDCONST: ", l + (1));
779 p("LSUBCONST: ", l - (1));
780 p("LMULCONST: ", l * (1));
781 p("LSHLCONST: ", l << (1));
782 p("LSHRCONST: ", l >> (1));
783 p("LUSHRCONST: ", l >>> (1));
784 p("LANDCONST: ", l & (1));
785 p("LORCONST: ", l | (1));
786 p("LXORCONST: ", l ^ (1));
788 if (!(l == (1))) p("not IF_LCMPEQ", (1));
789 if (!(l != (1))) p("not IF_LCMPNE", (1));
790 if (!(l < (1))) p("not IF_LCMPLT", (1));
791 if (!(l <= (1))) p("not IF_LCMPLE", (1));
792 if (!(l > (1))) p("not IF_LCMPGT", (1));
793 if (!(l >= (1))) p("not IF_LCMPGE", (1));
795 p("IADDCONST: ", i + (255));
796 p("ISUBCONST: ", i - (255));
797 p("IMULCONST: ", i * (255));
798 p("ISHLCONST: ", i << (255));
799 p("ISHRCONST: ", i >> (255));
800 p("IUSHRCONST: ", i >>> (255));
801 p("IANDCONST: ", i & (255));
802 p("IORCONST: ", i | (255));
803 p("IXORCONST: ", i ^ (255));
805 if (!(i == (255))) p("not IF_ICMPEQ", (255));
806 if (!(i != (255))) p("not IF_ICMPNE", (255));
807 if (!(i < (255))) p("not IF_ICMPLT", (255));
808 if (!(i <= (255))) p("not IF_ICMPLE", (255));
809 if (!(i > (255))) p("not IF_ICMPGT", (255));
810 if (!(i >= (255))) p("not IF_ICMPGE", (255));
812 p("LADDCONST: ", l + (255));
813 p("LSUBCONST: ", l - (255));
814 p("LMULCONST: ", l * (255));
815 p("LSHLCONST: ", l << (255));
816 p("LSHRCONST: ", l >> (255));
817 p("LUSHRCONST: ", l >>> (255));
818 p("LANDCONST: ", l & (255));
819 p("LORCONST: ", l | (255));
820 p("LXORCONST: ", l ^ (255));
822 if (!(l == (255))) p("not IF_LCMPEQ", (255));
823 if (!(l != (255))) p("not IF_LCMPNE", (255));
824 if (!(l < (255))) p("not IF_LCMPLT", (255));
825 if (!(l <= (255))) p("not IF_LCMPLE", (255));
826 if (!(l > (255))) p("not IF_LCMPGT", (255));
827 if (!(l >= (255))) p("not IF_LCMPGE", (255));
829 p("IADDCONST: ", i + (256));
830 p("ISUBCONST: ", i - (256));
831 p("IMULCONST: ", i * (256));
832 p("ISHLCONST: ", i << (256));
833 p("ISHRCONST: ", i >> (256));
834 p("IUSHRCONST: ", i >>> (256));
835 p("IANDCONST: ", i & (256));
836 p("IORCONST: ", i | (256));
837 p("IXORCONST: ", i ^ (256));
839 if (!(i == (256))) p("not IF_ICMPEQ", (256));
840 if (!(i != (256))) p("not IF_ICMPNE", (256));
841 if (!(i < (256))) p("not IF_ICMPLT", (256));
842 if (!(i <= (256))) p("not IF_ICMPLE", (256));
843 if (!(i > (256))) p("not IF_ICMPGT", (256));
844 if (!(i >= (256))) p("not IF_ICMPGE", (256));
846 p("LADDCONST: ", l + (256));
847 p("LSUBCONST: ", l - (256));
848 p("LMULCONST: ", l * (256));
849 p("LSHLCONST: ", l << (256));
850 p("LSHRCONST: ", l >> (256));
851 p("LUSHRCONST: ", l >>> (256));
852 p("LANDCONST: ", l & (256));
853 p("LORCONST: ", l | (256));
854 p("LXORCONST: ", l ^ (256));
856 if (!(l == (256))) p("not IF_LCMPEQ", (256));
857 if (!(l != (256))) p("not IF_LCMPNE", (256));
858 if (!(l < (256))) p("not IF_LCMPLT", (256));
859 if (!(l <= (256))) p("not IF_LCMPLE", (256));
860 if (!(l > (256))) p("not IF_LCMPGT", (256));
861 if (!(l >= (256))) p("not IF_LCMPGE", (256));
863 p("IADDCONST: ", i + (32767));
864 p("ISUBCONST: ", i - (32767));
865 p("IMULCONST: ", i * (32767));
866 p("ISHLCONST: ", i << (32767));
867 p("ISHRCONST: ", i >> (32767));
868 p("IUSHRCONST: ", i >>> (32767));
869 p("IANDCONST: ", i & (32767));
870 p("IORCONST: ", i | (32767));
871 p("IXORCONST: ", i ^ (32767));
873 if (!(i == (32767))) p("not IF_ICMPEQ", (32767));
874 if (!(i != (32767))) p("not IF_ICMPNE", (32767));
875 if (!(i < (32767))) p("not IF_ICMPLT", (32767));
876 if (!(i <= (32767))) p("not IF_ICMPLE", (32767));
877 if (!(i > (32767))) p("not IF_ICMPGT", (32767));
878 if (!(i >= (32767))) p("not IF_ICMPGE", (32767));
880 p("LADDCONST: ", l + (32767));
881 p("LSUBCONST: ", l - (32767));
882 p("LMULCONST: ", l * (32767));
883 p("LSHLCONST: ", l << (32767));
884 p("LSHRCONST: ", l >> (32767));
885 p("LUSHRCONST: ", l >>> (32767));
886 p("LANDCONST: ", l & (32767));
887 p("LORCONST: ", l | (32767));
888 p("LXORCONST: ", l ^ (32767));
890 if (!(l == (32767))) p("not IF_LCMPEQ", (32767));
891 if (!(l != (32767))) p("not IF_LCMPNE", (32767));
892 if (!(l < (32767))) p("not IF_LCMPLT", (32767));
893 if (!(l <= (32767))) p("not IF_LCMPLE", (32767));
894 if (!(l > (32767))) p("not IF_LCMPGT", (32767));
895 if (!(l >= (32767))) p("not IF_LCMPGE", (32767));
897 p("IADDCONST: ", i + (32768));
898 p("ISUBCONST: ", i - (32768));
899 p("IMULCONST: ", i * (32768));
900 p("ISHLCONST: ", i << (32768));
901 p("ISHRCONST: ", i >> (32768));
902 p("IUSHRCONST: ", i >>> (32768));
903 p("IANDCONST: ", i & (32768));
904 p("IORCONST: ", i | (32768));
905 p("IXORCONST: ", i ^ (32768));
907 if (!(i == (32768))) p("not IF_ICMPEQ", (32768));
908 if (!(i != (32768))) p("not IF_ICMPNE", (32768));
909 if (!(i < (32768))) p("not IF_ICMPLT", (32768));
910 if (!(i <= (32768))) p("not IF_ICMPLE", (32768));
911 if (!(i > (32768))) p("not IF_ICMPGT", (32768));
912 if (!(i >= (32768))) p("not IF_ICMPGE", (32768));
914 p("LADDCONST: ", l + (32768));
915 p("LSUBCONST: ", l - (32768));
916 p("LMULCONST: ", l * (32768));
917 p("LSHLCONST: ", l << (32768));
918 p("LSHRCONST: ", l >> (32768));
919 p("LUSHRCONST: ", l >>> (32768));
920 p("LANDCONST: ", l & (32768));
921 p("LORCONST: ", l | (32768));
922 p("LXORCONST: ", l ^ (32768));
924 if (!(l == (32768))) p("not IF_LCMPEQ", (32768));
925 if (!(l != (32768))) p("not IF_LCMPNE", (32768));
926 if (!(l < (32768))) p("not IF_LCMPLT", (32768));
927 if (!(l <= (32768))) p("not IF_LCMPLE", (32768));
928 if (!(l > (32768))) p("not IF_LCMPGT", (32768));
929 if (!(l >= (32768))) p("not IF_LCMPGE", (32768));
931 p("IADDCONST: ", i + (-32768));
932 p("ISUBCONST: ", i - (-32768));
933 p("IMULCONST: ", i * (-32768));
934 p("ISHLCONST: ", i << (-32768));
935 p("ISHRCONST: ", i >> (-32768));
936 p("IUSHRCONST: ", i >>> (-32768));
937 p("IANDCONST: ", i & (-32768));
938 p("IORCONST: ", i | (-32768));
939 p("IXORCONST: ", i ^ (-32768));
941 if (!(i == (-32768))) p("not IF_ICMPEQ", (-32768));
942 if (!(i != (-32768))) p("not IF_ICMPNE", (-32768));
943 if (!(i < (-32768))) p("not IF_ICMPLT", (-32768));
944 if (!(i <= (-32768))) p("not IF_ICMPLE", (-32768));
945 if (!(i > (-32768))) p("not IF_ICMPGT", (-32768));
946 if (!(i >= (-32768))) p("not IF_ICMPGE", (-32768));
948 p("LADDCONST: ", l + (-32768));
949 p("LSUBCONST: ", l - (-32768));
950 p("LMULCONST: ", l * (-32768));
951 p("LSHLCONST: ", l << (-32768));
952 p("LSHRCONST: ", l >> (-32768));
953 p("LUSHRCONST: ", l >>> (-32768));
954 p("LANDCONST: ", l & (-32768));
955 p("LORCONST: ", l | (-32768));
956 p("LXORCONST: ", l ^ (-32768));
958 if (!(l == (-32768))) p("not IF_LCMPEQ", (-32768));
959 if (!(l != (-32768))) p("not IF_LCMPNE", (-32768));
960 if (!(l < (-32768))) p("not IF_LCMPLT", (-32768));
961 if (!(l <= (-32768))) p("not IF_LCMPLE", (-32768));
962 if (!(l > (-32768))) p("not IF_LCMPGT", (-32768));
963 if (!(l >= (-32768))) p("not IF_LCMPGE", (-32768));
965 p("IADDCONST: ", i + (-32769));
966 p("ISUBCONST: ", i - (-32769));
967 p("IMULCONST: ", i * (-32769));
968 p("ISHLCONST: ", i << (-32769));
969 p("ISHRCONST: ", i >> (-32769));
970 p("IUSHRCONST: ", i >>> (-32769));
971 p("IANDCONST: ", i & (-32769));
972 p("IORCONST: ", i | (-32769));
973 p("IXORCONST: ", i ^ (-32769));
975 if (!(i == (-32769))) p("not IF_ICMPEQ", (-32769));
976 if (!(i != (-32769))) p("not IF_ICMPNE", (-32769));
977 if (!(i < (-32769))) p("not IF_ICMPLT", (-32769));
978 if (!(i <= (-32769))) p("not IF_ICMPLE", (-32769));
979 if (!(i > (-32769))) p("not IF_ICMPGT", (-32769));
980 if (!(i >= (-32769))) p("not IF_ICMPGE", (-32769));
982 p("LADDCONST: ", l + (-32769));
983 p("LSUBCONST: ", l - (-32769));
984 p("LMULCONST: ", l * (-32769));
985 p("LSHLCONST: ", l << (-32769));
986 p("LSHRCONST: ", l >> (-32769));
987 p("LUSHRCONST: ", l >>> (-32769));
988 p("LANDCONST: ", l & (-32769));
989 p("LORCONST: ", l | (-32769));
990 p("LXORCONST: ", l ^ (-32769));
992 if (!(l == (-32769))) p("not IF_LCMPEQ", (-32769));
993 if (!(l != (-32769))) p("not IF_LCMPNE", (-32769));
994 if (!(l < (-32769))) p("not IF_LCMPLT", (-32769));
995 if (!(l <= (-32769))) p("not IF_LCMPLE", (-32769));
996 if (!(l > (-32769))) p("not IF_LCMPGT", (-32769));
997 if (!(l >= (-32769))) p("not IF_LCMPGE", (-32769));
1000 static public void testint(int a, int b) {
1001 p ("TESTINT CALLED WITH ", a);
1007 try { p("IDIV: ", a/b); }
1008 catch (ArithmeticException e) { p("divison by zero"); }
1009 try { p("IREM: ", a%b); }
1010 catch (ArithmeticException e) { p("divison by zero"); }
1014 p("IUSHR: ", a>>>b);
1019 p("I2L: ", (long) a);
1020 p("I2F: ", (float) a);
1021 p("I2D: ", (double) a);
1022 p("INT2BYTE: ", (byte) a);
1023 p("INT2CHAR: ", (char) a);
1024 p("INT2SHORT: ", (short) a);
1026 if (!(a==0)) p("not IFEQ");
1027 if (!(a!=0)) p("not IFNE");
1028 if (!(a<0)) p("not IFLT");
1029 if (!(a<=0)) p("not IFLE");
1030 if (!(a>0)) p("not IFGT");
1031 if (!(a>=0)) p("not IFGE");
1033 if (!(a==b)) p("not IF_ICMPEQ");
1034 if (!(a!=b)) p("not IF_ICMPNE");
1035 if (!(a<b)) p("not IF_ICMPLT");
1036 if (!(a<=b)) p("not IF_ICMPLE");
1037 if (!(a>b)) p("not IF_ICMPGT");
1038 if (!(a>=b)) p("not IF_ICMPGE");
1042 static public void testlong(long a, long b) {
1043 p ("TESTLONG called with ", a);
1049 try { p("LDIV: ", a / b); }
1050 catch (ArithmeticException e) { p("divison by zero"); }
1051 try { p("LREM: ", a % b); }
1052 catch (ArithmeticException e) { p("divison by zero"); }
1054 p("LSHL: ", a << b);
1055 p("LSHR: ", a >> b);
1056 p("LUSHR: ", a >>>b);
1061 p("L2I: ", (int) a);
1062 p("L2F: ", (float) a);
1063 p("L2D: ", (double) a);
1065 p("LCMP a == b : ", a == b);
1066 p("LCMP a != b : ", a != b);
1067 p("LCMP a < b : ", a < b);
1068 p("LCMP a <= b : ", a <= b);
1069 p("LCMP a > b : ", a > b);
1070 p("LCMP a >= b : ", a >= b);
1072 if ((a==b)) p("not IF_LCMPEQ");
1073 if ((a!=b)) p("not IF_LCMPNE");
1074 if ((a<b)) p("not IF_LCMPLT");
1075 if ((a<=b)) p("not IF_LCMPLE");
1076 if ((a>b)) p("not IF_LCMPGT");
1077 if ((a>=b)) p("not IF_LCMPGE");
1080 static public void testfloat(float a, float b) {
1081 p ("TESTFLOAT called with ", a);
1090 p("F2I: ", (int) a);
1091 p("F2L: ", (long) a);
1092 p("F2D: ", (double) a);
1094 if ((a==b)) p("FCMP a=b");
1095 if ((a!=b)) p("FCMP a!=b");
1096 if ((a<b)) p("FCMP a<b");
1097 if ((a<=b)) p("FCMP a<=b");
1098 if ((a>b)) p("FCMP a>b");
1099 if ((a>=b)) p("FCMP a>=b");
1102 static public void testdouble(double a, double b) {
1103 p ("TESTDOUBLE called with ", a);
1112 p("D2I: ", (int) a);
1113 p("D2L: ", (long) a);
1114 p("D2F: ", (float) a);
1116 if ((a==b)) p("DCMP a=b");
1117 if ((a!=b)) p("DCMP a!=b");
1118 if ((a<b)) p("DCMP a<b");
1119 if ((a<=b)) p("DCMP a<=b");
1120 if ((a>b)) p("DCMP a>b");
1121 if ((a>=b)) p("DCMP a>=b");
1125 // ********************* output methods ****************************
1127 public static int linenum = 0;
1128 public static void pnl() {
1129 System.out.println ();
1130 System.out.print (linenum);
1131 System.out.print (". ");
1135 public static void p(String a) { System.out.print(a); pnl(); }
1136 public static void p(boolean a) {System.out.print(a);
1138 public static void p(int a) { System.out.print ("int: ");
1139 System.out.print(a);
1141 public static void p(long a) { System.out.print ("long: ");
1142 System.out.print(a);
1144 public static void p(short a) { System.out.print ("short: ");
1145 System.out.print(a);
1147 public static void p(byte a) { System.out.print ("byte: ");
1148 System.out.print(a);
1150 public static void p(char a) { System.out.print ("char: ");
1151 System.out.print((int)a);
1153 public static void p(float a) { System.out.print ("float: ");
1154 System.out.print ( java.lang.Float.floatToIntBits(a) );
1156 public static void p(double a) { System.out.print ("double: ");
1157 System.out.print( java.lang.Double.doubleToLongBits(a) );
1160 public static void p(String s,boolean i) {
1161 System.out.print(s); p(i);
1163 public static void p(String s,int i) {
1164 System.out.print(s); p(i);
1166 public static void p(String s,byte i) {
1167 System.out.print(s); p(i);
1169 public static void p(String s,char i) {
1170 System.out.print(s); p(i);
1172 public static void p(String s,short i) {
1173 System.out.print(s); p(i);
1175 public static void p(String s,long l) {
1176 System.out.print(s); p(l);
1178 public static void p(String s,float f) {
1179 System.out.print(s); p(f);
1181 public static void p(String s,double d) {
1182 System.out.print(s); p(d);
1188 // methods for testing interface and method calls
1190 public void jctest() { p (" <init> wird aktiviert"); };
1191 public void p_manyparam (int p_i1,int p_i2,
1193 long p_l1,long p_l2,
1194 long p_l3,long p_l4,
1195 float p_f1, float p_f2,
1196 float p_f3, float p_f4,
1197 double p_d1, double p_d2,
1198 double p_d3, double p_d4) {
1217 public void p_nonstatic (String a) {
1241 interface jcinterface {
1242 public void p_nonstatic (String a);