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