1 /* src/vm/jit/stack.c - stack analysis
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
8 This file is part of CACAO.
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.
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.
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
25 Contact: cacao@complang.tuwien.ac.at
27 Authors: Andreas Krall
29 Changes: Edwin Steiner
32 $Id: stack.c 2211 2005-04-04 10:39:36Z christian $
42 #include "mm/memory.h"
43 #include "native/native.h"
44 #include "toolbox/logging.h"
45 #include "vm/global.h"
46 #include "vm/builtin.h"
47 #include "vm/options.h"
48 #include "vm/statistics.h"
49 #include "vm/tables.h"
50 #include "vm/jit/codegen.inc.h"
51 #include "vm/jit/jit.h"
52 #include "vm/jit/reg.h"
53 #include "vm/jit/stack.h"
54 #include "vm/jit/lsra.h"
57 /**********************************************************************/
59 /**********************************************************************/
61 /* analyse_stack uses the intermediate code created by parse.c to
62 * build a model of the JVM operand stack for the current method.
64 * The following checks are performed:
65 * - check for operand stack underflow (before each instruction)
66 * - check for operand stack overflow (after[1] each instruction)
67 * - check for matching stack depth at merging points
68 * - check for matching basic types[2] at merging points
69 * - check basic types for instruction input (except for BUILTIN*
70 * opcodes, INVOKE* opcodes and MULTIANEWARRAY)
72 * [1]) Checking this after the instruction should be ok. parse.c
73 * counts the number of required stack slots in such a way that it is
74 * only vital that we don't exceed `maxstack` at basic block
77 * [2]) 'basic types' means the distinction between INT, LONG, FLOAT,
78 * DOUBLE and ADDRESS types. Subtypes of INT and different ADDRESS
79 * types are not discerned.
82 methodinfo *analyse_stack(methodinfo *m, codegendata *cd, registerdata *rd)
90 int opcode, i, len, loops;
91 int superblockend, repeat, deadcode;
108 argren = DMNEW(s4, cd->maxlocals); /* table for argument renaming */
109 for (i = 0; i < cd->maxlocals; i++)
112 rd->arguments_num = 0;
115 m->basicblocks[0].flags = BBREACHED;
116 m->basicblocks[0].instack = 0;
117 m->basicblocks[0].indepth = 0;
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;
125 bptr->pre_count = 10000;
130 #ifdef 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;
168 m->basicblocks[m->basicblockindex[iptr->op1]].pre_count++;
171 case ICMD_TABLESWITCH:
173 m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
174 i = *s4ptr++; /* low */
175 i = *s4ptr++ - i + 1; /* high */
177 m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
181 case ICMD_LOOKUPSWITCH:
183 m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
184 i = *s4ptr++; /* count */
186 m->basicblocks[m->basicblockindex[s4ptr[1]]].pre_count++;
202 b_count = m->basicblockcount;
203 bptr = m->basicblocks;
204 superblockend = true;
208 while (--b_count >= 0) {
209 if (bptr->flags == BBDELETED) {
212 else if (superblockend && (bptr->flags < BBREACHED))
214 else if (bptr->flags <= BBREACHED) {
216 stackdepth = bptr->indepth;
217 else if (bptr->flags < BBREACHED) {
219 bptr->instack = copy;
220 bptr->indepth = stackdepth;
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");
228 curstack = bptr->instack;
230 superblockend = false;
231 bptr->flags = BBFINISHED;
234 b_index = bptr - m->basicblocks;
239 /* dolog("p: %04d op: %s stack: %p", iptr - instr, icmd_names[opcode], curstack); */
241 #if defined(USEBUILTINTABLE)
244 stdopdescriptor *breplace;
245 breplace = find_builtin(opcode);
247 if (breplace && opcode == breplace->opcode) {
248 iptr[0].opc = breplace->icmd;
249 iptr[0].op1 = breplace->type_d;
250 iptr[0].val.fp = breplace->builtin;
251 m->isleafmethod = false;
252 switch (breplace->icmd) {
260 builtin_descriptor *breplace;
261 breplace = find_builtin(opcode);
263 if (breplace && opcode == breplace->opcode) {
264 iptr[0].opc = breplace->icmd;
265 iptr[0].op1 = breplace->type_d;
266 iptr[0].val.fp = breplace->builtin;
267 m->isleafmethod = false;
268 switch (breplace->icmd) {
276 #endif /* defined(USEBUILTINTABLE) */
283 case ICMD_CHECKASIZE:
284 case ICMD_CHECKEXCEPTION:
286 case ICMD_IFEQ_ICONST:
287 case ICMD_IFNE_ICONST:
288 case ICMD_IFLT_ICONST:
289 case ICMD_IFGE_ICONST:
290 case ICMD_IFGT_ICONST:
291 case ICMD_IFLE_ICONST:
292 case ICMD_ELSE_ICONST:
297 rd->locals[iptr->op1][TYPE_ADR].type = TYPE_ADR;
299 COUNT(count_pcmd_return);
301 superblockend = true;
304 /* pop 0 push 1 const */
307 COUNT(count_pcmd_load);
309 switch (iptr[1].opc) {
311 iptr[0].opc = ICMD_IADDCONST;
313 iptr[1].opc = ICMD_NOP;
314 OP1_1(TYPE_INT, TYPE_INT);
315 COUNT(count_pcmd_op);
318 iptr[0].opc = ICMD_ISUBCONST;
319 goto icmd_iconst_tail;
320 #if SUPPORT_CONST_MUL
322 iptr[0].opc = ICMD_IMULCONST;
323 goto icmd_iconst_tail;
324 #else /* SUPPORT_CONST_MUL */
326 if (iptr[0].val.i == 0x00000002)
328 else if (iptr[0].val.i == 0x00000004)
330 else if (iptr[0].val.i == 0x00000008)
332 else if (iptr[0].val.i == 0x00000010)
334 else if (iptr[0].val.i == 0x00000020)
336 else if (iptr[0].val.i == 0x00000040)
338 else if (iptr[0].val.i == 0x00000080)
340 else if (iptr[0].val.i == 0x00000100)
342 else if (iptr[0].val.i == 0x00000200)
344 else if (iptr[0].val.i == 0x00000400)
346 else if (iptr[0].val.i == 0x00000800)
348 else if (iptr[0].val.i == 0x00001000)
350 else if (iptr[0].val.i == 0x00002000)
352 else if (iptr[0].val.i == 0x00004000)
354 else if (iptr[0].val.i == 0x00008000)
356 else if (iptr[0].val.i == 0x00010000)
358 else if (iptr[0].val.i == 0x00020000)
360 else if (iptr[0].val.i == 0x00040000)
362 else if (iptr[0].val.i == 0x00080000)
364 else if (iptr[0].val.i == 0x00100000)
366 else if (iptr[0].val.i == 0x00200000)
368 else if (iptr[0].val.i == 0x00400000)
370 else if (iptr[0].val.i == 0x00800000)
372 else if (iptr[0].val.i == 0x01000000)
374 else if (iptr[0].val.i == 0x02000000)
376 else if (iptr[0].val.i == 0x04000000)
378 else if (iptr[0].val.i == 0x08000000)
380 else if (iptr[0].val.i == 0x10000000)
382 else if (iptr[0].val.i == 0x20000000)
384 else if (iptr[0].val.i == 0x40000000)
386 else if (iptr[0].val.i == 0x80000000)
392 iptr[0].opc = ICMD_IMULPOW2;
393 goto icmd_iconst_tail;
394 #endif /* SUPPORT_CONST_MUL */
396 if (iptr[0].val.i == 0x00000002)
398 else if (iptr[0].val.i == 0x00000004)
400 else if (iptr[0].val.i == 0x00000008)
402 else if (iptr[0].val.i == 0x00000010)
404 else if (iptr[0].val.i == 0x00000020)
406 else if (iptr[0].val.i == 0x00000040)
408 else if (iptr[0].val.i == 0x00000080)
410 else if (iptr[0].val.i == 0x00000100)
412 else if (iptr[0].val.i == 0x00000200)
414 else if (iptr[0].val.i == 0x00000400)
416 else if (iptr[0].val.i == 0x00000800)
418 else if (iptr[0].val.i == 0x00001000)
420 else if (iptr[0].val.i == 0x00002000)
422 else if (iptr[0].val.i == 0x00004000)
424 else if (iptr[0].val.i == 0x00008000)
426 else if (iptr[0].val.i == 0x00010000)
428 else if (iptr[0].val.i == 0x00020000)
430 else if (iptr[0].val.i == 0x00040000)
432 else if (iptr[0].val.i == 0x00080000)
434 else if (iptr[0].val.i == 0x00100000)
436 else if (iptr[0].val.i == 0x00200000)
438 else if (iptr[0].val.i == 0x00400000)
440 else if (iptr[0].val.i == 0x00800000)
442 else if (iptr[0].val.i == 0x01000000)
444 else if (iptr[0].val.i == 0x02000000)
446 else if (iptr[0].val.i == 0x04000000)
448 else if (iptr[0].val.i == 0x08000000)
450 else if (iptr[0].val.i == 0x10000000)
452 else if (iptr[0].val.i == 0x20000000)
454 else if (iptr[0].val.i == 0x40000000)
456 else if (iptr[0].val.i == 0x80000000)
462 iptr[0].opc = ICMD_IDIVPOW2;
463 goto icmd_iconst_tail;
465 if ((iptr[0].val.i == 0x00000002) ||
466 (iptr[0].val.i == 0x00000004) ||
467 (iptr[0].val.i == 0x00000008) ||
468 (iptr[0].val.i == 0x00000010) ||
469 (iptr[0].val.i == 0x00000020) ||
470 (iptr[0].val.i == 0x00000040) ||
471 (iptr[0].val.i == 0x00000080) ||
472 (iptr[0].val.i == 0x00000100) ||
473 (iptr[0].val.i == 0x00000200) ||
474 (iptr[0].val.i == 0x00000400) ||
475 (iptr[0].val.i == 0x00000800) ||
476 (iptr[0].val.i == 0x00001000) ||
477 (iptr[0].val.i == 0x00002000) ||
478 (iptr[0].val.i == 0x00004000) ||
479 (iptr[0].val.i == 0x00008000) ||
480 (iptr[0].val.i == 0x00010000) ||
481 (iptr[0].val.i == 0x00020000) ||
482 (iptr[0].val.i == 0x00040000) ||
483 (iptr[0].val.i == 0x00080000) ||
484 (iptr[0].val.i == 0x00100000) ||
485 (iptr[0].val.i == 0x00200000) ||
486 (iptr[0].val.i == 0x00400000) ||
487 (iptr[0].val.i == 0x00800000) ||
488 (iptr[0].val.i == 0x01000000) ||
489 (iptr[0].val.i == 0x02000000) ||
490 (iptr[0].val.i == 0x04000000) ||
491 (iptr[0].val.i == 0x08000000) ||
492 (iptr[0].val.i == 0x10000000) ||
493 (iptr[0].val.i == 0x20000000) ||
494 (iptr[0].val.i == 0x40000000) ||
495 (iptr[0].val.i == 0x80000000)) {
496 iptr[0].opc = ICMD_IREMPOW2;
498 goto icmd_iconst_tail;
502 #if SUPPORT_CONST_LOGICAL
504 iptr[0].opc = ICMD_IANDCONST;
505 goto icmd_iconst_tail;
507 iptr[0].opc = ICMD_IORCONST;
508 goto icmd_iconst_tail;
510 iptr[0].opc = ICMD_IXORCONST;
511 goto icmd_iconst_tail;
512 #endif /* SUPPORT_CONST_LOGICAL */
514 iptr[0].opc = ICMD_ISHLCONST;
515 goto icmd_iconst_tail;
517 iptr[0].opc = ICMD_ISHRCONST;
518 goto icmd_iconst_tail;
520 iptr[0].opc = ICMD_IUSHRCONST;
521 goto icmd_iconst_tail;
522 #if SUPPORT_LONG_SHIFT
524 iptr[0].opc = ICMD_LSHLCONST;
525 goto icmd_lconst_tail;
527 iptr[0].opc = ICMD_LSHRCONST;
528 goto icmd_lconst_tail;
530 iptr[0].opc = ICMD_LUSHRCONST;
531 goto icmd_lconst_tail;
532 #endif /* SUPPORT_LONG_SHIFT */
534 iptr[0].opc = ICMD_IFEQ;
536 iptr[0].op1 = iptr[1].op1;
539 /* iptr[1].opc = ICMD_NOP; */
541 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
543 iptr[0].target = (void *) tbptr;
545 MARKREACHED(tbptr, copy);
546 COUNT(count_pcmd_bra);
549 iptr[0].opc = ICMD_IFLT;
550 goto icmd_if_icmp_tail;
552 iptr[0].opc = ICMD_IFLE;
553 goto icmd_if_icmp_tail;
555 iptr[0].opc = ICMD_IFNE;
556 goto icmd_if_icmp_tail;
558 iptr[0].opc = ICMD_IFGT;
559 goto icmd_if_icmp_tail;
561 iptr[0].opc = ICMD_IFGE;
562 goto icmd_if_icmp_tail;
564 #if SUPPORT_CONST_STORE
569 #if SUPPORT_CONST_STORE_ZERO_ONLY
570 if (iptr[0].val.i == 0) {
571 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
572 switch (iptr[1].opc) {
574 iptr[0].opc = ICMD_IASTORECONST;
577 iptr[0].opc = ICMD_BASTORECONST;
580 iptr[0].opc = ICMD_CASTORECONST;
583 iptr[0].opc = ICMD_SASTORECONST;
587 iptr[1].opc = ICMD_NOP;
588 OPTT2_0(TYPE_INT, TYPE_ADR);
589 COUNT(count_pcmd_op);
590 #if SUPPORT_CONST_STORE_ZERO_ONLY
593 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
598 #if SUPPORT_CONST_STORE_ZERO_ONLY
599 if (iptr[0].val.i == 0) {
600 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
601 switch (iptr[1].opc) {
603 iptr[0].opc = ICMD_PUTSTATICCONST;
607 iptr[0].opc = ICMD_PUTFIELDCONST;
612 iptr[1].opc = ICMD_NOP;
613 iptr[0].op1 = TYPE_INT;
614 COUNT(count_pcmd_op);
615 #if SUPPORT_CONST_STORE_ZERO_ONLY
618 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
620 #endif /* SUPPORT_CONST_STORE */
630 COUNT(count_pcmd_load);
632 switch (iptr[1].opc) {
635 iptr[0].opc = ICMD_LADDCONST;
637 iptr[1].opc = ICMD_NOP;
638 OP1_1(TYPE_LNG,TYPE_LNG);
639 COUNT(count_pcmd_op);
642 iptr[0].opc = ICMD_LSUBCONST;
643 goto icmd_lconst_tail;
644 #endif /* SUPPORT_LONG_ADD */
645 #if SUPPORT_LONG_MUL && SUPPORT_CONST_MUL
647 iptr[0].opc = ICMD_LMULCONST;
648 goto icmd_lconst_tail;
649 #else /* SUPPORT_LONG_MUL && SUPPORT_CONST_MUL */
650 # if SUPPORT_LONG_SHIFT
652 if (iptr[0].val.l == 0x00000002)
654 else if (iptr[0].val.l == 0x00000004)
656 else if (iptr[0].val.l == 0x00000008)
658 else if (iptr[0].val.l == 0x00000010)
660 else if (iptr[0].val.l == 0x00000020)
662 else if (iptr[0].val.l == 0x00000040)
664 else if (iptr[0].val.l == 0x00000080)
666 else if (iptr[0].val.l == 0x00000100)
668 else if (iptr[0].val.l == 0x00000200)
670 else if (iptr[0].val.l == 0x00000400)
672 else if (iptr[0].val.l == 0x00000800)
674 else if (iptr[0].val.l == 0x00001000)
676 else if (iptr[0].val.l == 0x00002000)
678 else if (iptr[0].val.l == 0x00004000)
680 else if (iptr[0].val.l == 0x00008000)
682 else if (iptr[0].val.l == 0x00010000)
684 else if (iptr[0].val.l == 0x00020000)
686 else if (iptr[0].val.l == 0x00040000)
688 else if (iptr[0].val.l == 0x00080000)
690 else if (iptr[0].val.l == 0x00100000)
692 else if (iptr[0].val.l == 0x00200000)
694 else if (iptr[0].val.l == 0x00400000)
696 else if (iptr[0].val.l == 0x00800000)
698 else if (iptr[0].val.l == 0x01000000)
700 else if (iptr[0].val.l == 0x02000000)
702 else if (iptr[0].val.l == 0x04000000)
704 else if (iptr[0].val.l == 0x08000000)
706 else if (iptr[0].val.l == 0x10000000)
708 else if (iptr[0].val.l == 0x20000000)
710 else if (iptr[0].val.l == 0x40000000)
712 else if (iptr[0].val.l == 0x80000000)
718 iptr[0].opc = ICMD_LMULPOW2;
719 goto icmd_lconst_tail;
720 # endif /* SUPPORT_LONG_SHIFT */
721 #endif /* SUPPORT_LONG_MUL && SUPPORT_CONST_MUL */
724 if (iptr[0].val.l == 0x00000002)
726 else if (iptr[0].val.l == 0x00000004)
728 else if (iptr[0].val.l == 0x00000008)
730 else if (iptr[0].val.l == 0x00000010)
732 else if (iptr[0].val.l == 0x00000020)
734 else if (iptr[0].val.l == 0x00000040)
736 else if (iptr[0].val.l == 0x00000080)
738 else if (iptr[0].val.l == 0x00000100)
740 else if (iptr[0].val.l == 0x00000200)
742 else if (iptr[0].val.l == 0x00000400)
744 else if (iptr[0].val.l == 0x00000800)
746 else if (iptr[0].val.l == 0x00001000)
748 else if (iptr[0].val.l == 0x00002000)
750 else if (iptr[0].val.l == 0x00004000)
752 else if (iptr[0].val.l == 0x00008000)
754 else if (iptr[0].val.l == 0x00010000)
756 else if (iptr[0].val.l == 0x00020000)
758 else if (iptr[0].val.l == 0x00040000)
760 else if (iptr[0].val.l == 0x00080000)
762 else if (iptr[0].val.l == 0x00100000)
764 else if (iptr[0].val.l == 0x00200000)
766 else if (iptr[0].val.l == 0x00400000)
768 else if (iptr[0].val.l == 0x00800000)
770 else if (iptr[0].val.l == 0x01000000)
772 else if (iptr[0].val.l == 0x02000000)
774 else if (iptr[0].val.l == 0x04000000)
776 else if (iptr[0].val.l == 0x08000000)
778 else if (iptr[0].val.l == 0x10000000)
780 else if (iptr[0].val.l == 0x20000000)
782 else if (iptr[0].val.l == 0x40000000)
784 else if (iptr[0].val.l == 0x80000000)
790 iptr[0].opc = ICMD_LDIVPOW2;
791 goto icmd_lconst_tail;
793 if ((iptr[0].val.l == 0x00000002) ||
794 (iptr[0].val.l == 0x00000004) ||
795 (iptr[0].val.l == 0x00000008) ||
796 (iptr[0].val.l == 0x00000010) ||
797 (iptr[0].val.l == 0x00000020) ||
798 (iptr[0].val.l == 0x00000040) ||
799 (iptr[0].val.l == 0x00000080) ||
800 (iptr[0].val.l == 0x00000100) ||
801 (iptr[0].val.l == 0x00000200) ||
802 (iptr[0].val.l == 0x00000400) ||
803 (iptr[0].val.l == 0x00000800) ||
804 (iptr[0].val.l == 0x00001000) ||
805 (iptr[0].val.l == 0x00002000) ||
806 (iptr[0].val.l == 0x00004000) ||
807 (iptr[0].val.l == 0x00008000) ||
808 (iptr[0].val.l == 0x00010000) ||
809 (iptr[0].val.l == 0x00020000) ||
810 (iptr[0].val.l == 0x00040000) ||
811 (iptr[0].val.l == 0x00080000) ||
812 (iptr[0].val.l == 0x00100000) ||
813 (iptr[0].val.l == 0x00200000) ||
814 (iptr[0].val.l == 0x00400000) ||
815 (iptr[0].val.l == 0x00800000) ||
816 (iptr[0].val.l == 0x01000000) ||
817 (iptr[0].val.l == 0x02000000) ||
818 (iptr[0].val.l == 0x04000000) ||
819 (iptr[0].val.l == 0x08000000) ||
820 (iptr[0].val.l == 0x10000000) ||
821 (iptr[0].val.l == 0x20000000) ||
822 (iptr[0].val.l == 0x40000000) ||
823 (iptr[0].val.l == 0x80000000)) {
824 iptr[0].opc = ICMD_LREMPOW2;
826 goto icmd_lconst_tail;
830 #endif /* SUPPORT_LONG_DIV */
831 #if SUPPORT_LONG_LOGICAL && SUPPORT_CONST_LOGICAL
834 iptr[0].opc = ICMD_LANDCONST;
835 goto icmd_lconst_tail;
837 iptr[0].opc = ICMD_LORCONST;
838 goto icmd_lconst_tail;
840 iptr[0].opc = ICMD_LXORCONST;
841 goto icmd_lconst_tail;
842 #endif /* SUPPORT_LONG_LOGICAL && SUPPORT_CONST_LOGICAL */
843 #if !defined(NOLONG_CONDITIONAL)
845 if ((len > 1) && (iptr[2].val.i == 0)) {
846 switch (iptr[2].opc) {
848 iptr[0].opc = ICMD_IF_LEQ;
849 icmd_lconst_lcmp_tail:
850 iptr[0].op1 = iptr[2].op1;
853 /* iptr[1].opc = ICMD_NOP;
854 iptr[2].opc = ICMD_NOP; */
856 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
858 iptr[0].target = (void *) tbptr;
860 MARKREACHED(tbptr, copy);
861 COUNT(count_pcmd_bra);
862 COUNT(count_pcmd_op);
865 iptr[0].opc = ICMD_IF_LNE;
866 goto icmd_lconst_lcmp_tail;
868 iptr[0].opc = ICMD_IF_LLT;
869 goto icmd_lconst_lcmp_tail;
871 iptr[0].opc = ICMD_IF_LGT;
872 goto icmd_lconst_lcmp_tail;
874 iptr[0].opc = ICMD_IF_LLE;
875 goto icmd_lconst_lcmp_tail;
877 iptr[0].opc = ICMD_IF_LGE;
878 goto icmd_lconst_lcmp_tail;
881 } /* switch (iptr[2].opc) */
882 } /* if (iptr[2].val.i == 0) */
886 #endif /* !defined(NOLONG_CONDITIONAL) */
888 #if SUPPORT_CONST_STORE
890 #if SUPPORT_CONST_STORE_ZERO_ONLY
891 if (iptr[0].val.l == 0) {
892 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
893 iptr[0].opc = ICMD_LASTORECONST;
894 iptr[1].opc = ICMD_NOP;
895 OPTT2_0(TYPE_INT, TYPE_ADR);
896 COUNT(count_pcmd_op);
897 #if SUPPORT_CONST_STORE_ZERO_ONLY
900 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
905 #if SUPPORT_CONST_STORE_ZERO_ONLY
906 if (iptr[0].val.l == 0) {
907 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
908 switch (iptr[1].opc) {
910 iptr[0].opc = ICMD_PUTSTATICCONST;
914 iptr[0].opc = ICMD_PUTFIELDCONST;
919 iptr[1].opc = ICMD_NOP;
920 iptr[0].op1 = TYPE_LNG;
921 COUNT(count_pcmd_op);
922 #if SUPPORT_CONST_STORE_ZERO_ONLY
925 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
927 #endif /* SUPPORT_CONST_STORE */
937 COUNT(count_pcmd_load);
942 COUNT(count_pcmd_load);
947 COUNT(count_pcmd_load);
948 #if SUPPORT_CONST_STORE
949 if (len > 0 && iptr->val.a == 0) {
950 switch (iptr[1].opc) {
952 if (iptr[1].val.fp != BUILTIN_aastore) {
959 switch (iptr[1].opc) {
961 iptr[0].opc = ICMD_AASTORECONST;
962 OPTT2_0(TYPE_INT, TYPE_ADR);
965 iptr[0].opc = ICMD_PUTSTATICCONST;
966 iptr[0].op1 = TYPE_ADR;
970 iptr[0].opc = ICMD_PUTFIELDCONST;
971 iptr[0].op1 = TYPE_ADR;
976 iptr[1].opc = ICMD_NOP;
977 COUNT(count_pcmd_op);
984 #endif /* SUPPORT_CONST_STORE */
988 /* pop 0 push 1 load */
995 COUNT(count_load_instruction);
996 i = opcode-ICMD_ILOAD;
997 iptr->op1 = argren[iptr->op1];
998 rd->locals[iptr->op1][i].type = i;
999 LOAD(i, LOCALVAR, iptr->op1);
1009 COUNT(count_check_null);
1010 COUNT(count_check_bound);
1011 COUNT(count_pcmd_mem);
1012 OP2IAT_1(opcode-ICMD_IALOAD);
1018 COUNT(count_check_null);
1019 COUNT(count_check_bound);
1020 COUNT(count_pcmd_mem);
1024 /* pop 0 push 0 iinc */
1027 #if defined(STATISTICS)
1031 count_store_depth[10]++;
1033 count_store_depth[i]++;
1039 if ((copy->varkind == LOCALVAR) &&
1040 (copy->varnum == iptr->op1)) {
1041 copy->varkind = TEMPVAR;
1050 /* pop 1 push 0 store */
1060 i = opcode - ICMD_ISTORE;
1061 rd->locals[iptr->op1][i].type = i;
1062 #if defined(STATISTICS)
1067 count_store_length[20]++;
1069 count_store_length[i]++;
1072 count_store_depth[10]++;
1074 count_store_depth[i]++;
1077 copy = curstack->prev;
1080 if ((copy->varkind == LOCALVAR) &&
1081 (copy->varnum == iptr->op1)) {
1082 copy->varkind = TEMPVAR;
1088 if ((new - curstack) == 1) {
1089 curstack->varkind = LOCALVAR;
1090 curstack->varnum = iptr->op1;
1092 STORE(opcode-ICMD_ISTORE);
1102 COUNT(count_check_null);
1103 COUNT(count_check_bound);
1104 COUNT(count_pcmd_mem);
1105 OP3TIA_0(opcode-ICMD_IASTORE);
1111 COUNT(count_check_null);
1112 COUNT(count_check_bound);
1113 COUNT(count_pcmd_mem);
1120 #ifdef TYPECHECK_STACK_COMPCAT
1123 if (IS_2_WORD_TYPE(curstack->type)) {
1124 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1137 COUNT(count_pcmd_return);
1138 OP1_0(opcode-ICMD_IRETURN);
1139 superblockend = true;
1143 COUNT(count_check_null);
1147 superblockend = true;
1150 case ICMD_PUTSTATIC:
1151 COUNT(count_pcmd_mem);
1155 /* pop 1 push 0 branch */
1158 case ICMD_IFNONNULL:
1159 COUNT(count_pcmd_bra);
1161 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1163 iptr[0].target = (void *) tbptr;
1165 MARKREACHED(tbptr, copy);
1174 COUNT(count_pcmd_bra);
1175 #ifdef CONDITIONAL_LOADCONST
1177 tbptr = m->basicblocks + b_index;
1178 if ((b_count >= 3) &&
1179 ((b_index + 2) == m->basicblockindex[iptr[0].op1]) &&
1180 (tbptr[1].pre_count == 1) &&
1181 (iptr[1].opc == ICMD_ICONST) &&
1182 (iptr[2].opc == ICMD_GOTO) &&
1183 ((b_index + 3) == m->basicblockindex[iptr[2].op1]) &&
1184 (tbptr[2].pre_count == 1) &&
1185 (iptr[3].opc == ICMD_ICONST)) {
1186 OP1_1(TYPE_INT, TYPE_INT);
1187 switch (iptr[0].opc) {
1189 iptr[0].opc = ICMD_IFNE_ICONST;
1192 iptr[0].opc = ICMD_IFEQ_ICONST;
1195 iptr[0].opc = ICMD_IFGE_ICONST;
1198 iptr[0].opc = ICMD_IFLT_ICONST;
1201 iptr[0].opc = ICMD_IFLE_ICONST;
1204 iptr[0].opc = ICMD_IFGT_ICONST;
1207 iptr[0].val.i = iptr[1].val.i;
1208 iptr[1].opc = ICMD_ELSE_ICONST;
1209 iptr[1].val.i = iptr[3].val.i;
1210 iptr[2].opc = ICMD_NOP;
1211 iptr[3].opc = ICMD_NOP;
1212 tbptr[1].flags = BBDELETED;
1213 tbptr[2].flags = BBDELETED;
1214 tbptr[1].icount = 0;
1215 tbptr[2].icount = 0;
1216 if (tbptr[3].pre_count == 2) {
1217 len += tbptr[3].icount + 3;
1218 bptr->icount += tbptr[3].icount + 3;
1219 tbptr[3].flags = BBDELETED;
1220 tbptr[3].icount = 0;
1233 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1235 iptr[0].target = (void *) tbptr;
1237 MARKREACHED(tbptr, copy);
1240 /* pop 0 push 0 branch */
1243 COUNT(count_pcmd_bra);
1244 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1246 iptr[0].target = (void *) tbptr;
1248 MARKREACHED(tbptr, copy);
1250 superblockend = true;
1253 /* pop 1 push 0 table branch */
1255 case ICMD_TABLESWITCH:
1256 COUNT(count_pcmd_table);
1258 s4ptr = iptr->val.a;
1259 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1260 MARKREACHED(tbptr, copy);
1261 i = *s4ptr++; /* low */
1262 i = *s4ptr++ - i + 1; /* high */
1264 tptr = DMNEW(void*, i+1);
1265 iptr->target = (void *) tptr;
1267 tptr[0] = (void *) tbptr;
1271 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1273 tptr[0] = (void *) tbptr;
1276 MARKREACHED(tbptr, copy);
1279 superblockend = true;
1282 /* pop 1 push 0 table branch */
1284 case ICMD_LOOKUPSWITCH:
1285 COUNT(count_pcmd_table);
1287 s4ptr = iptr->val.a;
1288 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1289 MARKREACHED(tbptr, copy);
1290 i = *s4ptr++; /* count */
1292 tptr = DMNEW(void*, i+1);
1293 iptr->target = (void *) tptr;
1295 tptr[0] = (void *) tbptr;
1299 tbptr = m->basicblocks + m->basicblockindex[s4ptr[1]];
1301 tptr[0] = (void *) tbptr;
1304 MARKREACHED(tbptr, copy);
1308 superblockend = true;
1311 case ICMD_NULLCHECKPOP:
1312 case ICMD_MONITORENTER:
1313 COUNT(count_check_null);
1314 case ICMD_MONITOREXIT:
1318 /* pop 2 push 0 branch */
1320 case ICMD_IF_ICMPEQ:
1321 case ICMD_IF_ICMPNE:
1322 case ICMD_IF_ICMPLT:
1323 case ICMD_IF_ICMPGE:
1324 case ICMD_IF_ICMPGT:
1325 case ICMD_IF_ICMPLE:
1326 COUNT(count_pcmd_bra);
1328 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1330 iptr[0].target = (void *) tbptr;
1332 MARKREACHED(tbptr, copy);
1335 case ICMD_IF_ACMPEQ:
1336 case ICMD_IF_ACMPNE:
1337 COUNT(count_pcmd_bra);
1339 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1341 iptr[0].target = (void *) tbptr;
1343 MARKREACHED(tbptr, copy);
1349 COUNT(count_check_null);
1350 COUNT(count_pcmd_mem);
1351 OPTT2_0(iptr->op1,TYPE_ADR);
1356 if (!IS_2_WORD_TYPE(curstack->type)) {
1358 #ifdef TYPECHECK_STACK_COMPCAT
1361 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1362 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1367 OP1_0ANY; /* second pop */
1370 iptr->opc = ICMD_POP;
1374 /* pop 0 push 1 dup */
1377 #ifdef TYPECHECK_STACK_COMPCAT
1380 if (IS_2_WORD_TYPE(curstack->type)) {
1381 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1386 COUNT(count_dup_instruction);
1392 if (IS_2_WORD_TYPE(curstack->type)) {
1394 iptr->opc = ICMD_DUP;
1399 /* ..., ????, cat1 */
1400 #ifdef TYPECHECK_STACK_COMPCAT
1402 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1403 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1409 NEWSTACK(copy->prev->type, copy->prev->varkind,
1410 copy->prev->varnum);
1411 NEWSTACK(copy->type, copy->varkind,
1418 /* pop 2 push 3 dup */
1421 #ifdef TYPECHECK_STACK_COMPCAT
1424 if (IS_2_WORD_TYPE(curstack->type) ||
1425 IS_2_WORD_TYPE(curstack->prev->type)) {
1426 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1436 if (IS_2_WORD_TYPE(curstack->type)) {
1437 /* ..., ????, cat2 */
1438 #ifdef TYPECHECK_STACK_COMPCAT
1440 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1441 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1446 iptr->opc = ICMD_DUP_X1;
1450 /* ..., ????, cat1 */
1451 #ifdef TYPECHECK_STACK_COMPCAT
1454 if (IS_2_WORD_TYPE(curstack->prev->type)
1455 || IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1456 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1465 /* pop 3 push 4 dup */
1469 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1470 /* ..., cat2, ???? */
1471 #ifdef TYPECHECK_STACK_COMPCAT
1473 if (IS_2_WORD_TYPE(curstack->type)) {
1474 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1479 iptr->opc = ICMD_DUP_X1;
1483 /* ..., cat1, ???? */
1484 #ifdef TYPECHECK_STACK_COMPCAT
1487 if (IS_2_WORD_TYPE(curstack->type)
1488 || IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1489 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1500 if (IS_2_WORD_TYPE(curstack->type)) {
1501 /* ..., ????, cat2 */
1502 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1503 /* ..., cat2, cat2 */
1504 iptr->opc = ICMD_DUP_X1;
1508 /* ..., cat1, cat2 */
1509 #ifdef TYPECHECK_STACK_COMPCAT
1512 if (IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1513 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1518 iptr->opc = ICMD_DUP_X2;
1524 /* ..., ????, ????, cat1 */
1525 if (IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1526 /* ..., cat2, ????, cat1 */
1527 #ifdef TYPECHECK_STACK_COMPCAT
1529 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1530 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1535 iptr->opc = ICMD_DUP2_X1;
1539 /* ..., cat1, ????, cat1 */
1540 #ifdef TYPECHECK_STACK_COMPCAT
1543 if (IS_2_WORD_TYPE(curstack->prev->type)
1544 || IS_2_WORD_TYPE(curstack->prev->prev->prev->type)) {
1545 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1555 /* pop 2 push 2 swap */
1558 #ifdef TYPECHECK_STACK_COMPCAT
1561 if (IS_2_WORD_TYPE(curstack->type)
1562 || IS_2_WORD_TYPE(curstack->prev->type)) {
1563 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1574 #if !SUPPORT_DIVISION
1575 iptr[0].opc = ICMD_BUILTIN2;
1576 iptr[0].op1 = TYPE_INT;
1577 iptr[0].val.fp = BUILTIN_idiv;
1578 m->isleafmethod = false;
1583 #if !SUPPORT_DIVISION
1584 iptr[0].opc = ICMD_BUILTIN2;
1585 iptr[0].op1 = TYPE_INT;
1586 iptr[0].val.fp = BUILTIN_irem;
1587 m->isleafmethod = false;
1600 COUNT(count_pcmd_op);
1605 #if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
1606 iptr[0].opc = ICMD_BUILTIN2;
1607 iptr[0].op1 = TYPE_LNG;
1608 iptr[0].val.fp = BUILTIN_ldiv;
1609 m->isleafmethod = false;
1614 #if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
1615 iptr[0].opc = ICMD_BUILTIN2;
1616 iptr[0].op1 = TYPE_LNG;
1617 iptr[0].val.fp = BUILTIN_lrem;
1618 m->isleafmethod = false;
1625 #if SUPPORT_LONG_LOGICAL
1629 #endif /* SUPPORT_LONG_LOGICAL */
1630 COUNT(count_pcmd_op);
1637 COUNT(count_pcmd_op);
1646 COUNT(count_pcmd_op);
1655 COUNT(count_pcmd_op);
1660 COUNT(count_pcmd_op);
1661 #if !defined(NOLONG_CONDITIONAL)
1662 if ((len > 0) && (iptr[1].val.i == 0)) {
1663 switch (iptr[1].opc) {
1665 iptr[0].opc = ICMD_IF_LCMPEQ;
1667 iptr[0].op1 = iptr[1].op1;
1670 /* iptr[1].opc = ICMD_NOP; */
1672 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1674 iptr[0].target = (void *) tbptr;
1676 MARKREACHED(tbptr, copy);
1677 COUNT(count_pcmd_bra);
1680 iptr[0].opc = ICMD_IF_LCMPNE;
1681 goto icmd_lcmp_if_tail;
1683 iptr[0].opc = ICMD_IF_LCMPLT;
1684 goto icmd_lcmp_if_tail;
1686 iptr[0].opc = ICMD_IF_LCMPGT;
1687 goto icmd_lcmp_if_tail;
1689 iptr[0].opc = ICMD_IF_LCMPLE;
1690 goto icmd_lcmp_if_tail;
1692 iptr[0].opc = ICMD_IF_LCMPGE;
1693 goto icmd_lcmp_if_tail;
1695 OPTT2_1(TYPE_LNG, TYPE_INT);
1700 OPTT2_1(TYPE_LNG, TYPE_INT);
1704 COUNT(count_pcmd_op);
1705 OPTT2_1(TYPE_FLT, TYPE_INT);
1709 COUNT(count_pcmd_op);
1710 OPTT2_1(TYPE_DBL, TYPE_INT);
1718 case ICMD_INT2SHORT:
1719 COUNT(count_pcmd_op);
1720 OP1_1(TYPE_INT, TYPE_INT);
1723 COUNT(count_pcmd_op);
1724 OP1_1(TYPE_LNG, TYPE_LNG);
1727 COUNT(count_pcmd_op);
1728 OP1_1(TYPE_FLT, TYPE_FLT);
1731 COUNT(count_pcmd_op);
1732 OP1_1(TYPE_DBL, TYPE_DBL);
1736 COUNT(count_pcmd_op);
1737 OP1_1(TYPE_INT, TYPE_LNG);
1740 COUNT(count_pcmd_op);
1741 OP1_1(TYPE_INT, TYPE_FLT);
1744 COUNT(count_pcmd_op);
1745 OP1_1(TYPE_INT, TYPE_DBL);
1748 COUNT(count_pcmd_op);
1749 OP1_1(TYPE_LNG, TYPE_INT);
1752 COUNT(count_pcmd_op);
1753 OP1_1(TYPE_LNG, TYPE_FLT);
1756 COUNT(count_pcmd_op);
1757 OP1_1(TYPE_LNG, TYPE_DBL);
1760 COUNT(count_pcmd_op);
1761 OP1_1(TYPE_FLT, TYPE_INT);
1764 COUNT(count_pcmd_op);
1765 OP1_1(TYPE_FLT, TYPE_LNG);
1768 COUNT(count_pcmd_op);
1769 OP1_1(TYPE_FLT, TYPE_DBL);
1772 COUNT(count_pcmd_op);
1773 OP1_1(TYPE_DBL, TYPE_INT);
1776 COUNT(count_pcmd_op);
1777 OP1_1(TYPE_DBL, TYPE_LNG);
1780 COUNT(count_pcmd_op);
1781 OP1_1(TYPE_DBL, TYPE_FLT);
1784 case ICMD_CHECKCAST:
1785 OP1_1(TYPE_ADR, TYPE_ADR);
1788 case ICMD_INSTANCEOF:
1789 case ICMD_ARRAYLENGTH:
1790 OP1_1(TYPE_ADR, TYPE_INT);
1794 case ICMD_ANEWARRAY:
1795 OP1_1(TYPE_INT, TYPE_ADR);
1799 COUNT(count_check_null);
1800 COUNT(count_pcmd_mem);
1801 OP1_1(TYPE_ADR, iptr->op1);
1806 case ICMD_GETSTATIC:
1807 COUNT(count_pcmd_mem);
1817 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1819 iptr[0].target = (void *) tbptr;
1821 /* This is a dirty hack. The typechecker
1822 * needs it because the OP1_0ANY below
1823 * overwrites iptr->dst.
1825 iptr->val.a = (void *) iptr->dst;
1827 tbptr->type = BBTYPE_SBR;
1829 /* We need to check for overflow right here because
1830 * the pushed value is poped after MARKREACHED. */
1832 MARKREACHED(tbptr, copy);
1836 /* pop many push any */
1840 call_returntype = iptr->op1;
1843 #if defined(USEBUILTINTABLE) || !SUPPORT_DIVISION
1844 /* Just prevent a compiler warning... */
1848 call_returntype = iptr->op1;
1851 #if defined(USEBUILTINTABLE)
1852 /* Just prevent a compiler warning... */
1856 call_returntype = iptr->op1;
1860 case ICMD_INVOKEVIRTUAL:
1861 case ICMD_INVOKESPECIAL:
1862 case ICMD_INVOKEINTERFACE:
1863 case ICMD_INVOKESTATIC:
1864 COUNT(count_pcmd_met);
1866 methodinfo *lm = iptr->val.a;
1867 if (lm->flags & ACC_STATIC)
1868 {COUNT(count_check_null);}
1870 call_argcount = iptr->op1;
1871 call_returntype = lm->returntype;
1881 if (i > rd->arguments_num)
1882 rd->arguments_num = i;
1884 /* --------- old and unchanged till here (almoust ;)----------- */
1886 /* --------- new try from here on till #else ------- */
1890 #ifdef HAS_ADDRESS_REGISTER_FILE
1893 s4 stacksize = 0; /* Stackoffset for spilled arg */
1894 s4 maxstacksize = 0; /* Stackspace required for spilled args */
1897 #ifdef SPECIALMEMUSE
1898 /* normaly Parameters are spilled beginning from offset 0, regardless the argument index */
1899 /* with SPECIALMEMUSE, Parameters are spilled from offset 6, regarding the argument index -> Parameters in registers "waste" Stackspace */
1902 /* Calc ARGVAR Stackslots regarding CONSECUTIVE_[INT|FLOAT|ADDR]ARGS and */
1903 /* rd->[int|flt|adr]reg_argnum */
1905 /* count integer, float and if existing address arguments and possibly used stackspace*/
1909 #ifdef SPECIALMEMUSE
1911 stacksize += (IS_2_WORD_TYPE(copy->type)) ? 2 : 1;
1916 switch (copy->type) {
1918 #ifdef HAS_ADDRESS_REGISTER_FILE
1919 #ifdef CONSECUTIVE_ADDRARGS
1922 #ifndef SPECIALMEMUSE
1923 #ifdef CONSECUTIVE_ADDRARGS
1924 if (aarg > rd->adrreg_argnum)
1926 if (i >= rd->adrreg_argnum)
1934 #ifdef CONSECUTIVE_INTARGS
1936 iarg += (IS_2_WORD_TYPE(copy->type)) ? 2 : 1;
1941 #ifndef SPECIALMEMUSE
1942 #ifdef CONSECUTIVE_INTARGS
1943 if (iarg > rd->intreg_argnum)
1945 if (i >= rd->intreg_argnum)
1948 stacksize += (IS_2_WORD_TYPE(copy->type)) ? 2 : 1;
1956 #ifdef CONSECUTIVE_FLOATARGS
1959 #ifndef SPECIALMEMUSE
1960 #ifdef CONSECUTIVE_FLOATARGS
1962 if (farg > rd->fltreg_argnum)
1964 if (i >= rd->fltreg_argnum)
1967 stacksize += (IS_2_WORD_TYPE(copy->type)) ? 2 : 1;
1977 /* Set ARGVAR to appropriate registerfile index, calc rd->ifmemuse (max stackspace) */
1978 #ifdef SPECIALMEMUSE
1979 if (stacksize > rd->ifmemuse)
1980 rd->ifmemuse = stacksize;
1987 paramsize = (IS_2_WORD_TYPE(copy->type)) ? 2 : 1;
1989 #ifdef HAS_ADDRESS_REGISTER_FILE
1990 if (copy->type == TYPE_ADR) {
1991 #ifdef CONSECUTIVE_ADDRARGS
1996 #ifndef SPECIALMEMUSE
1997 if (aarg >= rd->adrreg_argnum)
1999 maxstacksize = stacksize;
2001 if (!(copy->flags & SAVEDVAR)) {
2002 copy->varnum = aarg;
2003 copy->varkind = ARGVAR;
2004 if (aarg < rd->adrreg_argnum) {
2006 copy->regoff = rd->argadrregs[aarg];
2008 copy->flags = INMEMORY;
2009 copy->regoff = stacksize - paramsize;
2010 #ifndef SPECIALMEMUSE
2011 stacksize -=paramsize;
2017 if (IS_FLT_DBL_TYPE(copy->type)) {
2018 #ifdef CONSECUTIVE_FLOATARGS
2023 #ifndef SPECIALMEMUSE
2025 if (farg >= rd->fltreg_argnum)
2027 maxstacksize = stacksize;
2029 if (!(copy->flags & SAVEDVAR)) {
2030 copy->varnum = farg;
2031 copy->varkind = ARGVAR;
2032 if (farg < rd->fltreg_argnum) {
2034 copy->regoff = rd->argfltregs[farg];
2036 copy->flags = INMEMORY;
2037 copy->regoff = stacksize - paramsize;
2038 #ifndef SPECIALMEMUSE
2039 stacksize -=paramsize;
2043 } else { /* int_arg */
2044 #ifdef CONSECUTIVE_INTARGS
2047 #ifndef SPECIALMEMUSE
2051 iarg = stacksize - paramsize - 6;
2055 #ifndef SPECIALMEMUSE
2056 if (iarg >= rd->intreg_argnum)
2058 maxstacksize = stacksize;
2060 if (!(copy->flags & SAVEDVAR)) {
2061 copy->varnum = iarg;
2062 copy->varkind = ARGVAR;
2064 if ((iarg+paramsize-1) < rd->intreg_argnum) {
2066 if (iarg < rd->intreg_argnum) {
2069 copy->regoff = rd->argintregs[iarg];
2071 copy->flags = INMEMORY;
2072 copy->regoff = stacksize - paramsize;
2073 #ifndef SPECIALMEMUSE
2074 stacksize -=paramsize;
2079 #ifdef HAS_ADDRESS_REGISTER_FILE
2082 #ifdef SPECIALMEMUSE
2083 stacksize -=paramsize;
2087 #ifndef SPECIALMEMUSE
2088 if (rd->ifmemuse < maxstacksize)
2089 rd->ifmemuse = maxstacksize;
2092 printf("ifmemuse,maxstacksize by stack.c: %3i,%3i\n",rd->ifmemuse, maxstacksize);
2094 #else /* ifdef INVOKE_NEW */
2095 #if defined(__X86_64__)
2101 /* count integer and float arguments */
2105 (IS_FLT_DBL_TYPE(copy->type)) ? farg++ : iarg++;
2109 /* calculate stack space required */
2111 stackargs += (iarg < INT_ARG_CNT) ?
2112 0 : (iarg - INT_ARG_CNT);
2113 stackargs += (farg < FLT_ARG_CNT) ?
2114 0 : (farg - FLT_ARG_CNT);
2119 if (!(copy->flags & SAVEDVAR)) {
2120 copy->varkind = ARGVAR;
2122 if (IS_FLT_DBL_TYPE(copy->type)) {
2123 if (--farg < FLT_ARG_CNT)
2124 copy->varnum = farg;
2126 copy->varnum = --stackargs + FLT_ARG_CNT;
2129 if (--iarg < INT_ARG_CNT)
2130 copy->varnum = iarg;
2132 copy->varnum = --stackargs + INT_ARG_CNT;
2136 (IS_FLT_DBL_TYPE(copy->type)) ? --farg : --iarg;
2141 #else /* defined(__X86_64__) */
2144 if (!(copy->flags & SAVEDVAR)) {
2145 copy->varkind = ARGVAR;
2150 #endif /* defined(__X86_64__) */
2151 #endif /* ifdef INVOKE_NEW */
2153 copy->flags |= SAVEDVAR;
2163 if (call_returntype != TYPE_VOID)
2164 OP0_1(call_returntype);
2166 if (lm->returntype != TYPE_VOID)
2167 OP0_1(lm->returntype);
2171 case ICMD_INLINE_START:
2172 case ICMD_INLINE_END:
2177 /* DEBUG */ /*dolog("builtin3");*/
2179 if (!(curstack->flags & SAVEDVAR)) {
2180 curstack->varkind = ARGVAR;
2181 curstack->varnum = 2;
2183 if (3 > rd->arguments_num) {
2184 rd->arguments_num = 3;
2189 #if defined(USEBUILTINTABLE) || !SUPPORT_DIVISION
2190 /* Just prevent a compiler warning... */
2194 /* DEBUG */ /*dolog("builtin2");*/
2195 if (!(curstack->flags & SAVEDVAR)) {
2196 curstack->varkind = ARGVAR;
2197 curstack->varnum = 1;
2199 if (2 > rd->arguments_num) {
2200 rd->arguments_num = 2;
2205 #if defined(USEBUILTINTABLE)
2206 /* Just prevent a compiler warning... */
2210 /* DEBUG */ /*dolog("builtin1");*/
2211 if (!(curstack->flags & SAVEDVAR)) {
2212 curstack->varkind = ARGVAR;
2213 curstack->varnum = 0;
2215 if (1 > rd->arguments_num) {
2216 rd->arguments_num = 1;
2221 copy->flags |= SAVEDVAR;
2224 if (iptr->op1 != TYPE_VOID)
2227 #endif /* ifndef INVOKE_NEW */
2228 case ICMD_MULTIANEWARRAY:
2232 #ifdef SPECIALMEMUSE
2233 if (rd->ifmemuse < (i + rd->intreg_argnum + 6))
2234 rd->ifmemuse = i + rd->intreg_argnum + 6;
2236 if (rd->ifmemuse < i)
2237 rd->ifmemuse = i; /* n integer args spilled on stack */
2240 if ((i + INT_ARG_CNT) > rd->arguments_num)
2241 rd->arguments_num = i + INT_ARG_CNT;
2244 /* check INT type here? Currently typecheck does this. */
2245 if (!(copy->flags & SAVEDVAR)) {
2246 copy->varkind = ARGVAR;
2247 copy->varnum = i + INT_ARG_CNT;
2249 copy->flags|=INMEMORY;
2250 #ifdef SPECIALMEMUSE
2251 copy->regoff = i + rd->intreg_argnum + 6;
2260 copy->flags |= SAVEDVAR;
2268 case ICMD_CLEAR_ARGREN:
2269 for (i = iptr->op1; i < cd->maxlocals; i++)
2271 iptr->opc = opcode = ICMD_NOP;
2275 case ICMD_READONLY_ARG:
2276 case ICMD_READONLY_ARG+1:
2277 case ICMD_READONLY_ARG+2:
2278 case ICMD_READONLY_ARG+3:
2279 case ICMD_READONLY_ARG+4:
2282 if (curstack->varkind == LOCALVAR) {
2283 i = curstack->varnum;
2284 argren[iptr->op1] = i;
2287 opcode = iptr->opc = opcode - ICMD_READONLY_ARG + ICMD_ISTORE;
2294 new_exception_message(string_java_lang_InternalError,
2301 } /* while instructions */
2303 bptr->outstack = curstack;
2304 bptr->outdepth = stackdepth;
2308 superblockend = true;
2310 } /* while blocks */
2311 } while (repeat && !deadcode);
2313 #if defined(STATISTICS)
2315 if (m->basicblockcount > count_max_basic_blocks)
2316 count_max_basic_blocks = m->basicblockcount;
2317 count_basic_blocks += m->basicblockcount;
2318 if (m->instructioncount > count_max_javainstr) count_max_javainstr = m->instructioncount;
2319 count_javainstr += m->instructioncount;
2320 if (m->stackcount > count_upper_bound_new_stack)
2321 count_upper_bound_new_stack = m->stackcount;
2322 if ((new - m->stack) > count_max_new_stack)
2323 count_max_new_stack = (new - m->stack);
2325 b_count = m->basicblockcount;
2326 bptr = m->basicblocks;
2327 while (--b_count >= 0) {
2328 if (bptr->flags > BBREACHED) {
2329 if (bptr->indepth >= 10)
2330 count_block_stack[10]++;
2332 count_block_stack[bptr->indepth]++;
2335 count_block_size_distribution[len]++;
2337 count_block_size_distribution[10]++;
2339 count_block_size_distribution[11]++;
2341 count_block_size_distribution[12]++;
2343 count_block_size_distribution[13]++;
2345 count_block_size_distribution[14]++;
2347 count_block_size_distribution[15]++;
2349 count_block_size_distribution[16]++;
2351 count_block_size_distribution[17]++;
2357 count_analyse_iterations[0]++;
2358 else if (loops == 2)
2359 count_analyse_iterations[1]++;
2360 else if (loops == 3)
2361 count_analyse_iterations[2]++;
2362 else if (loops == 4)
2363 count_analyse_iterations[3]++;
2365 count_analyse_iterations[4]++;
2367 if (m->basicblockcount <= 5)
2368 count_method_bb_distribution[0]++;
2369 else if (m->basicblockcount <= 10)
2370 count_method_bb_distribution[1]++;
2371 else if (m->basicblockcount <= 15)
2372 count_method_bb_distribution[2]++;
2373 else if (m->basicblockcount <= 20)
2374 count_method_bb_distribution[3]++;
2375 else if (m->basicblockcount <= 30)
2376 count_method_bb_distribution[4]++;
2377 else if (m->basicblockcount <= 40)
2378 count_method_bb_distribution[5]++;
2379 else if (m->basicblockcount <= 50)
2380 count_method_bb_distribution[6]++;
2381 else if (m->basicblockcount <= 75)
2382 count_method_bb_distribution[7]++;
2384 count_method_bb_distribution[8]++;
2388 /* just return methodinfo* to signal everything was ok */
2394 /**********************************************************************/
2395 /* DEBUGGING HELPERS */
2396 /**********************************************************************/
2398 void icmd_print_stack(codegendata *cd, stackptr s)
2410 j = cd->maxstack - i;
2415 /* DEBUG */ /*printf("(%d,%d,%d,%d)",s->varkind,s->flags,s->regoff,s->varnum); fflush(stdout);*/
2416 if (s->flags & SAVEDVAR)
2417 switch (s->varkind) {
2419 if (s->flags & INMEMORY)
2420 printf(" M%02d", s->regoff);
2421 #ifdef HAS_ADDRESS_REGISTER_FILE
2422 else if (s->type == TYPE_ADR)
2423 printf(" R%02d", s->regoff);
2425 else if (IS_FLT_DBL_TYPE(s->type))
2426 printf(" F%02d", s->regoff);
2428 printf(" %3s", regs[s->regoff]);
2432 printf(" I%02d", s->varnum);
2435 printf(" L%02d", s->varnum);
2438 printf(" A%02d", s->varnum);
2439 #ifdef INVOKE_NEW_DEBUG
2440 if (s->flags & INMEMORY)
2441 printf("(M%i)", s->regoff);
2443 printf("(R%i)", s->regoff);
2447 printf(" !%02d", j);
2450 switch (s->varkind) {
2452 if (s->flags & INMEMORY)
2453 printf(" m%02d", s->regoff);
2454 #ifdef HAS_ADDRESS_REGISTER_FILE
2455 else if (s->type == TYPE_ADR)
2456 printf(" r%02d", s->regoff);
2458 else if (IS_FLT_DBL_TYPE(s->type))
2459 printf(" f%02d", s->regoff);
2461 printf(" %3s", regs[s->regoff]);
2465 printf(" i%02d", s->varnum);
2468 printf(" l%02d", s->varnum);
2471 printf(" a%02d", s->varnum);
2472 #ifdef INVOKE_NEW_DEBUG
2473 if (s->flags & INMEMORY)
2474 printf("(M%i)", s->regoff);
2476 printf("(R%i)", s->regoff);
2480 printf(" ?%02d", j);
2488 static void print_reg(stackptr s) {
2490 if (s->flags & SAVEDVAR)
2491 switch (s->varkind) {
2493 if (s->flags & INMEMORY)
2494 printf(" tm%02d", s->regoff);
2496 printf(" tr%02d", s->regoff);
2499 printf(" s %02d", s->varnum);
2502 printf(" l %02d", s->varnum);
2505 printf(" a %02d", s->varnum);
2508 printf(" ! %02d", s->varnum);
2511 switch (s->varkind) {
2513 if (s->flags & INMEMORY)
2514 printf(" Tm%02d", s->regoff);
2516 printf(" Tr%02d", s->regoff);
2519 printf(" S %02d", s->varnum);
2522 printf(" L %02d", s->varnum);
2525 printf(" A %02d", s->varnum);
2528 printf(" ? %02d", s->varnum);
2538 char *icmd_builtin_name(functionptr bptr)
2540 builtin_descriptor *bdesc = builtin_desc;
2541 while ((bdesc->opcode != 0) && (bdesc->builtin != bptr))
2543 return (bdesc->opcode) ? bdesc->name : "<NOT IN TABLE>";
2547 static char *jit_type[] = {
2556 void show_icmd_method(methodinfo *m, codegendata *cd, registerdata *rd)
2563 utf_fprint_classname(stdout, m->class->name);
2565 utf_fprint(stdout, m->name);
2566 utf_fprint_classname(stdout, m->descriptor);
2567 printf("\n\nMax locals: %d\n", (int) cd->maxlocals);
2568 printf("Max stack: %d\n", (int) cd->maxstack);
2570 printf("Line number table length: %d\n", m->linenumbercount);
2572 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
2573 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
2574 printf(" L%03d ... ", ex->start->debug_nr );
2575 printf("L%03d = ", ex->end->debug_nr);
2576 printf("L%03d\n", ex->handler->debug_nr);
2579 printf("Local Table:\n");
2580 for (i = 0; i < cd->maxlocals; i++) {
2581 printf(" %3d: ", i);
2582 for (j = TYPE_INT; j <= TYPE_ADR; j++)
2583 if (rd->locals[i][j].type >= 0) {
2584 printf(" (%s) ", jit_type[j]);
2585 if (rd->locals[i][j].flags & INMEMORY)
2586 printf("m%2d", rd->locals[i][j].regoff);
2587 #ifdef HAS_ADDRESS_REGISTER_FILE
2588 else if (j == TYPE_ADR)
2589 printf("r%02d", rd->locals[i][j].regoff);
2591 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2592 printf("f%02d", rd->locals[i][j].regoff);
2594 printf("%3s", regs[rd->locals[i][j].regoff]);
2603 printf("Interface Table:\n");
2604 for (i = 0; i < cd->maxstack; i++) {
2605 if ((rd->interfaces[i][0].type >= 0) ||
2606 (rd->interfaces[i][1].type >= 0) ||
2607 (rd->interfaces[i][2].type >= 0) ||
2608 (rd->interfaces[i][3].type >= 0) ||
2609 (rd->interfaces[i][4].type >= 0)) {
2610 printf(" %3d: ", i);
2611 for (j = TYPE_INT; j <= TYPE_ADR; j++)
2612 if (rd->interfaces[i][j].type >= 0) {
2613 printf(" (%s) ", jit_type[j]);
2614 if (rd->interfaces[i][j].flags & SAVEDVAR) {
2615 if (rd->interfaces[i][j].flags & INMEMORY)
2616 printf("M%2d", rd->interfaces[i][j].regoff);
2617 #ifdef HAS_ADDRESS_REGISTER_FILE
2618 else if (j == TYPE_ADR)
2619 printf("R%02d", rd->interfaces[i][j].regoff);
2621 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2622 printf("F%02d", rd->interfaces[i][j].regoff);
2624 printf("%3s", regs[rd->locals[i][j].regoff]);
2628 if (rd->interfaces[i][j].flags & INMEMORY)
2629 printf("m%2d", rd->interfaces[i][j].regoff);
2630 #ifdef HAS_ADDRESS_REGISTER_FILE
2631 else if (j == TYPE_ADR)
2632 printf("r%02d", rd->interfaces[i][j].regoff);
2634 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2635 printf("f%02d", rd->interfaces[i][j].regoff);
2637 printf("%3s", regs[rd->locals[i][j].regoff]);
2648 if (showdisassemble) {
2649 #if defined(__I386__) || defined(__X86_64__)
2653 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen);
2654 for (i = 0; i < m->basicblocks[0].mpc;) {
2655 a = disassinstr(u1ptr);
2660 #elif defined(__XDSPCORE__)
2664 s4ptr = (s4 *) ((ptrint) m->mcode + cd->dseglen);
2665 for (i = 0; i < m->basicblocks[0].mpc;) {
2666 a = disassinstr(stdout, s4ptr);
2675 s4ptr = (s4 *) ((ptrint) m->mcode + cd->dseglen);
2676 for (i = 0; i < m->basicblocks[0].mpc; i += 4, s4ptr++) {
2683 for (bptr = m->basicblocks; bptr != NULL; bptr = bptr->next) {
2684 show_icmd_block(m, cd, bptr);
2689 void show_icmd_block(methodinfo *m, codegendata *cd, basicblock *bptr)
2695 if (bptr->flags != BBDELETED) {
2696 deadcode = bptr->flags <= BBREACHED;
2699 for (j = cd->maxstack; j > 0; j--)
2702 icmd_print_stack(cd, bptr->instack);
2703 printf("] L%03d(%d - %d) flags=%d:\n", bptr->debug_nr, bptr->icount, bptr->pre_count,bptr->flags);
2704 iptr = bptr->iinstr;
2706 for (i = 0; i < bptr->icount; i++, iptr++) {
2709 for (j = cd->maxstack; j > 0; j--)
2713 icmd_print_stack(cd, iptr->dst);
2714 printf("] %4d ", i);
2717 if (icmd_uses_tmp[iptr->opc][0])
2721 if (icmd_uses_tmp[iptr->opc][1])
2725 if (icmd_uses_tmp[iptr->opc][2])
2731 show_icmd(iptr, deadcode);
2735 if (showdisassemble && (!deadcode)) {
2736 #if defined(__I386__) || defined(__X86_64__)
2742 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen + i);
2744 if (bptr->next != NULL) {
2745 for (; i < bptr->next->mpc; ) {
2746 a = disassinstr(u1ptr);
2753 for (; u1ptr < (u1 *) ((ptrint) m->mcode + m->mcodelength); ) {
2754 a = disassinstr(u1ptr);
2760 #elif defined(__XDSPCORE__)
2766 s4ptr = (s4 *) ((ptrint) m->mcode + cd->dseglen + i);
2768 if (bptr->next != NULL) {
2769 for (; i < bptr->next->mpc;) {
2770 a = disassinstr(stdout, s4ptr);
2778 for (; s4ptr < (s4 *) ((ptrint) m->mcode + m->mcodelength); ) {
2779 a = disassinstr(stdout, s4ptr);
2790 s4ptr = (s4 *) ((ptrint) m->mcode + cd->dseglen + i);
2792 if (bptr->next != NULL) {
2793 for (; i < bptr->next->mpc; i += 4, s4ptr++)
2798 for (; s4ptr < (s4 *) ((ptrint) m->mcode + m->mcodelength); i += 4, s4ptr++)
2808 void show_icmd(instruction *iptr, bool deadcode)
2814 printf("%s", icmd_names[iptr->opc]);
2816 switch (iptr->opc) {
2817 case ICMD_IADDCONST:
2818 case ICMD_ISUBCONST:
2819 case ICMD_IMULCONST:
2823 case ICMD_IANDCONST:
2825 case ICMD_IXORCONST:
2826 case ICMD_ISHLCONST:
2827 case ICMD_ISHRCONST:
2828 case ICMD_IUSHRCONST:
2829 case ICMD_LSHLCONST:
2830 case ICMD_LSHRCONST:
2831 case ICMD_LUSHRCONST:
2833 case ICMD_ELSE_ICONST:
2834 case ICMD_IFEQ_ICONST:
2835 case ICMD_IFNE_ICONST:
2836 case ICMD_IFLT_ICONST:
2837 case ICMD_IFGE_ICONST:
2838 case ICMD_IFGT_ICONST:
2839 case ICMD_IFLE_ICONST:
2840 case ICMD_IASTORECONST:
2841 case ICMD_BASTORECONST:
2842 case ICMD_CASTORECONST:
2843 case ICMD_SASTORECONST:
2844 printf(" %d", iptr->val.i);
2847 case ICMD_LADDCONST:
2848 case ICMD_LSUBCONST:
2849 case ICMD_LMULCONST:
2853 case ICMD_LANDCONST:
2855 case ICMD_LXORCONST:
2857 case ICMD_LASTORECONST:
2858 #if defined(__I386__) || defined(__POWERPC__)
2859 printf(" %lld", iptr->val.l);
2861 printf(" %ld", iptr->val.l);
2866 printf(" %f", iptr->val.f);
2870 printf(" %f", iptr->val.d);
2874 case ICMD_AASTORECONST:
2875 printf(" %p", iptr->val.a);
2880 printf(" %d,", ((fieldinfo *) iptr->val.a)->offset);
2881 case ICMD_PUTSTATIC:
2882 case ICMD_GETSTATIC:
2884 utf_fprint(stdout, ((fieldinfo *) iptr->val.a)->class->name);
2886 utf_fprint(stdout, ((fieldinfo *) iptr->val.a)->name);
2888 utf_fprint(stdout, ((fieldinfo *) iptr->val.a)->descriptor);
2892 case ICMD_PUTSTATICCONST:
2893 case ICMD_PUTFIELDCONST:
2894 switch (iptr[1].op1) {
2896 printf(" %d,", iptr->val.i);
2899 #if defined(__I386__) || defined(__POWERPC__)
2900 printf(" %lld,", iptr->val.l);
2902 printf(" %ld,", iptr->val.l);
2906 printf(" %p,", iptr->val.a);
2909 printf(" %g,", iptr->val.f);
2912 printf(" %g,", iptr->val.d);
2915 if (iptr->opc == ICMD_PUTFIELDCONST)
2916 printf(" %d,", ((fieldinfo *) iptr[1].val.a)->offset);
2918 utf_fprint(stdout, ((fieldinfo *) iptr[1].val.a)->class->name);
2920 utf_fprint(stdout, ((fieldinfo *) iptr[1].val.a)->name);
2922 utf_fprint(stdout, ((fieldinfo *) iptr[1].val.a)->descriptor);
2927 printf(" %d + %d", iptr->op1, iptr->val.i);
2962 printf(" %d", iptr->op1);
2968 ((classinfo *) iptr->val.a)->name);
2972 switch (iptr->op1) {
3000 case ICMD_ANEWARRAY:
3004 ((classinfo *) iptr->val.a)->name);
3008 case ICMD_MULTIANEWARRAY:
3011 printf(" %d ",iptr->op1);
3012 vft = (vftbl_t *)iptr->val.a;
3014 utf_fprint(stdout,vft->class->name);
3020 case ICMD_CHECKCAST:
3021 case ICMD_INSTANCEOF:
3023 classinfo *c = iptr->val.a;
3024 if (c->flags & ACC_INTERFACE)
3025 printf(" (INTERFACE) ");
3027 printf(" (CLASS,%3d) ", c->vftbl->diffval);
3028 utf_fprint(stdout, c->name);
3032 case ICMD_INLINE_START:
3033 printf("\t\t\t%s.%s%s depth=%i",iptr->method->class->name->text,iptr->method->name->text,iptr->method->descriptor->text, iptr->op1);
3035 case ICMD_INLINE_END:
3041 printf(" %s", icmd_builtin_name((functionptr) iptr->val.fp));
3044 case ICMD_INVOKEVIRTUAL:
3045 case ICMD_INVOKESPECIAL:
3046 case ICMD_INVOKESTATIC:
3047 case ICMD_INVOKEINTERFACE:
3050 ((methodinfo *) iptr->val.a)->class->name);
3053 ((methodinfo *) iptr->val.a)->name);
3062 if (deadcode || !iptr->target)
3063 printf("(%d) op1=%d", iptr->val.i, iptr->op1);
3065 printf("(%d) L%03d", iptr->val.i, ((basicblock *) iptr->target)->debug_nr);
3074 if (deadcode || !iptr->target)
3075 #if defined(__I386__) || defined(__POWERPC__)
3076 printf("(%lld) op1=%d", iptr->val.l, iptr->op1);
3078 printf("(%ld) op1=%d", iptr->val.l, iptr->op1);
3081 #if defined(__I386__) || defined(__POWERPC__)
3082 printf("(%lld) L%03d", iptr->val.l, ((basicblock *) iptr->target)->debug_nr);
3084 printf("(%ld) L%03d", iptr->val.l, ((basicblock *) iptr->target)->debug_nr);
3091 case ICMD_IFNONNULL:
3092 case ICMD_IF_ICMPEQ:
3093 case ICMD_IF_ICMPNE:
3094 case ICMD_IF_ICMPLT:
3095 case ICMD_IF_ICMPGE:
3096 case ICMD_IF_ICMPGT:
3097 case ICMD_IF_ICMPLE:
3098 case ICMD_IF_LCMPEQ:
3099 case ICMD_IF_LCMPNE:
3100 case ICMD_IF_LCMPLT:
3101 case ICMD_IF_LCMPGE:
3102 case ICMD_IF_LCMPGT:
3103 case ICMD_IF_LCMPLE:
3104 case ICMD_IF_ACMPEQ:
3105 case ICMD_IF_ACMPNE:
3106 if (deadcode || !iptr->target)
3107 printf(" op1=%d", iptr->op1);
3109 printf(" L%03d", ((basicblock *) iptr->target)->debug_nr);
3112 case ICMD_TABLESWITCH:
3113 s4ptr = (s4*)iptr->val.a;
3115 if (deadcode || !iptr->target) {
3116 printf(" %d;", *s4ptr);
3119 tptr = (void **) iptr->target;
3120 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
3124 s4ptr++; /* skip default */
3125 j = *s4ptr++; /* low */
3126 j = *s4ptr++ - j; /* high */
3128 if (deadcode || !*tptr)
3129 printf(" %d", *s4ptr++);
3131 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
3138 case ICMD_LOOKUPSWITCH:
3139 s4ptr = (s4*)iptr->val.a;
3141 if (deadcode || !iptr->target) {
3142 printf(" %d;", *s4ptr);
3145 tptr = (void **) iptr->target;
3146 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
3149 s4ptr++; /* default */
3150 j = *s4ptr++; /* count */
3153 if (deadcode || !*tptr) {
3154 s4ptr++; /* skip value */
3155 printf(" %d",*s4ptr++);
3158 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
3164 printf(" Line number: %d, method:",iptr->line);
3166 utf_display(iptr->method->class->name);
3168 utf_display(iptr->method->name); */
3173 * These are local overrides for various environment variables in Emacs.
3174 * Please do not remove this and leave it at the end of the file, where
3175 * Emacs will automagically detect them.
3176 * ---------------------------------------------------------------------
3179 * indent-tabs-mode: t