do BasicToStrings automatically
[cacao.git] / jit / stack.c
1 /* jit/stack.c - stack analysis
2
3    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
4    R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
5    M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
6    P. Tomsich, J. Wenninger
7
8    This file is part of CACAO.
9
10    This program is free software; you can redistribute it and/or
11    modify it under the terms of the GNU General Public License as
12    published by the Free Software Foundation; either version 2, or (at
13    your option) any later version.
14
15    This program is distributed in the hope that it will be useful, but
16    WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23    02111-1307, USA.
24
25    Contact: cacao@complang.tuwien.ac.at
26
27    Authors: Andreas Krall
28
29    Changes: Edwin Steiner
30
31    $Id: stack.c 727 2003-12-11 10:52:40Z edwin $
32
33 */
34
35
36 #include <stdio.h>
37 #include "stack.h"
38 #include "global.h"
39 #include "jit.h"
40 #include "builtin.h"
41 #include "disass.h"
42 #include "reg.h"
43 #include "tables.h"
44 #include "types.h"
45 #include "toolbox/loging.h"
46 #include "toolbox/memory.h"
47
48
49 /* from codegen.inc */
50 extern int dseglen;
51
52
53 #ifdef STATISTICS
54 #define COUNT(cnt) cnt++
55 #else
56 #define COUNT(cnt)
57 #endif
58  
59 #define STACKRESET {curstack=0;stackdepth=0;}
60
61 #define TYPEPANIC  {show_icmd_method();panic("Stack type mismatch");}
62 #define UNDERFLOW  {show_icmd_method();panic("Stack underflow");} /* XXX why isn't this caught in parse.c? */
63 #define CURKIND    curstack->varkind
64 #define CURTYPE    curstack->type
65
66 #define REQUIRE(num)  do { if (stackdepth<(num)) {UNDERFLOW;} } while(0)
67 #define REQUIRE_1     REQUIRE(1)
68 #define REQUIRE_2     REQUIRE(2)
69 #define REQUIRE_3     REQUIRE(3)
70 #define REQUIRE_4     REQUIRE(4)
71
72 #define NEWSTACK(s,v,n) {new->prev=curstack;new->type=s;new->flags=0;   \
73                         new->varkind=v;new->varnum=n;curstack=new;new++;}
74 #define NEWSTACKn(s,n)  NEWSTACK(s,UNDEFVAR,n)
75 #define NEWSTACK0(s)    NEWSTACK(s,UNDEFVAR,0)
76 #define NEWXSTACK   {NEWSTACK(TYPE_ADR,STACKVAR,0);curstack=0;}
77
78 #define SETDST      {iptr->dst=curstack;}
79
80 /* The following macros do NOT check stackdepth, set stackdepth and iptr->dst */
81 #define POP(s)      {if(s!=curstack->type){TYPEPANIC;}                                                                          \
82                      if(curstack->varkind==UNDEFVAR)curstack->varkind=TEMPVAR;\
83                      curstack=curstack->prev;}
84 #define POPANY      {if(curstack->varkind==UNDEFVAR)curstack->varkind=TEMPVAR;  \
85                      curstack=curstack->prev;}
86 #define COPY(s,d)   {(d)->flags=0;(d)->type=(s)->type;\
87                      (d)->varkind=(s)->varkind;(d)->varnum=(s)->varnum;}
88 /******************************/
89
90 /* The following macros check stackdepth, set stackdepth and itpr->dst */
91 #define PUSHCONST(s){NEWSTACKn(s,stackdepth);SETDST;stackdepth++;}
92 #define LOAD(s,v,n) {NEWSTACK(s,v,n);SETDST;stackdepth++;}
93 #define STORE(s)    {REQUIRE_1;POP(s);SETDST;stackdepth--;}
94 #define OP1_0(s)    {REQUIRE_1;POP(s);SETDST;stackdepth--;}
95 #define OP1_0ANY    {REQUIRE_1;POPANY;SETDST;stackdepth--;}
96 #define OP0_1(s)    {NEWSTACKn(s,stackdepth);SETDST;stackdepth++;}
97 #define OP1_1(s,d)  {REQUIRE_1;POP(s);NEWSTACKn(d,stackdepth-1);SETDST;}
98 #define OP2_0(s)    {REQUIRE_2;POP(s);POP(s);SETDST;stackdepth-=2;}
99 #define OPTT2_0(t,b){REQUIRE_2;POP(t);POP(b);SETDST;stackdepth-=2;}
100 #define OP2_1(s)    {REQUIRE_2;POP(s);POP(s);NEWSTACKn(s,stackdepth-2);SETDST;stackdepth--;}
101 #define OP2IAT_1(s) {REQUIRE_2;POP(TYPE_INT);POP(TYPE_ADR);NEWSTACKn(s,stackdepth-2);\
102                      SETDST;stackdepth--;}
103 #define OP2IT_1(s)  {REQUIRE_2;POP(TYPE_INT);POP(s);NEWSTACKn(s,stackdepth-2);\
104                      SETDST;stackdepth--;}
105 #define OPTT2_1(s,d){REQUIRE_2;POP(s);POP(s);NEWSTACKn(d,stackdepth-2);SETDST;stackdepth--;}
106 #define OP2_2(s)    {REQUIRE_2;POP(s);POP(s);NEWSTACKn(s,stackdepth-2);\
107                      NEWSTACKn(s,stackdepth-1);SETDST;}
108 #define OP3TIA_0(s) {REQUIRE_3;POP(s);POP(TYPE_INT);POP(TYPE_ADR);SETDST;stackdepth-=3;}
109 #define OP3_0(s)    {REQUIRE_3;POP(s);POP(s);POP(s);SETDST;stackdepth-=3;}
110 #define POPMANY(i)  {REQUIRE(i);stackdepth-=i;while(--i>=0){POPANY;}SETDST;}
111 #define DUP         {REQUIRE_1;NEWSTACK(CURTYPE,CURKIND,curstack->varnum);SETDST; \
112                     stackdepth++;}
113 #define SWAP        {REQUIRE_2;COPY(curstack,new);POPANY;COPY(curstack,new+1);POPANY;\
114                     new[0].prev=curstack;new[1].prev=new;\
115                     curstack=new+1;new+=2;SETDST;}
116 #define DUP_X1      {REQUIRE_2;COPY(curstack,new);COPY(curstack,new+2);POPANY;\
117                     COPY(curstack,new+1);POPANY;new[0].prev=curstack;\
118                     new[1].prev=new;new[2].prev=new+1;\
119                     curstack=new+2;new+=3;SETDST;stackdepth++;}
120 #define DUP2_X1     {REQUIRE_3;COPY(curstack,new+1);COPY(curstack,new+4);POPANY;\
121                     COPY(curstack,new);COPY(curstack,new+3);POPANY;\
122                     COPY(curstack,new+2);POPANY;new[0].prev=curstack;\
123                     new[1].prev=new;new[2].prev=new+1;\
124                     new[3].prev=new+2;new[4].prev=new+3;\
125                     curstack=new+4;new+=5;SETDST;stackdepth+=2;}
126 #define DUP_X2      {REQUIRE_3;COPY(curstack,new);COPY(curstack,new+3);POPANY;\
127                     COPY(curstack,new+2);POPANY;COPY(curstack,new+1);POPANY;\
128                     new[0].prev=curstack;new[1].prev=new;\
129                     new[2].prev=new+1;new[3].prev=new+2;\
130                     curstack=new+3;new+=4;SETDST;stackdepth++;}
131 #define DUP2_X2     {REQUIRE_4;COPY(curstack,new+1);COPY(curstack,new+5);POPANY;\
132                     COPY(curstack,new);COPY(curstack,new+4);POPANY;\
133                     COPY(curstack,new+3);POPANY;COPY(curstack,new+2);POPANY;\
134                     new[0].prev=curstack;new[1].prev=new;\
135                     new[2].prev=new+1;new[3].prev=new+2;\
136                     new[4].prev=new+3;new[5].prev=new+4;\
137                     curstack=new+5;new+=6;SETDST;stackdepth+=2;}
138 /******************************/
139
140 #define COPYCURSTACK(copy) {\
141         int d;\
142         stackptr s;\
143         if(curstack){\
144                 s=curstack;\
145                 new+=stackdepth;\
146                 d=stackdepth;\
147                 copy=new;\
148                 while(s){\
149                         copy--;d--;\
150                         copy->prev=copy-1;\
151                         copy->type=s->type;\
152                         copy->flags=0;\
153                         copy->varkind=STACKVAR;\
154                         copy->varnum=d;\
155                         s=s->prev;\
156                         }\
157                 copy->prev=NULL;\
158                 copy=new-1;\
159                 }\
160         else\
161                 copy=NULL;\
162 }
163
164
165 #define BBEND(s,i){\
166         i=stackdepth-1;\
167         copy=s;\
168         while(copy){\
169                 if((copy->varkind==STACKVAR)&&(copy->varnum>i))\
170                         copy->varkind=TEMPVAR;\
171                 else {\
172                         copy->varkind=STACKVAR;\
173                         copy->varnum=i;\
174                         }\
175                 interfaces[i][copy->type].type = copy->type;\
176                 interfaces[i][copy->type].flags |= copy->flags;\
177                 i--;copy=copy->prev;\
178                 }\
179         i=bptr->indepth-1;\
180         copy=bptr->instack;\
181         while(copy){\
182                 interfaces[i][copy->type].type = copy->type;\
183                 if(copy->varkind==STACKVAR){\
184                         if (copy->flags & SAVEDVAR)\
185                                 interfaces[i][copy->type].flags |= SAVEDVAR;\
186                         }\
187                 i--;copy=copy->prev;\
188                 }\
189 }
190
191         
192 #define MARKREACHED(b,c) {\
193         if(b->flags<0)\
194                 {COPYCURSTACK(c);b->flags=0;b->instack=c;b->indepth=stackdepth;}\
195         else {stackptr s=curstack;stackptr t=b->instack;\
196                 if(b->indepth!=stackdepth)\
197                         {show_icmd_method();panic("Stack depth mismatch");}\
198                 while(s){if (s->type!=t->type)\
199                                 TYPEPANIC\
200                         s=s->prev;t=t->prev;\
201                         }\
202                 }\
203 }
204
205
206 void analyse_stack()
207 {
208         int b_count;
209         int b_index;
210         int stackdepth;
211         stackptr curstack;
212         stackptr new;
213         stackptr copy;
214         int opcode, i, len, loops;
215         int superblockend, repeat, deadcode;
216         instruction *iptr;
217         basicblock *bptr;
218         basicblock *tbptr;
219         s4 *s4ptr;
220         void* *tptr;
221
222         if (compileverbose) {
223                 char logtext[MAXLOGTEXT];
224                 sprintf(logtext, "Analysing: ");
225                 utf_sprint(logtext+strlen(logtext), method->class->name);
226                 strcpy(logtext+strlen(logtext), ".");
227                 utf_sprint(logtext+strlen(logtext), method->name);
228                 utf_sprint(logtext+strlen(logtext), method->descriptor);
229                 dolog(logtext);
230         }
231
232         int *argren = DMNEW(int, maxlocals); 
233         //int *argren = (int *)alloca(maxlocals * sizeof(int)); /* table for argument renaming */
234         for (i = 0; i < maxlocals; i++)
235                 argren[i] = i;
236         
237         arguments_num = 0;
238         new = stack;
239         loops = 0;
240         block[0].flags = BBREACHED;
241         block[0].instack = 0;
242         block[0].indepth = 0;
243
244         for (i = 0; i < exceptiontablelength; i++) {
245                 bptr = &block[block_index[extable[i].handlerpc]];
246                 bptr->flags = BBREACHED;
247                 bptr->type = BBTYPE_EXH;
248                 bptr->instack = new;
249                 bptr->indepth = 1;
250                 bptr->pre_count = 10000;
251                 STACKRESET;
252                 NEWXSTACK;
253         }
254
255 #ifdef CONDITIONAL_LOADCONST
256         b_count = block_count;
257         bptr = block;
258         while (--b_count >= 0) {
259                 if (bptr->icount != 0) {
260                         iptr = bptr->iinstr + bptr->icount - 1;
261                         switch (iptr->opc) {
262                         case ICMD_RET:
263                         case ICMD_RETURN:
264                         case ICMD_IRETURN:
265                         case ICMD_LRETURN:
266                         case ICMD_FRETURN:
267                         case ICMD_DRETURN:
268                         case ICMD_ARETURN:
269                         case ICMD_ATHROW:
270                                 break;
271
272                         case ICMD_IFEQ:
273                         case ICMD_IFNE:
274                         case ICMD_IFLT:
275                         case ICMD_IFGE:
276                         case ICMD_IFGT:
277                         case ICMD_IFLE:
278
279                         case ICMD_IFNULL:
280                         case ICMD_IFNONNULL:
281
282                         case ICMD_IF_ICMPEQ:
283                         case ICMD_IF_ICMPNE:
284                         case ICMD_IF_ICMPLT:
285                         case ICMD_IF_ICMPGE:
286                         case ICMD_IF_ICMPGT:
287                         case ICMD_IF_ICMPLE:
288
289                         case ICMD_IF_ACMPEQ:
290                         case ICMD_IF_ACMPNE:
291                                 bptr[1].pre_count++;
292                         case ICMD_GOTO:
293                                 block[block_index[iptr->op1]].pre_count++;
294                                 break;
295
296                         case ICMD_TABLESWITCH:
297                                 s4ptr = iptr->val.a;
298                                 block[block_index[*s4ptr++]].pre_count++;   /* default */
299                                 i = *s4ptr++;                               /* low     */
300                                 i = *s4ptr++ - i + 1;                       /* high    */
301                                 while (--i >= 0) {
302                                         block[block_index[*s4ptr++]].pre_count++;
303                                 }
304                                 break;
305                                         
306                         case ICMD_LOOKUPSWITCH:
307                                 s4ptr = iptr->val.a;
308                                 block[block_index[*s4ptr++]].pre_count++;   /* default */
309                                 i = *s4ptr++;                               /* count   */
310                                 while (--i >= 0) {
311                                         block[block_index[s4ptr[1]]].pre_count++;
312                                         s4ptr += 2;
313                                 }
314                                 break;
315                         default:
316                                 bptr[1].pre_count++;
317                                 break;
318                         }
319                 }
320                 bptr++;
321         }
322 #endif
323
324
325         do {
326                 loops++;
327                 b_count = block_count;
328                 bptr = block;
329                 superblockend = true;
330                 repeat = false;
331                 STACKRESET;
332                 deadcode = true;
333                 while (--b_count >= 0) {
334                         if (bptr->flags == BBDELETED) {
335                                 /* do nothing */
336                         }
337                         else if (superblockend && (bptr->flags < BBREACHED))
338                                 repeat = true;
339                         else if (bptr->flags <= BBREACHED) {
340                                 if (superblockend)
341                                         stackdepth = bptr->indepth;
342                                 else if (bptr->flags < BBREACHED) {
343                                         COPYCURSTACK(copy);
344                                         bptr->instack = copy;
345                                         bptr->indepth = stackdepth;
346                                 }
347                                 else if (bptr->indepth != stackdepth) {
348                                         show_icmd_method();
349                                         panic("Stack depth mismatch");
350                                         
351                                 }
352                                 curstack = bptr->instack;
353                                 deadcode = false;
354                                 superblockend = false;
355                                 bptr->flags = BBFINISHED;
356                                 len = bptr->icount;
357                                 iptr = bptr->iinstr;
358                                 b_index = bptr - block;
359                                 while (--len >= 0)  {
360                                         opcode = iptr->opc;
361                                         iptr->target = NULL;
362
363                                         /* DEBUG XXX */ /*  dolog("p:%04d op: %s",iptr-instr,icmd_names[opcode]); */
364
365 #ifdef USEBUILTINTABLE
366                                         {
367 #if 0
368                                                 stdopdescriptor *breplace;
369                                                 breplace = find_builtin(opcode);
370
371                                                 if (breplace && opcode == breplace->opcode) {
372                                                         iptr[0].opc = breplace->icmd;
373                                                         iptr[0].op1 = breplace->type_d;
374                                                         iptr[0].val.a = breplace->builtin;
375                                                         isleafmethod = false;
376                                                         switch (breplace->icmd) {
377                                                         case ICMD_BUILTIN1:
378                                                                 goto builtin1;
379                                                         case ICMD_BUILTIN2:
380                                                                 goto builtin2;
381                                                         }
382                                                 }
383 #endif
384                                                 builtin_descriptor *breplace;
385                                                 breplace = find_builtin(opcode);
386
387                                                 if (breplace && opcode == breplace->opcode) {
388                                                         iptr[0].opc = breplace->icmd;
389                                                         iptr[0].op1 = breplace->type_d;
390                                                         iptr[0].val.a = breplace->builtin;
391                                                         isleafmethod = false;
392                                                         switch (breplace->icmd) {
393                                                         case ICMD_BUILTIN1:
394                                                                 goto builtin1;
395                                                         case ICMD_BUILTIN2:
396                                                                 goto builtin2;
397                                                         }
398                                                 }
399                                         }
400 #endif
401                                         
402                                         switch (opcode) {
403
404                                                 /* pop 0 push 0 */
405
406                                         case ICMD_NOP:
407                                         case ICMD_CHECKASIZE:
408
409                                         case ICMD_IFEQ_ICONST:
410                                         case ICMD_IFNE_ICONST:
411                                         case ICMD_IFLT_ICONST:
412                                         case ICMD_IFGE_ICONST:
413                                         case ICMD_IFGT_ICONST:
414                                         case ICMD_IFLE_ICONST:
415                                         case ICMD_ELSE_ICONST:
416                                                 SETDST;
417                                                 break;
418
419                                         case ICMD_RET:
420                                                 locals[iptr->op1][TYPE_ADR].type = TYPE_ADR;
421                                         case ICMD_RETURN:
422                                                 COUNT(count_pcmd_return);
423                                                 SETDST;
424                                                 superblockend = true;
425                                                 break;
426
427                                                 /* pop 0 push 1 const */
428                                                 
429                                         case ICMD_ICONST:
430                                                 COUNT(count_pcmd_load);
431                                                 if (len > 0) {
432                                                         switch (iptr[1].opc) {
433                                                         case ICMD_IADD:
434                                                                 iptr[0].opc = ICMD_IADDCONST;
435                                                         icmd_iconst_tail:
436                                                                 iptr[1].opc = ICMD_NOP;
437                                                                 OP1_1(TYPE_INT,TYPE_INT);
438                                                                 COUNT(count_pcmd_op);
439                                                                 break;
440                                                         case ICMD_ISUB:
441                                                                 iptr[0].opc = ICMD_ISUBCONST;
442                                                                 goto icmd_iconst_tail;
443                                                         case ICMD_IMUL:
444                                                                 iptr[0].opc = ICMD_IMULCONST;
445                                                                 goto icmd_iconst_tail;
446                                                         case ICMD_IDIV:
447                                                                 if (iptr[0].val.i == 0x00000002)
448                                                                         iptr[0].val.i = 1;
449                                                                 else if (iptr[0].val.i == 0x00000004)
450                                                                         iptr[0].val.i = 2;
451                                                                 else if (iptr[0].val.i == 0x00000008)
452                                                                         iptr[0].val.i = 3;
453                                                                 else if (iptr[0].val.i == 0x00000010)
454                                                                         iptr[0].val.i = 4;
455                                                                 else if (iptr[0].val.i == 0x00000020)
456                                                                         iptr[0].val.i = 5;
457                                                                 else if (iptr[0].val.i == 0x00000040)
458                                                                         iptr[0].val.i = 6;
459                                                                 else if (iptr[0].val.i == 0x00000080)
460                                                                         iptr[0].val.i = 7;
461                                                                 else if (iptr[0].val.i == 0x00000100)
462                                                                         iptr[0].val.i = 8;
463                                                                 else if (iptr[0].val.i == 0x00000200)
464                                                                         iptr[0].val.i = 9;
465                                                                 else if (iptr[0].val.i == 0x00000400)
466                                                                         iptr[0].val.i = 10;
467                                                                 else if (iptr[0].val.i == 0x00000800)
468                                                                         iptr[0].val.i = 11;
469                                                                 else if (iptr[0].val.i == 0x00001000)
470                                                                         iptr[0].val.i = 12;
471                                                                 else if (iptr[0].val.i == 0x00002000)
472                                                                         iptr[0].val.i = 13;
473                                                                 else if (iptr[0].val.i == 0x00004000)
474                                                                         iptr[0].val.i = 14;
475                                                                 else if (iptr[0].val.i == 0x00008000)
476                                                                         iptr[0].val.i = 15;
477                                                                 else if (iptr[0].val.i == 0x00010000)
478                                                                         iptr[0].val.i = 16;
479                                                                 else if (iptr[0].val.i == 0x00020000)
480                                                                         iptr[0].val.i = 17;
481                                                                 else if (iptr[0].val.i == 0x00040000)
482                                                                         iptr[0].val.i = 18;
483                                                                 else if (iptr[0].val.i == 0x00080000)
484                                                                         iptr[0].val.i = 19;
485                                                                 else if (iptr[0].val.i == 0x00100000)
486                                                                         iptr[0].val.i = 20;
487                                                                 else if (iptr[0].val.i == 0x00200000)
488                                                                         iptr[0].val.i = 21;
489                                                                 else if (iptr[0].val.i == 0x00400000)
490                                                                         iptr[0].val.i = 22;
491                                                                 else if (iptr[0].val.i == 0x00800000)
492                                                                         iptr[0].val.i = 23;
493                                                                 else if (iptr[0].val.i == 0x01000000)
494                                                                         iptr[0].val.i = 24;
495                                                                 else if (iptr[0].val.i == 0x02000000)
496                                                                         iptr[0].val.i = 25;
497                                                                 else if (iptr[0].val.i == 0x04000000)
498                                                                         iptr[0].val.i = 26;
499                                                                 else if (iptr[0].val.i == 0x08000000)
500                                                                         iptr[0].val.i = 27;
501                                                                 else if (iptr[0].val.i == 0x10000000)
502                                                                         iptr[0].val.i = 28;
503                                                                 else if (iptr[0].val.i == 0x20000000)
504                                                                         iptr[0].val.i = 29;
505                                                                 else if (iptr[0].val.i == 0x40000000)
506                                                                         iptr[0].val.i = 30;
507                                                                 else if (iptr[0].val.i == 0x80000000)
508                                                                         iptr[0].val.i = 31;
509                                                                 else {
510                                                                         PUSHCONST(TYPE_INT);
511                                                                         break;
512                                                                 }
513                                                                 iptr[0].opc = ICMD_IDIVPOW2;
514                                                                 goto icmd_iconst_tail;
515                                                         case ICMD_IREM:
516 #if !defined(NO_DIV_OPT)
517                                                                 if (iptr[0].val.i == 0x10001) {
518                                                                         iptr[0].opc = ICMD_IREM0X10001;
519                                                                         goto icmd_iconst_tail;
520                                                                 }
521 #endif
522                                                                 if ((iptr[0].val.i == 0x00000002) ||
523                                                                         (iptr[0].val.i == 0x00000004) ||
524                                                                         (iptr[0].val.i == 0x00000008) ||
525                                                                         (iptr[0].val.i == 0x00000010) ||
526                                                                         (iptr[0].val.i == 0x00000020) ||
527                                                                         (iptr[0].val.i == 0x00000040) ||
528                                                                         (iptr[0].val.i == 0x00000080) ||
529                                                                         (iptr[0].val.i == 0x00000100) ||
530                                                                         (iptr[0].val.i == 0x00000200) ||
531                                                                         (iptr[0].val.i == 0x00000400) ||
532                                                                         (iptr[0].val.i == 0x00000800) ||
533                                                                         (iptr[0].val.i == 0x00001000) ||
534                                                                         (iptr[0].val.i == 0x00002000) ||
535                                                                         (iptr[0].val.i == 0x00004000) ||
536                                                                         (iptr[0].val.i == 0x00008000) ||
537                                                                         (iptr[0].val.i == 0x00010000) ||
538                                                                         (iptr[0].val.i == 0x00020000) ||
539                                                                         (iptr[0].val.i == 0x00040000) ||
540                                                                         (iptr[0].val.i == 0x00080000) ||
541                                                                         (iptr[0].val.i == 0x00100000) ||
542                                                                         (iptr[0].val.i == 0x00200000) ||
543                                                                         (iptr[0].val.i == 0x00400000) ||
544                                                                         (iptr[0].val.i == 0x00800000) ||
545                                                                         (iptr[0].val.i == 0x01000000) ||
546                                                                         (iptr[0].val.i == 0x02000000) ||
547                                                                         (iptr[0].val.i == 0x04000000) ||
548                                                                         (iptr[0].val.i == 0x08000000) ||
549                                                                         (iptr[0].val.i == 0x10000000) ||
550                                                                         (iptr[0].val.i == 0x20000000) ||
551                                                                         (iptr[0].val.i == 0x40000000) ||
552                                                                         (iptr[0].val.i == 0x80000000)) {
553                                                                         iptr[0].opc = ICMD_IREMPOW2;
554                                                                         iptr[0].val.i -= 1;
555                                                                         goto icmd_iconst_tail;
556                                                                 }
557                                                                 PUSHCONST(TYPE_INT);
558                                                                 break;
559                                                         case ICMD_IAND:
560                                                                 iptr[0].opc = ICMD_IANDCONST;
561                                                                 goto icmd_iconst_tail;
562                                                         case ICMD_IOR:
563                                                                 iptr[0].opc = ICMD_IORCONST;
564                                                                 goto icmd_iconst_tail;
565                                                         case ICMD_IXOR:
566                                                                 iptr[0].opc = ICMD_IXORCONST;
567                                                                 goto icmd_iconst_tail;
568                                                         case ICMD_ISHL:
569                                                                 iptr[0].opc = ICMD_ISHLCONST;
570                                                                 goto icmd_iconst_tail;
571                                                         case ICMD_ISHR:
572                                                                 iptr[0].opc = ICMD_ISHRCONST;
573                                                                 goto icmd_iconst_tail;
574                                                         case ICMD_IUSHR:
575                                                                 iptr[0].opc = ICMD_IUSHRCONST;
576                                                                 goto icmd_iconst_tail;
577 #if SUPPORT_LONG_SHIFT
578                                                         case ICMD_LSHL:
579                                                                 iptr[0].opc = ICMD_LSHLCONST;
580                                                                 goto icmd_lconst_tail;
581                                                         case ICMD_LSHR:
582                                                                 iptr[0].opc = ICMD_LSHRCONST;
583                                                                 goto icmd_lconst_tail;
584                                                         case ICMD_LUSHR:
585                                                                 iptr[0].opc = ICMD_LUSHRCONST;
586                                                                 goto icmd_lconst_tail;
587 #endif
588                                                         case ICMD_IF_ICMPEQ:
589                                                                 iptr[0].opc = ICMD_IFEQ;
590                                                         icmd_if_icmp_tail:
591                                                                 iptr[0].op1 = iptr[1].op1;
592                                                                 bptr->icount--;
593                                                                 len--;
594                                                                 /* iptr[1].opc = ICMD_NOP; */
595                                                                 OP1_0(TYPE_INT);
596                                                                 tbptr = block + block_index[iptr->op1];
597
598                                                                 iptr[0].target = (void *) tbptr;
599
600                                                                 MARKREACHED(tbptr, copy);
601                                                                 COUNT(count_pcmd_bra);
602                                                                 break;
603                                                         case ICMD_IF_ICMPLT:
604                                                                 iptr[0].opc = ICMD_IFLT;
605                                                                 goto icmd_if_icmp_tail;
606                                                         case ICMD_IF_ICMPLE:
607                                                                 iptr[0].opc = ICMD_IFLE;
608                                                                 goto icmd_if_icmp_tail;
609                                                         case ICMD_IF_ICMPNE:
610                                                                 iptr[0].opc = ICMD_IFNE;
611                                                                 goto icmd_if_icmp_tail;
612                                                         case ICMD_IF_ICMPGT:
613                                                                 iptr[0].opc = ICMD_IFGT;
614                                                                 goto icmd_if_icmp_tail;
615                                                         case ICMD_IF_ICMPGE:
616                                                                 iptr[0].opc = ICMD_IFGE;
617                                                                 goto icmd_if_icmp_tail;
618                                                         default:
619                                                                 PUSHCONST(TYPE_INT);
620                                                         }
621                                                 }
622                                                 else
623                                                         PUSHCONST(TYPE_INT);
624                                                 break;
625                                         case ICMD_LCONST:
626                                                 COUNT(count_pcmd_load);
627                                                 if (len > 0) {
628                                                         switch (iptr[1].opc) {
629 #if SUPPORT_LONG_ADD
630                                                         case ICMD_LADD:
631                                                                 iptr[0].opc = ICMD_LADDCONST;
632                                                         icmd_lconst_tail:
633                                                                 iptr[1].opc = ICMD_NOP;
634                                                                 OP1_1(TYPE_LNG,TYPE_LNG);
635                                                                 COUNT(count_pcmd_op);
636                                                                 break;
637                                                         case ICMD_LSUB:
638                                                                 iptr[0].opc = ICMD_LSUBCONST;
639                                                                 goto icmd_lconst_tail;
640 #endif
641 #if SUPPORT_LONG_MUL
642                                                         case ICMD_LMUL:
643                                                                 iptr[0].opc = ICMD_LMULCONST;
644                                                                 goto icmd_lconst_tail;
645 #endif
646 #if SUPPORT_LONG_DIV
647                                                         case ICMD_LDIV:
648                                                                 if (iptr[0].val.l == 0x00000002)
649                                                                         iptr[0].val.i = 1;
650                                                                 else if (iptr[0].val.l == 0x00000004)
651                                                                         iptr[0].val.i = 2;
652                                                                 else if (iptr[0].val.l == 0x00000008)
653                                                                         iptr[0].val.i = 3;
654                                                                 else if (iptr[0].val.l == 0x00000010)
655                                                                         iptr[0].val.i = 4;
656                                                                 else if (iptr[0].val.l == 0x00000020)
657                                                                         iptr[0].val.i = 5;
658                                                                 else if (iptr[0].val.l == 0x00000040)
659                                                                         iptr[0].val.i = 6;
660                                                                 else if (iptr[0].val.l == 0x00000080)
661                                                                         iptr[0].val.i = 7;
662                                                                 else if (iptr[0].val.l == 0x00000100)
663                                                                         iptr[0].val.i = 8;
664                                                                 else if (iptr[0].val.l == 0x00000200)
665                                                                         iptr[0].val.i = 9;
666                                                                 else if (iptr[0].val.l == 0x00000400)
667                                                                         iptr[0].val.i = 10;
668                                                                 else if (iptr[0].val.l == 0x00000800)
669                                                                         iptr[0].val.i = 11;
670                                                                 else if (iptr[0].val.l == 0x00001000)
671                                                                         iptr[0].val.i = 12;
672                                                                 else if (iptr[0].val.l == 0x00002000)
673                                                                         iptr[0].val.i = 13;
674                                                                 else if (iptr[0].val.l == 0x00004000)
675                                                                         iptr[0].val.i = 14;
676                                                                 else if (iptr[0].val.l == 0x00008000)
677                                                                         iptr[0].val.i = 15;
678                                                                 else if (iptr[0].val.l == 0x00010000)
679                                                                         iptr[0].val.i = 16;
680                                                                 else if (iptr[0].val.l == 0x00020000)
681                                                                         iptr[0].val.i = 17;
682                                                                 else if (iptr[0].val.l == 0x00040000)
683                                                                         iptr[0].val.i = 18;
684                                                                 else if (iptr[0].val.l == 0x00080000)
685                                                                         iptr[0].val.i = 19;
686                                                                 else if (iptr[0].val.l == 0x00100000)
687                                                                         iptr[0].val.i = 20;
688                                                                 else if (iptr[0].val.l == 0x00200000)
689                                                                         iptr[0].val.i = 21;
690                                                                 else if (iptr[0].val.l == 0x00400000)
691                                                                         iptr[0].val.i = 22;
692                                                                 else if (iptr[0].val.l == 0x00800000)
693                                                                         iptr[0].val.i = 23;
694                                                                 else if (iptr[0].val.l == 0x01000000)
695                                                                         iptr[0].val.i = 24;
696                                                                 else if (iptr[0].val.l == 0x02000000)
697                                                                         iptr[0].val.i = 25;
698                                                                 else if (iptr[0].val.l == 0x04000000)
699                                                                         iptr[0].val.i = 26;
700                                                                 else if (iptr[0].val.l == 0x08000000)
701                                                                         iptr[0].val.i = 27;
702                                                                 else if (iptr[0].val.l == 0x10000000)
703                                                                         iptr[0].val.i = 28;
704                                                                 else if (iptr[0].val.l == 0x20000000)
705                                                                         iptr[0].val.i = 29;
706                                                                 else if (iptr[0].val.l == 0x40000000)
707                                                                         iptr[0].val.i = 30;
708                                                                 else if (iptr[0].val.l == 0x80000000)
709                                                                         iptr[0].val.i = 31;
710                                                                 else {
711                                                                         PUSHCONST(TYPE_LNG);
712                                                                         break;
713                                                                 }
714                                                                 iptr[0].opc = ICMD_LDIVPOW2;
715                                                                 goto icmd_lconst_tail;
716                                                         case ICMD_LREM:
717 #if !defined(NO_DIV_OPT)
718                                                                 if (iptr[0].val.l == 0x10001) {
719                                                                         iptr[0].opc = ICMD_LREM0X10001;
720                                                                         goto icmd_lconst_tail;
721                                                                 }
722 #endif
723                                                                 if ((iptr[0].val.l == 0x00000002) ||
724                                                                         (iptr[0].val.l == 0x00000004) ||
725                                                                         (iptr[0].val.l == 0x00000008) ||
726                                                                         (iptr[0].val.l == 0x00000010) ||
727                                                                         (iptr[0].val.l == 0x00000020) ||
728                                                                         (iptr[0].val.l == 0x00000040) ||
729                                                                         (iptr[0].val.l == 0x00000080) ||
730                                                                         (iptr[0].val.l == 0x00000100) ||
731                                                                         (iptr[0].val.l == 0x00000200) ||
732                                                                         (iptr[0].val.l == 0x00000400) ||
733                                                                         (iptr[0].val.l == 0x00000800) ||
734                                                                         (iptr[0].val.l == 0x00001000) ||
735                                                                         (iptr[0].val.l == 0x00002000) ||
736                                                                         (iptr[0].val.l == 0x00004000) ||
737                                                                         (iptr[0].val.l == 0x00008000) ||
738                                                                         (iptr[0].val.l == 0x00010000) ||
739                                                                         (iptr[0].val.l == 0x00020000) ||
740                                                                         (iptr[0].val.l == 0x00040000) ||
741                                                                         (iptr[0].val.l == 0x00080000) ||
742                                                                         (iptr[0].val.l == 0x00100000) ||
743                                                                         (iptr[0].val.l == 0x00200000) ||
744                                                                         (iptr[0].val.l == 0x00400000) ||
745                                                                         (iptr[0].val.l == 0x00800000) ||
746                                                                         (iptr[0].val.l == 0x01000000) ||
747                                                                         (iptr[0].val.l == 0x02000000) ||
748                                                                         (iptr[0].val.l == 0x04000000) ||
749                                                                         (iptr[0].val.l == 0x08000000) ||
750                                                                         (iptr[0].val.l == 0x10000000) ||
751                                                                         (iptr[0].val.l == 0x20000000) ||
752                                                                         (iptr[0].val.l == 0x40000000) ||
753                                                                         (iptr[0].val.l == 0x80000000)) {
754                                                                         iptr[0].opc = ICMD_LREMPOW2;
755                                                                         iptr[0].val.l -= 1;
756                                                                         goto icmd_lconst_tail;
757                                                                 }
758                                                                 PUSHCONST(TYPE_LNG);
759                                                                 break;
760 #endif
761 #if SUPPORT_LONG_LOG
762                                                         case ICMD_LAND:
763                                                                 iptr[0].opc = ICMD_LANDCONST;
764                                                                 goto icmd_lconst_tail;
765                                                         case ICMD_LOR:
766                                                                 iptr[0].opc = ICMD_LORCONST;
767                                                                 goto icmd_lconst_tail;
768                                                         case ICMD_LXOR:
769                                                                 iptr[0].opc = ICMD_LXORCONST;
770                                                                 goto icmd_lconst_tail;
771 #endif
772 #if !defined(NOLONG_CONDITIONAL)
773                                                         case ICMD_LCMP:
774                                                                 if ((len > 1) && (iptr[2].val.i == 0)) {
775                                                                         switch (iptr[2].opc) {
776                                                                         case ICMD_IFEQ:
777                                                                                 iptr[0].opc = ICMD_IF_LEQ;
778                                                                         icmd_lconst_lcmp_tail:
779                                                                                 iptr[0].op1 = iptr[2].op1;
780                                                                                 bptr->icount -= 2;
781                                                                                 len -= 2;
782                                                                                 /* iptr[1].opc = ICMD_NOP;
783                                                                                    iptr[2].opc = ICMD_NOP; */
784                                                                                 OP1_0(TYPE_LNG);
785                                                                                 tbptr = block + block_index[iptr->op1];
786
787                                                                                 iptr[0].target = (void *) tbptr;
788
789                                                                                 MARKREACHED(tbptr, copy);
790                                                                                 COUNT(count_pcmd_bra);
791                                                                                 COUNT(count_pcmd_op);
792                                                                                 break;
793                                                                         case ICMD_IFNE:
794                                                                                 iptr[0].opc = ICMD_IF_LNE;
795                                                                                 goto icmd_lconst_lcmp_tail;
796                                                                         case ICMD_IFLT:
797                                                                                 iptr[0].opc = ICMD_IF_LLT;
798                                                                                 goto icmd_lconst_lcmp_tail;
799                                                                         case ICMD_IFGT:
800                                                                                 iptr[0].opc = ICMD_IF_LGT;
801                                                                                 goto icmd_lconst_lcmp_tail;
802                                                                         case ICMD_IFLE:
803                                                                                 iptr[0].opc = ICMD_IF_LLE;
804                                                                                 goto icmd_lconst_lcmp_tail;
805                                                                         case ICMD_IFGE:
806                                                                                 iptr[0].opc = ICMD_IF_LGE;
807                                                                                 goto icmd_lconst_lcmp_tail;
808                                                                         default:
809                                                                                 PUSHCONST(TYPE_LNG);
810                                                                         } /* switch (iptr[2].opc) */
811                                                                 } /* if (iptr[2].val.i == 0) */
812                                                                 else
813                                                                         PUSHCONST(TYPE_LNG);
814                                                                 break;
815 #endif
816                                                         default:
817                                                                 PUSHCONST(TYPE_LNG);
818                                                         }
819                                                 }
820                                                 else
821                                                         PUSHCONST(TYPE_LNG);
822                                                 break;
823                                         case ICMD_FCONST:
824                                                 COUNT(count_pcmd_load);
825                                                 PUSHCONST(TYPE_FLT);
826                                                 break;
827                                         case ICMD_DCONST:
828                                                 COUNT(count_pcmd_load);
829                                                 PUSHCONST(TYPE_DBL);
830                                                 break;
831                                         case ICMD_ACONST:
832                                                 COUNT(count_pcmd_load);
833                                                 PUSHCONST(TYPE_ADR);
834                                                 break;
835
836                                                 /* pop 0 push 1 load */
837                                                 
838                                         case ICMD_ILOAD:
839                                         case ICMD_LLOAD:
840                                         case ICMD_FLOAD:
841                                         case ICMD_DLOAD:
842                                         case ICMD_ALOAD:
843                                                 COUNT(count_load_instruction);
844                                                 i = opcode-ICMD_ILOAD;
845                                                 iptr->op1 = argren[iptr->op1];
846                                                 locals[iptr->op1][i].type = i;
847                                                 LOAD(i, LOCALVAR, iptr->op1);
848                                                 break;
849
850                                                 /* pop 2 push 1 */
851
852                                         case ICMD_IALOAD:
853                                         case ICMD_LALOAD:
854                                         case ICMD_FALOAD:
855                                         case ICMD_DALOAD:
856                                         case ICMD_AALOAD:
857                                                 COUNT(count_check_null);
858                                                 COUNT(count_check_bound);
859                                                 COUNT(count_pcmd_mem);
860                                                 OP2IAT_1(opcode-ICMD_IALOAD);
861                                                 break;
862
863                                         case ICMD_BALOAD:
864                                         case ICMD_CALOAD:
865                                         case ICMD_SALOAD:
866                                                 COUNT(count_check_null);
867                                                 COUNT(count_check_bound);
868                                                 COUNT(count_pcmd_mem);
869                                                 OP2IAT_1(TYPE_INT);
870                                                 break;
871
872                                                 /* pop 0 push 0 iinc */
873
874                                         case ICMD_IINC:
875 #ifdef STATISTICS
876                                                 i = stackdepth;
877                                                 if (i >= 10)
878                                                         count_store_depth[10]++;
879                                                 else
880                                                         count_store_depth[i]++;
881 #endif
882                                                 copy = curstack;
883                                                 i = stackdepth - 1;
884                                                 while (copy) {
885                                                         if ((copy->varkind == LOCALVAR) &&
886                                                                 (copy->varnum == iptr->op1)) {
887                                                                 copy->varkind = TEMPVAR;
888                                                                 copy->varnum = i;
889                                                         }
890                                                         i--;
891                                                         copy = copy->prev;
892                                                 }
893                                                 SETDST;
894                                                 break;
895
896                                                 /* pop 1 push 0 store */
897
898                                         case ICMD_ISTORE:
899                                         case ICMD_LSTORE:
900                                         case ICMD_FSTORE:
901                                         case ICMD_DSTORE:
902                                         case ICMD_ASTORE:
903                                         icmd_store:
904                                                 REQUIRE_1;
905
906                                         i = opcode - ICMD_ISTORE;
907                                         locals[iptr->op1][i].type = i;
908 #ifdef STATISTICS
909                                         count_pcmd_store++;
910                                         i = new - curstack;
911                                         if (i >= 20)
912                                                 count_store_length[20]++;
913                                         else
914                                                 count_store_length[i]++;
915                                         i = stackdepth - 1;
916                                         if (i >= 10)
917                                                 count_store_depth[10]++;
918                                         else
919                                                 count_store_depth[i]++;
920 #endif
921                                         copy = curstack->prev;
922                                         i = stackdepth - 2;
923                                         while (copy) {
924                                                 if ((copy->varkind == LOCALVAR) &&
925                                                         (copy->varnum == iptr->op1)) {
926                                                         copy->varkind = TEMPVAR;
927                                                         copy->varnum = i;
928                                                 }
929                                                 i--;
930                                                 copy = copy->prev;
931                                         }
932                                         if ((new - curstack) == 1) {
933                                                 curstack->varkind = LOCALVAR;
934                                                 curstack->varnum = iptr->op1;
935                                         };
936                                         STORE(opcode-ICMD_ISTORE);
937                                         break;
938
939                                         /* pop 3 push 0 */
940
941                                         case ICMD_IASTORE:
942                                         case ICMD_LASTORE:
943                                         case ICMD_FASTORE:
944                                         case ICMD_DASTORE:
945                                         case ICMD_AASTORE:
946                                                 COUNT(count_check_null);
947                                                 COUNT(count_check_bound);
948                                                 COUNT(count_pcmd_mem);
949                                                 OP3TIA_0(opcode-ICMD_IASTORE);
950                                                 break;
951                                         case ICMD_BASTORE:
952                                         case ICMD_CASTORE:
953                                         case ICMD_SASTORE:
954                                                 COUNT(count_check_null);
955                                                 COUNT(count_check_bound);
956                                                 COUNT(count_pcmd_mem);
957                                                 OP3TIA_0(TYPE_INT);
958                                                 break;
959
960                                                 /* pop 1 push 0 */
961
962                                         case ICMD_POP:
963                                                 OP1_0ANY;
964                                                 break;
965
966                                         case ICMD_IRETURN:
967                                         case ICMD_LRETURN:
968                                         case ICMD_FRETURN:
969                                         case ICMD_DRETURN:
970                                         case ICMD_ARETURN:
971                                                 COUNT(count_pcmd_return);
972                                                 OP1_0(opcode-ICMD_IRETURN);
973                                                 superblockend = true;
974                                                 break;
975
976                                         case ICMD_ATHROW:
977                                                 COUNT(count_check_null);
978                                                 OP1_0(TYPE_ADR);
979                                                 STACKRESET;
980                                                 SETDST;
981                                                 superblockend = true;
982                                                 break;
983
984                                         case ICMD_PUTSTATIC:
985                                                 COUNT(count_pcmd_mem);
986                                                 OP1_0(iptr->op1);
987                                                 break;
988
989                                                 /* pop 1 push 0 branch */
990
991                                         case ICMD_IFNULL:
992                                         case ICMD_IFNONNULL:
993                                                 COUNT(count_pcmd_bra);
994                                                 OP1_0(TYPE_ADR);
995                                                 tbptr = block + block_index[iptr->op1];
996
997                                                 iptr[0].target = (void *) tbptr;
998
999                                                 MARKREACHED(tbptr, copy);
1000                                                 break;
1001
1002                                         case ICMD_IFEQ:
1003                                         case ICMD_IFNE:
1004                                         case ICMD_IFLT:
1005                                         case ICMD_IFGE:
1006                                         case ICMD_IFGT:
1007                                         case ICMD_IFLE:
1008                                                 COUNT(count_pcmd_bra);
1009 #ifdef CONDITIONAL_LOADCONST
1010                                                 {
1011                                                         tbptr = block + b_index;
1012                                                         if ((b_count >= 3) &&
1013                                                             ((b_index + 2) == block_index[iptr[0].op1]) &&
1014                                                             (tbptr[1].pre_count == 1) &&
1015                                                             (iptr[1].opc == ICMD_ICONST) &&
1016                                                             (iptr[2].opc == ICMD_GOTO)   &&
1017                                                             ((b_index + 3) == block_index[iptr[2].op1]) &&
1018                                                             (tbptr[2].pre_count == 1) &&
1019                                                             (iptr[3].opc == ICMD_ICONST)) {
1020                                                                 OP1_1(TYPE_INT, TYPE_INT);
1021                                                                 switch (iptr[0].opc) {
1022                                                                 case ICMD_IFEQ:
1023                                                                         iptr[0].opc = ICMD_IFNE_ICONST;
1024                                                                         break;
1025                                                                 case ICMD_IFNE:
1026                                                                         iptr[0].opc = ICMD_IFEQ_ICONST;
1027                                                                         break;
1028                                                                 case ICMD_IFLT:
1029                                                                         iptr[0].opc = ICMD_IFGE_ICONST;
1030                                                                         break;
1031                                                                 case ICMD_IFGE:
1032                                                                         iptr[0].opc = ICMD_IFLT_ICONST;
1033                                                                         break;
1034                                                                 case ICMD_IFGT:
1035                                                                         iptr[0].opc = ICMD_IFLE_ICONST;
1036                                                                         break;
1037                                                                 case ICMD_IFLE:
1038                                                                         iptr[0].opc = ICMD_IFGT_ICONST;
1039                                                                         break;
1040                                                                 }
1041                                                                 iptr[0].val.i = iptr[1].val.i;
1042                                                                 iptr[1].opc = ICMD_ELSE_ICONST;
1043                                                                 iptr[1].val.i = iptr[3].val.i;
1044                                                                 iptr[2].opc = ICMD_NOP;
1045                                                                 iptr[3].opc = ICMD_NOP;
1046                                                                 tbptr[1].flags = BBDELETED;
1047                                                                 tbptr[2].flags = BBDELETED;
1048                                                                 tbptr[1].icount = 0;
1049                                                                 tbptr[2].icount = 0;
1050                                                                 if (tbptr[3].pre_count == 2) {
1051                                                                         len += tbptr[3].icount + 3;
1052                                                                         bptr->icount += tbptr[3].icount + 3;
1053                                                                         tbptr[3].flags = BBDELETED;
1054                                                                         tbptr[3].icount = 0;
1055                                                                         b_index++;
1056                                                                 }
1057                                                                 else {
1058                                                                         bptr->icount++;
1059                                                                         len ++;
1060                                                                 }
1061                                                                 b_index += 2;
1062                                                                 break;
1063                                                         }
1064                                                 }
1065 #endif
1066                                                 OP1_0(TYPE_INT);
1067                                                 tbptr = block + block_index[iptr->op1];
1068
1069                                                 iptr[0].target = (void *) tbptr;
1070
1071                                                 MARKREACHED(tbptr, copy);
1072                                                 break;
1073
1074                                                 /* pop 0 push 0 branch */
1075
1076                                         case ICMD_GOTO:
1077                                                 COUNT(count_pcmd_bra);
1078                                                 tbptr = block + block_index[iptr->op1];
1079
1080                                                 iptr[0].target = (void *) tbptr;
1081
1082                                                 MARKREACHED(tbptr, copy);
1083                                                 SETDST;
1084                                                 superblockend = true;
1085                                                 break;
1086
1087                                                 /* pop 1 push 0 table branch */
1088
1089                                         case ICMD_TABLESWITCH:
1090                                                 COUNT(count_pcmd_table);
1091                                                 OP1_0(TYPE_INT);
1092                                                 s4ptr = iptr->val.a;
1093                                                 tbptr = block + block_index[*s4ptr++]; /* default */
1094                                                 MARKREACHED(tbptr, copy);
1095                                                 i = *s4ptr++;                          /* low     */
1096                                                 i = *s4ptr++ - i + 1;                  /* high    */
1097
1098                                                 tptr = DMNEW(void*, i+1);
1099                                                 iptr->target = (void *) tptr;
1100
1101                                                 tptr[0] = (void *) tbptr;
1102                                                 tptr++;
1103
1104                                                 while (--i >= 0) {
1105                                                         tbptr = block + block_index[*s4ptr++];
1106
1107                                                         tptr[0] = (void *) tbptr;
1108                                                         tptr++;
1109
1110                                                         MARKREACHED(tbptr, copy);
1111                                                 }
1112                                                 SETDST;
1113                                                 superblockend = true;
1114                                                 break;
1115                                                         
1116                                                 /* pop 1 push 0 table branch */
1117
1118                                         case ICMD_LOOKUPSWITCH:
1119                                                 COUNT(count_pcmd_table);
1120                                                 OP1_0(TYPE_INT);
1121                                                 s4ptr = iptr->val.a;
1122                                                 tbptr = block + block_index[*s4ptr++]; /* default */
1123                                                 MARKREACHED(tbptr, copy);
1124                                                 i = *s4ptr++;                          /* count   */
1125
1126                                                 tptr = DMNEW(void*, i+1);
1127                                                 iptr->target = (void *) tptr;
1128
1129                                                 tptr[0] = (void *) tbptr;
1130                                                 tptr++;
1131
1132                                                 while (--i >= 0) {
1133                                                         tbptr = block + block_index[s4ptr[1]];
1134
1135                                                         tptr[0] = (void *) tbptr;
1136                                                         tptr++;
1137                                                                 
1138                                                         MARKREACHED(tbptr, copy);
1139                                                         s4ptr += 2;
1140                                                 }
1141                                                 SETDST;
1142                                                 superblockend = true;
1143                                                 break;
1144
1145                                         case ICMD_NULLCHECKPOP:
1146                                         case ICMD_MONITORENTER:
1147                                                 COUNT(count_check_null);
1148                                         case ICMD_MONITOREXIT:
1149                                                 OP1_0(TYPE_ADR);
1150                                                 break;
1151
1152                                                 /* pop 2 push 0 branch */
1153
1154                                         case ICMD_IF_ICMPEQ:
1155                                         case ICMD_IF_ICMPNE:
1156                                         case ICMD_IF_ICMPLT:
1157                                         case ICMD_IF_ICMPGE:
1158                                         case ICMD_IF_ICMPGT:
1159                                         case ICMD_IF_ICMPLE:
1160                                                 COUNT(count_pcmd_bra);
1161                                                 OP2_0(TYPE_INT);
1162                                                 tbptr = block + block_index[iptr->op1];
1163                                                         
1164                                                 iptr[0].target = (void *) tbptr;
1165
1166                                                 MARKREACHED(tbptr, copy);
1167                                                 break;
1168
1169                                         case ICMD_IF_ACMPEQ:
1170                                         case ICMD_IF_ACMPNE:
1171                                                 COUNT(count_pcmd_bra);
1172                                                 OP2_0(TYPE_ADR);
1173                                                 tbptr = block + block_index[iptr->op1];
1174
1175                                                 iptr[0].target = (void *) tbptr;
1176
1177                                                 MARKREACHED(tbptr, copy);
1178                                                 break;
1179
1180                                                 /* pop 2 push 0 */
1181
1182                                         case ICMD_PUTFIELD:
1183                                                 COUNT(count_check_null);
1184                                                 COUNT(count_pcmd_mem);
1185                                                 OPTT2_0(iptr->op1,TYPE_ADR);
1186                                                 break;
1187
1188                                         case ICMD_POP2:
1189                                                 REQUIRE_1;
1190                                                 if (! IS_2_WORD_TYPE(curstack->type)) {
1191                                                         OP1_0ANY;                /* second pop */
1192                                                 }
1193                                                 else
1194                                                         iptr->opc = ICMD_POP;
1195                                                 OP1_0ANY;
1196                                                 break;
1197
1198                                                 /* pop 0 push 1 dup */
1199                                                 
1200                                         case ICMD_DUP:
1201                                                 COUNT(count_dup_instruction);
1202                                                 DUP;
1203                                                 break;
1204
1205                                         case ICMD_DUP2:
1206                                                 REQUIRE_1;
1207                                                 if (IS_2_WORD_TYPE(curstack->type)) {
1208                                                         iptr->opc = ICMD_DUP;
1209                                                         DUP;
1210                                                 }
1211                                                 else {
1212                                                         REQUIRE_2;
1213                                                         copy = curstack;
1214                                                         NEWSTACK(copy->prev->type, copy->prev->varkind,
1215                                                                          copy->prev->varnum);
1216                                                         NEWSTACK(copy->type, copy->varkind,
1217                                                                          copy->varnum);
1218                                                         SETDST;
1219                                                         stackdepth+=2;
1220                                                 }
1221                                                 break;
1222
1223                                                 /* pop 2 push 3 dup */
1224                                                 
1225                                         case ICMD_DUP_X1:
1226                                                 DUP_X1;
1227                                                 break;
1228
1229                                         case ICMD_DUP2_X1:
1230                                                 REQUIRE_2;
1231                                                 if (IS_2_WORD_TYPE(curstack->type)) {
1232                                                         iptr->opc = ICMD_DUP_X1;
1233                                                         DUP_X1;
1234                                                 }
1235                                                 else {
1236                                                         DUP2_X1;
1237                                                 }
1238                                                 break;
1239
1240                                                 /* pop 3 push 4 dup */
1241                                                 
1242                                         case ICMD_DUP_X2:
1243                                                 REQUIRE_2;
1244                                                 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1245                                                         iptr->opc = ICMD_DUP_X1;
1246                                                         DUP_X1;
1247                                                 }
1248                                                 else {
1249                                                         DUP_X2;
1250                                                 }
1251                                                 break;
1252
1253                                         case ICMD_DUP2_X2:
1254                                                 REQUIRE_2;
1255                                                 if (IS_2_WORD_TYPE(curstack->type)) {
1256                                                         if (IS_2_WORD_TYPE(curstack->prev->type)) {
1257                                                                 iptr->opc = ICMD_DUP_X1;
1258                                                                 DUP_X1;
1259                                                         }
1260                                                         else {
1261                                                                 iptr->opc = ICMD_DUP_X2;
1262                                                                 DUP_X2;
1263                                                         }
1264                                                 }
1265                                                 else
1266                                                         REQUIRE_3;
1267                                                         if (IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1268                                                                 iptr->opc = ICMD_DUP2_X1;
1269                                                                 DUP2_X1;
1270                                                         }
1271                                                         else {
1272                                                                 DUP2_X2;
1273                                                         }
1274                                                 break;
1275
1276                                                 /* pop 2 push 2 swap */
1277                                                 
1278                                         case ICMD_SWAP:
1279                                                 SWAP;
1280                                                 break;
1281
1282                                                 /* pop 2 push 1 */
1283                                                 
1284                                         case ICMD_IDIV:
1285 #if !SUPPORT_DIVISION
1286                                                 iptr[0].opc = ICMD_BUILTIN2;
1287                                                 iptr[0].op1 = TYPE_INT;
1288                                                 iptr[0].val.a = BUILTIN_idiv;
1289                                                 isleafmethod = false;
1290                                                 goto builtin2;
1291 #endif
1292
1293                                         case ICMD_IREM:
1294 #if !SUPPORT_DIVISION
1295                                                 iptr[0].opc = ICMD_BUILTIN2;
1296                                                 iptr[0].op1 = TYPE_INT;
1297                                                 iptr[0].val.a = BUILTIN_irem;
1298                                                 isleafmethod = false;
1299                                                 goto builtin2;
1300 #endif
1301
1302                                         case ICMD_IADD:
1303                                         case ICMD_ISUB:
1304                                         case ICMD_IMUL:
1305
1306                                         case ICMD_ISHL:
1307                                         case ICMD_ISHR:
1308                                         case ICMD_IUSHR:
1309                                         case ICMD_IAND:
1310                                         case ICMD_IOR:
1311                                         case ICMD_IXOR:
1312                                                 COUNT(count_pcmd_op);
1313                                                 OP2_1(TYPE_INT);
1314                                                 break;
1315
1316                                         case ICMD_LDIV:
1317 #if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
1318                                                 iptr[0].opc = ICMD_BUILTIN2;
1319                                                 iptr[0].op1 = TYPE_LNG;
1320                                                 iptr[0].val.a = BUILTIN_ldiv;
1321                                                 isleafmethod = false;
1322                                                 goto builtin2;
1323 #endif
1324
1325                                         case ICMD_LREM:
1326 #if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
1327                                                 iptr[0].opc = ICMD_BUILTIN2;
1328                                                 iptr[0].op1 = TYPE_LNG;
1329                                                 iptr[0].val.a = BUILTIN_lrem;
1330                                                 isleafmethod = false;
1331                                                 goto builtin2;
1332 #endif
1333
1334                                         case ICMD_LADD:
1335                                         case ICMD_LSUB:
1336                                         case ICMD_LMUL:
1337
1338                                         case ICMD_LOR:
1339                                         case ICMD_LAND:
1340                                         case ICMD_LXOR:
1341                                                 /* XXX DEBUG */ /*dolog("OP2_1(TYPE_LNG)"); */
1342                                                 COUNT(count_pcmd_op);
1343                                                 OP2_1(TYPE_LNG);
1344                                                 break;
1345
1346                                         case ICMD_LSHL:
1347                                         case ICMD_LSHR:
1348                                         case ICMD_LUSHR:
1349                                                 COUNT(count_pcmd_op);
1350                                                 OP2IT_1(TYPE_LNG);
1351                                                 break;
1352
1353                                         case ICMD_FADD:
1354                                         case ICMD_FSUB:
1355                                         case ICMD_FMUL:
1356                                         case ICMD_FDIV:
1357                                         case ICMD_FREM:
1358                                                 COUNT(count_pcmd_op);
1359                                                 OP2_1(TYPE_FLT);
1360                                                 break;
1361
1362                                         case ICMD_DADD:
1363                                         case ICMD_DSUB:
1364                                         case ICMD_DMUL:
1365                                         case ICMD_DDIV:
1366                                         case ICMD_DREM:
1367                                                 COUNT(count_pcmd_op);
1368                                                 OP2_1(TYPE_DBL);
1369                                                 break;
1370
1371                                         case ICMD_LCMP:
1372                                                 COUNT(count_pcmd_op);
1373 #if !defined(NOLONG_CONDITIONAL)
1374                                                 if ((len > 0) && (iptr[1].val.i == 0)) {
1375                                                         switch (iptr[1].opc) {
1376                                                         case ICMD_IFEQ:
1377                                                                 iptr[0].opc = ICMD_IF_LCMPEQ;
1378                                                         icmd_lcmp_if_tail:
1379                                                                 iptr[0].op1 = iptr[1].op1;
1380                                                                 len--;
1381                                                                 bptr->icount--;
1382                                                                 /* iptr[1].opc = ICMD_NOP; */
1383                                                                 OP2_0(TYPE_LNG);
1384                                                                 tbptr = block + block_index[iptr->op1];
1385                         
1386                                                                 iptr[0].target = (void *) tbptr;
1387
1388                                                                 MARKREACHED(tbptr, copy);
1389                                                                 COUNT(count_pcmd_bra);
1390                                                                 break;
1391                                                         case ICMD_IFNE:
1392                                                                 iptr[0].opc = ICMD_IF_LCMPNE;
1393                                                                 goto icmd_lcmp_if_tail;
1394                                                         case ICMD_IFLT:
1395                                                                 iptr[0].opc = ICMD_IF_LCMPLT;
1396                                                                 goto icmd_lcmp_if_tail;
1397                                                         case ICMD_IFGT:
1398                                                                 iptr[0].opc = ICMD_IF_LCMPGT;
1399                                                                 goto icmd_lcmp_if_tail;
1400                                                         case ICMD_IFLE:
1401                                                                 iptr[0].opc = ICMD_IF_LCMPLE;
1402                                                                 goto icmd_lcmp_if_tail;
1403                                                         case ICMD_IFGE:
1404                                                                 iptr[0].opc = ICMD_IF_LCMPGE;
1405                                                                 goto icmd_lcmp_if_tail;
1406                                                         default:
1407                                                                 OPTT2_1(TYPE_LNG, TYPE_INT);
1408                                                         }
1409                                                 }
1410                                                 else
1411 #endif
1412                                                         OPTT2_1(TYPE_LNG, TYPE_INT);
1413                                                 break;
1414                                         case ICMD_FCMPL:
1415                                         case ICMD_FCMPG:
1416                                                 COUNT(count_pcmd_op);
1417                                                 OPTT2_1(TYPE_FLT, TYPE_INT);
1418                                                 break;
1419                                         case ICMD_DCMPL:
1420                                         case ICMD_DCMPG:
1421                                                 COUNT(count_pcmd_op);
1422                                                 OPTT2_1(TYPE_DBL, TYPE_INT);
1423                                                 break;
1424
1425                                                 /* pop 1 push 1 */
1426                                                 
1427                                         case ICMD_INEG:
1428                                         case ICMD_INT2BYTE:
1429                                         case ICMD_INT2CHAR:
1430                                         case ICMD_INT2SHORT:
1431                                                 COUNT(count_pcmd_op);
1432                                                 OP1_1(TYPE_INT, TYPE_INT);
1433                                                 break;
1434                                         case ICMD_LNEG:
1435                                                 COUNT(count_pcmd_op);
1436                                                 OP1_1(TYPE_LNG, TYPE_LNG);
1437                                                 break;
1438                                         case ICMD_FNEG:
1439                                                 COUNT(count_pcmd_op);
1440                                                 OP1_1(TYPE_FLT, TYPE_FLT);
1441                                                 break;
1442                                         case ICMD_DNEG:
1443                                                 COUNT(count_pcmd_op);
1444                                                 OP1_1(TYPE_DBL, TYPE_DBL);
1445                                                 break;
1446
1447                                         case ICMD_I2L:
1448                                                 COUNT(count_pcmd_op);
1449                                                 OP1_1(TYPE_INT, TYPE_LNG);
1450                                                 break;
1451                                         case ICMD_I2F:
1452                                                 COUNT(count_pcmd_op);
1453                                                 OP1_1(TYPE_INT, TYPE_FLT);
1454                                                 break;
1455                                         case ICMD_I2D:
1456                                                 COUNT(count_pcmd_op);
1457                                                 OP1_1(TYPE_INT, TYPE_DBL);
1458                                                 break;
1459                                         case ICMD_L2I:
1460                                                 COUNT(count_pcmd_op);
1461                                                 OP1_1(TYPE_LNG, TYPE_INT);
1462                                                 break;
1463                                         case ICMD_L2F:
1464                                                 COUNT(count_pcmd_op);
1465                                                 OP1_1(TYPE_LNG, TYPE_FLT);
1466                                                 break;
1467                                         case ICMD_L2D:
1468                                                 COUNT(count_pcmd_op);
1469                                                 OP1_1(TYPE_LNG, TYPE_DBL);
1470                                                 break;
1471                                         case ICMD_F2I:
1472                                                 COUNT(count_pcmd_op);
1473                                                 OP1_1(TYPE_FLT, TYPE_INT);
1474                                                 break;
1475                                         case ICMD_F2L:
1476                                                 COUNT(count_pcmd_op);
1477                                                 OP1_1(TYPE_FLT, TYPE_LNG);
1478                                                 break;
1479                                         case ICMD_F2D:
1480                                                 COUNT(count_pcmd_op);
1481                                                 OP1_1(TYPE_FLT, TYPE_DBL);
1482                                                 break;
1483                                         case ICMD_D2I:
1484                                                 COUNT(count_pcmd_op);
1485                                                 OP1_1(TYPE_DBL, TYPE_INT);
1486                                                 break;
1487                                         case ICMD_D2L:
1488                                                 COUNT(count_pcmd_op);
1489                                                 OP1_1(TYPE_DBL, TYPE_LNG);
1490                                                 break;
1491                                         case ICMD_D2F:
1492                                                 COUNT(count_pcmd_op);
1493                                                 OP1_1(TYPE_DBL, TYPE_FLT);
1494                                                 break;
1495
1496                                         case ICMD_CHECKCAST:
1497                                                 OP1_1(TYPE_ADR, TYPE_ADR);
1498                                                 break;
1499
1500                                         case ICMD_ARRAYLENGTH:
1501                                         case ICMD_INSTANCEOF:
1502                                                 OP1_1(TYPE_ADR, TYPE_INT);
1503                                                 break;
1504
1505                                         case ICMD_NEWARRAY:
1506                                         case ICMD_ANEWARRAY:
1507                                                 OP1_1(TYPE_INT, TYPE_ADR);
1508                                                 break;
1509
1510                                         case ICMD_GETFIELD:
1511                                                 COUNT(count_check_null);
1512                                                 COUNT(count_pcmd_mem);
1513                                                 OP1_1(TYPE_ADR, iptr->op1);
1514                                                 break;
1515
1516                                                 /* pop 0 push 1 */
1517                                                 
1518                                         case ICMD_GETSTATIC:
1519                                                 COUNT(count_pcmd_mem);
1520                                                 OP0_1(iptr->op1);
1521                                                 break;
1522
1523                                         case ICMD_NEW:
1524                                                 OP0_1(TYPE_ADR);
1525                                                 break;
1526
1527                                         case ICMD_JSR:
1528                                                 OP0_1(TYPE_ADR);
1529                                                 tbptr = block + block_index[iptr->op1];
1530
1531                                                 iptr[0].target = (void *) tbptr;
1532
1533                                                 /* XXX This is a dirty hack. The typechecker
1534                                                  * needs it because the OP1_0ANY below
1535                                                  * overwrites iptr->dst.
1536                                                  */
1537                                                 iptr->val.a = (void*) iptr->dst;
1538
1539                                                 tbptr->type=BBTYPE_SBR;
1540                                                 MARKREACHED(tbptr, copy);
1541                                                 OP1_0ANY;
1542                                                 break;
1543
1544                                                 /* pop many push any */
1545                                                 
1546                                         case ICMD_INVOKEVIRTUAL:
1547                                         case ICMD_INVOKESPECIAL:
1548                                         case ICMD_INVOKEINTERFACE:
1549                                         case ICMD_INVOKESTATIC:
1550                                                 COUNT(count_pcmd_met);
1551                                                 {
1552                                                         methodinfo *m = iptr->val.a;
1553                                                         if (m->flags & ACC_STATIC)
1554                                                                 {COUNT(count_check_null);}
1555                                                         i = iptr->op1;
1556                                                         if (i > arguments_num)
1557                                                                 arguments_num = i;
1558                                                         REQUIRE(i);
1559 #if defined(__X86_64__)
1560                                                         {
1561                                                                 int iarg = 0;
1562                                                                 int farg = 0;
1563                                                                 int stackargs = 0;
1564
1565                                                                 copy = curstack;
1566                                                                 while (--i >= 0) {
1567                                                                         (IS_FLT_DBL_TYPE(copy->type)) ? farg++ : iarg++;
1568                                                                         copy = copy->prev;
1569                                                                 }
1570
1571                                                                 stackargs += (iarg < intreg_argnum) ? 0 : (iarg - intreg_argnum);
1572                                                                 stackargs += (farg < fltreg_argnum) ? 0 : (farg - fltreg_argnum);
1573
1574                                                                 i = iptr->op1;
1575                                                                 copy = curstack;
1576                                                                 while (--i >= 0) {
1577                                                                         if (!(copy->flags & SAVEDVAR)) {
1578                                                                                 copy->varkind = ARGVAR;
1579                                                                                 if (IS_FLT_DBL_TYPE(copy->type)) {
1580                                                                                         if (--farg < fltreg_argnum) {
1581                                                                                                 copy->varnum = farg;
1582                                                                                         } else {
1583                                                                                                 copy->varnum = --stackargs + intreg_argnum;
1584                                                                                         }
1585                                                                                 } else {
1586                                                                                         if (--iarg < intreg_argnum) {
1587                                                                                                 copy->varnum = iarg;
1588                                                                                         } else {
1589                                                                                                 copy->varnum = --stackargs + intreg_argnum;
1590                                                                                         }
1591                                                                                 }
1592                                                                         } else {
1593                                                                                 (IS_FLT_DBL_TYPE(copy->type)) ? --farg : --iarg;
1594                                                                         }
1595                                                                         copy = copy->prev;
1596                                                                 }
1597                                                         }
1598 #else
1599                                                         copy = curstack;
1600                                                         while (--i >= 0) {
1601                                                                 if (! (copy->flags & SAVEDVAR)) {
1602                                                                         copy->varkind = ARGVAR;
1603                                                                         copy->varnum = i;
1604                                                                 }
1605                                                                 copy = copy->prev;
1606                                                         }
1607 #endif
1608                                                         while (copy) {
1609                                                                 copy->flags |= SAVEDVAR;
1610                                                                 copy = copy->prev;
1611                                                         }
1612                                                         i = iptr->op1;
1613                                                         POPMANY(i);
1614                                                         if (m->returntype != TYPE_VOID) {
1615                                                                 OP0_1(m->returntype);
1616                                                         }
1617                                                         break;
1618                                                 }
1619
1620                                         case ICMD_BUILTIN3:
1621                                                 /* XXX DEBUG */ /*dolog("builtin3");*/
1622                                                 REQUIRE_3;
1623                                                 if (! (curstack->flags & SAVEDVAR)) {
1624                                                         curstack->varkind = ARGVAR;
1625                                                         curstack->varnum = 2;
1626                                                 }
1627                                                 if (3 > arguments_num) {
1628                                                         arguments_num = 3;
1629                                                 }
1630                                                 OP1_0ANY;
1631
1632                                         case ICMD_BUILTIN2:
1633                                         builtin2:
1634                                                 REQUIRE_2;
1635                                                 /* XXX DEBUG */ /*dolog("builtin2");*/
1636                                         if (!(curstack->flags & SAVEDVAR)) {
1637                                                 curstack->varkind = ARGVAR;
1638                                                 curstack->varnum = 1;
1639                                         }
1640                                         if (2 > arguments_num) {
1641                                                 arguments_num = 2;
1642                                         }
1643                                         OP1_0ANY;
1644
1645                                         case ICMD_BUILTIN1:
1646                                         builtin1:
1647                                                 REQUIRE_1;
1648                                                 /* XXX DEBUG */ /*dolog("builtin1");*/
1649                                         if (!(curstack->flags & SAVEDVAR)) {
1650                                                 curstack->varkind = ARGVAR;
1651                                                 curstack->varnum = 0;
1652                                         }
1653                                         if (1 > arguments_num) {
1654                                                 arguments_num = 1;
1655                                         }
1656                                         OP1_0ANY;
1657                                         copy = curstack;
1658                                         while (copy) {
1659                                                 copy->flags |= SAVEDVAR;
1660                                                 copy = copy->prev;
1661                                         }
1662                                         if (iptr->op1 != TYPE_VOID)
1663                                                 OP0_1(iptr->op1);
1664                                         break;
1665
1666                                         case ICMD_MULTIANEWARRAY:
1667                                                 i = iptr->op1;
1668                                                 REQUIRE(i);
1669                                                 if ((i + intreg_argnum) > arguments_num)
1670                                                         arguments_num = i + intreg_argnum;
1671                                                 copy = curstack;
1672                                                 while (--i >= 0) {
1673                                                         if (! (copy->flags & SAVEDVAR)) {
1674                                                                 copy->varkind = ARGVAR;
1675                                                                 copy->varnum = i + intreg_argnum;
1676                                                         }
1677                                                         copy = copy->prev;
1678                                                 }
1679                                                 while (copy) {
1680                                                         copy->flags |= SAVEDVAR;
1681                                                         copy = copy->prev;
1682                                                 }
1683                                                 i = iptr->op1;
1684                                                 POPMANY(i);
1685                                                 OP0_1(TYPE_ADR);
1686                                                 break;
1687
1688                                         case ICMD_CLEAR_ARGREN:
1689                                                 for (i = iptr->op1; i<maxlocals; i++) 
1690                                                         argren[i] = i;
1691                                                 iptr->opc = opcode = ICMD_NOP;
1692                                                 SETDST;
1693                                                 break;
1694                                                 
1695                                         case ICMD_READONLY_ARG:
1696                                         case ICMD_READONLY_ARG+1:
1697                                         case ICMD_READONLY_ARG+2:
1698                                         case ICMD_READONLY_ARG+3:
1699                                         case ICMD_READONLY_ARG+4:
1700
1701                                                 REQUIRE_1;
1702                                                 if (curstack->varkind == LOCALVAR) {
1703                                                         i = curstack->varnum;
1704                                                         argren[iptr->op1] = i;
1705                                                         iptr->op1 = i;
1706                                                 }
1707                                                 opcode = iptr->opc = opcode - ICMD_READONLY_ARG + ICMD_ISTORE;
1708                                                 goto icmd_store;
1709
1710                                                 break;
1711
1712                                         default:
1713                                                 printf("ICMD %d at %d\n", iptr->opc, (int)(iptr-instr));
1714                                                 panic("Missing ICMD code during stack analysis");
1715                                         } /* switch */
1716                                         /* XXX DEBUG */ /*dolog("iptr++");*/
1717                                         iptr++;
1718                                 } /* while instructions */
1719                                 bptr->outstack = curstack;
1720                                 bptr->outdepth = stackdepth;
1721                                 BBEND(curstack, i);
1722                         } /* if */
1723                         else
1724                                 superblockend = true;
1725                         bptr++;
1726                 } /* while blocks */
1727         } while (repeat && !deadcode);
1728
1729 #ifdef STATISTICS
1730         if (block_count > count_max_basic_blocks)
1731                 count_max_basic_blocks = block_count;
1732         count_basic_blocks += block_count;
1733         if (instr_count > count_max_javainstr)
1734                 count_max_javainstr = instr_count;
1735         count_javainstr += instr_count;
1736         if (stack_count > count_upper_bound_new_stack)
1737                 count_upper_bound_new_stack = stack_count;
1738         if ((new - stack) > count_max_new_stack)
1739                 count_max_new_stack = (new - stack);
1740
1741         b_count = block_count;
1742         bptr = block;
1743         while (--b_count >= 0) {
1744                 if (bptr->flags > BBREACHED) {
1745                         if (bptr->indepth >= 10)
1746                                 count_block_stack[10]++;
1747                         else
1748                                 count_block_stack[bptr->indepth]++;
1749                         len = bptr->icount;
1750                         if (len < 10) 
1751                                 count_block_size_distribution[len]++;
1752                         else if (len <= 12)
1753                                 count_block_size_distribution[10]++;
1754                         else if (len <= 14)
1755                                 count_block_size_distribution[11]++;
1756                         else if (len <= 16)
1757                                 count_block_size_distribution[12]++;
1758                         else if (len <= 18)
1759                                 count_block_size_distribution[13]++;
1760                         else if (len <= 20)
1761                                 count_block_size_distribution[14]++;
1762                         else if (len <= 25)
1763                                 count_block_size_distribution[15]++;
1764                         else if (len <= 30)
1765                                 count_block_size_distribution[16]++;
1766                         else
1767                                 count_block_size_distribution[17]++;
1768                 }
1769                 bptr++;
1770         }
1771
1772         if (loops == 1)
1773                 count_analyse_iterations[0]++;
1774         else if (loops == 2)
1775                 count_analyse_iterations[1]++;
1776         else if (loops == 3)
1777                 count_analyse_iterations[2]++;
1778         else if (loops == 4)
1779                 count_analyse_iterations[3]++;
1780         else
1781                 count_analyse_iterations[4]++;
1782
1783         if (block_count <= 5)
1784                 count_method_bb_distribution[0]++;
1785         else if (block_count <= 10)
1786                 count_method_bb_distribution[1]++;
1787         else if (block_count <= 15)
1788                 count_method_bb_distribution[2]++;
1789         else if (block_count <= 20)
1790                 count_method_bb_distribution[3]++;
1791         else if (block_count <= 30)
1792                 count_method_bb_distribution[4]++;
1793         else if (block_count <= 40)
1794                 count_method_bb_distribution[5]++;
1795         else if (block_count <= 50)
1796                 count_method_bb_distribution[6]++;
1797         else if (block_count <= 75)
1798                 count_method_bb_distribution[7]++;
1799         else
1800                 count_method_bb_distribution[8]++;
1801 #endif
1802 }
1803
1804
1805 void icmd_print_stack(stackptr s)
1806 {
1807         int i, j;
1808         stackptr t;
1809
1810         i = maxstack;
1811         t = s;
1812         
1813         while (t) {
1814                 i--;
1815                 t = t->prev;
1816         }
1817         j = maxstack - i;
1818         while (--i >= 0)
1819                 printf("    ");
1820         while (s) {
1821                 j--;
1822                 /* XXX remove */ /* printf("(%d)",s->flags); fflush(stdout); */
1823                 if (s->flags & SAVEDVAR)
1824                         switch (s->varkind) {
1825                         case TEMPVAR:
1826                                 if (s->flags & INMEMORY)
1827                                         printf((regs_ok) ? " M%02d" : " M??", s->regoff);
1828                                 else if ((s->type == TYPE_FLT) || (s->type == TYPE_DBL))
1829                                         printf((regs_ok) ? " F%02d" : " F??", s->regoff);
1830                                 else {
1831                                         if (regs_ok) printf(" %3s",regs[s->regoff]); else printf(" ???");
1832                                 }
1833                                 break;
1834                         case STACKVAR:
1835                                 printf(" I%02d", s->varnum);
1836                                 break;
1837                         case LOCALVAR:
1838                                 printf(" L%02d", s->varnum);
1839                                 break;
1840                         case ARGVAR:
1841                                 printf(" A%02d", s->varnum);
1842                                 break;
1843                         default:
1844                                 printf(" !%02d", j);
1845                         }
1846                 else
1847                         switch (s->varkind) {
1848                         case TEMPVAR:
1849                                 if (s->flags & INMEMORY)
1850                                         printf((regs_ok) ? " m%02d" : " m??", s->regoff);
1851                                 else if ((s->type == TYPE_FLT) || (s->type == TYPE_DBL))
1852                                         printf((regs_ok) ? " f%02d" : " f??", s->regoff);
1853                                 else {
1854                                         if (regs_ok) printf(" %3s",regs[s->regoff]); else printf(" ???");
1855                                 }
1856                                 break;
1857                         case STACKVAR:
1858                                 printf(" i%02d", s->varnum);
1859                                 break;
1860                         case LOCALVAR:
1861                                 printf(" l%02d", s->varnum);
1862                                 break;
1863                         case ARGVAR:
1864                                 printf(" a%02d", s->varnum);
1865                                 break;
1866                         default:
1867                                 printf(" ?%02d", j);
1868                         }
1869                 s = s->prev;
1870         }
1871 }
1872
1873
1874 #if 0
1875 static void print_reg(stackptr s) {
1876         if (s) {
1877                 if (s->flags & SAVEDVAR)
1878                         switch (s->varkind) {
1879                         case TEMPVAR:
1880                                 if (s->flags & INMEMORY)
1881                                         printf(" tm%02d", s->regoff);
1882                                 else
1883                                         printf(" tr%02d", s->regoff);
1884                                 break;
1885                         case STACKVAR:
1886                                 printf(" s %02d", s->varnum);
1887                                 break;
1888                         case LOCALVAR:
1889                                 printf(" l %02d", s->varnum);
1890                                 break;
1891                         case ARGVAR:
1892                                 printf(" a %02d", s->varnum);
1893                                 break;
1894                         default:
1895                                 printf(" ! %02d", s->varnum);
1896                         }
1897                 else
1898                         switch (s->varkind) {
1899                         case TEMPVAR:
1900                                 if (s->flags & INMEMORY)
1901                                         printf(" Tm%02d", s->regoff);
1902                                 else
1903                                         printf(" Tr%02d", s->regoff);
1904                                 break;
1905                         case STACKVAR:
1906                                 printf(" S %02d", s->varnum);
1907                                 break;
1908                         case LOCALVAR:
1909                                 printf(" L %02d", s->varnum);
1910                                 break;
1911                         case ARGVAR:
1912                                 printf(" A %02d", s->varnum);
1913                                 break;
1914                         default:
1915                                 printf(" ? %02d", s->varnum);
1916                         }
1917         }
1918         else
1919                 printf("     ");
1920                 
1921 }
1922 #endif
1923
1924
1925 char *icmd_builtin_name(functionptr bptr)
1926 {
1927         builtin_descriptor *bdesc = builtin_desc;
1928         while ((bdesc->opcode != 0) && (bdesc->builtin != bptr))
1929                 bdesc++;
1930         return (bdesc->opcode) ? bdesc->name : "<NOT IN TABLE>";
1931 }
1932
1933
1934 static char *jit_type[] = {
1935         "int",
1936         "lng",
1937         "flt",
1938         "dbl",
1939         "adr"
1940 };
1941
1942
1943 void show_icmd_method()
1944 {
1945         int i, j;
1946         int deadcode;
1947         s4  *s4ptr;
1948         instruction *iptr;
1949         basicblock *bptr;
1950         void **tptr;
1951         xtable *ex;
1952
1953         printf("\n");
1954         utf_fprint(stdout, class->name);
1955         printf(".");
1956         utf_fprint(stdout, method->name);
1957         printf(" ");
1958         utf_fprint(stdout, method->descriptor);
1959         printf ("\n\nMax locals: %d\n", (int) maxlocals);
1960         printf ("Max stack:  %d\n", (int) maxstack);
1961
1962         printf ("Exceptions (Number: %d):\n", exceptiontablelength);
1963         for (ex = extable; ex != NULL; ex = ex->down) {
1964                 printf("    L%03d ... ", ex->start->debug_nr );
1965                 printf("L%03d  = ", ex->end->debug_nr);
1966                 printf("L%03d\n", ex->handler->debug_nr);
1967         }
1968         
1969         printf ("Local Table:\n");
1970         for (i = 0; i < maxlocals; i++) {
1971                 printf("   %3d: ", i);
1972                 for (j = TYPE_INT; j <= TYPE_ADR; j++)
1973                         if (locals[i][j].type >= 0) {
1974                                 printf("   (%s) ", jit_type[j]);
1975                                 if (locals[i][j].flags & INMEMORY)
1976                                         printf((regs_ok) ? "m%2d" : "m??", locals[i][j].regoff);
1977                                 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
1978                                         printf((regs_ok) ? "f%02d" : "f??", locals[i][j].regoff);
1979                                 else {
1980                                         if (regs_ok) printf("%3s",regs[locals[i][j].regoff]); else printf("???");
1981                                 }
1982                         }
1983                 printf("\n");
1984         }
1985         printf("\n");
1986
1987         printf ("Interface Table:\n");
1988         for (i = 0; i < maxstack; i++) {
1989                 if ((interfaces[i][0].type >= 0) || (interfaces[i][1].type >= 0) ||
1990                     (interfaces[i][2].type >= 0) || (interfaces[i][3].type >= 0) ||
1991                     (interfaces[i][4].type >= 0)) {
1992                         printf("   %3d: ", i);
1993                         for (j = TYPE_INT; j <= TYPE_ADR; j++)
1994                                 if (interfaces[i][j].type >= 0) {
1995                                         printf("   (%s) ", jit_type[j]);
1996                                         if (interfaces[i][j].flags & SAVEDVAR) {
1997                                                 if (interfaces[i][j].flags & INMEMORY)
1998                                                         printf((regs_ok) ? "M%2d" : "M??", interfaces[i][j].regoff);
1999                                                 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2000                                                         printf((regs_ok) ? "F%02d" : "F??", interfaces[i][j].regoff);
2001                                                 else {
2002                                                         if (regs_ok) printf("%3s",regs[interfaces[i][j].regoff]); else printf("???");
2003                                                 }
2004                                         }
2005                                         else {
2006                                                 if (interfaces[i][j].flags & INMEMORY)
2007                                                         printf((regs_ok) ? "m%2d" : "m??", interfaces[i][j].regoff);
2008                                                 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2009                                                         printf((regs_ok) ? "f%02d" : "f??", interfaces[i][j].regoff);
2010                                                 else {
2011                                                         if (regs_ok) printf("%3s",regs[interfaces[i][j].regoff]); else printf("???");
2012                                                 }
2013                                         }
2014                                 }
2015                         printf("\n");
2016                 }
2017         }
2018         printf("\n");
2019
2020         if (showdisassemble) {
2021 #if defined(__I386__) || defined(__X86_64__)
2022                 u1 *u1ptr;
2023                 int a;
2024
2025                 u1ptr = method->mcode + dseglen;
2026                 for (i = 0; i < block[0].mpc; i++, u1ptr++) {
2027                         a = disassinstr(u1ptr, i);
2028                         i += a;
2029                         u1ptr += a;
2030                 }
2031                 printf("\n");
2032 #else
2033                 s4ptr = (s4 *) (method->mcode + dseglen);
2034                 for (i = 0; i < block[0].mpc; i += 4, s4ptr++) {
2035                         disassinstr(*s4ptr, i); 
2036                 }
2037                 printf("\n");
2038 #endif
2039         }
2040
2041         
2042         for (bptr = block; bptr != NULL; bptr = bptr->next) {
2043                 show_icmd_block(bptr);
2044         }
2045 }
2046
2047 void
2048 show_icmd_block(basicblock *bptr)
2049 {
2050         int i, j;
2051         int deadcode;
2052         s4  *s4ptr;
2053         instruction *iptr;
2054
2055                 if (bptr->flags != BBDELETED) {
2056                         deadcode = bptr->flags <= BBREACHED;
2057                         printf("[");
2058                         if (deadcode)
2059                                 for (j = method->maxstack; j > 0; j--)
2060                                         printf(" ?  ");
2061                         else
2062                                 icmd_print_stack(bptr->instack);
2063                         printf("] L%03d(%d - %d) flags=%d:\n", bptr->debug_nr, bptr->icount, bptr->pre_count,bptr->flags);
2064                         iptr = bptr->iinstr;
2065
2066                         for (i=0; i < bptr->icount; i++, iptr++) {
2067                                 printf("[");
2068                                 if (deadcode) {
2069                                         for (j = method->maxstack; j > 0; j--)
2070                                                 printf(" ?  ");
2071                                 }
2072                                 else
2073                                         icmd_print_stack(iptr->dst);
2074                                 printf("]     %4d  ", i);
2075                                 /* XXX remove */ /*fflush(stdout);*/
2076                                 show_icmd(iptr,deadcode);
2077                                 printf("\n");
2078                         }
2079
2080                         if (showdisassemble && (!deadcode)) {
2081 #if defined(__I386__) || defined(__X86_64__)
2082                                 u1 *u1ptr;
2083                                 int a;
2084
2085                                 printf("\n");
2086                                 i = bptr->mpc;
2087                                 u1ptr = method->mcode + dseglen + i;
2088
2089                                 if (bptr->next != NULL) {
2090                                         for (; i < bptr->next->mpc; i++, u1ptr++) {
2091                                                 a = disassinstr(u1ptr, i);
2092                                                 i += a;
2093                                                 u1ptr += a;
2094                                         }
2095                                         printf("\n");
2096
2097                                 } else {
2098                                         for (; u1ptr < (u1 *) (method->mcode + method->mcodelength); i++, u1ptr++) {
2099                                                 a = disassinstr(u1ptr, i); 
2100                                                 i += a;
2101                                                 u1ptr += a;
2102                                         }
2103                                         printf("\n");
2104                                 }
2105 #else
2106                                 printf("\n");
2107                                 i = bptr->mpc;
2108                                 s4ptr = (s4 *) (method->mcode + dseglen + i);
2109
2110                                 if (bptr->next != NULL) {
2111                                         for (; i < bptr->next->mpc; i += 4, s4ptr++) {
2112                                                 disassinstr(*s4ptr, i); 
2113                                     }
2114                                         printf("\n");
2115                             }
2116                                 else {
2117                                         for (; s4ptr < (s4 *) (method->mcode + method->mcodelength); i += 4, s4ptr++) {
2118                                                 disassinstr(*s4ptr, i); 
2119                                     }
2120                                         printf("\n");
2121                             }
2122 #endif
2123                     }
2124                 }
2125 }
2126
2127 void
2128 show_icmd(instruction *iptr,bool deadcode)
2129 {
2130         int j;
2131         s4  *s4ptr;
2132         void **tptr;
2133         
2134         printf("%s",icmd_names[iptr->opc]);
2135         switch ((int) iptr->opc) {
2136                                 case ICMD_IADDCONST:
2137                                 case ICMD_ISUBCONST:
2138                                 case ICMD_IMULCONST:
2139                                 case ICMD_IDIVPOW2:
2140                                 case ICMD_IREMPOW2:
2141                                 case ICMD_IREM0X10001:
2142                                 case ICMD_IANDCONST:
2143                                 case ICMD_IORCONST:
2144                                 case ICMD_IXORCONST:
2145                                 case ICMD_ISHLCONST:
2146                                 case ICMD_ISHRCONST:
2147                                 case ICMD_IUSHRCONST:
2148                                 case ICMD_LSHLCONST:
2149                                 case ICMD_LSHRCONST:
2150                                 case ICMD_LUSHRCONST:
2151                                 case ICMD_ICONST:
2152                                 case ICMD_ELSE_ICONST:
2153                                 case ICMD_IFEQ_ICONST:
2154                                 case ICMD_IFNE_ICONST:
2155                                 case ICMD_IFLT_ICONST:
2156                                 case ICMD_IFGE_ICONST:
2157                                 case ICMD_IFGT_ICONST:
2158                                 case ICMD_IFLE_ICONST:
2159                                         printf(" %d", iptr->val.i);
2160                                         break;
2161                                 case ICMD_LADDCONST:
2162                                 case ICMD_LSUBCONST:
2163                                 case ICMD_LMULCONST:
2164                                 case ICMD_LDIVPOW2:
2165                                 case ICMD_LREMPOW2:
2166                                 case ICMD_LANDCONST:
2167                                 case ICMD_LORCONST:
2168                                 case ICMD_LXORCONST:
2169                                 case ICMD_LCONST:
2170 #if defined(__I386__)
2171                                         printf(" %lld", iptr->val.l);
2172 #else
2173                                         printf(" %ld", iptr->val.l);
2174 #endif
2175                                         break;
2176                                 case ICMD_FCONST:
2177                                         printf(" %f", iptr->val.f);
2178                                         break;
2179                                 case ICMD_DCONST:
2180                                         printf(" %f", iptr->val.d);
2181                                         break;
2182                                 case ICMD_ACONST:
2183                                         printf(" %p", iptr->val.a);
2184                                         break;
2185                                 case ICMD_GETFIELD:
2186                                 case ICMD_PUTFIELD:
2187                                         printf(" %d,", ((fieldinfo *) iptr->val.a)->offset);
2188                                 case ICMD_PUTSTATIC:
2189                                 case ICMD_GETSTATIC:
2190                                         printf(" ");
2191                                         utf_fprint(stdout,
2192                                                            ((fieldinfo *) iptr->val.a)->class->name);
2193                                         printf(".");
2194                                         utf_fprint(stdout,
2195                                                            ((fieldinfo *) iptr->val.a)->name);
2196                                         printf(" (type ");
2197                                         utf_fprint(stdout,
2198                                                            ((fieldinfo *) iptr->val.a)->descriptor);
2199                                         printf(")");
2200                                         break;
2201                                 case ICMD_IINC:
2202                                         printf(" %d + %d", iptr->op1, iptr->val.i);
2203                                         break;
2204
2205                             case ICMD_IASTORE:
2206                             case ICMD_SASTORE:
2207                             case ICMD_BASTORE:
2208                             case ICMD_CASTORE:
2209                             case ICMD_LASTORE:
2210                             case ICMD_DASTORE:
2211                             case ICMD_FASTORE:
2212                             case ICMD_AASTORE:
2213
2214                             case ICMD_IALOAD:
2215                             case ICMD_SALOAD:
2216                             case ICMD_BALOAD:
2217                             case ICMD_CALOAD:
2218                             case ICMD_LALOAD:
2219                             case ICMD_DALOAD:
2220                             case ICMD_FALOAD:
2221                             case ICMD_AALOAD:
2222                                         if (iptr->op1 != 0)
2223                                                 printf("(opt.)");
2224                                         break;
2225
2226                                 case ICMD_RET:
2227                                 case ICMD_ILOAD:
2228                                 case ICMD_LLOAD:
2229                                 case ICMD_FLOAD:
2230                                 case ICMD_DLOAD:
2231                                 case ICMD_ALOAD:
2232                                 case ICMD_ISTORE:
2233                                 case ICMD_LSTORE:
2234                                 case ICMD_FSTORE:
2235                                 case ICMD_DSTORE:
2236                                 case ICMD_ASTORE:
2237                                         printf(" %d", iptr->op1);
2238                                         break;
2239                                 case ICMD_NEW:
2240                                         printf(" ");
2241                                         utf_fprint(stdout,
2242                                                            ((classinfo *) iptr->val.a)->name);
2243                                         break;
2244                                 case ICMD_NEWARRAY:
2245                                         switch (iptr->op1) {
2246                                         case 4:
2247                                                 printf(" boolean");
2248                                                 break;
2249                                         case 5:
2250                                                 printf(" char");
2251                                                 break;
2252                                         case 6:
2253                                                 printf(" float");
2254                                                 break;
2255                                         case 7:
2256                                                 printf(" double");
2257                                                 break;
2258                                         case 8:
2259                                                 printf(" byte");
2260                                                 break;
2261                                         case 9:
2262                                                 printf(" short");
2263                                                 break;
2264                                         case 10:
2265                                                 printf(" int");
2266                                                 break;
2267                                         case 11:
2268                                                 printf(" long");
2269                                                 break;
2270                                         }
2271                                         break;
2272                                 case ICMD_ANEWARRAY:
2273                                         if (iptr->op1) {
2274                                                 printf(" ");
2275                                                 utf_fprint(stdout,
2276                                                                    ((classinfo *) iptr->val.a)->name);
2277                                         }
2278                                         break;
2279                     case ICMD_MULTIANEWARRAY:
2280                                         {
2281                                                 vftbl *vft;
2282                                                 printf(" %d ",iptr->op1);
2283                                                 vft = (vftbl *)iptr->val.a;
2284                                                 if (vft)
2285                                                         utf_fprint(stdout,vft->class->name);
2286                                                 else
2287                                                         printf("<null>");
2288                                         }
2289                                         break;
2290                                 case ICMD_CHECKCAST:
2291                                 case ICMD_INSTANCEOF:
2292                                         if (iptr->op1) {
2293                                                 classinfo *c = iptr->val.a;
2294                                                 if (c->flags & ACC_INTERFACE)
2295                                                         printf(" (INTERFACE) ");
2296                                                 else
2297                                                         printf(" (CLASS,%3d) ", c->vftbl->diffval);
2298                                                 utf_fprint(stdout, c->name);
2299                                         }
2300                                         break;
2301                                 case ICMD_BUILTIN3:
2302                                 case ICMD_BUILTIN2:
2303                                 case ICMD_BUILTIN1:
2304                                         printf(" %s", icmd_builtin_name((functionptr) iptr->val.a));
2305                                         break;
2306                                 case ICMD_INVOKEVIRTUAL:
2307                                 case ICMD_INVOKESPECIAL:
2308                                 case ICMD_INVOKESTATIC:
2309                                 case ICMD_INVOKEINTERFACE:
2310                                         printf(" ");
2311                                         utf_fprint(stdout,
2312                                                            ((methodinfo *) iptr->val.a)->class->name);
2313                                         printf(".");
2314                                         utf_fprint(stdout,
2315                                                            ((methodinfo *) iptr->val.a)->name);
2316                                         break;
2317                                 case ICMD_IFEQ:
2318                                 case ICMD_IFNE:
2319                                 case ICMD_IFLT:
2320                                 case ICMD_IFGE:
2321                                 case ICMD_IFGT:
2322                                 case ICMD_IFLE:
2323                                         if (deadcode || !iptr->target)
2324                                                 printf("(%d) op1=%d", iptr->val.i, iptr->op1);
2325                                         else
2326                                                 printf("(%d) L%03d", iptr->val.i, ((basicblock *) iptr->target)->debug_nr);
2327                                         break;
2328                                 case ICMD_IF_LEQ:
2329                                 case ICMD_IF_LNE:
2330                                 case ICMD_IF_LLT:
2331                                 case ICMD_IF_LGE:
2332                                 case ICMD_IF_LGT:
2333                                 case ICMD_IF_LLE:
2334                                         if (deadcode || !iptr->target)
2335                                                 printf("(%lld) op1=%d", iptr->val.l, iptr->op1);
2336                                         else
2337                                                 printf("(%lld) L%03d", iptr->val.l, ((basicblock *) iptr->target)->debug_nr);
2338                                         break;
2339                                 case ICMD_JSR:
2340                                 case ICMD_GOTO:
2341                                 case ICMD_IFNULL:
2342                                 case ICMD_IFNONNULL:
2343                                 case ICMD_IF_ICMPEQ:
2344                                 case ICMD_IF_ICMPNE:
2345                                 case ICMD_IF_ICMPLT:
2346                                 case ICMD_IF_ICMPGE:
2347                                 case ICMD_IF_ICMPGT:
2348                                 case ICMD_IF_ICMPLE:
2349                                 case ICMD_IF_LCMPEQ:
2350                                 case ICMD_IF_LCMPNE:
2351                                 case ICMD_IF_LCMPLT:
2352                                 case ICMD_IF_LCMPGE:
2353                                 case ICMD_IF_LCMPGT:
2354                                 case ICMD_IF_LCMPLE:
2355                                 case ICMD_IF_ACMPEQ:
2356                                 case ICMD_IF_ACMPNE:
2357                                         if (deadcode || !iptr->target)
2358                                                 printf(" op1=%d", iptr->op1);
2359                                         else
2360                                                 printf(" L%03d", ((basicblock *) iptr->target)->debug_nr);
2361                                         break;
2362                                 case ICMD_TABLESWITCH:
2363
2364                                         s4ptr = iptr->val.a;
2365
2366                                         if (deadcode || !iptr->target) {
2367                                                 printf(" %d;", *s4ptr);
2368                                         }
2369                                         else {
2370                                                 tptr = (void **) iptr->target;
2371                                                 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr); 
2372                                                 tptr++;
2373                                         }
2374
2375                                         s4ptr++;         /* skip default */
2376                                         j = *s4ptr++;                               /* low     */
2377                                         j = *s4ptr++ - j;                           /* high    */
2378                                         while (j >= 0) {
2379                                                 if (deadcode || !*tptr)
2380                                                         printf(" %d", *s4ptr++);
2381                                                 else {
2382                                                         printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
2383                                                         tptr++;
2384                                                 }
2385                                                 j--;
2386                                         }
2387                                         break;
2388                                 case ICMD_LOOKUPSWITCH:
2389                                         s4ptr = iptr->val.a;
2390
2391                                         if (deadcode || !iptr->target) {
2392                                                 printf(" %d;", *s4ptr);
2393                                         }
2394                                         else {
2395                                                 tptr = (void **) iptr->target;
2396                                                 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
2397                                                 tptr++;
2398                                         }
2399                                         s4ptr++;                                         /* default */
2400                                         j = *s4ptr++;                                    /* count   */
2401
2402                                         while (--j >= 0) {
2403                                                 if (deadcode || !*tptr) {
2404                                                         s4ptr++; /* skip value */
2405                                                         printf(" %d",*s4ptr++);
2406                                                 }
2407                                                 else {
2408                                                         printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
2409                                                         tptr++;
2410                                                 }
2411                                         }
2412                                         break;
2413         }
2414 }
2415
2416 /*
2417  * These are local overrides for various environment variables in Emacs.
2418  * Please do not remove this and leave it at the end of the file, where
2419  * Emacs will automagically detect them.
2420  * ---------------------------------------------------------------------
2421  * Local variables:
2422  * mode: c
2423  * indent-tabs-mode: t
2424  * c-basic-offset: 4
2425  * tab-width: 4
2426  * End:
2427  */