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