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