3464cef818331fbc9bb1b42fae4a5e4cfc0c0237
[cacao.git] / tests / jctest.java
1 /* tests/jctest.java - checks most of the JVM instructions
2
3    Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
4    R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
5    C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
6    TU Wien
7
8    This file is part of CACAO.
9
10    This program is free software; you can redistribute it and/or
11    modify it under the terms of the GNU General Public License as
12    published by the Free Software Foundation; either version 2, or (at
13    your option) any later version.
14
15    This program is distributed in the hope that it will be useful, but
16    WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23    02111-1307, USA.
24
25    Contact: cacao@complang.tuwien.ac.at
26
27    Authors: Reinhard Grafl
28
29    Changes: Christian Thalinger
30
31    $Id: jctest.java 1769 2004-12-17 12:30:34Z twisti $
32
33 */
34
35 public class jctest implements jcinterface {
36     static {
37         p("<clinit> called");
38     }
39
40     static int linenum = 0;
41
42     static int i1 = 77;
43     static long l1 = 123456789, l2 = 987654321, l3 = -99999999999999L;
44     static int i2, i3 = -100;
45     static float f1 = 0.1F, f2 = 0.2F, f3 = 0.3F;
46     static double d1 = 0.001, d2 = 0.002, d3 = 0.003;
47     static String s1, s2 = "constant string";
48
49     int n_i1, n_i2, n_i3, n_i4;
50     long n_l1, n_l2, n_l3, n_l4;
51     float n_f1, n_f2, n_f3, n_f4;
52     double n_d1, n_d2, n_d3, n_d4;
53
54         
55     public static void main(String[] s) {
56         p ("=================== JavaVM - Tester ========================");
57
58         p ("------------------- test arguments");
59         int i;
60         for (i = 0; i < s.length; i++) p(s[i]);
61
62         testgeneral();
63         testtables();
64         testcasts();
65         testspecialnullpointers();
66         testarrays();
67                 
68         p("------------------- test consts");
69         testconst( 1,          1);
70         testconst(-1,         -1);
71         testconst(-24123,     -4918923241323L);
72         testconst(-243511,    -4423423234231423L);
73         testconst(0x7fffffff, 0x7fffffffffffffffL);
74         testconst(0x80000000, 0x8000000000000000L);
75
76         p("------------------- test div and rem consts");
77         testdivremconst(17);
78         testdivremconst(12347);
79         testdivremconst(8893427);
80         testdivremconst(1005234562);
81         testdivremconst(-17);
82         testdivremconst(-12347);
83         testdivremconst(-8893427);
84         testdivremconst(-1005234562);
85
86         testdivremconst(17L);
87         testdivremconst(12347L);
88         testdivremconst(8893427L);
89         testdivremconst(1005234562L);
90         testdivremconst(12135005234562L);
91         testdivremconst(2343552355623464626L);
92         testdivremconst(-17L);
93         testdivremconst(-12347L);
94         testdivremconst(-8893427L);
95         testdivremconst(-1005234562L);
96         testdivremconst(-12135005234562L);
97         testdivremconst(-2343552355623464626L);
98
99         p("------------------- test ints");
100         testint(1,2);
101         testint(-1,17);
102         testint(-24351,24123);
103         testint(4918923,-441423);
104         testint(0,0);
105         testint(-1,-1);
106         testint(1423487,123444444);
107         testint(0x7fffffff,1);
108         testint(0,0x7fffffff);
109         testint(0x3333,143444);
110         testint(4444441,12342);
111         testint(0x80000000,-1);
112
113         p("------------------- test longs");
114         testlong(1,2);
115         testlong(-1,17);
116         testlong(-24351,24123);
117         testlong(4918923241323L,-4423423234231423L);
118         testlong(0,0);
119         testlong(-1,-1);
120         testlong(1423487,123444442344L);
121         testlong(0x7fffffffffffffffL,1);
122         testlong(0,0x7fffffffffffffffL);
123         testlong(0x3333,143444);
124         testlong(4444441,12342);
125         testlong(0x8000000000000000L,-1);
126
127         p("------------------- test floats");
128         testfloat((float) 1,(float) 2.042);
129         testfloat((float) -1.234,(float) 17.44);
130         testfloat((float) -24351,(float) 24123);
131         testfloat((float) 0.1,(float) 1243);
132         testfloat((float) 0.0,(float) -555.4132);
133         testfloat((float) 77.0,(float) -555);
134         testfloat((float) 2147483000.0,(float) -555234);
135
136         p("------------------- test doubles");
137         testdouble(1,2.042);
138         testdouble(-1.234,17.44);
139         testdouble(-24351,24123);
140         testdouble(0.1,1243);
141         testdouble(0.0,-555.4132);
142         testdouble(77.0,-555);
143         testdouble(2147483000.0,-555234);
144
145         p("=================== end of test =========================");
146     }
147
148
149     public static void testgeneral() {
150         int i;
151         // ******************** basic data types *******************************
152                 
153         p ("------------------- test int-PUSH-STORE-LOAD");
154         int j = -1;
155         p(j); p (0); p(2); p(17); p(-100); 
156         p (500); p(-32768); p(-32769); p(32767); p(32768);
157         p (90000); p(-1000000000);
158                 
159         p ("------------------- test long-PUSH-STORE-LOAD");
160         long l = 3L;
161         p ( l ); p ( 0L ); p ( 99L );
162         p (500L); p(-32768L); p(-32769L); p(32767L); p(32768L);
163         p ( 6900000000000L ); p ( 349827389478173274L );
164
165         p ("------------------- test float-PUSH-STORE-LOAD");
166         float f = 99.444F;
167         p ( f ); p (0.0F); p (1.0F); p (342323423478.2223434234232334F);
168         
169         p ("------------------- test double-PUSH-STORE-LOAD");
170         double d = 99234.42D;
171         p ( d ); p (0.0D); p (1.0D); p (342323423478.2223434234232334D);
172
173
174         // ******************** static variables *******************************
175
176         p ("------------------- test static variables");        
177         i1 = i1+i2+i3;
178         l2 = l1+l2+l3;
179         f1 = f1*f2;
180         p (i1); p(i2); p(i3); 
181         p (l1); p(l2); p(l3);
182         p (f1); p(f2); p(f3);
183         p (d1); p(d2); p(d3);
184
185         // ******************** arithmetic test ********************************
186                 
187         p ("------------------- test arithmetic");
188         i1 = 17;
189         i2 = 0x7fffffff;
190         p (i2);
191         p (i2+1);
192         p (i1-i2);
193         l1 = 0x7fffffffffffffffL;
194         p (l1);
195         p (l1+1);
196         p (l1+0x7fffffffffffffffL);
197                 
198                 
199         // ******************** test method calls ******************************
200                 
201         p ("statische methode");
202         jctest ttt = new jctest ();
203         ttt.p_manyparam (19,18,17,16, 88,77,66,55, 
204                          0.1F,0.2F,0.3F,0.4F, -2.0D,-3.0D,-4.0D,-5.0D );
205         jcinterface ttt2 = ttt;
206         ttt2.p_nonstatic ("interface method");
207     }
208
209
210
211     // ************************ test tables ************************************
212                 
213     public static void testtables() {
214         int i;
215
216         p ("------------------- test tableswitch");
217
218         for (i = -5; i < 15; i++) {
219             switch (i) {
220             case  2:  p ("->  2"); break;       
221             case  3:  p ("->  3"); break;       
222             case  5:  p ("->  5"); break;       
223             case  6:  p ("->  6"); break;
224             case  7:  p ("->  7"); break;
225             case  8:  p ("->  8"); break;
226             case 10:  p ("-> 10"); break;
227             default:  p ("default"); break;
228             }
229         }
230
231         p ("------------------- test lookupswitch");
232
233         for (i = -5; i < 15; i++) {
234             switch (i) {
235             case  2:  p ("->  2"); break;
236             case  8:  p ("->  8"); break;
237             case 14:  p ("-> 14"); break;
238             case -4:  p ("-> -4"); break;
239             default:  p ("default"); break;
240             }
241         }       
242     }
243
244
245     // ****************** test type casts and array stores *********************
246
247     public static void testcasts() {
248         Object     o   = new Object();
249         Object     oi  = new Integer(0);
250         Object[]   oa  = new Object [1];
251         Object[]   oia = new Integer[1];
252         Integer    i   = new Integer(0);
253         Integer[]  ia;
254         java.io.DataOutput dataout = null;
255         Object             od  = new java.io.DataOutputStream(
256                                                               (java.io.DataOutputStream)dataout);
257
258         p ("------------------- test casts");
259
260         p("Integer is instanceof Object:  ", oi instanceof Object);
261         p("Integer is instanceof Integer: ", oi instanceof Integer);
262         p("Object is instanceof Integer:  ", o instanceof Integer);
263
264         try {
265             p ("type cast check: Integer = Object(Integer)");
266             i = (Integer) oi;
267             p ("type cast check: Integer = Object");
268             i = (Integer) o;
269             p ("error: class cast exception not thrown");
270         }       
271         catch (ClassCastException c) {
272             p ("exception: class cast");
273         }
274
275         p("DataOutputStream is instanceof DataOutput: ",
276           od instanceof java.io.DataOutput);
277         p("Object is instanceof DataOutput: ", o instanceof java.io.DataOutput);
278
279         try {
280             p ("type cast check: DataOutput = Object(DataOutputStream)");
281             dataout = (java.io.DataOutput) od;
282             p ("type cast check: DataOutput = Object");
283             dataout = (java.io.DataOutput) o;
284             p ("error: class cast exception not thrown");
285         }       
286         catch (ClassCastException c) {
287             p ("exception: class cast");
288         }
289
290         try {
291             p ("type cast check: Integer[] = Object(Integer)[]");
292             ia = (Integer[]) oia;
293             p ("type cast check: Integer[] = Object[]");
294             ia = (Integer[]) oa;
295             p ("error: class cast exception not thrown");
296         }       
297         catch (ClassCastException c) {
298             p ("exception: class cast");
299         }
300
301         try {
302             p ("array store check: Object(Integer)[0] = Integer");
303             oia[0] = i;
304             p ("array store check: Object(Integer)[0] = Object");
305             oia[0] = o;
306             p ("error: array store exception not thrown");
307         }       
308         catch (ArrayStoreException c) {
309             p ("exception: array store");
310         }
311     }
312
313
314     // ****************** test special null pointers ***************************
315
316     public static void testspecialnullpointers() {
317         int i = 0;
318         jctest c = null;
319         jcinterface f = null;
320
321         p ("------------------- test special null pointers");
322
323         try {
324             p ("null pointer check: put field");
325             c.n_i1 = 0;
326             p ("error: put field null pointer exception not thrown");
327         }       
328         catch (NullPointerException x) {
329             p ("exception: null pointer");
330         }
331
332         try {
333             p ("null pointer check: get field");
334             i = c.n_i1;
335             p ("error: get field null pointer exception not thrown");
336         }       
337         catch (NullPointerException x) {
338             p ("exception: null pointer");
339         }
340
341         try {
342             p ("null pointer check: invokevirtual");
343             c.p_nonstatic("invokevirtual");
344             p ("error: invokevirtual null pointer exception not thrown");
345         }       
346         catch (NullPointerException x) {
347             p ("exception: null pointer");
348         }
349
350         try {
351             p ("null pointer check: invokeinterface");
352             f.p_nonstatic("invokeinterface");
353             p ("error: invokeinterface null pointer exception not thrown");
354         }       
355         catch (NullPointerException x) {
356             p ("exception: null pointer");
357         }
358
359         try {
360             p ("null pointer check: monitorenter");
361             synchronized (c) {
362                 p ("error: monitorenter null pointer exception not thrown");
363             }
364         }       
365         catch (NullPointerException x) {
366             p ("exception: null pointer");
367         }
368     }
369
370
371     // ************************ test array bounds ******************************
372
373     public static void testarraybounds(byte[] ba, int i) {
374         p ("testarraybounds: " + (i - 10));
375         ba[i-10] = 0;
376         p ("testarraybounds: " + (i - 5));
377         ba[i-5]  = 0;
378         p ("testarraybounds: " + (i));
379         ba[i]    = 0;
380         p ("testarraybounds: " + (i + 5));
381         ba[i+5]  = 0;
382         p ("testarraybounds: " + (i + 10));
383         ba[i+10] = 0; 
384     }
385
386
387     // ************************ test arrays ************************************                
388
389     public static void testarrays() {
390         int    i;
391         long   l;
392         float  f;
393         double d;
394         String s;
395                 
396         p ("------------------- test byte arrays");
397
398         byte[] ba = null;
399
400         try {
401             p ("null pointer check: byte array store");
402             ba[1] = 0;
403             p ("error: null pointer exception not thrown");
404         }       
405         catch (NullPointerException c) {
406             p ("exception: null pointer");
407         }
408         try {
409             p ("null pointer check: byte array load");
410             i = ba[1];
411             p ("error: null pointer exception not thrown");
412         }       
413         catch (NullPointerException c) {
414             p ("exception: null pointer");
415         }
416
417         try {
418             p ("negative array size check: byte array");
419             ba = new byte [-2];
420             p ("error: negative array size exception not thrown");
421         }       
422         catch (NegativeArraySizeException c) {
423             p ("exception: negative array size");
424         }
425
426         ba = new byte [100];
427
428
429         try {
430             p ("array bound check: byte array store");
431             ba[-1] = 0;
432             p ("error: exception not thrown");
433         }       
434         catch (ArrayIndexOutOfBoundsException c) {
435             p ("exception_1: out of bounds: "+(-1));
436         }
437         try {
438             p ("array bound check: byte array load");
439             i = ba[-1];
440             p ("error: exception not thrown");
441         }       
442         catch (ArrayIndexOutOfBoundsException c) {
443             p ("exception_2: out of bounds: "+(-1));
444         }
445
446         try {
447             testarraybounds(ba, 5);
448         }       
449         catch (ArrayIndexOutOfBoundsException c) {
450             p ("exception_3: out of bounds: "+5);
451         }
452         try {
453             testarraybounds(ba, 50);
454         }       
455         catch (ArrayIndexOutOfBoundsException c) {
456             p ("exception_4: out of bounds: "+50);
457         }
458         try {
459             testarraybounds(ba, 100);
460         }       
461         catch (ArrayIndexOutOfBoundsException c) {
462             p ("exception_5: out of bounds: "+100);
463         }
464
465         try {
466             ba[-4] = 0;
467         }       
468         catch (ArrayIndexOutOfBoundsException c) {
469             p ("exception_6: out of bounds: "+(-4));
470         }
471         try {
472             ba[-3] = 0;
473         }       
474         catch (ArrayIndexOutOfBoundsException c) {
475             p ("exception_7: out of bounds: "+(-3));
476         }
477
478         for (i=-2; i<102; i++) { 
479             try {
480                 ba[i] = (byte) (i-50);
481             }   
482             catch (ArrayIndexOutOfBoundsException c) {
483                 p ("exception_8: out of bounds: "+i);
484             }
485         }
486                 
487         try {
488             ba[102] = 0;
489         }       
490         catch (ArrayIndexOutOfBoundsException c) {
491             p ("exception_9: out of bounds: "+102);
492         }
493         try {
494             ba[103] = 0;
495         }       
496         catch (ArrayIndexOutOfBoundsException c) {
497             p ("exception_10: out of bounds: "+103);
498         }
499         for (i=0; i<100; i++) p (ba[i]);                
500
501
502                 
503
504         p ("-------- test short arrays");               
505
506         short[] sa = null;
507
508         try {
509             p ("null pointer check: short array store");
510             sa[1] = 0;
511             p ("error: null pointer exception not thrown");
512         }       
513         catch (NullPointerException c) {
514             p ("exception: null pointer");
515         }
516         try {
517             p ("null pointer check: short array load");
518             i = sa[1];
519             p ("error: null pointer exception not thrown");
520         }       
521         catch (NullPointerException c) {
522             p ("exception: null pointer");
523         }
524
525         sa = new short [100];
526
527         try {
528             p ("array bound check: short array store");
529             sa[-1] = 0;
530             p ("error: exception not thrown");
531         }       
532         catch (ArrayIndexOutOfBoundsException c) {
533             p ("exception_11: out of bounds: "+(-1));
534         }
535         try {
536             p ("array bound check: short array load");
537             i = sa[-1];
538             p ("error: exception not thrown");
539         }       
540         catch (ArrayIndexOutOfBoundsException c) {
541             p ("exception_12: out of bounds: "+(-1));
542         }
543
544         for (i=0; i<100; i++) sa[i] = (short) (i-50);
545         for (i=0; i<100; i++) p (sa[i]);
546                 
547                 
548
549         p ("-------- test int arrays");         
550
551         int[] ia = null;
552
553         try {
554             p ("null pointer check: int array store");
555             ia[1] = 0;
556             p ("error: null pointer exception not thrown");
557         }       
558         catch (NullPointerException c) {
559             p ("exception: null pointer");
560         }
561         try {
562             p ("null pointer check: int array load");
563             i = ia[1];
564             p ("error: null pointer exception not thrown");
565         }       
566         catch (NullPointerException c) {
567             p ("exception: null pointer");
568         }
569
570         ia = new int [50];
571
572         try {
573             p ("array bound check: int array store");
574             ia[-1] = 0;
575             p ("error: exception not thrown");
576         }       
577         catch (ArrayIndexOutOfBoundsException c) {
578             p ("exception: out of bounds: "+(-1));
579         }
580         try {
581             p ("array bound check: int array load");
582             i = ia[-1];
583             p ("error: exception not thrown");
584         }       
585         catch (ArrayIndexOutOfBoundsException c) {
586             p ("exception: out of bounds: "+(-1));
587         }
588
589         for (i=0; i<10; i++) ia[i] = (123456 + i);
590         for (i=0; i<10; i++) p (ia[i]);
591
592                 
593
594         p ("-------- test long arrays");                
595
596         long[] la = null;
597
598         try {
599             p ("null pointer check: long array store");
600             la[1] = 0;
601             p ("error: null pointer exception not thrown");
602         }       
603         catch (NullPointerException c) {
604             p ("exception: null pointer");
605         }
606         try {
607             p ("null pointer check: long array load");
608             l = la[1];
609             p ("error: null pointer exception not thrown");
610         }       
611         catch (NullPointerException c) {
612             p ("exception: null pointer");
613         }
614
615         la = new long [10];
616
617         try {
618             p ("array bound check: long array store");
619             la[-1] = 0;
620             p ("error: exception not thrown");
621         }       
622         catch (ArrayIndexOutOfBoundsException c) {
623             p ("exception: out of bounds: "+(-1));
624         }
625         try {
626             p ("array bound check: long array load");
627             l = la[-1];
628             p ("error: exception not thrown");
629         }       
630         catch (ArrayIndexOutOfBoundsException c) {
631             p ("exception: out of bounds: "+(-1));
632         }
633
634         for (i=0; i<10; i++) la[i] = (1234567890123L + i);
635         for (i=0; i<10; i++) p (la[i]);
636
637                 
638         p ("-------- test char arrays");                
639
640         char[] ca = null;
641
642         try {
643             p ("null pointer check: char array store");
644             ca[1] = 0;
645             p ("error: null pointer exception not thrown");
646         }       
647         catch (NullPointerException c) {
648             p ("exception: null pointer");
649         }
650         try {
651             p ("null pointer check: char array load");
652             i = ca[1];
653             p ("error: null pointer exception not thrown");
654         }       
655         catch (NullPointerException c) {
656             p ("exception: null pointer");
657         }
658
659         ca = new char [50];
660
661         try {
662             p ("array bound check: char array store");
663             ca[-1] = 0;
664             p ("error: exception not thrown");
665         }       
666         catch (ArrayIndexOutOfBoundsException c) {
667             p ("exception: out of bounds: "+(-1));
668         }
669         try {
670             p ("array bound check: char array load");
671             i = ca[-1];
672             p ("error: exception not thrown");
673         }       
674         catch (ArrayIndexOutOfBoundsException c) {
675             p ("exception: out of bounds: "+(-1));
676         }
677
678         for (i=0; i<50; i++) ca[i] = (char) ('A' + i);
679         for (i=0; i<50; i++) p (ca[i]);
680
681         p ("-------- test address arrays");
682
683         String[] sta = null;
684
685         try {
686             p ("null pointer check: address array store");
687             sta[1] = null;
688             p ("error: null pointer exception not thrown");
689         }       
690         catch (NullPointerException c) {
691             p ("exception: null pointer");
692         }
693         try {
694             p ("null pointer check: address array load");
695             s = sta[1];
696             p ("error: null pointer exception not thrown");
697         }       
698         catch (NullPointerException c) {
699             p ("exception: null pointer");
700         }
701
702         try {
703             p ("negative array size check: address array");
704             sta = new String[-3];
705             p ("error: negative array size exception not thrown");
706         }       
707         catch (NegativeArraySizeException c) {
708             p ("exception: negative array size");
709         }
710
711         sta = new String[5];
712
713         try {
714             p ("array bound check: address array store");
715             sta[-1] = null;
716             p ("error: exception not thrown");
717         }       
718         catch (ArrayIndexOutOfBoundsException c) {
719             p ("exception: out of bounds: "+(-1));
720         }
721         try {
722             p ("array bound check: address array load");
723             s = sta[-1];
724             p ("error: exception not thrown");
725         }       
726         catch (ArrayIndexOutOfBoundsException c) {
727             p ("exception: out of bounds: "+(-1));
728         }
729
730         for (i=0; i<5; i++) sta[i] = Integer.toString(i) + ". Zeile";
731         for (i=0; i<5; i++) p (sta[i]);
732                 
733         p ("-------- test multi dimensional arrays");
734
735         int [][][] iaaa = null;
736
737         try {
738             p ("negative array size check: multi dimensional array");
739             iaaa = new int[2][3][-4];
740             p ("error: negative array size exception not thrown");
741         }       
742         catch (NegativeArraySizeException c) {
743             p ("exception: negative array size");
744         }
745
746         try {
747             p("savedvar size copy check: multi dimensional array");
748             Integer io = new Integer(10);
749             iaaa = new int[10][io.intValue()][10];
750             for (i = 0; i < 10; i++) {
751                 for (int j = 0; j < 10; j++) {
752                     for (int k = 0; k < 10; k++) {
753                         iaaa[i][j][k] = 1;
754                     }
755                 }
756             }
757             p("successfully created");
758         } catch (Exception e) {
759             p("error: exception thrown");
760         }
761
762         iaaa = new int[2][3][4];
763         long [][][] laaa = new long[2][3][6];
764         float [][][] faaa = new float[2][3][4];
765         double [][][] daaa = new double[3][4][7];
766         for (i=0; i<2; i++) {
767             int i2; for (i2=0; i2<3; i2++) {
768                 int i3; for (i3=0; i3<4; i3++) {
769                     iaaa[i][i2][i3] = i*i*i + i2*i2 + i3;
770                     laaa[i][i2][i3] = i*i*i + i2*i2 + i3 + 7;
771                     faaa[i][i2][i3] = i*i*i + i2*i2 + i3 + 0.4F;
772                     daaa[i][i2][i3] = i*i*i + i2*i2 + i3 - 47.0001;
773                     p (iaaa[i][i2][i3]);
774                     p (laaa[i][i2][i3]);
775                     p (faaa[i][i2][i3]);
776                     p (daaa[i][i2][i3]);
777                 }
778             }
779         }
780     }
781
782
783     static public void testconst(int i, long l) {
784         p ("TESTCONST CALLED WITH ", i);
785         p ("                  AND ", l);
786                 
787         if (!(i == (0))) p("not IFEQ:   ", (0));
788         if (!(i != (0))) p("not IFNE:   ", (0));
789         if (!(i <  (0))) p("not IFLT:   ", (0));
790         if (!(i <= (0))) p("not IFLE:   ", (0));
791         if (!(i >  (0))) p("not IFGT:   ", (0));
792         if (!(i >= (0))) p("not IFGE:   ", (0));
793
794         if (!(l == (0))) p("not IF_LEQ: ", (0));
795         if (!(l != (0))) p("not IF_LNE: ", (0));
796         if (!(l <  (0))) p("not IF_LLT: ", (0));
797         if (!(l <= (0))) p("not IF_LLE: ", (0));
798         if (!(l >  (0))) p("not IF_LGT: ", (0));
799         if (!(l >= (0))) p("not IF_LGE: ", (0));
800
801         p("IADDCONST:  ", i  +  (-1));
802         p("ISUBCONST:  ", i  -  (-1));
803         p("IMULCONST:  ", i  *  (-1));
804         p("ISHLCONST:  ", i <<  (-1));
805         p("ISHRCONST:  ", i >>  (-1));
806         p("IUSHRCONST: ", i >>> (-1));
807         p("IANDCONST:  ", i  &  (-1));
808         p("IORCONST:   ", i  |  (-1));
809         p("IXORCONST:  ", i  ^  (-1));
810
811         if (!(i == (-1))) p("not IFEQ:   ", (-1));
812         if (!(i != (-1))) p("not IFNE:   ", (-1));
813         if (!(i <  (-1))) p("not IFLT:   ", (-1));
814         if (!(i <= (-1))) p("not IFLE:   ", (-1));
815         if (!(i >  (-1))) p("not IFGT:   ", (-1));
816         if (!(i >= (-1))) p("not IFGE:   ", (-1));
817
818         p("LADDCONST:  ", l  +  (-1));
819         p("LSUBCONST:  ", l  -  (-1));
820         p("LMULCONST:  ", l  *  (-1));
821         p("LSHLCONST:  ", l <<  (-1));
822         p("LSHRCONST:  ", l >>  (-1));
823         p("LUSHRCONST: ", l >>> (-1));
824         p("LANDCONST:  ", l  &  (-1));
825         p("LORCONST:   ", l  |  (-1));
826         p("LXORCONST:  ", l  ^  (-1));
827
828         if (!(l == (-1))) p("not IF_LEQ: ", (-1));
829         if (!(l != (-1))) p("not IF_LNE: ", (-1));
830         if (!(l <  (-1))) p("not IF_LLT: ", (-1));
831         if (!(l <= (-1))) p("not IF_LLE: ", (-1));
832         if (!(l >  (-1))) p("not IF_LGT: ", (-1));
833         if (!(l >= (-1))) p("not IF_LGE: ", (-1));
834
835         p("IADDCONST:  ", i  +  (1));
836         p("ISUBCONST:  ", i  -  (1));
837         p("IMULCONST:  ", i  *  (1));
838         p("ISHLCONST:  ", i <<  (1));
839         p("ISHRCONST:  ", i >>  (1));
840         p("IUSHRCONST: ", i >>> (1));
841         p("IANDCONST:  ", i  &  (1));
842         p("IORCONST:   ", i  |  (1));
843         p("IXORCONST:  ", i  ^  (1));
844
845         if (!(i == (1))) p("not IFEQ:   ", (1));
846         if (!(i != (1))) p("not IFNE:   ", (1));
847         if (!(i <  (1))) p("not IFLT:   ", (1));
848         if (!(i <= (1))) p("not IFLE:   ", (1));
849         if (!(i >  (1))) p("not IFGT:   ", (1));
850         if (!(i >= (1))) p("not IFGE:   ", (1));
851
852         p("LADDCONST:  ", l  +  (1));
853         p("LSUBCONST:  ", l  -  (1));
854         p("LMULCONST:  ", l  *  (1));
855         p("LSHLCONST:  ", l <<  (1));
856         p("LSHRCONST:  ", l >>  (1));
857         p("LUSHRCONST: ", l >>> (1));
858         p("LANDCONST:  ", l  &  (1));
859         p("LORCONST:   ", l  |  (1));
860         p("LXORCONST:  ", l  ^  (1));
861
862         if (!(l == (1))) p("not IF_LEQ: ", (1));
863         if (!(l != (1))) p("not IF_LNE: ", (1));
864         if (!(l <  (1))) p("not IF_LLT: ", (1));
865         if (!(l <= (1))) p("not IF_LLE: ", (1));
866         if (!(l >  (1))) p("not IF_LGT: ", (1));
867         if (!(l >= (1))) p("not IF_LGE: ", (1));
868
869         p("IADDCONST:  ", i  +  (255));
870         p("ISUBCONST:  ", i  -  (255));
871         p("IMULCONST:  ", i  *  (255));
872         p("ISHLCONST:  ", i <<  (255));
873         p("ISHRCONST:  ", i >>  (255));
874         p("IUSHRCONST: ", i >>> (255));
875         p("IANDCONST:  ", i  &  (255));
876         p("IORCONST:   ", i  |  (255));
877         p("IXORCONST:  ", i  ^  (255));
878
879         if (!(i == (255))) p("not IFEQ:   ", (255));
880         if (!(i != (255))) p("not IFNE:   ", (255));
881         if (!(i <  (255))) p("not IFLT:   ", (255));
882         if (!(i <= (255))) p("not IFLE:   ", (255));
883         if (!(i >  (255))) p("not IFGT:   ", (255));
884         if (!(i >= (255))) p("not IFGE:   ", (255));
885
886         p("LADDCONST:  ", l  +  (255));
887         p("LSUBCONST:  ", l  -  (255));
888         p("LMULCONST:  ", l  *  (255));
889         p("LSHLCONST:  ", l <<  (255));
890         p("LSHRCONST:  ", l >>  (255));
891         p("LUSHRCONST: ", l >>> (255));
892         p("LANDCONST:  ", l  &  (255));
893         p("LORCONST:   ", l  |  (255));
894         p("LXORCONST:  ", l  ^  (255));
895
896         if (!(l == (255))) p("not IF_LEQ: ", (255));
897         if (!(l != (255))) p("not IF_LNE: ", (255));
898         if (!(l <  (255))) p("not IF_LLT: ", (255));
899         if (!(l <= (255))) p("not IF_LLE: ", (255));
900         if (!(l >  (255))) p("not IF_LGT: ", (255));
901         if (!(l >= (255))) p("not IF_LGE: ", (255));
902
903         p("IADDCONST:  ", i  +  (256));
904         p("ISUBCONST:  ", i  -  (256));
905         p("IMULCONST:  ", i  *  (256));
906         p("ISHLCONST:  ", i <<  (256));
907         p("ISHRCONST:  ", i >>  (256));
908         p("IUSHRCONST: ", i >>> (256));
909         p("IANDCONST:  ", i  &  (256));
910         p("IORCONST:   ", i  |  (256));
911         p("IXORCONST:  ", i  ^  (256));
912
913         if (!(i == (256))) p("not IFEQ:   ", (256));
914         if (!(i != (256))) p("not IFNE:   ", (256));
915         if (!(i <  (256))) p("not IFLT:   ", (256));
916         if (!(i <= (256))) p("not IFLE:   ", (256));
917         if (!(i >  (256))) p("not IFGT:   ", (256));
918         if (!(i >= (256))) p("not IFGE:   ", (256));
919
920         p("LADDCONST:  ", l  +  (256));
921         p("LSUBCONST:  ", l  -  (256));
922         p("LMULCONST:  ", l  *  (256));
923         p("LSHLCONST:  ", l <<  (256));
924         p("LSHRCONST:  ", l >>  (256));
925         p("LUSHRCONST: ", l >>> (256));
926         p("LANDCONST:  ", l  &  (256));
927         p("LORCONST:   ", l  |  (256));
928         p("LXORCONST:  ", l  ^  (256));
929
930         if (!(l == (256))) p("not IF_LEQ: ", (256));
931         if (!(l != (256))) p("not IF_LNE: ", (256));
932         if (!(l <  (256))) p("not IF_LLT: ", (256));
933         if (!(l <= (256))) p("not IF_LLE: ", (256));
934         if (!(l >  (256))) p("not IF_LGT: ", (256));
935         if (!(l >= (256))) p("not IF_LGE: ", (256));
936
937         p("IADDCONST:  ", i  +  (32767));
938         p("ISUBCONST:  ", i  -  (32767));
939         p("IMULCONST:  ", i  *  (32767));
940         p("ISHLCONST:  ", i <<  (32767));
941         p("ISHRCONST:  ", i >>  (32767));
942         p("IUSHRCONST: ", i >>> (32767));
943         p("IANDCONST:  ", i  &  (32767));
944         p("IORCONST:   ", i  |  (32767));
945         p("IXORCONST:  ", i  ^  (32767));
946
947         if (!(i == (32767))) p("not IFEQ:   ", (32767));
948         if (!(i != (32767))) p("not IFNE:   ", (32767));
949         if (!(i <  (32767))) p("not IFLT:   ", (32767));
950         if (!(i <= (32767))) p("not IFLE:   ", (32767));
951         if (!(i >  (32767))) p("not IFGT:   ", (32767));
952         if (!(i >= (32767))) p("not IFGE:   ", (32767));
953
954         p("LADDCONST:  ", l  +  (32767));
955         p("LSUBCONST:  ", l  -  (32767));
956         p("LMULCONST:  ", l  *  (32767));
957         p("LSHLCONST:  ", l <<  (32767));
958         p("LSHRCONST:  ", l >>  (32767));
959         p("LUSHRCONST: ", l >>> (32767));
960         p("LANDCONST:  ", l  &  (32767));
961         p("LORCONST:   ", l  |  (32767));
962         p("LXORCONST:  ", l  ^  (32767));
963
964         if (!(l == (32767))) p("not IF_LEQ: ", (32767));
965         if (!(l != (32767))) p("not IF_LNE: ", (32767));
966         if (!(l <  (32767))) p("not IF_LLT: ", (32767));
967         if (!(l <= (32767))) p("not IF_LLE: ", (32767));
968         if (!(l >  (32767))) p("not IF_LGT: ", (32767));
969         if (!(l >= (32767))) p("not IF_LGE: ", (32767));
970
971         p("IADDCONST:  ", i  +  (32768));
972         p("ISUBCONST:  ", i  -  (32768));
973         p("IMULCONST:  ", i  *  (32768));
974         p("ISHLCONST:  ", i <<  (32768));
975         p("ISHRCONST:  ", i >>  (32768));
976         p("IUSHRCONST: ", i >>> (32768));
977         p("IANDCONST:  ", i  &  (32768));
978         p("IORCONST:   ", i  |  (32768));
979         p("IXORCONST:  ", i  ^  (32768));
980
981         if (!(i == (32768))) p("not IFEQ:   ", (32768));
982         if (!(i != (32768))) p("not IFNE:   ", (32768));
983         if (!(i <  (32768))) p("not IFLT:   ", (32768));
984         if (!(i <= (32768))) p("not IFLE:   ", (32768));
985         if (!(i >  (32768))) p("not IFGT:   ", (32768));
986         if (!(i >= (32768))) p("not IFGE:   ", (32768));
987
988         p("LADDCONST:  ", l  +  (32768));
989         p("LSUBCONST:  ", l  -  (32768));
990         p("LMULCONST:  ", l  *  (32768));
991         p("LSHLCONST:  ", l <<  (32768));
992         p("LSHRCONST:  ", l >>  (32768));
993         p("LUSHRCONST: ", l >>> (32768));
994         p("LANDCONST:  ", l  &  (32768));
995         p("LORCONST:   ", l  |  (32768));
996         p("LXORCONST:  ", l  ^  (32768));
997
998         if (!(l == (32768))) p("not IF_LEQ: ", (32768));
999         if (!(l != (32768))) p("not IF_LNE: ", (32768));
1000         if (!(l <  (32768))) p("not IF_LLT: ", (32768));
1001         if (!(l <= (32768))) p("not IF_LLE: ", (32768));
1002         if (!(l >  (32768))) p("not IF_LGT: ", (32768));
1003         if (!(l >= (32768))) p("not IF_LGE: ", (32768));
1004
1005         p("IADDCONST:  ", i  +  (-32768));
1006         p("ISUBCONST:  ", i  -  (-32768));
1007         p("IMULCONST:  ", i  *  (-32768));
1008         p("ISHLCONST:  ", i <<  (-32768));
1009         p("ISHRCONST:  ", i >>  (-32768));
1010         p("IUSHRCONST: ", i >>> (-32768));
1011         p("IANDCONST:  ", i  &  (-32768));
1012         p("IORCONST:   ", i  |  (-32768));
1013         p("IXORCONST:  ", i  ^  (-32768));
1014
1015         if (!(i == (-32768))) p("not IFEQ:   ", (-32768));
1016         if (!(i != (-32768))) p("not IFNE:   ", (-32768));
1017         if (!(i <  (-32768))) p("not IFLT:   ", (-32768));
1018         if (!(i <= (-32768))) p("not IFLE:   ", (-32768));
1019         if (!(i >  (-32768))) p("not IFGT:   ", (-32768));
1020         if (!(i >= (-32768))) p("not IFGE:   ", (-32768));
1021
1022         p("LADDCONST:  ", l  +  (-32768));
1023         p("LSUBCONST:  ", l  -  (-32768));
1024         p("LMULCONST:  ", l  *  (-32768));
1025         p("LSHLCONST:  ", l <<  (-32768));
1026         p("LSHRCONST:  ", l >>  (-32768));
1027         p("LUSHRCONST: ", l >>> (-32768));
1028         p("LANDCONST:  ", l  &  (-32768));
1029         p("LORCONST:   ", l  |  (-32768));
1030         p("LXORCONST:  ", l  ^  (-32768));
1031
1032         if (!(l == (-32768))) p("not IF_LEQ: ", (-32768));
1033         if (!(l != (-32768))) p("not IF_LNE: ", (-32768));
1034         if (!(l <  (-32768))) p("not IF_LLT: ", (-32768));
1035         if (!(l <= (-32768))) p("not IF_LLE: ", (-32768));
1036         if (!(l >  (-32768))) p("not IF_LGT: ", (-32768));
1037         if (!(l >= (-32768))) p("not IF_LGE: ", (-32768));
1038
1039         p("IADDCONST:  ", i  +  (-32769));
1040         p("ISUBCONST:  ", i  -  (-32769));
1041         p("IMULCONST:  ", i  *  (-32769));
1042         p("ISHLCONST:  ", i <<  (-32769));
1043         p("ISHRCONST:  ", i >>  (-32769));
1044         p("IUSHRCONST: ", i >>> (-32769));
1045         p("IANDCONST:  ", i  &  (-32769));
1046         p("IORCONST:   ", i  |  (-32769));
1047         p("IXORCONST:  ", i  ^  (-32769));
1048
1049         if (!(i == (-32769))) p("not IFEQ:   ", (-32769));
1050         if (!(i != (-32769))) p("not IFNE:   ", (-32769));
1051         if (!(i <  (-32769))) p("not IFLT:   ", (-32769));
1052         if (!(i <= (-32769))) p("not IFLE:   ", (-32769));
1053         if (!(i >  (-32769))) p("not IFGT:   ", (-32769));
1054         if (!(i >= (-32769))) p("not IFGE:   ", (-32769));
1055
1056         p("LADDCONST:  ", l  +  (-32769));
1057         p("LSUBCONST:  ", l  -  (-32769));
1058         p("LMULCONST:  ", l  *  (-32769));
1059         p("LSHLCONST:  ", l <<  (-32769));
1060         p("LSHRCONST:  ", l >>  (-32769));
1061         p("LUSHRCONST: ", l >>> (-32769));
1062         p("LANDCONST:  ", l  &  (-32769));
1063         p("LORCONST:   ", l  |  (-32769));
1064         p("LXORCONST:  ", l  ^  (-32769));
1065
1066         if (!(l == (-32769))) p("not IF_LEQ: ", (-32769));
1067         if (!(l != (-32769))) p("not IF_LNE: ", (-32769));
1068         if (!(l <  (-32769))) p("not IF_LLT: ", (-32769));
1069         if (!(l <= (-32769))) p("not IF_LLE: ", (-32769));
1070         if (!(l >  (-32769))) p("not IF_LGT: ", (-32769));
1071         if (!(l >= (-32769))) p("not IF_LGE: ", (-32769));
1072
1073         p("IADDCONST:  ", i  +  (2147483647));
1074         p("ISUBCONST:  ", i  -  (2147483647));
1075         p("IMULCONST:  ", i  *  (2147483647));
1076         p("ISHLCONST:  ", i <<  (2147483647));
1077         p("ISHRCONST:  ", i >>  (2147483647));
1078         p("IUSHRCONST: ", i >>> (2147483647));
1079         p("IANDCONST:  ", i  &  (2147483647));
1080         p("IORCONST:   ", i  |  (2147483647));
1081         p("IXORCONST:  ", i  ^  (2147483647));
1082
1083         if (!(i == (2147483647))) p("not IFEQ:   ", (2147483647));
1084         if (!(i != (2147483647))) p("not IFNE:   ", (2147483647));
1085         if (!(i <  (2147483647))) p("not IFLT:   ", (2147483647));
1086         if (!(i <= (2147483647))) p("not IFLE:   ", (2147483647));
1087         if (!(i >  (2147483647))) p("not IFGT:   ", (2147483647));
1088         if (!(i >= (2147483647))) p("not IFGE:   ", (2147483647));
1089
1090         p("LADDCONST:  ", l  +  (2147483647));
1091         p("LSUBCONST:  ", l  -  (2147483647));
1092         p("LMULCONST:  ", l  *  (2147483647));
1093         p("LSHLCONST:  ", l <<  (2147483647));
1094         p("LSHRCONST:  ", l >>  (2147483647));
1095         p("LUSHRCONST: ", l >>> (2147483647));
1096         p("LANDCONST:  ", l  &  (2147483647));
1097         p("LORCONST:   ", l  |  (2147483647));
1098         p("LXORCONST:  ", l  ^  (2147483647));
1099
1100         if (!(l == (2147483647))) p("not IF_LEQ: ", (2147483647));
1101         if (!(l != (2147483647))) p("not IF_LNE: ", (2147483647));
1102         if (!(l <  (2147483647))) p("not IF_LLT: ", (2147483647));
1103         if (!(l <= (2147483647))) p("not IF_LLE: ", (2147483647));
1104         if (!(l >  (2147483647))) p("not IF_LGT: ", (2147483647));
1105         if (!(l >= (2147483647))) p("not IF_LGE: ", (2147483647));
1106
1107         p("LADDCONST:  ", l  +  (2147483648L));
1108         p("LSUBCONST:  ", l  -  (2147483648L));
1109         p("LMULCONST:  ", l  *  (2147483648L));
1110         p("LSHLCONST:  ", l <<  (2147483648L));
1111         p("LSHRCONST:  ", l >>  (2147483648L));
1112         p("LUSHRCONST: ", l >>> (2147483648L));
1113         p("LANDCONST:  ", l  &  (2147483648L));
1114         p("LORCONST:   ", l  |  (2147483648L));
1115         p("LXORCONST:  ", l  ^  (2147483648L));
1116
1117         if (!(l == (2147483648L))) p("not IF_LEQ: ", (2147483648L));
1118         if (!(l != (2147483648L))) p("not IF_LNE: ", (2147483648L));
1119         if (!(l <  (2147483648L))) p("not IF_LLT: ", (2147483648L));
1120         if (!(l <= (2147483648L))) p("not IF_LLE: ", (2147483648L));
1121         if (!(l >  (2147483648L))) p("not IF_LGT: ", (2147483648L));
1122         if (!(l >= (2147483648L))) p("not IF_LGE: ", (2147483648L));
1123
1124         p("IADDCONST:  ", i  +  (-2147483648));
1125         p("ISUBCONST:  ", i  -  (-2147483648));
1126         p("IMULCONST:  ", i  *  (-2147483648));
1127         p("ISHLCONST:  ", i <<  (-2147483648));
1128         p("ISHRCONST:  ", i >>  (-2147483648));
1129         p("IUSHRCONST: ", i >>> (-2147483648));
1130         p("IANDCONST:  ", i  &  (-2147483648));
1131         p("IORCONST:   ", i  |  (-2147483648));
1132         p("IXORCONST:  ", i  ^  (-2147483648));
1133
1134         if (!(i == (-2147483648))) p("not IFEQ:   ", (-2147483648));
1135         if (!(i != (-2147483648))) p("not IFNE:   ", (-2147483648));
1136         if (!(i <  (-2147483648))) p("not IFLT:   ", (-2147483648));
1137         if (!(i <= (-2147483648))) p("not IFLE:   ", (-2147483648));
1138         if (!(i >  (-2147483648))) p("not IFGT:   ", (-2147483648));
1139         if (!(i >= (-2147483648))) p("not IFGE:   ", (-2147483648));
1140
1141         p("LADDCONST:  ", l  +  (-2147483648));
1142         p("LSUBCONST:  ", l  -  (-2147483648));
1143         p("LMULCONST:  ", l  *  (-2147483648));
1144         p("LSHLCONST:  ", l <<  (-2147483648));
1145         p("LSHRCONST:  ", l >>  (-2147483648));
1146         p("LUSHRCONST: ", l >>> (-2147483648));
1147         p("LANDCONST:  ", l  &  (-2147483648));
1148         p("LORCONST:   ", l  |  (-2147483648));
1149         p("LXORCONST:  ", l  ^  (-2147483648));
1150
1151         if (!(l == (-2147483648))) p("not IF_LEQ: ", (-2147483648));
1152         if (!(l != (-2147483648))) p("not IF_LNE: ", (-2147483648));
1153         if (!(l <  (-2147483648))) p("not IF_LLT: ", (-2147483648));
1154         if (!(l <= (-2147483648))) p("not IF_LLE: ", (-2147483648));
1155         if (!(l >  (-2147483648))) p("not IF_LGT: ", (-2147483648));
1156         if (!(l >= (-2147483648))) p("not IF_LGE: ", (-2147483648));
1157
1158         p("LADDCONST:  ", l  +  (-2147483649L));
1159         p("LSUBCONST:  ", l  -  (-2147483649L));
1160         p("LMULCONST:  ", l  *  (-2147483649L));
1161         p("LSHLCONST:  ", l <<  (-2147483649L));
1162         p("LSHRCONST:  ", l >>  (-2147483649L));
1163         p("LUSHRCONST: ", l >>> (-2147483649L));
1164         p("LANDCONST:  ", l  &  (-2147483649L));
1165         p("LORCONST:   ", l  |  (-2147483649L));
1166         p("LXORCONST:  ", l  ^  (-2147483649L));
1167
1168         if (!(l == (-2147483649L))) p("not IF_LEQ: ", (-2147483649L));
1169         if (!(l != (-2147483649L))) p("not IF_LNE: ", (-2147483649L));
1170         if (!(l <  (-2147483649L))) p("not IF_LLT: ", (-2147483649L));
1171         if (!(l <= (-2147483649L))) p("not IF_LLE: ", (-2147483649L));
1172         if (!(l >  (-2147483649L))) p("not IF_LGT: ", (-2147483649L));
1173         if (!(l >= (-2147483649L))) p("not IF_LGE: ", (-2147483649L));
1174     }
1175
1176     static public void testdivremconst(int a) {
1177         p("IDIVPOW2 (" + a + " / 0x00000002):  ", a / 0x00000002);
1178         p("IDIVPOW2 (" + a + " / 0x00000004):  ", a / 0x00000004);
1179         p("IDIVPOW2 (" + a + " / 0x00000008):  ", a / 0x00000008);
1180         p("IDIVPOW2 (" + a + " / 0x00000010):  ", a / 0x00000010);
1181         p("IDIVPOW2 (" + a + " / 0x00000020):  ", a / 0x00000020);
1182         p("IDIVPOW2 (" + a + " / 0x00000040):  ", a / 0x00000040);
1183         p("IDIVPOW2 (" + a + " / 0x00000080):  ", a / 0x00000080);
1184         p("IDIVPOW2 (" + a + " / 0x00000100):  ", a / 0x00000100);
1185         p("IDIVPOW2 (" + a + " / 0x00000200):  ", a / 0x00000200);
1186         p("IDIVPOW2 (" + a + " / 0x00000400):  ", a / 0x00000400);
1187         p("IDIVPOW2 (" + a + " / 0x00000800):  ", a / 0x00000800);
1188         p("IDIVPOW2 (" + a + " / 0x00001000):  ", a / 0x00001000);
1189         p("IDIVPOW2 (" + a + " / 0x00002000):  ", a / 0x00002000);
1190         p("IDIVPOW2 (" + a + " / 0x00004000):  ", a / 0x00004000);
1191         p("IDIVPOW2 (" + a + " / 0x00008000):  ", a / 0x00008000);
1192         p("IDIVPOW2 (" + a + " / 0x00010000):  ", a / 0x00010000);
1193         p("IDIVPOW2 (" + a + " / 0x00020000):  ", a / 0x00020000);
1194         p("IDIVPOW2 (" + a + " / 0x00040000):  ", a / 0x00040000);
1195         p("IDIVPOW2 (" + a + " / 0x00080000):  ", a / 0x00080000);
1196         p("IDIVPOW2 (" + a + " / 0x00100000):  ", a / 0x00100000);
1197         p("IDIVPOW2 (" + a + " / 0x00200000):  ", a / 0x00200000);
1198         p("IDIVPOW2 (" + a + " / 0x00400000):  ", a / 0x00400000);
1199         p("IDIVPOW2 (" + a + " / 0x00800000):  ", a / 0x00800000);
1200         p("IDIVPOW2 (" + a + " / 0x01000000):  ", a / 0x01000000);
1201         p("IDIVPOW2 (" + a + " / 0x02000000):  ", a / 0x02000000);
1202         p("IDIVPOW2 (" + a + " / 0x04000000):  ", a / 0x04000000);
1203         p("IDIVPOW2 (" + a + " / 0x08000000):  ", a / 0x08000000);
1204         p("IDIVPOW2 (" + a + " / 0x10000000):  ", a / 0x10000000);
1205         p("IDIVPOW2 (" + a + " / 0x20000000):  ", a / 0x20000000);
1206         p("IDIVPOW2 (" + a + " / 0x40000000):  ", a / 0x40000000);
1207         p("IDIVPOW2 (" + a + " / 0x80000000):  ", a / 0x80000000);
1208
1209         p("IREMPOW2 (" + a + " % 0x00000002):  ", a % 0x00000002);
1210         p("IREMPOW2 (" + a + " % 0x00000004):  ", a % 0x00000004);
1211         p("IREMPOW2 (" + a + " % 0x00000008):  ", a % 0x00000008);
1212         p("IREMPOW2 (" + a + " % 0x00000010):  ", a % 0x00000010);
1213         p("IREMPOW2 (" + a + " % 0x00000020):  ", a % 0x00000020);
1214         p("IREMPOW2 (" + a + " % 0x00000040):  ", a % 0x00000040);
1215         p("IREMPOW2 (" + a + " % 0x00000080):  ", a % 0x00000080);
1216         p("IREMPOW2 (" + a + " % 0x00000100):  ", a % 0x00000100);
1217         p("IREMPOW2 (" + a + " % 0x00000200):  ", a % 0x00000200);
1218         p("IREMPOW2 (" + a + " % 0x00000400):  ", a % 0x00000400);
1219         p("IREMPOW2 (" + a + " % 0x00000800):  ", a % 0x00000800);
1220         p("IREMPOW2 (" + a + " % 0x00001000):  ", a % 0x00001000);
1221         p("IREMPOW2 (" + a + " % 0x00002000):  ", a % 0x00002000);
1222         p("IREMPOW2 (" + a + " % 0x00004000):  ", a % 0x00004000);
1223         p("IREMPOW2 (" + a + " % 0x00008000):  ", a % 0x00008000);
1224         p("IREMPOW2 (" + a + " % 0x00010000):  ", a % 0x00010000);
1225         p("IREMPOW2 (" + a + " % 0x00020000):  ", a % 0x00020000);
1226         p("IREMPOW2 (" + a + " % 0x00040000):  ", a % 0x00040000);
1227         p("IREMPOW2 (" + a + " % 0x00080000):  ", a % 0x00080000);
1228         p("IREMPOW2 (" + a + " % 0x00100000):  ", a % 0x00100000);
1229         p("IREMPOW2 (" + a + " % 0x00200000):  ", a % 0x00200000);
1230         p("IREMPOW2 (" + a + " % 0x00400000):  ", a % 0x00400000);
1231         p("IREMPOW2 (" + a + " % 0x00800000):  ", a % 0x00800000);
1232         p("IREMPOW2 (" + a + " % 0x01000000):  ", a % 0x01000000);
1233         p("IREMPOW2 (" + a + " % 0x02000000):  ", a % 0x02000000);
1234         p("IREMPOW2 (" + a + " % 0x04000000):  ", a % 0x04000000);
1235         p("IREMPOW2 (" + a + " % 0x08000000):  ", a % 0x08000000);
1236         p("IREMPOW2 (" + a + " % 0x10000000):  ", a % 0x10000000);
1237         p("IREMPOW2 (" + a + " % 0x20000000):  ", a % 0x20000000);
1238         p("IREMPOW2 (" + a + " % 0x40000000):  ", a % 0x40000000);
1239         p("IREMPOW2 (" + a + " % 0x80000000):  ", a % 0x80000000);
1240     }
1241
1242     static public void testdivremconst(long a) {
1243         p("LDIVPOW2 (" + a + " / 0x00000002):  ", a / 0x00000002);
1244         p("LDIVPOW2 (" + a + " / 0x00000004):  ", a / 0x00000004);
1245         p("LDIVPOW2 (" + a + " / 0x00000008):  ", a / 0x00000008);
1246         p("LDIVPOW2 (" + a + " / 0x00000010):  ", a / 0x00000010);
1247         p("LDIVPOW2 (" + a + " / 0x00000020):  ", a / 0x00000020);
1248         p("LDIVPOW2 (" + a + " / 0x00000040):  ", a / 0x00000040);
1249         p("LDIVPOW2 (" + a + " / 0x00000080):  ", a / 0x00000080);
1250         p("LDIVPOW2 (" + a + " / 0x00000100):  ", a / 0x00000100);
1251         p("LDIVPOW2 (" + a + " / 0x00000200):  ", a / 0x00000200);
1252         p("LDIVPOW2 (" + a + " / 0x00000400):  ", a / 0x00000400);
1253         p("LDIVPOW2 (" + a + " / 0x00000800):  ", a / 0x00000800);
1254         p("LDIVPOW2 (" + a + " / 0x00001000):  ", a / 0x00001000);
1255         p("LDIVPOW2 (" + a + " / 0x00002000):  ", a / 0x00002000);
1256         p("LDIVPOW2 (" + a + " / 0x00004000):  ", a / 0x00004000);
1257         p("LDIVPOW2 (" + a + " / 0x00008000):  ", a / 0x00008000);
1258         p("LDIVPOW2 (" + a + " / 0x00010000):  ", a / 0x00010000);
1259         p("LDIVPOW2 (" + a + " / 0x00020000):  ", a / 0x00020000);
1260         p("LDIVPOW2 (" + a + " / 0x00040000):  ", a / 0x00040000);
1261         p("LDIVPOW2 (" + a + " / 0x00080000):  ", a / 0x00080000);
1262         p("LDIVPOW2 (" + a + " / 0x00100000):  ", a / 0x00100000);
1263         p("LDIVPOW2 (" + a + " / 0x00200000):  ", a / 0x00200000);
1264         p("LDIVPOW2 (" + a + " / 0x00400000):  ", a / 0x00400000);
1265         p("LDIVPOW2 (" + a + " / 0x00800000):  ", a / 0x00800000);
1266         p("LDIVPOW2 (" + a + " / 0x01000000):  ", a / 0x01000000);
1267         p("LDIVPOW2 (" + a + " / 0x02000000):  ", a / 0x02000000);
1268         p("LDIVPOW2 (" + a + " / 0x04000000):  ", a / 0x04000000);
1269         p("LDIVPOW2 (" + a + " / 0x08000000):  ", a / 0x08000000);
1270         p("LDIVPOW2 (" + a + " / 0x10000000):  ", a / 0x10000000);
1271         p("LDIVPOW2 (" + a + " / 0x20000000):  ", a / 0x20000000);
1272         p("LDIVPOW2 (" + a + " / 0x40000000):  ", a / 0x40000000);
1273         p("LDIVPOW2 (" + a + " / 0x80000000):  ", a / 0x80000000);
1274
1275         p("LREMPOW2 (" + a + " % 0x00000002):  ", a % 0x00000002L);
1276         p("LREMPOW2 (" + a + " % 0x00000004):  ", a % 0x00000004L);
1277         p("LREMPOW2 (" + a + " % 0x00000008):  ", a % 0x00000008L);
1278         p("LREMPOW2 (" + a + " % 0x00000010):  ", a % 0x00000010L);
1279         p("LREMPOW2 (" + a + " % 0x00000020):  ", a % 0x00000020L);
1280         p("LREMPOW2 (" + a + " % 0x00000040):  ", a % 0x00000040L);
1281         p("LREMPOW2 (" + a + " % 0x00000080):  ", a % 0x00000080L);
1282         p("LREMPOW2 (" + a + " % 0x00000100):  ", a % 0x00000100L);
1283         p("LREMPOW2 (" + a + " % 0x00000200):  ", a % 0x00000200L);
1284         p("LREMPOW2 (" + a + " % 0x00000400):  ", a % 0x00000400L);
1285         p("LREMPOW2 (" + a + " % 0x00000800):  ", a % 0x00000800L);
1286         p("LREMPOW2 (" + a + " % 0x00001000):  ", a % 0x00001000L);
1287         p("LREMPOW2 (" + a + " % 0x00002000):  ", a % 0x00002000L);
1288         p("LREMPOW2 (" + a + " % 0x00004000):  ", a % 0x00004000L);
1289         p("LREMPOW2 (" + a + " % 0x00008000):  ", a % 0x00008000L);
1290         p("LREMPOW2 (" + a + " % 0x00010000):  ", a % 0x00010000L);
1291         p("LREMPOW2 (" + a + " % 0x00020000):  ", a % 0x00020000L);
1292         p("LREMPOW2 (" + a + " % 0x00040000):  ", a % 0x00040000L);
1293         p("LREMPOW2 (" + a + " % 0x00080000):  ", a % 0x00080000L);
1294         p("LREMPOW2 (" + a + " % 0x00100000):  ", a % 0x00100000L);
1295         p("LREMPOW2 (" + a + " % 0x00200000):  ", a % 0x00200000L);
1296         p("LREMPOW2 (" + a + " % 0x00400000):  ", a % 0x00400000L);
1297         p("LREMPOW2 (" + a + " % 0x00800000):  ", a % 0x00800000L);
1298         p("LREMPOW2 (" + a + " % 0x01000000):  ", a % 0x01000000L);
1299         p("LREMPOW2 (" + a + " % 0x02000000):  ", a % 0x02000000L);
1300         p("LREMPOW2 (" + a + " % 0x04000000):  ", a % 0x04000000L);
1301         p("LREMPOW2 (" + a + " % 0x08000000):  ", a % 0x08000000L);
1302         p("LREMPOW2 (" + a + " % 0x10000000):  ", a % 0x10000000L);
1303         p("LREMPOW2 (" + a + " % 0x20000000):  ", a % 0x20000000L);
1304         p("LREMPOW2 (" + a + " % 0x40000000):  ", a % 0x40000000L);
1305         p("LREMPOW2 (" + a + " % 0x80000000):  ", a % 0x80000000L);
1306     }
1307
1308
1309     static public void testint(int a, int b) {
1310         p ("TESTINT CALLED WITH ", a);
1311         p ("                AND ", b);
1312                 
1313         p("IADD:  ", a+b);
1314         p("ISUB:  ", a-b);
1315         p("IMUL:  ", a*b);
1316         try { p("IDIV:  ", a/b); } 
1317         catch (ArithmeticException e) { p("divison by zero"); }
1318         try { p("IREM:  ", a%b); } 
1319         catch (ArithmeticException e) { p("divison by zero"); }
1320         p("INEG:  ", -a);
1321         p("ISHL:  ", a<<b);
1322         p("ISHR:  ", a>>b);
1323         p("IUSHR: ", a>>>b);
1324         p("IAND:  ", a & b);
1325         p("IOR:   ", a | b);
1326         p("IXOR:  ", a ^ b);
1327
1328         p("I2L:   ", (long) a);
1329         p("I2F:   ", (float) a);
1330         p("I2D:   ", (double) a);
1331         p("INT2BYTE: ", (byte) a);      
1332         p("INT2CHAR: ", (char) a);      
1333         p("INT2SHORT: ", (short) a);    
1334
1335         if (!(a==0)) p("not IFEQ");
1336         if (!(a!=0)) p("not IFNE");
1337         if (!(a<0))  p("not IFLT");
1338         if (!(a<=0)) p("not IFLE");
1339         if (!(a>0))  p("not IFGT");
1340         if (!(a>=0)) p("not IFGE");
1341
1342         if (!(a==b)) p("not IF_ICMPEQ");
1343         if (!(a!=b)) p("not IF_ICMPNE");
1344         if (!(a<b))  p("not IF_ICMPLT");
1345         if (!(a<=b)) p("not IF_ICMPLE");
1346         if (!(a>b))  p("not IF_ICMPGT");
1347         if (!(a>=b)) p("not IF_ICMPGE");
1348                 
1349         p("COND_ICMPEQ " + a + " == 0: " + ((a == 0) ? 0 : 1));
1350         p("COND_ICMPNE " + a + " != 0: " + ((a != 0) ? 0 : 1));
1351         p("COND_ICMPLT " + a + " <  0: " + ((a <  0) ? 0 : 1));
1352         p("COND_ICMPLE " + a + " <= 0: " + ((a <= 0) ? 0 : 1));
1353         p("COND_ICMPGT " + a + " >  0: " + ((a >  0) ? 0 : 1));
1354         p("COND_ICMPGE " + a + " >= 0: " + ((a >= 0) ? 0 : 1));
1355                 
1356         p("COND_ICMPEQ " + a + " == 0: " + ((a == 0) ? 1 : 0));
1357         p("COND_ICMPNE " + a + " != 0: " + ((a != 0) ? 1 : 0));
1358         p("COND_ICMPLT " + a + " <  0: " + ((a <  0) ? 1 : 0));
1359         p("COND_ICMPLE " + a + " <= 0: " + ((a <= 0) ? 1 : 0));
1360         p("COND_ICMPGT " + a + " >  0: " + ((a >  0) ? 1 : 0));
1361         p("COND_ICMPGE " + a + " >= 0: " + ((a >= 0) ? 1 : 0));
1362                 
1363         p("COND_ICMPEQ " + a + " == 0: " + ((a == 0) ? 2 : 3));
1364         p("COND_ICMPNE " + a + " != 0: " + ((a != 0) ? 2 : 3));
1365         p("COND_ICMPLT " + a + " <  0: " + ((a <  0) ? 2 : 3));
1366         p("COND_ICMPLE " + a + " <= 0: " + ((a <= 0) ? 2 : 3));
1367         p("COND_ICMPGT " + a + " >  0: " + ((a >  0) ? 2 : 3));
1368         p("COND_ICMPGE " + a + " >= 0: " + ((a >= 0) ? 2 : 3));
1369                 
1370         p("COND_ICMPEQ " + a + " == " + b + ": " + (a == b));
1371         p("COND_ICMPNE " + a + " != " + b + ": " + (a != b));
1372         p("COND_ICMPLT " + a + " <  " + b + ": " + (a <  b));
1373         p("COND_ICMPLE " + a + " <= " + b + ": " + (a <= b));
1374         p("COND_ICMPGT " + a + " >  " + b + ": " + (a >  b));
1375         p("COND_ICMPGE " + a + " >= " + b + ": " + (a >= b));
1376                 
1377     }
1378
1379     static public void testlong(long a, long b) {
1380         p ("TESTLONG called with ", a);
1381         p ("                 AND ", b);
1382                 
1383         p("LADD:  ", a + b);
1384         p("LSUB:  ", a - b);
1385         p("LMUL:  ", a * b);
1386         try { p("LDIV:  ", a / b); } 
1387         catch (ArithmeticException e) { p("divison by zero"); }
1388         try { p("LREM:  ", a % b); } 
1389         catch (ArithmeticException e) { p("divison by zero"); }
1390         p("LNEG:  ", -a);
1391         p("LSHL:  ", a << b);
1392         p("LSHR:  ", a >> b);
1393         p("LUSHR: ", a >>>b);
1394         p("LAND:  ", a &  b);
1395         p("LOR:   ", a |  b);
1396         p("LXOR:  ", a ^  b);
1397
1398         p("L2I:   ", (int) a);
1399         p("L2F:   ", (float) a);
1400         p("L2D:   ", (double) a);
1401
1402         p("LCMP a == b : ", a == b);
1403         p("LCMP a != b : ", a != b);
1404         p("LCMP a <  b : ", a <  b);
1405         p("LCMP a <= b : ", a <= b);
1406         p("LCMP a >  b : ", a >  b);
1407         p("LCMP a >= b : ", a >= b);
1408
1409         if ((a==b)) p("not IF_LCMPEQ");
1410         if ((a!=b)) p("not IF_LCMPNE");
1411         if ((a<b))  p("not IF_LCMPLT");
1412         if ((a<=b)) p("not IF_LCMPLE");
1413         if ((a>b))  p("not IF_LCMPGT");
1414         if ((a>=b)) p("not IF_LCMPGE");
1415     }
1416
1417     static public void testfloat(float a, float b) {
1418         p ("TESTFLOAT called with ", a);
1419         p ("                  AND ", b);
1420                 
1421         p("FADD:  ", a+b);
1422         p("FSUB:  ", a-b);
1423         p("FMUL:  ", a*b);
1424         p("FDIV:  ", a/b); 
1425         p("FREM:  ", a%b);
1426                 
1427         p("F2I:   ", (int) a);
1428         p("F2L:   ", (long) a);
1429         p("F2D:   ", (double) a);
1430
1431         if ((a==b)) p("FCMP a=b");
1432         if ((a!=b)) p("FCMP a!=b");
1433         if ((a<b))  p("FCMP a<b");
1434         if ((a<=b)) p("FCMP a<=b");
1435         if ((a>b))  p("FCMP a>b");
1436         if ((a>=b)) p("FCMP a>=b");
1437     }
1438
1439     static public void testdouble(double a, double b) {
1440         p ("TESTDOUBLE called with ", a);
1441         p ("                   AND ", b);
1442                 
1443         p("DADD:  ", a+b);
1444         p("DSUB:  ", a-b);
1445         p("DMUL:  ", a*b);
1446         p("DDIV:  ", a/b); 
1447         p("DREM:  ", a%b);
1448                 
1449         p("D2I:   ", (int) a);
1450         p("D2L:   ", (long) a);
1451         p("D2F:   ", (float) a);
1452
1453         if ((a==b)) p("DCMP a=b");
1454         if ((a!=b)) p("DCMP a!=b");
1455         if ((a<b))  p("DCMP a<b");
1456         if ((a<=b)) p("DCMP a<=b");
1457         if ((a>b))  p("DCMP a>b");
1458         if ((a>=b)) p("DCMP a>=b");
1459     }
1460
1461
1462     // ********************* output methods ****************************
1463         
1464     public static void pnl() {
1465         System.out.println ();
1466         System.out.print (linenum);
1467         System.out.print (".    ");
1468         linenum++;
1469     }
1470
1471     public static void p(String a) { System.out.print(a); pnl(); }
1472     public static void p(boolean a) {System.out.print(a); 
1473     pnl();  }
1474     public static void p(int a) { System.out.print ("int: ");
1475     System.out.print(a); 
1476     pnl();  }
1477     public static void p(long a) { System.out.print ("long: ");
1478     System.out.print(a); 
1479     pnl(); }
1480     public static void p(short a) { System.out.print ("short: ");
1481     System.out.print(a); 
1482     pnl(); }
1483     public static void p(byte a) { System.out.print ("byte: ");
1484     System.out.print(a); 
1485     pnl(); }
1486     public static void p(char a) { System.out.print ("char: ");
1487     System.out.print((int) a); 
1488     pnl(); }
1489     public static void p(float a) { System.out.print ("float: ");
1490     System.out.print ( java.lang.Float.floatToIntBits(a) ); 
1491     pnl(); }
1492     public static void p(double a) { System.out.print ("double: ");
1493     System.out.print( java.lang.Double.doubleToLongBits(a) ); 
1494     pnl(); }
1495
1496     public static void p(String s,boolean i) { 
1497         System.out.print(s); p(i);
1498     }
1499     public static void p(String s,int i) { 
1500         System.out.print(s); p(i);
1501     }
1502     public static void p(String s,byte i) { 
1503         System.out.print(s); p(i);
1504     }
1505     public static void p(String s,char i) { 
1506         System.out.print(s); p(i);
1507     }
1508     public static void p(String s,short i) { 
1509         System.out.print(s); p(i);
1510     }
1511     public static void p(String s,long l) { 
1512         System.out.print(s); p(l);
1513     }
1514     public static void p(String s,float f) { 
1515         System.out.print(s); p(f);
1516     }
1517     public static void p(String s,double d) {
1518         System.out.print(s); p(d);
1519     }
1520
1521     // methods for testing interface and method calls
1522
1523     public void jctest() {
1524         p("<init> called");
1525     }
1526
1527     public void p_manyparam(int p_i1,int p_i2,
1528                             int p_i3, int p_i4, 
1529                             long p_l1,long p_l2,
1530                             long p_l3,long p_l4, 
1531                             float p_f1, float p_f2, 
1532                             float p_f3, float p_f4,
1533                             double p_d1, double p_d2,
1534                             double p_d3, double p_d4) {
1535         n_i1 = p_i1;
1536         n_i2 = p_i2;
1537         n_i3 = p_i3;
1538         n_i4 = p_i4;
1539         n_l1 = p_l1;
1540         n_l2 = p_l2;
1541         n_l3 = p_l3;
1542         n_l4 = p_l4;
1543         n_f1 = p_f1;
1544         n_f2 = p_f2;
1545         n_f3 = p_f3;
1546         n_f4 = p_f4;
1547         n_d1 = p_d1;
1548         n_d2 = p_d2;
1549         n_d3 = p_d3;
1550         n_d4 = p_d4;
1551     }
1552                 
1553     public void p_nonstatic (String a) { 
1554         p(a); 
1555         p(n_i1);
1556         p(n_i2);
1557         p(n_i3);
1558         p(n_i4);
1559         p(n_l1);
1560         p(n_l2);
1561         p(n_l3);
1562         p(n_l4);
1563         p(n_f1);
1564         p(n_f2);
1565         p(n_f3);
1566         p(n_f4);
1567         p(n_d1);
1568         p(n_d2);
1569         p(n_d3);
1570         p(n_d4);
1571                 
1572     }
1573 }
1574
1575 interface jcinterface { 
1576     public void p_nonstatic (String a);
1577 }