5ba14eecf003fb3bb45be250b3f65b456f462752
[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 div and rem consts");
59                 testdivremconst(17);
60                 testdivremconst(12347);
61                 testdivremconst(8893427);
62                 testdivremconst(1005234562);
63                 testdivremconst(-17);
64                 testdivremconst(-12347);
65                 testdivremconst(-8893427);
66                 testdivremconst(-1005234562);
67
68                 testdivremconst(17L);
69                 testdivremconst(12347L);
70                 testdivremconst(8893427L);
71                 testdivremconst(1005234562L);
72                 testdivremconst(12135005234562L);
73                 testdivremconst(2343552355623464626L);
74                 testdivremconst(-17L);
75                 testdivremconst(-12347L);
76                 testdivremconst(-8893427L);
77                 testdivremconst(-1005234562L);
78                 testdivremconst(-12135005234562L);
79                 testdivremconst(-2343552355623464626L);
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                 java.io.DataOutput dataout = null;
316                 Object             od  = new java.io.DataOutputStream(
317                                              (java.io.DataOutputStream)dataout);
318
319                 p ("------------------- test casts");
320
321                 p("Integer is instanceof Object:  ", oi instanceof Object);
322                 p("Integer is instanceof Integer: ", oi instanceof Integer);
323                 p("Object is instanceof Integer:  ", o instanceof Integer);
324
325                 try {
326                         p ("type cast check: Integer = Object(Integer)");
327                         i = (Integer) oi;
328                         p ("type cast check: Integer = Object");
329                         i = (Integer) o;
330                         p ("error: class cast exception not thrown");
331                         }       
332                 catch (ClassCastException c) {
333                         p ("exception: class cast");
334                         }
335
336                 p("DataOutputStream is instanceof DataOutput: ",
337                                                       od instanceof java.io.DataOutput);
338                 p("Object is instanceof DataOutput: ", o instanceof java.io.DataOutput);
339
340                 try {
341                         p ("type cast check: DataOutput = Object(DataOutputStream)");
342                         dataout = (java.io.DataOutput) od;
343                         p ("type cast check: DataOutput = Object");
344                         dataout = (java.io.DataOutput) o;
345                         p ("error: class cast exception not thrown");
346                         }       
347                 catch (ClassCastException c) {
348                         p ("exception: class cast");
349                         }
350
351                 try {
352                         p ("type cast check: Integer[] = Object(Integer)[]");
353                         ia = (Integer[]) oia;
354                         p ("type cast check: Integer[] = Object[]");
355                         ia = (Integer[]) oa;
356                         p ("error: class cast exception not thrown");
357                         }       
358                 catch (ClassCastException c) {
359                         p ("exception: class cast");
360                         }
361
362                 try {
363                         p ("array store check: Object(Integer)[0] = Integer");
364                         oia[0] = i;
365                         p ("array store check: Object(Integer)[0] = Object");
366                         oia[0] = o;
367                         p ("error: array store exception not thrown");
368                         }       
369                 catch (ArrayStoreException c) {
370                         p ("exception: array store");
371                         }
372                 }
373
374
375         // ****************** test special null pointers ***************************            
376
377         public static void testspecialnullpointers() {
378                 int i = 0;
379                 jctest c = null;
380                 jcinterface f = null;
381
382                 p ("------------------- test special null pointers");
383
384                 try {
385                         p ("null pointer check: put field");
386                         c.n_i1 = 0;
387                         p ("error: put field null pointer exception not thrown");
388                         }       
389                 catch (NullPointerException x) {
390                         p ("exception: null pointer");
391                         }
392
393                 try {
394                         p ("null pointer check: get field");
395                         i = c.n_i1;
396                         p ("error: get field null pointer exception not thrown");
397                         }       
398                 catch (NullPointerException x) {
399                         p ("exception: null pointer");
400                         }
401
402                 try {
403                         p ("null pointer check: invokevirtual");
404                         c.p_nonstatic("invokevirtual");
405                         p ("error: invokevirtual null pointer exception not thrown");
406                         }       
407                 catch (NullPointerException x) {
408                         p ("exception: null pointer");
409                         }
410
411                 try {
412                         p ("null pointer check: invokeinterface");
413                         f.p_nonstatic("invokeinterface");
414                         p ("error: invokeinterface null pointer exception not thrown");
415                         }       
416                 catch (NullPointerException x) {
417                         p ("exception: null pointer");
418                         }
419
420                 try {
421                         p ("null pointer check: monitorenter");
422                         synchronized (c) {
423                                 p ("error: monitorenter null pointer exception not thrown");
424                                 }
425                         }       
426                 catch (NullPointerException x) {
427                         p ("exception: null pointer");
428                         }
429                 }
430
431
432         // ************************ test array bounds ******************************            
433
434         public static void testarraybounds(byte[] ba, int i) {
435                 
436                         p ("testarraybounds: " + (i - 10));
437                         ba[i-10] = 0;
438                         p ("testarraybounds: " + (i - 5));
439                         ba[i-5]  = 0;
440                         p ("testarraybounds: " + (i));
441                         ba[i]    = 0;
442                         p ("testarraybounds: " + (i + 5));
443                         ba[i+5]  = 0;
444                         p ("testarraybounds: " + (i + 10));
445                         ba[i+10] = 0;
446                 }
447
448
449         // ************************ test arrays ************************************            
450
451         public static void testarrays() {
452                 int    i;
453                 long   l;
454                 float  f;
455                 double d;
456                 String s;
457                 
458                 p ("------------------- test byte arrays");
459
460                 byte[] ba = null;
461
462                 try {
463                         p ("null pointer check: byte array store");
464                         ba[1] = 0;
465                         p ("error: null pointer exception not thrown");
466                         }       
467                 catch (NullPointerException c) {
468                         p ("exception: null pointer");
469                         }
470                 try {
471                         p ("null pointer check: byte array load");
472                         i = ba[1];
473                         p ("error: null pointer exception not thrown");
474                         }       
475                 catch (NullPointerException c) {
476                         p ("exception: null pointer");
477                         }
478
479                 try {
480                         p ("negative array size check: byte array");
481                         ba = new byte [-2];
482                         p ("error: negative array size exception not thrown");
483                         }       
484                 catch (NegativeArraySizeException c) {
485                         p ("exception: negative array size");
486                         }
487
488                 ba = new byte [100];
489
490
491                 try {
492                         p ("array bound check: byte array store");
493                         ba[-1] = 0;
494                         p ("error: exception not thrown");
495                         }       
496                 catch (ArrayIndexOutOfBoundsException c) {
497                         p ("exception: out of bounds: "+(-1));
498                         }
499                 try {
500                         p ("array bound check: byte array load");
501                         i = ba[-1];
502                         p ("error: exception not thrown");
503                         }       
504                 catch (ArrayIndexOutOfBoundsException c) {
505                         p ("exception: out of bounds: "+(-1));
506                         }
507
508                 try {
509                         testarraybounds(ba, 5);
510                         }       
511                 catch (ArrayIndexOutOfBoundsException c) {
512                         p ("exception: out of bounds: "+5);
513                         }
514                 try {
515                         testarraybounds(ba, 50);
516                         }       
517                 catch (ArrayIndexOutOfBoundsException c) {
518                         p ("exception: out of bounds: "+50);
519                         }
520                 try {
521                         testarraybounds(ba, 100);
522                         }       
523                 catch (ArrayIndexOutOfBoundsException c) {
524                         p ("exception: out of bounds: "+100);
525                         }
526
527                 try {
528                         ba[-4] = 0;
529                         }       
530                 catch (ArrayIndexOutOfBoundsException c) {
531                         p ("exception: out of bounds: "+(-4));
532                         }
533                 try {
534                         ba[-3] = 0;
535                         }       
536                 catch (ArrayIndexOutOfBoundsException c) {
537                         p ("exception: out of bounds: "+(-3));
538                         }
539                 for (i=-2; i<102; i++) { 
540                         try {
541                                 ba[i] = (byte) (i-50);
542                                 }       
543                         catch (ArrayIndexOutOfBoundsException c) {
544                                 p ("exception: out of bounds: "+i);
545                                 }
546                         }
547                 try {
548                         ba[102] = 0;
549                         }       
550                 catch (ArrayIndexOutOfBoundsException c) {
551                         p ("exception: out of bounds: "+102);
552                         }
553                 try {
554                         ba[103] = 0;
555                         }       
556                 catch (ArrayIndexOutOfBoundsException c) {
557                         p ("exception: out of bounds: "+103);
558                         }
559                 for (i=0; i<100; i++) p (ba[i]);                
560
561
562                 p ("-------- test short arrays");               
563
564                 short[] sa = null;
565
566                 try {
567                         p ("null pointer check: short array store");
568                         sa[1] = 0;
569                         p ("error: null pointer exception not thrown");
570                         }       
571                 catch (NullPointerException c) {
572                         p ("exception: null pointer");
573                         }
574                 try {
575                         p ("null pointer check: short array load");
576                         i = sa[1];
577                         p ("error: null pointer exception not thrown");
578                         }       
579                 catch (NullPointerException c) {
580                         p ("exception: null pointer");
581                         }
582
583                 sa = new short [100];
584
585                 try {
586                         p ("array bound check: short array store");
587                         sa[-1] = 0;
588                         p ("error: exception not thrown");
589                         }       
590                 catch (ArrayIndexOutOfBoundsException c) {
591                         p ("exception: out of bounds: "+(-1));
592                         }
593                 try {
594                         p ("array bound check: short array load");
595                         i = sa[-1];
596                         p ("error: exception not thrown");
597                         }       
598                 catch (ArrayIndexOutOfBoundsException c) {
599                         p ("exception: out of bounds: "+(-1));
600                         }
601
602                 for (i=0; i<100; i++) sa[i] = (short) (i-50);
603                 for (i=0; i<100; i++) p (sa[i]);
604                 
605
606                 p ("-------- test int arrays");         
607
608                 int[] ia = null;
609
610                 try {
611                         p ("null pointer check: int array store");
612                         ia[1] = 0;
613                         p ("error: null pointer exception not thrown");
614                         }       
615                 catch (NullPointerException c) {
616                         p ("exception: null pointer");
617                         }
618                 try {
619                         p ("null pointer check: int array load");
620                         i = ia[1];
621                         p ("error: null pointer exception not thrown");
622                         }       
623                 catch (NullPointerException c) {
624                         p ("exception: null pointer");
625                         }
626
627                 ia = new int [50];
628
629                 try {
630                         p ("array bound check: int array store");
631                         ia[-1] = 0;
632                         p ("error: exception not thrown");
633                         }       
634                 catch (ArrayIndexOutOfBoundsException c) {
635                         p ("exception: out of bounds: "+(-1));
636                         }
637                 try {
638                         p ("array bound check: int array load");
639                         i = ia[-1];
640                         p ("error: exception not thrown");
641                         }       
642                 catch (ArrayIndexOutOfBoundsException c) {
643                         p ("exception: out of bounds: "+(-1));
644                         }
645
646                 for (i=0; i<10; i++) ia[i] = (123456 + i);
647                 for (i=0; i<10; i++) p (ia[i]);
648
649                 
650
651                 p ("-------- test long arrays");                
652
653                 long[] la = null;
654
655                 try {
656                         p ("null pointer check: long array store");
657                         la[1] = 0;
658                         p ("error: null pointer exception not thrown");
659                         }       
660                 catch (NullPointerException c) {
661                         p ("exception: null pointer");
662                         }
663                 try {
664                         p ("null pointer check: long array load");
665                         l = la[1];
666                         p ("error: null pointer exception not thrown");
667                         }       
668                 catch (NullPointerException c) {
669                         p ("exception: null pointer");
670                         }
671
672                 la = new long [10];
673
674                 try {
675                         p ("array bound check: long array store");
676                         la[-1] = 0;
677                         p ("error: exception not thrown");
678                         }       
679                 catch (ArrayIndexOutOfBoundsException c) {
680                         p ("exception: out of bounds: "+(-1));
681                         }
682                 try {
683                         p ("array bound check: long array load");
684                         l = la[-1];
685                         p ("error: exception not thrown");
686                         }       
687                 catch (ArrayIndexOutOfBoundsException c) {
688                         p ("exception: out of bounds: "+(-1));
689                         }
690
691                 for (i=0; i<10; i++) la[i] = (1234567890123L + i);
692                 for (i=0; i<10; i++) p (la[i]);
693
694                 
695                 p ("-------- test char arrays");                
696
697                 char[] ca = null;
698
699                 try {
700                         p ("null pointer check: char array store");
701                         ca[1] = 0;
702                         p ("error: null pointer exception not thrown");
703                         }       
704                 catch (NullPointerException c) {
705                         p ("exception: null pointer");
706                         }
707                 try {
708                         p ("null pointer check: char array load");
709                         i = ca[1];
710                         p ("error: null pointer exception not thrown");
711                         }       
712                 catch (NullPointerException c) {
713                         p ("exception: null pointer");
714                         }
715
716                 ca = new char [50];
717
718                 try {
719                         p ("array bound check: char array store");
720                         ca[-1] = 0;
721                         p ("error: exception not thrown");
722                         }       
723                 catch (ArrayIndexOutOfBoundsException c) {
724                         p ("exception: out of bounds: "+(-1));
725                         }
726                 try {
727                         p ("array bound check: char array load");
728                         i = ca[-1];
729                         p ("error: exception not thrown");
730                         }       
731                 catch (ArrayIndexOutOfBoundsException c) {
732                         p ("exception: out of bounds: "+(-1));
733                         }
734
735                 for (i=0; i<50; i++) ca[i] = (char) ('A' + i);
736                 for (i=0; i<50; i++) p (ca[i]);
737
738                 p ("-------- test address arrays");
739
740                 String[] sta = null;
741
742                 try {
743                         p ("null pointer check: address array store");
744                         sta[1] = null;
745                         p ("error: null pointer exception not thrown");
746                         }       
747                 catch (NullPointerException c) {
748                         p ("exception: null pointer");
749                         }
750                 try {
751                         p ("null pointer check: address array load");
752                         s = sta[1];
753                         p ("error: null pointer exception not thrown");
754                         }       
755                 catch (NullPointerException c) {
756                         p ("exception: null pointer");
757                         }
758
759                 try {
760                         p ("negative array size check: address array");
761                         sta = new String[-3];
762                         p ("error: negative array size exception not thrown");
763                         }       
764                 catch (NegativeArraySizeException c) {
765                         p ("exception: negative array size");
766                         }
767
768                 sta = new String[5];
769
770                 try {
771                         p ("array bound check: address array store");
772                         sta[-1] = null;
773                         p ("error: exception not thrown");
774                         }       
775                 catch (ArrayIndexOutOfBoundsException c) {
776                         p ("exception: out of bounds: "+(-1));
777                         }
778                 try {
779                         p ("array bound check: address array load");
780                         s = sta[-1];
781                         p ("error: exception not thrown");
782                         }       
783                 catch (ArrayIndexOutOfBoundsException c) {
784                         p ("exception: out of bounds: "+(-1));
785                         }
786
787                 for (i=0; i<5; i++) sta[i] = Integer.toString(i) + ". Zeile";
788                 for (i=0; i<5; i++) p (sta[i]);
789                 
790                 p ("-------- test multi dimensional arrays");
791
792                 int [][][] iaaa = null;
793
794                 try {
795                         p ("negative array size check: multi dimensional array");
796                         iaaa = new int[2][3][-4];
797                         p ("error: negative array size exception not thrown");
798                         }       
799                 catch (NegativeArraySizeException c) {
800                         p ("exception: negative array size");
801                         }
802
803                 iaaa = new int[2][3][4];
804                 long [][][] laaa = new long[2][3][6];
805                 float [][][] faaa = new float[2][3][4];
806                 double [][][] daaa = new double[3][4][7];
807                 for (i=0; i<2; i++) {
808                         int i2; for (i2=0; i2<3; i2++) {
809                                 int i3; for (i3=0; i3<4; i3++) {
810                                         iaaa[i][i2][i3] = i*i*i + i2*i2 + i3;
811                                         laaa[i][i2][i3] = i*i*i + i2*i2 + i3 + 7;
812                                         faaa[i][i2][i3] = i*i*i + i2*i2 + i3 + 0.4F;
813                                         daaa[i][i2][i3] = i*i*i + i2*i2 + i3 - 47.0001;
814                                         p (iaaa[i][i2][i3]);
815                                         p (laaa[i][i2][i3]);
816                                         p (faaa[i][i2][i3]);
817                                         p (daaa[i][i2][i3]);
818                                         }
819                                 }
820                         }
821
822
823                                         
824                 }
825
826
827         static public void testconst(int i, long l) {
828                 p ("TESTCONST CALLED WITH ", i);
829                 p ("                  AND ", l);
830                 
831                 if (!(i == (0))) p("not IF_ICMPEQ", (0));
832                 if (!(i != (0))) p("not IF_ICMPNE", (0));
833                 if (!(i <  (0))) p("not IF_ICMPLT", (0));
834                 if (!(i <= (0))) p("not IF_ICMPLE", (0));
835                 if (!(i >  (0))) p("not IF_ICMPGT", (0));
836                 if (!(i >= (0))) p("not IF_ICMPGE", (0));
837
838                 if (!(l == (0))) p("not IF_LCMPEQ", (0));
839                 if (!(l != (0))) p("not IF_LCMPNE", (0));
840                 if (!(l <  (0))) p("not IF_LCMPLT", (0));
841                 if (!(l <= (0))) p("not IF_LCMPLE", (0));
842                 if (!(l >  (0))) p("not IF_LCMPGT", (0));
843                 if (!(l >= (0))) p("not IF_LCMPGE", (0));
844
845                 p("IADDCONST:  ", i  +  (-1));
846                 p("ISUBCONST:  ", i  -  (-1));
847                 p("IMULCONST:  ", i  *  (-1));
848                 p("ISHLCONST:  ", i <<  (-1));
849                 p("ISHRCONST:  ", i >>  (-1));
850                 p("IUSHRCONST: ", i >>> (-1));
851                 p("IANDCONST:  ", i  &  (-1));
852                 p("IORCONST:   ", i  |  (-1));
853                 p("IXORCONST:  ", i  ^  (-1));
854
855                 if (!(i == (-1))) p("not IF_ICMPEQ", (-1));
856                 if (!(i != (-1))) p("not IF_ICMPNE", (-1));
857                 if (!(i <  (-1))) p("not IF_ICMPLT", (-1));
858                 if (!(i <= (-1))) p("not IF_ICMPLE", (-1));
859                 if (!(i >  (-1))) p("not IF_ICMPGT", (-1));
860                 if (!(i >= (-1))) p("not IF_ICMPGE", (-1));
861
862                 p("LADDCONST:  ", l  +  (-1));
863                 p("LSUBCONST:  ", l  -  (-1));
864                 p("LMULCONST:  ", l  *  (-1));
865                 p("LSHLCONST:  ", l <<  (-1));
866                 p("LSHRCONST:  ", l >>  (-1));
867                 p("LUSHRCONST: ", l >>> (-1));
868                 p("LANDCONST:  ", l  &  (-1));
869                 p("LORCONST:   ", l  |  (-1));
870                 p("LXORCONST:  ", l  ^  (-1));
871
872                 if (!(l == (-1))) p("not IF_LCMPEQ", (-1));
873                 if (!(l != (-1))) p("not IF_LCMPNE", (-1));
874                 if (!(l <  (-1))) p("not IF_LCMPLT", (-1));
875                 if (!(l <= (-1))) p("not IF_LCMPLE", (-1));
876                 if (!(l >  (-1))) p("not IF_LCMPGT", (-1));
877                 if (!(l >= (-1))) p("not IF_LCMPGE", (-1));
878
879                 p("IADDCONST:  ", i  +  (1));
880                 p("ISUBCONST:  ", i  -  (1));
881                 p("IMULCONST:  ", i  *  (1));
882                 p("ISHLCONST:  ", i <<  (1));
883                 p("ISHRCONST:  ", i >>  (1));
884                 p("IUSHRCONST: ", i >>> (1));
885                 p("IANDCONST:  ", i  &  (1));
886                 p("IORCONST:   ", i  |  (1));
887                 p("IXORCONST:  ", i  ^  (1));
888
889                 if (!(i == (1))) p("not IF_ICMPEQ", (1));
890                 if (!(i != (1))) p("not IF_ICMPNE", (1));
891                 if (!(i <  (1))) p("not IF_ICMPLT", (1));
892                 if (!(i <= (1))) p("not IF_ICMPLE", (1));
893                 if (!(i >  (1))) p("not IF_ICMPGT", (1));
894                 if (!(i >= (1))) p("not IF_ICMPGE", (1));
895
896                 p("LADDCONST:  ", l  +  (1));
897                 p("LSUBCONST:  ", l  -  (1));
898                 p("LMULCONST:  ", l  *  (1));
899                 p("LSHLCONST:  ", l <<  (1));
900                 p("LSHRCONST:  ", l >>  (1));
901                 p("LUSHRCONST: ", l >>> (1));
902                 p("LANDCONST:  ", l  &  (1));
903                 p("LORCONST:   ", l  |  (1));
904                 p("LXORCONST:  ", l  ^  (1));
905
906                 if (!(l == (1))) p("not IF_LCMPEQ", (1));
907                 if (!(l != (1))) p("not IF_LCMPNE", (1));
908                 if (!(l <  (1))) p("not IF_LCMPLT", (1));
909                 if (!(l <= (1))) p("not IF_LCMPLE", (1));
910                 if (!(l >  (1))) p("not IF_LCMPGT", (1));
911                 if (!(l >= (1))) p("not IF_LCMPGE", (1));
912
913                 p("IADDCONST:  ", i  +  (255));
914                 p("ISUBCONST:  ", i  -  (255));
915                 p("IMULCONST:  ", i  *  (255));
916                 p("ISHLCONST:  ", i <<  (255));
917                 p("ISHRCONST:  ", i >>  (255));
918                 p("IUSHRCONST: ", i >>> (255));
919                 p("IANDCONST:  ", i  &  (255));
920                 p("IORCONST:   ", i  |  (255));
921                 p("IXORCONST:  ", i  ^  (255));
922
923                 if (!(i == (255))) p("not IF_ICMPEQ", (255));
924                 if (!(i != (255))) p("not IF_ICMPNE", (255));
925                 if (!(i <  (255))) p("not IF_ICMPLT", (255));
926                 if (!(i <= (255))) p("not IF_ICMPLE", (255));
927                 if (!(i >  (255))) p("not IF_ICMPGT", (255));
928                 if (!(i >= (255))) p("not IF_ICMPGE", (255));
929
930                 p("LADDCONST:  ", l  +  (255));
931                 p("LSUBCONST:  ", l  -  (255));
932                 p("LMULCONST:  ", l  *  (255));
933                 p("LSHLCONST:  ", l <<  (255));
934                 p("LSHRCONST:  ", l >>  (255));
935                 p("LUSHRCONST: ", l >>> (255));
936                 p("LANDCONST:  ", l  &  (255));
937                 p("LORCONST:   ", l  |  (255));
938                 p("LXORCONST:  ", l  ^  (255));
939
940                 if (!(l == (255))) p("not IF_LCMPEQ", (255));
941                 if (!(l != (255))) p("not IF_LCMPNE", (255));
942                 if (!(l <  (255))) p("not IF_LCMPLT", (255));
943                 if (!(l <= (255))) p("not IF_LCMPLE", (255));
944                 if (!(l >  (255))) p("not IF_LCMPGT", (255));
945                 if (!(l >= (255))) p("not IF_LCMPGE", (255));
946
947                 p("IADDCONST:  ", i  +  (256));
948                 p("ISUBCONST:  ", i  -  (256));
949                 p("IMULCONST:  ", i  *  (256));
950                 p("ISHLCONST:  ", i <<  (256));
951                 p("ISHRCONST:  ", i >>  (256));
952                 p("IUSHRCONST: ", i >>> (256));
953                 p("IANDCONST:  ", i  &  (256));
954                 p("IORCONST:   ", i  |  (256));
955                 p("IXORCONST:  ", i  ^  (256));
956
957                 if (!(i == (256))) p("not IF_ICMPEQ", (256));
958                 if (!(i != (256))) p("not IF_ICMPNE", (256));
959                 if (!(i <  (256))) p("not IF_ICMPLT", (256));
960                 if (!(i <= (256))) p("not IF_ICMPLE", (256));
961                 if (!(i >  (256))) p("not IF_ICMPGT", (256));
962                 if (!(i >= (256))) p("not IF_ICMPGE", (256));
963
964                 p("LADDCONST:  ", l  +  (256));
965                 p("LSUBCONST:  ", l  -  (256));
966                 p("LMULCONST:  ", l  *  (256));
967                 p("LSHLCONST:  ", l <<  (256));
968                 p("LSHRCONST:  ", l >>  (256));
969                 p("LUSHRCONST: ", l >>> (256));
970                 p("LANDCONST:  ", l  &  (256));
971                 p("LORCONST:   ", l  |  (256));
972                 p("LXORCONST:  ", l  ^  (256));
973
974                 if (!(l == (256))) p("not IF_LCMPEQ", (256));
975                 if (!(l != (256))) p("not IF_LCMPNE", (256));
976                 if (!(l <  (256))) p("not IF_LCMPLT", (256));
977                 if (!(l <= (256))) p("not IF_LCMPLE", (256));
978                 if (!(l >  (256))) p("not IF_LCMPGT", (256));
979                 if (!(l >= (256))) p("not IF_LCMPGE", (256));
980
981                 p("IADDCONST:  ", i  +  (32767));
982                 p("ISUBCONST:  ", i  -  (32767));
983                 p("IMULCONST:  ", i  *  (32767));
984                 p("ISHLCONST:  ", i <<  (32767));
985                 p("ISHRCONST:  ", i >>  (32767));
986                 p("IUSHRCONST: ", i >>> (32767));
987                 p("IANDCONST:  ", i  &  (32767));
988                 p("IORCONST:   ", i  |  (32767));
989                 p("IXORCONST:  ", i  ^  (32767));
990
991                 if (!(i == (32767))) p("not IF_ICMPEQ", (32767));
992                 if (!(i != (32767))) p("not IF_ICMPNE", (32767));
993                 if (!(i <  (32767))) p("not IF_ICMPLT", (32767));
994                 if (!(i <= (32767))) p("not IF_ICMPLE", (32767));
995                 if (!(i >  (32767))) p("not IF_ICMPGT", (32767));
996                 if (!(i >= (32767))) p("not IF_ICMPGE", (32767));
997
998                 p("LADDCONST:  ", l  +  (32767));
999                 p("LSUBCONST:  ", l  -  (32767));
1000                 p("LMULCONST:  ", l  *  (32767));
1001                 p("LSHLCONST:  ", l <<  (32767));
1002                 p("LSHRCONST:  ", l >>  (32767));
1003                 p("LUSHRCONST: ", l >>> (32767));
1004                 p("LANDCONST:  ", l  &  (32767));
1005                 p("LORCONST:   ", l  |  (32767));
1006                 p("LXORCONST:  ", l  ^  (32767));
1007
1008                 if (!(l == (32767))) p("not IF_LCMPEQ", (32767));
1009                 if (!(l != (32767))) p("not IF_LCMPNE", (32767));
1010                 if (!(l <  (32767))) p("not IF_LCMPLT", (32767));
1011                 if (!(l <= (32767))) p("not IF_LCMPLE", (32767));
1012                 if (!(l >  (32767))) p("not IF_LCMPGT", (32767));
1013                 if (!(l >= (32767))) p("not IF_LCMPGE", (32767));
1014
1015                 p("IADDCONST:  ", i  +  (32768));
1016                 p("ISUBCONST:  ", i  -  (32768));
1017                 p("IMULCONST:  ", i  *  (32768));
1018                 p("ISHLCONST:  ", i <<  (32768));
1019                 p("ISHRCONST:  ", i >>  (32768));
1020                 p("IUSHRCONST: ", i >>> (32768));
1021                 p("IANDCONST:  ", i  &  (32768));
1022                 p("IORCONST:   ", i  |  (32768));
1023                 p("IXORCONST:  ", i  ^  (32768));
1024
1025                 if (!(i == (32768))) p("not IF_ICMPEQ", (32768));
1026                 if (!(i != (32768))) p("not IF_ICMPNE", (32768));
1027                 if (!(i <  (32768))) p("not IF_ICMPLT", (32768));
1028                 if (!(i <= (32768))) p("not IF_ICMPLE", (32768));
1029                 if (!(i >  (32768))) p("not IF_ICMPGT", (32768));
1030                 if (!(i >= (32768))) p("not IF_ICMPGE", (32768));
1031
1032                 p("LADDCONST:  ", l  +  (32768));
1033                 p("LSUBCONST:  ", l  -  (32768));
1034                 p("LMULCONST:  ", l  *  (32768));
1035                 p("LSHLCONST:  ", l <<  (32768));
1036                 p("LSHRCONST:  ", l >>  (32768));
1037                 p("LUSHRCONST: ", l >>> (32768));
1038                 p("LANDCONST:  ", l  &  (32768));
1039                 p("LORCONST:   ", l  |  (32768));
1040                 p("LXORCONST:  ", l  ^  (32768));
1041
1042                 if (!(l == (32768))) p("not IF_LCMPEQ", (32768));
1043                 if (!(l != (32768))) p("not IF_LCMPNE", (32768));
1044                 if (!(l <  (32768))) p("not IF_LCMPLT", (32768));
1045                 if (!(l <= (32768))) p("not IF_LCMPLE", (32768));
1046                 if (!(l >  (32768))) p("not IF_LCMPGT", (32768));
1047                 if (!(l >= (32768))) p("not IF_LCMPGE", (32768));
1048
1049                 p("IADDCONST:  ", i  +  (-32768));
1050                 p("ISUBCONST:  ", i  -  (-32768));
1051                 p("IMULCONST:  ", i  *  (-32768));
1052                 p("ISHLCONST:  ", i <<  (-32768));
1053                 p("ISHRCONST:  ", i >>  (-32768));
1054                 p("IUSHRCONST: ", i >>> (-32768));
1055                 p("IANDCONST:  ", i  &  (-32768));
1056                 p("IORCONST:   ", i  |  (-32768));
1057                 p("IXORCONST:  ", i  ^  (-32768));
1058
1059                 if (!(i == (-32768))) p("not IF_ICMPEQ", (-32768));
1060                 if (!(i != (-32768))) p("not IF_ICMPNE", (-32768));
1061                 if (!(i <  (-32768))) p("not IF_ICMPLT", (-32768));
1062                 if (!(i <= (-32768))) p("not IF_ICMPLE", (-32768));
1063                 if (!(i >  (-32768))) p("not IF_ICMPGT", (-32768));
1064                 if (!(i >= (-32768))) p("not IF_ICMPGE", (-32768));
1065
1066                 p("LADDCONST:  ", l  +  (-32768));
1067                 p("LSUBCONST:  ", l  -  (-32768));
1068                 p("LMULCONST:  ", l  *  (-32768));
1069                 p("LSHLCONST:  ", l <<  (-32768));
1070                 p("LSHRCONST:  ", l >>  (-32768));
1071                 p("LUSHRCONST: ", l >>> (-32768));
1072                 p("LANDCONST:  ", l  &  (-32768));
1073                 p("LORCONST:   ", l  |  (-32768));
1074                 p("LXORCONST:  ", l  ^  (-32768));
1075
1076                 if (!(l == (-32768))) p("not IF_LCMPEQ", (-32768));
1077                 if (!(l != (-32768))) p("not IF_LCMPNE", (-32768));
1078                 if (!(l <  (-32768))) p("not IF_LCMPLT", (-32768));
1079                 if (!(l <= (-32768))) p("not IF_LCMPLE", (-32768));
1080                 if (!(l >  (-32768))) p("not IF_LCMPGT", (-32768));
1081                 if (!(l >= (-32768))) p("not IF_LCMPGE", (-32768));
1082
1083                 p("IADDCONST:  ", i  +  (-32769));
1084                 p("ISUBCONST:  ", i  -  (-32769));
1085                 p("IMULCONST:  ", i  *  (-32769));
1086                 p("ISHLCONST:  ", i <<  (-32769));
1087                 p("ISHRCONST:  ", i >>  (-32769));
1088                 p("IUSHRCONST: ", i >>> (-32769));
1089                 p("IANDCONST:  ", i  &  (-32769));
1090                 p("IORCONST:   ", i  |  (-32769));
1091                 p("IXORCONST:  ", i  ^  (-32769));
1092
1093                 if (!(i == (-32769))) p("not IF_ICMPEQ", (-32769));
1094                 if (!(i != (-32769))) p("not IF_ICMPNE", (-32769));
1095                 if (!(i <  (-32769))) p("not IF_ICMPLT", (-32769));
1096                 if (!(i <= (-32769))) p("not IF_ICMPLE", (-32769));
1097                 if (!(i >  (-32769))) p("not IF_ICMPGT", (-32769));
1098                 if (!(i >= (-32769))) p("not IF_ICMPGE", (-32769));
1099
1100                 p("LADDCONST:  ", l  +  (-32769));
1101                 p("LSUBCONST:  ", l  -  (-32769));
1102                 p("LMULCONST:  ", l  *  (-32769));
1103                 p("LSHLCONST:  ", l <<  (-32769));
1104                 p("LSHRCONST:  ", l >>  (-32769));
1105                 p("LUSHRCONST: ", l >>> (-32769));
1106                 p("LANDCONST:  ", l  &  (-32769));
1107                 p("LORCONST:   ", l  |  (-32769));
1108                 p("LXORCONST:  ", l  ^  (-32769));
1109
1110                 if (!(l == (-32769))) p("not IF_LCMPEQ", (-32769));
1111                 if (!(l != (-32769))) p("not IF_LCMPNE", (-32769));
1112                 if (!(l <  (-32769))) p("not IF_LCMPLT", (-32769));
1113                 if (!(l <= (-32769))) p("not IF_LCMPLE", (-32769));
1114                 if (!(l >  (-32769))) p("not IF_LCMPGT", (-32769));
1115                 if (!(l >= (-32769))) p("not IF_LCMPGE", (-32769));
1116
1117         }
1118
1119         static public void testrem0x10001(int a) {
1120                 p("IREM0X10001 (" + a + " % 0x10001):  ", a % 0x10001);
1121                 }
1122
1123         static public void testrem0x10001(long a) {
1124                 p("LREM0X10001 (" + a + " % 0x10001):  ", a % 0x10001L);
1125                 }
1126
1127         static public void testdivremconst(int a) {
1128                 p("IDIVPOW2 (" + a + " / 0x00000002):  ", a / 0x00000002);
1129                 p("IDIVPOW2 (" + a + " / 0x00000004):  ", a / 0x00000004);
1130                 p("IDIVPOW2 (" + a + " / 0x00000008):  ", a / 0x00000008);
1131                 p("IDIVPOW2 (" + a + " / 0x00000010):  ", a / 0x00000010);
1132                 p("IDIVPOW2 (" + a + " / 0x00000020):  ", a / 0x00000020);
1133                 p("IDIVPOW2 (" + a + " / 0x00000040):  ", a / 0x00000040);
1134                 p("IDIVPOW2 (" + a + " / 0x00000080):  ", a / 0x00000080);
1135                 p("IDIVPOW2 (" + a + " / 0x00000100):  ", a / 0x00000100);
1136                 p("IDIVPOW2 (" + a + " / 0x00000200):  ", a / 0x00000200);
1137                 p("IDIVPOW2 (" + a + " / 0x00000400):  ", a / 0x00000400);
1138                 p("IDIVPOW2 (" + a + " / 0x00000800):  ", a / 0x00000800);
1139                 p("IDIVPOW2 (" + a + " / 0x00001000):  ", a / 0x00001000);
1140                 p("IDIVPOW2 (" + a + " / 0x00002000):  ", a / 0x00002000);
1141                 p("IDIVPOW2 (" + a + " / 0x00004000):  ", a / 0x00004000);
1142                 p("IDIVPOW2 (" + a + " / 0x00008000):  ", a / 0x00008000);
1143                 p("IDIVPOW2 (" + a + " / 0x00010000):  ", a / 0x00010000);
1144                 p("IDIVPOW2 (" + a + " / 0x00020000):  ", a / 0x00020000);
1145                 p("IDIVPOW2 (" + a + " / 0x00040000):  ", a / 0x00040000);
1146                 p("IDIVPOW2 (" + a + " / 0x00080000):  ", a / 0x00080000);
1147                 p("IDIVPOW2 (" + a + " / 0x00100000):  ", a / 0x00100000);
1148                 p("IDIVPOW2 (" + a + " / 0x00200000):  ", a / 0x00200000);
1149                 p("IDIVPOW2 (" + a + " / 0x00400000):  ", a / 0x00400000);
1150                 p("IDIVPOW2 (" + a + " / 0x00800000):  ", a / 0x00800000);
1151                 p("IDIVPOW2 (" + a + " / 0x01000000):  ", a / 0x01000000);
1152                 p("IDIVPOW2 (" + a + " / 0x02000000):  ", a / 0x02000000);
1153                 p("IDIVPOW2 (" + a + " / 0x04000000):  ", a / 0x04000000);
1154                 p("IDIVPOW2 (" + a + " / 0x08000000):  ", a / 0x08000000);
1155                 p("IDIVPOW2 (" + a + " / 0x10000000):  ", a / 0x10000000);
1156                 p("IDIVPOW2 (" + a + " / 0x20000000):  ", a / 0x20000000);
1157                 p("IDIVPOW2 (" + a + " / 0x40000000):  ", a / 0x40000000);
1158                 p("IDIVPOW2 (" + a + " / 0x80000000):  ", a / 0x80000000);
1159
1160                 p("IREMPOW2 (" + a + " % 0x00000002):  ", a % 0x00000002);
1161                 p("IREMPOW2 (" + a + " % 0x00000004):  ", a % 0x00000004);
1162                 p("IREMPOW2 (" + a + " % 0x00000008):  ", a % 0x00000008);
1163                 p("IREMPOW2 (" + a + " % 0x00000010):  ", a % 0x00000010);
1164                 p("IREMPOW2 (" + a + " % 0x00000020):  ", a % 0x00000020);
1165                 p("IREMPOW2 (" + a + " % 0x00000040):  ", a % 0x00000040);
1166                 p("IREMPOW2 (" + a + " % 0x00000080):  ", a % 0x00000080);
1167                 p("IREMPOW2 (" + a + " % 0x00000100):  ", a % 0x00000100);
1168                 p("IREMPOW2 (" + a + " % 0x00000200):  ", a % 0x00000200);
1169                 p("IREMPOW2 (" + a + " % 0x00000400):  ", a % 0x00000400);
1170                 p("IREMPOW2 (" + a + " % 0x00000800):  ", a % 0x00000800);
1171                 p("IREMPOW2 (" + a + " % 0x00001000):  ", a % 0x00001000);
1172                 p("IREMPOW2 (" + a + " % 0x00002000):  ", a % 0x00002000);
1173                 p("IREMPOW2 (" + a + " % 0x00004000):  ", a % 0x00004000);
1174                 p("IREMPOW2 (" + a + " % 0x00008000):  ", a % 0x00008000);
1175                 p("IREMPOW2 (" + a + " % 0x00010000):  ", a % 0x00010000);
1176                 p("IREMPOW2 (" + a + " % 0x00020000):  ", a % 0x00020000);
1177                 p("IREMPOW2 (" + a + " % 0x00040000):  ", a % 0x00040000);
1178                 p("IREMPOW2 (" + a + " % 0x00080000):  ", a % 0x00080000);
1179                 p("IREMPOW2 (" + a + " % 0x00100000):  ", a % 0x00100000);
1180                 p("IREMPOW2 (" + a + " % 0x00200000):  ", a % 0x00200000);
1181                 p("IREMPOW2 (" + a + " % 0x00400000):  ", a % 0x00400000);
1182                 p("IREMPOW2 (" + a + " % 0x00800000):  ", a % 0x00800000);
1183                 p("IREMPOW2 (" + a + " % 0x01000000):  ", a % 0x01000000);
1184                 p("IREMPOW2 (" + a + " % 0x02000000):  ", a % 0x02000000);
1185                 p("IREMPOW2 (" + a + " % 0x04000000):  ", a % 0x04000000);
1186                 p("IREMPOW2 (" + a + " % 0x08000000):  ", a % 0x08000000);
1187                 p("IREMPOW2 (" + a + " % 0x10000000):  ", a % 0x10000000);
1188                 p("IREMPOW2 (" + a + " % 0x20000000):  ", a % 0x20000000);
1189                 p("IREMPOW2 (" + a + " % 0x40000000):  ", a % 0x40000000);
1190                 p("IREMPOW2 (" + a + " % 0x80000000):  ", a % 0x80000000);
1191                 }
1192
1193         static public void testdivremconst(long a) {
1194                 p("LDIVPOW2 (" + a + " / 0x00000002):  ", a / 0x00000002);
1195                 p("LDIVPOW2 (" + a + " / 0x00000004):  ", a / 0x00000004);
1196                 p("LDIVPOW2 (" + a + " / 0x00000008):  ", a / 0x00000008);
1197                 p("LDIVPOW2 (" + a + " / 0x00000010):  ", a / 0x00000010);
1198                 p("LDIVPOW2 (" + a + " / 0x00000020):  ", a / 0x00000020);
1199                 p("LDIVPOW2 (" + a + " / 0x00000040):  ", a / 0x00000040);
1200                 p("LDIVPOW2 (" + a + " / 0x00000080):  ", a / 0x00000080);
1201                 p("LDIVPOW2 (" + a + " / 0x00000100):  ", a / 0x00000100);
1202                 p("LDIVPOW2 (" + a + " / 0x00000200):  ", a / 0x00000200);
1203                 p("LDIVPOW2 (" + a + " / 0x00000400):  ", a / 0x00000400);
1204                 p("LDIVPOW2 (" + a + " / 0x00000800):  ", a / 0x00000800);
1205                 p("LDIVPOW2 (" + a + " / 0x00001000):  ", a / 0x00001000);
1206                 p("LDIVPOW2 (" + a + " / 0x00002000):  ", a / 0x00002000);
1207                 p("LDIVPOW2 (" + a + " / 0x00004000):  ", a / 0x00004000);
1208                 p("LDIVPOW2 (" + a + " / 0x00008000):  ", a / 0x00008000);
1209                 p("LDIVPOW2 (" + a + " / 0x00010000):  ", a / 0x00010000);
1210                 p("LDIVPOW2 (" + a + " / 0x00020000):  ", a / 0x00020000);
1211                 p("LDIVPOW2 (" + a + " / 0x00040000):  ", a / 0x00040000);
1212                 p("LDIVPOW2 (" + a + " / 0x00080000):  ", a / 0x00080000);
1213                 p("LDIVPOW2 (" + a + " / 0x00100000):  ", a / 0x00100000);
1214                 p("LDIVPOW2 (" + a + " / 0x00200000):  ", a / 0x00200000);
1215                 p("LDIVPOW2 (" + a + " / 0x00400000):  ", a / 0x00400000);
1216                 p("LDIVPOW2 (" + a + " / 0x00800000):  ", a / 0x00800000);
1217                 p("LDIVPOW2 (" + a + " / 0x01000000):  ", a / 0x01000000);
1218                 p("LDIVPOW2 (" + a + " / 0x02000000):  ", a / 0x02000000);
1219                 p("LDIVPOW2 (" + a + " / 0x04000000):  ", a / 0x04000000);
1220                 p("LDIVPOW2 (" + a + " / 0x08000000):  ", a / 0x08000000);
1221                 p("LDIVPOW2 (" + a + " / 0x10000000):  ", a / 0x10000000);
1222                 p("LDIVPOW2 (" + a + " / 0x20000000):  ", a / 0x20000000);
1223                 p("LDIVPOW2 (" + a + " / 0x40000000):  ", a / 0x40000000);
1224                 p("LDIVPOW2 (" + a + " / 0x80000000):  ", a / 0x80000000);
1225
1226                 p("LREMPOW2 (" + a + " % 0x00000002):  ", a % 0x00000002L);
1227                 p("LREMPOW2 (" + a + " % 0x00000004):  ", a % 0x00000004L);
1228                 p("LREMPOW2 (" + a + " % 0x00000008):  ", a % 0x00000008L);
1229                 p("LREMPOW2 (" + a + " % 0x00000010):  ", a % 0x00000010L);
1230                 p("LREMPOW2 (" + a + " % 0x00000020):  ", a % 0x00000020L);
1231                 p("LREMPOW2 (" + a + " % 0x00000040):  ", a % 0x00000040L);
1232                 p("LREMPOW2 (" + a + " % 0x00000080):  ", a % 0x00000080L);
1233                 p("LREMPOW2 (" + a + " % 0x00000100):  ", a % 0x00000100L);
1234                 p("LREMPOW2 (" + a + " % 0x00000200):  ", a % 0x00000200L);
1235                 p("LREMPOW2 (" + a + " % 0x00000400):  ", a % 0x00000400L);
1236                 p("LREMPOW2 (" + a + " % 0x00000800):  ", a % 0x00000800L);
1237                 p("LREMPOW2 (" + a + " % 0x00001000):  ", a % 0x00001000L);
1238                 p("LREMPOW2 (" + a + " % 0x00002000):  ", a % 0x00002000L);
1239                 p("LREMPOW2 (" + a + " % 0x00004000):  ", a % 0x00004000L);
1240                 p("LREMPOW2 (" + a + " % 0x00008000):  ", a % 0x00008000L);
1241                 p("LREMPOW2 (" + a + " % 0x00010000):  ", a % 0x00010000L);
1242                 p("LREMPOW2 (" + a + " % 0x00020000):  ", a % 0x00020000L);
1243                 p("LREMPOW2 (" + a + " % 0x00040000):  ", a % 0x00040000L);
1244                 p("LREMPOW2 (" + a + " % 0x00080000):  ", a % 0x00080000L);
1245                 p("LREMPOW2 (" + a + " % 0x00100000):  ", a % 0x00100000L);
1246                 p("LREMPOW2 (" + a + " % 0x00200000):  ", a % 0x00200000L);
1247                 p("LREMPOW2 (" + a + " % 0x00400000):  ", a % 0x00400000L);
1248                 p("LREMPOW2 (" + a + " % 0x00800000):  ", a % 0x00800000L);
1249                 p("LREMPOW2 (" + a + " % 0x01000000):  ", a % 0x01000000L);
1250                 p("LREMPOW2 (" + a + " % 0x02000000):  ", a % 0x02000000L);
1251                 p("LREMPOW2 (" + a + " % 0x04000000):  ", a % 0x04000000L);
1252                 p("LREMPOW2 (" + a + " % 0x08000000):  ", a % 0x08000000L);
1253                 p("LREMPOW2 (" + a + " % 0x10000000):  ", a % 0x10000000L);
1254                 p("LREMPOW2 (" + a + " % 0x20000000):  ", a % 0x20000000L);
1255                 p("LREMPOW2 (" + a + " % 0x40000000):  ", a % 0x40000000L);
1256                 p("LREMPOW2 (" + a + " % 0x80000000):  ", a % 0x80000000L);
1257                 }
1258
1259
1260         static public void testint(int a, int b) {
1261                 p ("TESTINT CALLED WITH ", a);
1262                 p ("                AND ", b);
1263                 
1264                 p("IADD:  ", a+b);
1265                 p("ISUB:  ", a-b);
1266                 p("IMUL:  ", a*b);
1267                 try { p("IDIV:  ", a/b); } 
1268                 catch (ArithmeticException e) { p("divison by zero"); }
1269                 try { p("IREM:  ", a%b); } 
1270                 catch (ArithmeticException e) { p("divison by zero"); }
1271                 p("INEG:  ", -a);
1272                 p("ISHL:  ", a<<b);
1273                 p("ISHR:  ", a>>b);
1274                 p("IUSHR: ", a>>>b);
1275                 p("IAND:  ", a & b);
1276                 p("IOR:   ", a | b);
1277                 p("IXOR:  ", a ^ b);
1278
1279                 p("I2L:   ", (long) a);
1280                 p("I2F:   ", (float) a);
1281                 p("I2D:   ", (double) a);
1282                 p("INT2BYTE: ", (byte) a);      
1283                 p("INT2CHAR: ", (char) a);      
1284                 p("INT2SHORT: ", (short) a);    
1285
1286                 if (!(a==0)) p("not IFEQ");
1287                 if (!(a!=0)) p("not IFNE");
1288                 if (!(a<0))  p("not IFLT");
1289                 if (!(a<=0)) p("not IFLE");
1290                 if (!(a>0))  p("not IFGT");
1291                 if (!(a>=0)) p("not IFGE");
1292
1293                 if (!(a==b)) p("not IF_ICMPEQ");
1294                 if (!(a!=b)) p("not IF_ICMPNE");
1295                 if (!(a<b))  p("not IF_ICMPLT");
1296                 if (!(a<=b)) p("not IF_ICMPLE");
1297                 if (!(a>b))  p("not IF_ICMPGT");
1298                 if (!(a>=b)) p("not IF_ICMPGE");
1299                 
1300                 p("COND_ICMPEQ " + a + " == 0: " + ((a == 0) ? 0 : 1));
1301                 p("COND_ICMPNE " + a + " != 0: " + ((a != 0) ? 0 : 1));
1302                 p("COND_ICMPLT " + a + " <  0: " + ((a <  0) ? 0 : 1));
1303                 p("COND_ICMPLE " + a + " <= 0: " + ((a <= 0) ? 0 : 1));
1304                 p("COND_ICMPGT " + a + " >  0: " + ((a >  0) ? 0 : 1));
1305                 p("COND_ICMPGE " + a + " >= 0: " + ((a >= 0) ? 0 : 1));
1306                 
1307                 p("COND_ICMPEQ " + a + " == 0: " + ((a == 0) ? 1 : 0));
1308                 p("COND_ICMPNE " + a + " != 0: " + ((a != 0) ? 1 : 0));
1309                 p("COND_ICMPLT " + a + " <  0: " + ((a <  0) ? 1 : 0));
1310                 p("COND_ICMPLE " + a + " <= 0: " + ((a <= 0) ? 1 : 0));
1311                 p("COND_ICMPGT " + a + " >  0: " + ((a >  0) ? 1 : 0));
1312                 p("COND_ICMPGE " + a + " >= 0: " + ((a >= 0) ? 1 : 0));
1313                 
1314                 p("COND_ICMPEQ " + a + " == 0: " + ((a == 0) ? 2 : 3));
1315                 p("COND_ICMPNE " + a + " != 0: " + ((a != 0) ? 2 : 3));
1316                 p("COND_ICMPLT " + a + " <  0: " + ((a <  0) ? 2 : 3));
1317                 p("COND_ICMPLE " + a + " <= 0: " + ((a <= 0) ? 2 : 3));
1318                 p("COND_ICMPGT " + a + " >  0: " + ((a >  0) ? 2 : 3));
1319                 p("COND_ICMPGE " + a + " >= 0: " + ((a >= 0) ? 2 : 3));
1320                 
1321                 p("COND_ICMPEQ " + a + " == " + b + ": " + (a == b));
1322                 p("COND_ICMPNE " + a + " != " + b + ": " + (a != b));
1323                 p("COND_ICMPLT " + a + " <  " + b + ": " + (a <  b));
1324                 p("COND_ICMPLE " + a + " <= " + b + ": " + (a <= b));
1325                 p("COND_ICMPGT " + a + " >  " + b + ": " + (a >  b));
1326                 p("COND_ICMPGE " + a + " >= " + b + ": " + (a >= b));
1327                 
1328         }
1329
1330         static public void testlong(long a, long b) {
1331                 p ("TESTLONG called with ", a);
1332                 p ("                 AND ", b);
1333                 
1334                 p("LADD:  ", a + b);
1335                 p("LSUB:  ", a - b);
1336                 p("LMUL:  ", a * b);
1337                 try { p("LDIV:  ", a / b); } 
1338                 catch (ArithmeticException e) { p("divison by zero"); }
1339                 try { p("LREM:  ", a % b); } 
1340                 catch (ArithmeticException e) { p("divison by zero"); }
1341                 p("LNEG:  ", -a);
1342                 p("LSHL:  ", a << b);
1343                 p("LSHR:  ", a >> b);
1344                 p("LUSHR: ", a >>>b);
1345                 p("LAND:  ", a &  b);
1346                 p("LOR:   ", a |  b);
1347                 p("LXOR:  ", a ^  b);
1348
1349                 p("L2I:   ", (int) a);
1350                 p("L2F:   ", (float) a);
1351                 p("L2D:   ", (double) a);
1352
1353                 p("LCMP a == b : ", a == b);
1354                 p("LCMP a != b : ", a != b);
1355                 p("LCMP a <  b : ", a <  b);
1356                 p("LCMP a <= b : ", a <= b);
1357                 p("LCMP a >  b : ", a >  b);
1358                 p("LCMP a >= b : ", a >= b);
1359
1360                 if ((a==b)) p("not IF_LCMPEQ");
1361                 if ((a!=b)) p("not IF_LCMPNE");
1362                 if ((a<b))  p("not IF_LCMPLT");
1363                 if ((a<=b)) p("not IF_LCMPLE");
1364                 if ((a>b))  p("not IF_LCMPGT");
1365                 if ((a>=b)) p("not IF_LCMPGE");
1366         }
1367
1368         static public void testfloat(float a, float b) {
1369                 p ("TESTFLOAT called with ", a);
1370                 p ("                  AND ", b);
1371                 
1372                 p("FADD:  ", a+b);
1373                 p("FSUB:  ", a-b);
1374                 p("FMUL:  ", a*b);
1375                 p("FDIV:  ", a/b); 
1376                 p("FREM:  ", a%b);
1377                 
1378                 p("F2I:   ", (int) a);
1379                 p("F2L:   ", (long) a);
1380                 p("F2D:   ", (double) a);
1381
1382                 if ((a==b)) p("FCMP a=b");
1383                 if ((a!=b)) p("FCMP a!=b");
1384                 if ((a<b))  p("FCMP a<b");
1385                 if ((a<=b)) p("FCMP a<=b");
1386                 if ((a>b))  p("FCMP a>b");
1387                 if ((a>=b)) p("FCMP a>=b");
1388         }
1389
1390         static public void testdouble(double a, double b) {
1391                 p ("TESTDOUBLE called with ", a);
1392                 p ("                   AND ", b);
1393                 
1394                 p("DADD:  ", a+b);
1395                 p("DSUB:  ", a-b);
1396                 p("DMUL:  ", a*b);
1397                 p("DDIV:  ", a/b); 
1398                 p("DREM:  ", a%b);
1399                 
1400                 p("D2I:   ", (int) a);
1401                 p("D2L:   ", (long) a);
1402                 p("D2F:   ", (float) a);
1403
1404                 if ((a==b)) p("DCMP a=b");
1405                 if ((a!=b)) p("DCMP a!=b");
1406                 if ((a<b))  p("DCMP a<b");
1407                 if ((a<=b)) p("DCMP a<=b");
1408                 if ((a>b))  p("DCMP a>b");
1409                 if ((a>=b)) p("DCMP a>=b");
1410         }
1411
1412
1413         // ********************* output methods ****************************
1414         
1415         public static int linenum = 0;
1416         public static void pnl() {
1417                 System.out.println ();
1418                 System.out.print (linenum);
1419                 System.out.print (".    ");
1420                 linenum++;
1421                 }
1422
1423         public static void p(String a) { System.out.print(a); pnl(); }
1424         public static void p(boolean a) {System.out.print(a); 
1425                                       pnl();  }
1426         public static void p(int a) { System.out.print ("int: ");
1427                                       System.out.print(a); 
1428                                       pnl();  }
1429         public static void p(long a) { System.out.print ("long: ");
1430                                        System.out.print(a); 
1431                                        pnl(); }
1432         public static void p(short a) { System.out.print ("short: ");
1433                                        System.out.print(a); 
1434                                        pnl(); }
1435         public static void p(byte a) { System.out.print ("byte: ");
1436                                        System.out.print(a); 
1437                                        pnl(); }
1438         public static void p(char a) { System.out.print ("char: ");
1439                                        System.out.print((int)a); 
1440                                        pnl(); }
1441         public static void p(float a) { System.out.print ("float: ");
1442                                         System.out.print ( java.lang.Float.floatToIntBits(a) ); 
1443                                         pnl(); }
1444         public static void p(double a) { System.out.print ("double: ");
1445                                          System.out.print( java.lang.Double.doubleToLongBits(a) ); 
1446                                          pnl(); }
1447
1448         public static void p(String s,boolean i) { 
1449                 System.out.print(s); p(i);
1450                 }
1451         public static void p(String s,int i) { 
1452                 System.out.print(s); p(i);
1453                 }
1454         public static void p(String s,byte i) { 
1455                 System.out.print(s); p(i);
1456                 }
1457         public static void p(String s,char i) { 
1458                 System.out.print(s); p(i);
1459                 }
1460         public static void p(String s,short i) { 
1461                 System.out.print(s); p(i);
1462                 }
1463         public static void p(String s,long l) { 
1464                 System.out.print(s); p(l);
1465                 }
1466         public static void p(String s,float f) { 
1467                 System.out.print(s); p(f);
1468                 }
1469         public static void p(String s,double d) {
1470                 System.out.print(s); p(d);
1471                 }
1472
1473
1474
1475
1476         // methods for testing interface and method calls
1477
1478         public void jctest() { p (" <init> wird aktiviert"); };
1479         public void p_manyparam (int p_i1,int p_i2,
1480                                  int p_i3, int p_i4, 
1481                                  long p_l1,long p_l2,
1482                                  long p_l3,long p_l4, 
1483                                  float p_f1, float p_f2, 
1484                                  float p_f3, float p_f4,
1485                                  double p_d1, double p_d2,
1486                                  double p_d3, double p_d4) {
1487                 n_i1 = p_i1;
1488                 n_i2 = p_i2;
1489                 n_i3 = p_i3;
1490                 n_i4 = p_i4;
1491                 n_l1 = p_l1;
1492                 n_l2 = p_l2;
1493                 n_l3 = p_l3;
1494                 n_l4 = p_l4;
1495                 n_f1 = p_f1;
1496                 n_f2 = p_f2;
1497                 n_f3 = p_f3;
1498                 n_f4 = p_f4;
1499                 n_d1 = p_d1;
1500                 n_d2 = p_d2;
1501                 n_d3 = p_d3;
1502                 n_d4 = p_d4;
1503                 }
1504                 
1505         public void p_nonstatic (String a) { 
1506                 p(a); 
1507                 p(n_i1);
1508                 p(n_i2);
1509                 p(n_i3);
1510                 p(n_i4);
1511                 p(n_l1);
1512                 p(n_l2);
1513                 p(n_l3);
1514                 p(n_l4);
1515                 p(n_f1);
1516                 p(n_f2);
1517                 p(n_f3);
1518                 p(n_f4);
1519                 p(n_d1);
1520                 p(n_d2);
1521                 p(n_d3);
1522                 p(n_d4);
1523                 
1524                 }
1525
1526         }
1527         
1528         
1529 interface jcinterface { 
1530         public void p_nonstatic (String a);
1531         }
1532         
1533