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
33 $Id: stack.c 2949 2005-07-09 12:20:02Z twisti $
47 #include "mm/memory.h"
48 #include "native/native.h"
49 #include "toolbox/logging.h"
50 #include "vm/global.h"
51 #include "vm/builtin.h"
52 #include "vm/options.h"
53 #include "vm/resolve.h"
54 #include "vm/statistics.h"
55 #include "vm/stringlocal.h"
56 #include "vm/tables.h"
57 #include "vm/jit/codegen.inc.h"
58 #include "vm/jit/jit.h"
59 #include "vm/jit/reg.h"
60 #include "vm/jit/stack.h"
61 #include "vm/jit/lsra.h"
64 /**********************************************************************/
66 /**********************************************************************/
68 /* analyse_stack uses the intermediate code created by parse.c to
69 * build a model of the JVM operand stack for the current method.
71 * The following checks are performed:
72 * - check for operand stack underflow (before each instruction)
73 * - check for operand stack overflow (after[1] each instruction)
74 * - check for matching stack depth at merging points
75 * - check for matching basic types[2] at merging points
76 * - check basic types for instruction input (except for BUILTIN*
77 * opcodes, INVOKE* opcodes and MULTIANEWARRAY)
79 * [1]) Checking this after the instruction should be ok. parse.c
80 * counts the number of required stack slots in such a way that it is
81 * only vital that we don't exceed `maxstack` at basic block
84 * [2]) 'basic types' means the distinction between INT, LONG, FLOAT,
85 * DOUBLE and ADDRESS types. Subtypes of INT and different ADDRESS
86 * types are not discerned.
89 methodinfo *analyse_stack(methodinfo *m, codegendata *cd, registerdata *rd)
97 int opcode, i, len, loops;
98 int superblockend, repeat, deadcode;
106 builtintable_entry *bte;
107 unresolved_method *um;
114 argren = DMNEW(s4, cd->maxlocals); /* table for argument renaming */
115 for (i = 0; i < cd->maxlocals; i++)
120 m->basicblocks[0].flags = BBREACHED;
121 m->basicblocks[0].instack = 0;
122 m->basicblocks[0].indepth = 0;
124 for (i = 0; i < cd->exceptiontablelength; i++) {
125 bptr = &m->basicblocks[m->basicblockindex[cd->exceptiontable[i].handlerpc]];
126 bptr->flags = BBREACHED;
127 bptr->type = BBTYPE_EXH;
130 bptr->pre_count = 10000;
135 #if CONDITIONAL_LOADCONST
136 b_count = m->basicblockcount;
137 bptr = m->basicblocks;
138 while (--b_count >= 0) {
139 if (bptr->icount != 0) {
140 iptr = bptr->iinstr + bptr->icount - 1;
173 m->basicblocks[m->basicblockindex[iptr->op1]].pre_count++;
176 case ICMD_TABLESWITCH:
178 m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
179 i = *s4ptr++; /* low */
180 i = *s4ptr++ - i + 1; /* high */
182 m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
186 case ICMD_LOOKUPSWITCH:
188 m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
189 i = *s4ptr++; /* count */
191 m->basicblocks[m->basicblockindex[s4ptr[1]]].pre_count++;
202 #endif /* CONDITIONAL_LOADCONST */
207 b_count = m->basicblockcount;
208 bptr = m->basicblocks;
209 superblockend = true;
214 while (--b_count >= 0) {
215 if (bptr->flags == BBDELETED) {
218 } else if (superblockend && (bptr->flags < BBREACHED)) {
221 } else if (bptr->flags <= BBREACHED) {
223 stackdepth = bptr->indepth;
225 } else if (bptr->flags < BBREACHED) {
227 bptr->instack = copy;
228 bptr->indepth = stackdepth;
230 } else if (bptr->indepth != stackdepth) {
231 show_icmd_method(m, cd, rd);
232 printf("Block: %d, required depth: %d, current depth: %d\n", bptr->debug_nr, bptr->indepth, stackdepth);
233 log_text("Stack depth mismatch");
237 curstack = bptr->instack;
239 superblockend = false;
240 bptr->flags = BBFINISHED;
243 b_index = bptr - m->basicblocks;
247 /* XXX TWISTI: why is this set to NULL here? */
248 /* iptr->target = NULL; */
250 #if defined(USEBUILTINTABLE)
251 bte = builtintable_get_automatic(opcode);
253 if (bte && bte->opcode == opcode) {
254 iptr->opc = ICMD_BUILTIN;
255 iptr->op1 = bte->md->paramcount;
257 m->isleafmethod = false;
260 #endif /* defined(USEBUILTINTABLE) */
267 COUNT(count_check_null);
269 case ICMD_CHECKASIZE:
270 case ICMD_CHECKEXCEPTION:
272 case ICMD_IFEQ_ICONST:
273 case ICMD_IFNE_ICONST:
274 case ICMD_IFLT_ICONST:
275 case ICMD_IFGE_ICONST:
276 case ICMD_IFGT_ICONST:
277 case ICMD_IFLE_ICONST:
278 case ICMD_ELSE_ICONST:
283 rd->locals[iptr->op1][TYPE_ADR].type = TYPE_ADR;
285 COUNT(count_pcmd_return);
287 superblockend = true;
290 /* pop 0 push 1 const */
293 COUNT(count_pcmd_load);
295 switch (iptr[1].opc) {
297 iptr[0].opc = ICMD_IADDCONST;
299 iptr[1].opc = ICMD_NOP;
300 OP1_1(TYPE_INT, TYPE_INT);
301 COUNT(count_pcmd_op);
304 iptr[0].opc = ICMD_ISUBCONST;
305 goto icmd_iconst_tail;
306 #if SUPPORT_CONST_MUL
308 iptr[0].opc = ICMD_IMULCONST;
309 goto icmd_iconst_tail;
310 #else /* SUPPORT_CONST_MUL */
312 if (iptr[0].val.i == 0x00000002)
314 else if (iptr[0].val.i == 0x00000004)
316 else if (iptr[0].val.i == 0x00000008)
318 else if (iptr[0].val.i == 0x00000010)
320 else if (iptr[0].val.i == 0x00000020)
322 else if (iptr[0].val.i == 0x00000040)
324 else if (iptr[0].val.i == 0x00000080)
326 else if (iptr[0].val.i == 0x00000100)
328 else if (iptr[0].val.i == 0x00000200)
330 else if (iptr[0].val.i == 0x00000400)
332 else if (iptr[0].val.i == 0x00000800)
334 else if (iptr[0].val.i == 0x00001000)
336 else if (iptr[0].val.i == 0x00002000)
338 else if (iptr[0].val.i == 0x00004000)
340 else if (iptr[0].val.i == 0x00008000)
342 else if (iptr[0].val.i == 0x00010000)
344 else if (iptr[0].val.i == 0x00020000)
346 else if (iptr[0].val.i == 0x00040000)
348 else if (iptr[0].val.i == 0x00080000)
350 else if (iptr[0].val.i == 0x00100000)
352 else if (iptr[0].val.i == 0x00200000)
354 else if (iptr[0].val.i == 0x00400000)
356 else if (iptr[0].val.i == 0x00800000)
358 else if (iptr[0].val.i == 0x01000000)
360 else if (iptr[0].val.i == 0x02000000)
362 else if (iptr[0].val.i == 0x04000000)
364 else if (iptr[0].val.i == 0x08000000)
366 else if (iptr[0].val.i == 0x10000000)
368 else if (iptr[0].val.i == 0x20000000)
370 else if (iptr[0].val.i == 0x40000000)
372 else if (iptr[0].val.i == 0x80000000)
378 iptr[0].opc = ICMD_IMULPOW2;
379 goto icmd_iconst_tail;
380 #endif /* SUPPORT_CONST_MUL */
382 if (iptr[0].val.i == 0x00000002)
384 else if (iptr[0].val.i == 0x00000004)
386 else if (iptr[0].val.i == 0x00000008)
388 else if (iptr[0].val.i == 0x00000010)
390 else if (iptr[0].val.i == 0x00000020)
392 else if (iptr[0].val.i == 0x00000040)
394 else if (iptr[0].val.i == 0x00000080)
396 else if (iptr[0].val.i == 0x00000100)
398 else if (iptr[0].val.i == 0x00000200)
400 else if (iptr[0].val.i == 0x00000400)
402 else if (iptr[0].val.i == 0x00000800)
404 else if (iptr[0].val.i == 0x00001000)
406 else if (iptr[0].val.i == 0x00002000)
408 else if (iptr[0].val.i == 0x00004000)
410 else if (iptr[0].val.i == 0x00008000)
412 else if (iptr[0].val.i == 0x00010000)
414 else if (iptr[0].val.i == 0x00020000)
416 else if (iptr[0].val.i == 0x00040000)
418 else if (iptr[0].val.i == 0x00080000)
420 else if (iptr[0].val.i == 0x00100000)
422 else if (iptr[0].val.i == 0x00200000)
424 else if (iptr[0].val.i == 0x00400000)
426 else if (iptr[0].val.i == 0x00800000)
428 else if (iptr[0].val.i == 0x01000000)
430 else if (iptr[0].val.i == 0x02000000)
432 else if (iptr[0].val.i == 0x04000000)
434 else if (iptr[0].val.i == 0x08000000)
436 else if (iptr[0].val.i == 0x10000000)
438 else if (iptr[0].val.i == 0x20000000)
440 else if (iptr[0].val.i == 0x40000000)
442 else if (iptr[0].val.i == 0x80000000)
448 iptr[0].opc = ICMD_IDIVPOW2;
449 goto icmd_iconst_tail;
451 /*log_text("stack.c: ICMD_ICONST/ICMD_IREM");*/
452 if ((iptr[0].val.i == 0x00000002) ||
453 (iptr[0].val.i == 0x00000004) ||
454 (iptr[0].val.i == 0x00000008) ||
455 (iptr[0].val.i == 0x00000010) ||
456 (iptr[0].val.i == 0x00000020) ||
457 (iptr[0].val.i == 0x00000040) ||
458 (iptr[0].val.i == 0x00000080) ||
459 (iptr[0].val.i == 0x00000100) ||
460 (iptr[0].val.i == 0x00000200) ||
461 (iptr[0].val.i == 0x00000400) ||
462 (iptr[0].val.i == 0x00000800) ||
463 (iptr[0].val.i == 0x00001000) ||
464 (iptr[0].val.i == 0x00002000) ||
465 (iptr[0].val.i == 0x00004000) ||
466 (iptr[0].val.i == 0x00008000) ||
467 (iptr[0].val.i == 0x00010000) ||
468 (iptr[0].val.i == 0x00020000) ||
469 (iptr[0].val.i == 0x00040000) ||
470 (iptr[0].val.i == 0x00080000) ||
471 (iptr[0].val.i == 0x00100000) ||
472 (iptr[0].val.i == 0x00200000) ||
473 (iptr[0].val.i == 0x00400000) ||
474 (iptr[0].val.i == 0x00800000) ||
475 (iptr[0].val.i == 0x01000000) ||
476 (iptr[0].val.i == 0x02000000) ||
477 (iptr[0].val.i == 0x04000000) ||
478 (iptr[0].val.i == 0x08000000) ||
479 (iptr[0].val.i == 0x10000000) ||
480 (iptr[0].val.i == 0x20000000) ||
481 (iptr[0].val.i == 0x40000000) ||
482 (iptr[0].val.i == 0x80000000)) {
483 iptr[0].opc = ICMD_IREMPOW2;
485 goto icmd_iconst_tail;
489 #if SUPPORT_CONST_LOGICAL
491 iptr[0].opc = ICMD_IANDCONST;
492 goto icmd_iconst_tail;
494 iptr[0].opc = ICMD_IORCONST;
495 goto icmd_iconst_tail;
497 iptr[0].opc = ICMD_IXORCONST;
498 goto icmd_iconst_tail;
499 #endif /* SUPPORT_CONST_LOGICAL */
501 iptr[0].opc = ICMD_ISHLCONST;
502 goto icmd_iconst_tail;
504 iptr[0].opc = ICMD_ISHRCONST;
505 goto icmd_iconst_tail;
507 iptr[0].opc = ICMD_IUSHRCONST;
508 goto icmd_iconst_tail;
509 #if SUPPORT_LONG_SHIFT
511 iptr[0].opc = ICMD_LSHLCONST;
512 goto icmd_lconst_tail;
514 iptr[0].opc = ICMD_LSHRCONST;
515 goto icmd_lconst_tail;
517 iptr[0].opc = ICMD_LUSHRCONST;
518 goto icmd_lconst_tail;
519 #endif /* SUPPORT_LONG_SHIFT */
521 iptr[0].opc = ICMD_IFEQ;
523 iptr[0].op1 = iptr[1].op1;
527 /* iptr[1].opc = ICMD_NOP; */
529 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
531 iptr[0].target = (void *) tbptr;
533 MARKREACHED(tbptr, copy);
534 COUNT(count_pcmd_bra);
540 iptr[0].opc = ICMD_IFLT;
541 goto icmd_if_icmp_tail;
543 iptr[0].opc = ICMD_IFLE;
544 goto icmd_if_icmp_tail;
546 iptr[0].opc = ICMD_IFNE;
547 goto icmd_if_icmp_tail;
549 iptr[0].opc = ICMD_IFGT;
550 goto icmd_if_icmp_tail;
552 iptr[0].opc = ICMD_IFGE;
553 goto icmd_if_icmp_tail;
555 #if SUPPORT_CONST_STORE
560 #if SUPPORT_CONST_STORE_ZERO_ONLY
561 if (iptr[0].val.i == 0) {
562 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
563 switch (iptr[1].opc) {
565 iptr[0].opc = ICMD_IASTORECONST;
568 iptr[0].opc = ICMD_BASTORECONST;
571 iptr[0].opc = ICMD_CASTORECONST;
574 iptr[0].opc = ICMD_SASTORECONST;
578 iptr[1].opc = ICMD_NOP;
579 OPTT2_0(TYPE_INT, TYPE_ADR);
580 COUNT(count_pcmd_op);
581 #if SUPPORT_CONST_STORE_ZERO_ONLY
584 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
589 #if SUPPORT_CONST_STORE_ZERO_ONLY
590 if (iptr[0].val.i == 0) {
591 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
592 switch (iptr[1].opc) {
594 iptr[0].opc = ICMD_PUTSTATICCONST;
598 iptr[0].opc = ICMD_PUTFIELDCONST;
603 iptr[1].opc = ICMD_NOP;
604 iptr[0].op1 = TYPE_INT;
605 COUNT(count_pcmd_op);
606 #if SUPPORT_CONST_STORE_ZERO_ONLY
609 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
611 #endif /* SUPPORT_CONST_STORE */
621 COUNT(count_pcmd_load);
623 switch (iptr[1].opc) {
626 iptr[0].opc = ICMD_LADDCONST;
628 iptr[1].opc = ICMD_NOP;
629 OP1_1(TYPE_LNG,TYPE_LNG);
630 COUNT(count_pcmd_op);
633 iptr[0].opc = ICMD_LSUBCONST;
634 goto icmd_lconst_tail;
635 #endif /* SUPPORT_LONG_ADD */
636 #if SUPPORT_LONG_MUL && SUPPORT_CONST_MUL
638 iptr[0].opc = ICMD_LMULCONST;
639 goto icmd_lconst_tail;
640 #else /* SUPPORT_LONG_MUL && SUPPORT_CONST_MUL */
641 # if SUPPORT_LONG_SHIFT
643 if (iptr[0].val.l == 0x00000002)
645 else if (iptr[0].val.l == 0x00000004)
647 else if (iptr[0].val.l == 0x00000008)
649 else if (iptr[0].val.l == 0x00000010)
651 else if (iptr[0].val.l == 0x00000020)
653 else if (iptr[0].val.l == 0x00000040)
655 else if (iptr[0].val.l == 0x00000080)
657 else if (iptr[0].val.l == 0x00000100)
659 else if (iptr[0].val.l == 0x00000200)
661 else if (iptr[0].val.l == 0x00000400)
663 else if (iptr[0].val.l == 0x00000800)
665 else if (iptr[0].val.l == 0x00001000)
667 else if (iptr[0].val.l == 0x00002000)
669 else if (iptr[0].val.l == 0x00004000)
671 else if (iptr[0].val.l == 0x00008000)
673 else if (iptr[0].val.l == 0x00010000)
675 else if (iptr[0].val.l == 0x00020000)
677 else if (iptr[0].val.l == 0x00040000)
679 else if (iptr[0].val.l == 0x00080000)
681 else if (iptr[0].val.l == 0x00100000)
683 else if (iptr[0].val.l == 0x00200000)
685 else if (iptr[0].val.l == 0x00400000)
687 else if (iptr[0].val.l == 0x00800000)
689 else if (iptr[0].val.l == 0x01000000)
691 else if (iptr[0].val.l == 0x02000000)
693 else if (iptr[0].val.l == 0x04000000)
695 else if (iptr[0].val.l == 0x08000000)
697 else if (iptr[0].val.l == 0x10000000)
699 else if (iptr[0].val.l == 0x20000000)
701 else if (iptr[0].val.l == 0x40000000)
703 else if (iptr[0].val.l == 0x80000000)
709 iptr[0].opc = ICMD_LMULPOW2;
710 goto icmd_lconst_tail;
711 # endif /* SUPPORT_LONG_SHIFT */
712 #endif /* SUPPORT_LONG_MUL && SUPPORT_CONST_MUL */
715 if (iptr[0].val.l == 0x00000002)
717 else if (iptr[0].val.l == 0x00000004)
719 else if (iptr[0].val.l == 0x00000008)
721 else if (iptr[0].val.l == 0x00000010)
723 else if (iptr[0].val.l == 0x00000020)
725 else if (iptr[0].val.l == 0x00000040)
727 else if (iptr[0].val.l == 0x00000080)
729 else if (iptr[0].val.l == 0x00000100)
731 else if (iptr[0].val.l == 0x00000200)
733 else if (iptr[0].val.l == 0x00000400)
735 else if (iptr[0].val.l == 0x00000800)
737 else if (iptr[0].val.l == 0x00001000)
739 else if (iptr[0].val.l == 0x00002000)
741 else if (iptr[0].val.l == 0x00004000)
743 else if (iptr[0].val.l == 0x00008000)
745 else if (iptr[0].val.l == 0x00010000)
747 else if (iptr[0].val.l == 0x00020000)
749 else if (iptr[0].val.l == 0x00040000)
751 else if (iptr[0].val.l == 0x00080000)
753 else if (iptr[0].val.l == 0x00100000)
755 else if (iptr[0].val.l == 0x00200000)
757 else if (iptr[0].val.l == 0x00400000)
759 else if (iptr[0].val.l == 0x00800000)
761 else if (iptr[0].val.l == 0x01000000)
763 else if (iptr[0].val.l == 0x02000000)
765 else if (iptr[0].val.l == 0x04000000)
767 else if (iptr[0].val.l == 0x08000000)
769 else if (iptr[0].val.l == 0x10000000)
771 else if (iptr[0].val.l == 0x20000000)
773 else if (iptr[0].val.l == 0x40000000)
775 else if (iptr[0].val.l == 0x80000000)
781 iptr[0].opc = ICMD_LDIVPOW2;
782 goto icmd_lconst_tail;
784 if ((iptr[0].val.l == 0x00000002) ||
785 (iptr[0].val.l == 0x00000004) ||
786 (iptr[0].val.l == 0x00000008) ||
787 (iptr[0].val.l == 0x00000010) ||
788 (iptr[0].val.l == 0x00000020) ||
789 (iptr[0].val.l == 0x00000040) ||
790 (iptr[0].val.l == 0x00000080) ||
791 (iptr[0].val.l == 0x00000100) ||
792 (iptr[0].val.l == 0x00000200) ||
793 (iptr[0].val.l == 0x00000400) ||
794 (iptr[0].val.l == 0x00000800) ||
795 (iptr[0].val.l == 0x00001000) ||
796 (iptr[0].val.l == 0x00002000) ||
797 (iptr[0].val.l == 0x00004000) ||
798 (iptr[0].val.l == 0x00008000) ||
799 (iptr[0].val.l == 0x00010000) ||
800 (iptr[0].val.l == 0x00020000) ||
801 (iptr[0].val.l == 0x00040000) ||
802 (iptr[0].val.l == 0x00080000) ||
803 (iptr[0].val.l == 0x00100000) ||
804 (iptr[0].val.l == 0x00200000) ||
805 (iptr[0].val.l == 0x00400000) ||
806 (iptr[0].val.l == 0x00800000) ||
807 (iptr[0].val.l == 0x01000000) ||
808 (iptr[0].val.l == 0x02000000) ||
809 (iptr[0].val.l == 0x04000000) ||
810 (iptr[0].val.l == 0x08000000) ||
811 (iptr[0].val.l == 0x10000000) ||
812 (iptr[0].val.l == 0x20000000) ||
813 (iptr[0].val.l == 0x40000000) ||
814 (iptr[0].val.l == 0x80000000)) {
815 iptr[0].opc = ICMD_LREMPOW2;
817 goto icmd_lconst_tail;
821 #endif /* SUPPORT_LONG_DIV */
822 #if SUPPORT_LONG_LOGICAL && SUPPORT_CONST_LOGICAL
825 iptr[0].opc = ICMD_LANDCONST;
826 goto icmd_lconst_tail;
828 iptr[0].opc = ICMD_LORCONST;
829 goto icmd_lconst_tail;
831 iptr[0].opc = ICMD_LXORCONST;
832 goto icmd_lconst_tail;
833 #endif /* SUPPORT_LONG_LOGICAL && SUPPORT_CONST_LOGICAL */
834 #if !defined(NOLONG_CONDITIONAL)
836 if ((len > 1) && (iptr[2].val.i == 0)) {
837 switch (iptr[2].opc) {
839 iptr[0].opc = ICMD_IF_LEQ;
840 icmd_lconst_lcmp_tail:
841 iptr[0].op1 = iptr[2].op1;
844 /* iptr[1].opc = ICMD_NOP;
845 iptr[2].opc = ICMD_NOP; */
847 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
849 iptr[0].target = (void *) tbptr;
851 MARKREACHED(tbptr, copy);
852 COUNT(count_pcmd_bra);
853 COUNT(count_pcmd_op);
856 iptr[0].opc = ICMD_IF_LNE;
857 goto icmd_lconst_lcmp_tail;
859 iptr[0].opc = ICMD_IF_LLT;
860 goto icmd_lconst_lcmp_tail;
862 iptr[0].opc = ICMD_IF_LGT;
863 goto icmd_lconst_lcmp_tail;
865 iptr[0].opc = ICMD_IF_LLE;
866 goto icmd_lconst_lcmp_tail;
868 iptr[0].opc = ICMD_IF_LGE;
869 goto icmd_lconst_lcmp_tail;
872 } /* switch (iptr[2].opc) */
873 } /* if (iptr[2].val.i == 0) */
877 #endif /* !defined(NOLONG_CONDITIONAL) */
879 #if SUPPORT_CONST_STORE
881 #if SUPPORT_CONST_STORE_ZERO_ONLY
882 if (iptr[0].val.l == 0) {
883 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
884 iptr[0].opc = ICMD_LASTORECONST;
885 iptr[1].opc = ICMD_NOP;
886 OPTT2_0(TYPE_INT, TYPE_ADR);
887 COUNT(count_pcmd_op);
888 #if SUPPORT_CONST_STORE_ZERO_ONLY
891 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
896 #if SUPPORT_CONST_STORE_ZERO_ONLY
897 if (iptr[0].val.l == 0) {
898 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
899 switch (iptr[1].opc) {
901 iptr[0].opc = ICMD_PUTSTATICCONST;
905 iptr[0].opc = ICMD_PUTFIELDCONST;
910 iptr[1].opc = ICMD_NOP;
911 iptr[0].op1 = TYPE_LNG;
912 COUNT(count_pcmd_op);
913 #if SUPPORT_CONST_STORE_ZERO_ONLY
916 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
918 #endif /* SUPPORT_CONST_STORE */
928 COUNT(count_pcmd_load);
933 COUNT(count_pcmd_load);
938 COUNT(count_pcmd_load);
939 #if SUPPORT_CONST_STORE
940 if (len > 0 && iptr->val.a == 0) {
941 switch (iptr[1].opc) {
942 #if !defined(__POWERPC__) && !defined(__X86_64__)
944 if (iptr[1].val.fp != BUILTIN_aastore) {
952 switch (iptr[1].opc) {
954 iptr[0].opc = ICMD_AASTORECONST;
955 OPTT2_0(TYPE_INT, TYPE_ADR);
958 iptr[0].opc = ICMD_PUTSTATICCONST;
959 iptr[0].op1 = TYPE_ADR;
963 iptr[0].opc = ICMD_PUTFIELDCONST;
964 iptr[0].op1 = TYPE_ADR;
969 iptr[1].opc = ICMD_NOP;
970 COUNT(count_pcmd_op);
977 #endif /* SUPPORT_CONST_STORE */
981 /* pop 0 push 1 load */
988 COUNT(count_load_instruction);
989 i = opcode-ICMD_ILOAD;
990 iptr->op1 = argren[iptr->op1];
991 rd->locals[iptr->op1][i].type = i;
992 LOAD(i, LOCALVAR, iptr->op1);
1002 COUNT(count_check_null);
1003 COUNT(count_check_bound);
1004 COUNT(count_pcmd_mem);
1005 OP2IAT_1(opcode-ICMD_IALOAD);
1011 COUNT(count_check_null);
1012 COUNT(count_check_bound);
1013 COUNT(count_pcmd_mem);
1017 /* pop 0 push 0 iinc */
1020 #if defined(STATISTICS)
1024 count_store_depth[10]++;
1026 count_store_depth[i]++;
1032 if ((copy->varkind == LOCALVAR) &&
1033 (copy->varnum == iptr->op1)) {
1034 copy->varkind = TEMPVAR;
1043 /* pop 1 push 0 store */
1053 i = opcode - ICMD_ISTORE;
1054 rd->locals[iptr->op1][i].type = i;
1055 #if defined(STATISTICS)
1060 count_store_length[20]++;
1062 count_store_length[i]++;
1065 count_store_depth[10]++;
1067 count_store_depth[i]++;
1070 copy = curstack->prev;
1073 if ((copy->varkind == LOCALVAR) &&
1074 (copy->varnum == iptr->op1)) {
1075 copy->varkind = TEMPVAR;
1081 if ((new - curstack) == 1) {
1082 curstack->varkind = LOCALVAR;
1083 curstack->varnum = iptr->op1;
1085 STORE(opcode-ICMD_ISTORE);
1091 #if defined(__POWERPC__) || defined(__X86_64__)
1092 COUNT(count_check_null);
1093 COUNT(count_check_bound);
1094 COUNT(count_pcmd_mem);
1096 bte = (builtintable_entry *) iptr->val.a;
1100 if (md->memuse > rd->memuse)
1101 rd->memuse = md->memuse;
1102 if (md->argintreguse > rd->argintreguse)
1103 rd->argintreguse = md->argintreguse;
1105 /* make all stack variables saved */
1109 copy->flags |= SAVEDVAR;
1121 COUNT(count_check_null);
1122 COUNT(count_check_bound);
1123 COUNT(count_pcmd_mem);
1124 OP3TIA_0(opcode - ICMD_IASTORE);
1130 COUNT(count_check_null);
1131 COUNT(count_check_bound);
1132 COUNT(count_pcmd_mem);
1139 #ifdef TYPECHECK_STACK_COMPCAT
1142 if (IS_2_WORD_TYPE(curstack->type)) {
1143 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1156 md_return_alloc(m, rd, opcode - ICMD_IRETURN, curstack);
1157 COUNT(count_pcmd_return);
1158 OP1_0(opcode - ICMD_IRETURN);
1159 superblockend = true;
1163 COUNT(count_check_null);
1167 superblockend = true;
1170 case ICMD_PUTSTATIC:
1171 COUNT(count_pcmd_mem);
1175 /* pop 1 push 0 branch */
1178 case ICMD_IFNONNULL:
1179 COUNT(count_pcmd_bra);
1181 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1183 iptr[0].target = (void *) tbptr;
1185 MARKREACHED(tbptr, copy);
1197 COUNT(count_pcmd_bra);
1198 #if CONDITIONAL_LOADCONST
1199 tbptr = m->basicblocks + b_index;
1200 if ((b_count >= 3) &&
1201 ((b_index + 2) == m->basicblockindex[iptr[0].op1]) &&
1202 (tbptr[1].pre_count == 1) &&
1203 (tbptr[1].iinstr[0].opc == ICMD_ICONST) &&
1204 (tbptr[1].iinstr[1].opc == ICMD_GOTO) &&
1205 ((b_index + 3) == m->basicblockindex[tbptr[1].iinstr[1].op1]) &&
1206 (tbptr[2].pre_count == 1) &&
1207 (tbptr[2].iinstr[0].opc == ICMD_ICONST) &&
1208 (tbptr[2].icount==1)) {
1209 /*printf("tbptr[2].icount=%d\n",tbptr[2].icount);*/
1210 OP1_1(TYPE_INT, TYPE_INT);
1211 switch (iptr[0].opc) {
1213 iptr[0].opc = ICMD_IFNE_ICONST;
1216 iptr[0].opc = ICMD_IFEQ_ICONST;
1219 iptr[0].opc = ICMD_IFGE_ICONST;
1222 iptr[0].opc = ICMD_IFLT_ICONST;
1225 iptr[0].opc = ICMD_IFLE_ICONST;
1228 iptr[0].opc = ICMD_IFGT_ICONST;
1232 iptr[0].val.i = iptr[1].val.i;
1233 iptr[1].opc = ICMD_ELSE_ICONST;
1234 iptr[1].val.i = iptr[3].val.i;
1235 iptr[2].opc = ICMD_NOP;
1236 iptr[3].opc = ICMD_NOP;
1238 /* HACK: save compare value in iptr[1].op1 */
1239 iptr[1].op1 = iptr[0].val.i;
1240 iptr[0].val.i = tbptr[1].iinstr[0].val.i;
1241 iptr[1].opc = ICMD_ELSE_ICONST;
1242 iptr[1].val.i = tbptr[2].iinstr[0].val.i;
1243 tbptr[1].iinstr[0].opc = ICMD_NOP;
1244 tbptr[1].iinstr[1].opc = ICMD_NOP;
1245 tbptr[2].iinstr[0].opc = ICMD_NOP;
1247 tbptr[1].flags = BBDELETED;
1248 tbptr[2].flags = BBDELETED;
1249 tbptr[1].icount = 0;
1250 tbptr[2].icount = 0;
1251 if (tbptr[3].pre_count == 2) {
1252 len += tbptr[3].icount + 3;
1253 bptr->icount += tbptr[3].icount + 3;
1254 tbptr[3].flags = BBDELETED;
1255 tbptr[3].icount = 0;
1265 #endif /* CONDITIONAL_LOADCONST */
1268 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1270 iptr[0].target = (void *) tbptr;
1272 MARKREACHED(tbptr, copy);
1275 /* pop 0 push 0 branch */
1278 COUNT(count_pcmd_bra);
1279 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1281 iptr[0].target = (void *) tbptr;
1283 MARKREACHED(tbptr, copy);
1285 superblockend = true;
1288 /* pop 1 push 0 table branch */
1290 case ICMD_TABLESWITCH:
1291 COUNT(count_pcmd_table);
1293 s4ptr = iptr->val.a;
1294 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1295 MARKREACHED(tbptr, copy);
1296 i = *s4ptr++; /* low */
1297 i = *s4ptr++ - i + 1; /* high */
1299 tptr = DMNEW(void*, i+1);
1300 iptr->target = (void *) tptr;
1302 tptr[0] = (void *) tbptr;
1306 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1308 tptr[0] = (void *) tbptr;
1311 MARKREACHED(tbptr, copy);
1314 superblockend = true;
1317 /* pop 1 push 0 table branch */
1319 case ICMD_LOOKUPSWITCH:
1320 COUNT(count_pcmd_table);
1322 s4ptr = iptr->val.a;
1323 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1324 MARKREACHED(tbptr, copy);
1325 i = *s4ptr++; /* count */
1327 tptr = DMNEW(void*, i+1);
1328 iptr->target = (void *) tptr;
1330 tptr[0] = (void *) tbptr;
1334 tbptr = m->basicblocks + m->basicblockindex[s4ptr[1]];
1336 tptr[0] = (void *) tbptr;
1339 MARKREACHED(tbptr, copy);
1343 superblockend = true;
1346 case ICMD_MONITORENTER:
1347 COUNT(count_check_null);
1348 case ICMD_MONITOREXIT:
1352 /* pop 2 push 0 branch */
1354 case ICMD_IF_ICMPEQ:
1355 case ICMD_IF_ICMPNE:
1356 case ICMD_IF_ICMPLT:
1357 case ICMD_IF_ICMPGE:
1358 case ICMD_IF_ICMPGT:
1359 case ICMD_IF_ICMPLE:
1360 COUNT(count_pcmd_bra);
1362 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1364 iptr[0].target = (void *) tbptr;
1366 MARKREACHED(tbptr, copy);
1369 case ICMD_IF_ACMPEQ:
1370 case ICMD_IF_ACMPNE:
1371 COUNT(count_pcmd_bra);
1373 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1375 iptr[0].target = (void *) tbptr;
1377 MARKREACHED(tbptr, copy);
1383 COUNT(count_check_null);
1384 COUNT(count_pcmd_mem);
1385 OPTT2_0(iptr->op1,TYPE_ADR);
1390 if (!IS_2_WORD_TYPE(curstack->type)) {
1392 #ifdef TYPECHECK_STACK_COMPCAT
1395 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1396 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1401 OP1_0ANY; /* second pop */
1404 iptr->opc = ICMD_POP;
1408 /* pop 0 push 1 dup */
1411 #ifdef TYPECHECK_STACK_COMPCAT
1414 if (IS_2_WORD_TYPE(curstack->type)) {
1415 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1420 COUNT(count_dup_instruction);
1426 if (IS_2_WORD_TYPE(curstack->type)) {
1428 iptr->opc = ICMD_DUP;
1433 /* ..., ????, cat1 */
1434 #ifdef TYPECHECK_STACK_COMPCAT
1436 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1437 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1443 NEWSTACK(copy->prev->type, copy->prev->varkind,
1444 copy->prev->varnum);
1445 NEWSTACK(copy->type, copy->varkind,
1452 /* pop 2 push 3 dup */
1455 #ifdef TYPECHECK_STACK_COMPCAT
1458 if (IS_2_WORD_TYPE(curstack->type) ||
1459 IS_2_WORD_TYPE(curstack->prev->type)) {
1460 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1470 if (IS_2_WORD_TYPE(curstack->type)) {
1471 /* ..., ????, cat2 */
1472 #ifdef TYPECHECK_STACK_COMPCAT
1474 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1475 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1480 iptr->opc = ICMD_DUP_X1;
1484 /* ..., ????, cat1 */
1485 #ifdef TYPECHECK_STACK_COMPCAT
1488 if (IS_2_WORD_TYPE(curstack->prev->type)
1489 || IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1490 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1499 /* pop 3 push 4 dup */
1503 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1504 /* ..., cat2, ???? */
1505 #ifdef TYPECHECK_STACK_COMPCAT
1507 if (IS_2_WORD_TYPE(curstack->type)) {
1508 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1513 iptr->opc = ICMD_DUP_X1;
1517 /* ..., cat1, ???? */
1518 #ifdef TYPECHECK_STACK_COMPCAT
1521 if (IS_2_WORD_TYPE(curstack->type)
1522 || IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1523 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1534 if (IS_2_WORD_TYPE(curstack->type)) {
1535 /* ..., ????, cat2 */
1536 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1537 /* ..., cat2, cat2 */
1538 iptr->opc = ICMD_DUP_X1;
1542 /* ..., cat1, cat2 */
1543 #ifdef TYPECHECK_STACK_COMPCAT
1546 if (IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1547 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1552 iptr->opc = ICMD_DUP_X2;
1558 /* ..., ????, ????, cat1 */
1559 if (IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1560 /* ..., cat2, ????, cat1 */
1561 #ifdef TYPECHECK_STACK_COMPCAT
1563 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1564 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1569 iptr->opc = ICMD_DUP2_X1;
1573 /* ..., cat1, ????, cat1 */
1574 #ifdef TYPECHECK_STACK_COMPCAT
1577 if (IS_2_WORD_TYPE(curstack->prev->type)
1578 || IS_2_WORD_TYPE(curstack->prev->prev->prev->type)) {
1579 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1589 /* pop 2 push 2 swap */
1592 #ifdef TYPECHECK_STACK_COMPCAT
1595 if (IS_2_WORD_TYPE(curstack->type)
1596 || IS_2_WORD_TYPE(curstack->prev->type)) {
1597 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1607 #if defined(__POWERPC__)
1610 #if !SUPPORT_DIVISION
1611 bte = (builtintable_entry *) iptr->val.a;
1615 if (md->memuse > rd->memuse)
1616 rd->memuse = md->memuse;
1617 if (md->argintreguse > rd->argintreguse)
1618 rd->argintreguse = md->argintreguse;
1620 /* make all stack variables saved */
1624 copy->flags |= SAVEDVAR;
1630 #if !SUPPORT_DIVISION
1631 bte = builtintable_get_internal(BUILTIN_idiv);
1632 iptr->opc = ICMD_BUILTIN;
1633 iptr->op1 = bte->md->paramcount;
1635 m->isleafmethod = false;
1640 #if !SUPPORT_DIVISION
1641 bte = builtintable_get_internal(BUILTIN_irem);
1642 iptr->opc = ICMD_BUILTIN;
1643 iptr->op1 = bte->md->paramcount;
1645 m->isleafmethod = false;
1659 COUNT(count_pcmd_op);
1663 #if defined(__POWERPC__)
1666 #if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
1667 bte = (builtintable_entry *) iptr->val.a;
1671 if (md->memuse > rd->memuse)
1672 rd->memuse = md->memuse;
1673 if (md->argintreguse > rd->argintreguse)
1674 rd->argintreguse = md->argintreguse;
1676 /* make all stack variables saved */
1680 copy->flags |= SAVEDVAR;
1686 #if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
1687 bte = builtintable_get_internal(BUILTIN_ldiv);
1688 iptr->opc = ICMD_BUILTIN;
1689 iptr->op1 = bte->md->paramcount;
1691 m->isleafmethod = false;
1696 #if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
1697 bte = builtintable_get_internal(BUILTIN_lrem);
1698 iptr->opc = ICMD_BUILTIN;
1699 iptr->op1 = bte->md->paramcount;
1701 m->isleafmethod = false;
1709 #if SUPPORT_LONG_LOGICAL
1713 #endif /* SUPPORT_LONG_LOGICAL */
1714 COUNT(count_pcmd_op);
1721 COUNT(count_pcmd_op);
1730 COUNT(count_pcmd_op);
1739 COUNT(count_pcmd_op);
1744 COUNT(count_pcmd_op);
1745 #if !defined(NOLONG_CONDITIONAL)
1746 if ((len > 0) && (iptr[1].val.i == 0)) {
1747 switch (iptr[1].opc) {
1749 iptr[0].opc = ICMD_IF_LCMPEQ;
1751 iptr[0].op1 = iptr[1].op1;
1754 /* iptr[1].opc = ICMD_NOP; */
1756 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1758 iptr[0].target = (void *) tbptr;
1760 MARKREACHED(tbptr, copy);
1761 COUNT(count_pcmd_bra);
1764 iptr[0].opc = ICMD_IF_LCMPNE;
1765 goto icmd_lcmp_if_tail;
1767 iptr[0].opc = ICMD_IF_LCMPLT;
1768 goto icmd_lcmp_if_tail;
1770 iptr[0].opc = ICMD_IF_LCMPGT;
1771 goto icmd_lcmp_if_tail;
1773 iptr[0].opc = ICMD_IF_LCMPLE;
1774 goto icmd_lcmp_if_tail;
1776 iptr[0].opc = ICMD_IF_LCMPGE;
1777 goto icmd_lcmp_if_tail;
1779 OPTT2_1(TYPE_LNG, TYPE_INT);
1784 OPTT2_1(TYPE_LNG, TYPE_INT);
1788 COUNT(count_pcmd_op);
1789 OPTT2_1(TYPE_FLT, TYPE_INT);
1793 COUNT(count_pcmd_op);
1794 OPTT2_1(TYPE_DBL, TYPE_INT);
1802 case ICMD_INT2SHORT:
1803 COUNT(count_pcmd_op);
1804 OP1_1(TYPE_INT, TYPE_INT);
1807 COUNT(count_pcmd_op);
1808 OP1_1(TYPE_LNG, TYPE_LNG);
1811 COUNT(count_pcmd_op);
1812 OP1_1(TYPE_FLT, TYPE_FLT);
1815 COUNT(count_pcmd_op);
1816 OP1_1(TYPE_DBL, TYPE_DBL);
1820 COUNT(count_pcmd_op);
1821 OP1_1(TYPE_INT, TYPE_LNG);
1824 COUNT(count_pcmd_op);
1825 OP1_1(TYPE_INT, TYPE_FLT);
1828 COUNT(count_pcmd_op);
1829 OP1_1(TYPE_INT, TYPE_DBL);
1832 COUNT(count_pcmd_op);
1833 OP1_1(TYPE_LNG, TYPE_INT);
1836 COUNT(count_pcmd_op);
1837 OP1_1(TYPE_LNG, TYPE_FLT);
1840 COUNT(count_pcmd_op);
1841 OP1_1(TYPE_LNG, TYPE_DBL);
1844 COUNT(count_pcmd_op);
1845 OP1_1(TYPE_FLT, TYPE_INT);
1848 COUNT(count_pcmd_op);
1849 OP1_1(TYPE_FLT, TYPE_LNG);
1852 COUNT(count_pcmd_op);
1853 OP1_1(TYPE_FLT, TYPE_DBL);
1856 COUNT(count_pcmd_op);
1857 OP1_1(TYPE_DBL, TYPE_INT);
1860 COUNT(count_pcmd_op);
1861 OP1_1(TYPE_DBL, TYPE_LNG);
1864 COUNT(count_pcmd_op);
1865 OP1_1(TYPE_DBL, TYPE_FLT);
1868 case ICMD_CHECKCAST:
1869 OP1_1(TYPE_ADR, TYPE_ADR);
1872 case ICMD_ARRAYCHECKCAST:
1873 bte = (builtintable_entry *) iptr->val.a;
1876 if (md->memuse > rd->memuse)
1877 rd->memuse = md->memuse;
1878 if (md->argintreguse > rd->argintreguse)
1879 rd->argintreguse = md->argintreguse;
1881 /* make all stack variables saved */
1885 copy->flags |= SAVEDVAR;
1889 OP1_1(TYPE_ADR, TYPE_ADR);
1892 case ICMD_INSTANCEOF:
1893 case ICMD_ARRAYLENGTH:
1894 OP1_1(TYPE_ADR, TYPE_INT);
1898 case ICMD_ANEWARRAY:
1899 OP1_1(TYPE_INT, TYPE_ADR);
1903 COUNT(count_check_null);
1904 COUNT(count_pcmd_mem);
1905 OP1_1(TYPE_ADR, iptr->op1);
1910 case ICMD_GETSTATIC:
1911 COUNT(count_pcmd_mem);
1921 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1923 iptr[0].target = (void *) tbptr;
1925 /* This is a dirty hack. The typechecker
1926 * needs it because the OP1_0ANY below
1927 * overwrites iptr->dst.
1929 iptr->val.a = (void *) iptr->dst;
1931 tbptr->type = BBTYPE_SBR;
1933 /* We need to check for overflow right here because
1934 * the pushed value is poped after MARKREACHED. */
1936 MARKREACHED(tbptr, copy);
1940 /* pop many push any */
1944 bte = (builtintable_entry *) iptr->val.a;
1948 case ICMD_INVOKESTATIC:
1949 case ICMD_INVOKESPECIAL:
1950 case ICMD_INVOKEVIRTUAL:
1951 case ICMD_INVOKEINTERFACE:
1952 COUNT(count_pcmd_met);
1954 md = um->methodref->parseddesc.md;
1955 /* if (lm->flags & ACC_STATIC) */
1956 /* {COUNT(count_check_null);} */
1960 if (md->memuse > rd->memuse)
1961 rd->memuse = md->memuse;
1962 if (md->argintreguse > rd->argintreguse)
1963 rd->argintreguse = md->argintreguse;
1964 if (md->argfltreguse > rd->argfltreguse)
1965 rd->argfltreguse = md->argfltreguse;
1970 for (i-- ; i >= 0; i--) {
1971 if (!(copy->flags & SAVEDVAR)) {
1972 copy->varkind = ARGVAR;
1974 if (md->params[i].inmemory) {
1975 copy->flags = INMEMORY;
1976 copy->regoff = md->params[i].regoff;
1979 if (IS_FLT_DBL_TYPE(copy->type))
1981 rd->argfltregs[md->params[i].regoff];
1983 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
1984 if (IS_2_WORD_TYPE(copy->type))
1985 copy->regoff = PACK_REGS(
1986 rd->argintregs[GET_LOW_REG(md->params[i].regoff)],
1987 rd->argintregs[GET_HIGH_REG(md->params[i].regoff)]);
1991 rd->argintregs[md->params[i].regoff];
1999 copy->flags |= SAVEDVAR;
2005 if (md->returntype.type != TYPE_VOID)
2006 OP0_1(md->returntype.type);
2009 case ICMD_INLINE_START:
2010 case ICMD_INLINE_END:
2014 case ICMD_MULTIANEWARRAY:
2015 if (rd->argintreguse < 3)
2016 rd->argintreguse = 3;
2021 #if defined(SPECIALMEMUSE)
2022 # if defined(__DARWIN__)
2023 if (rd->memuse < (i + INT_ARG_CNT + LA_WORD_SIZE))
2024 rd->memuse = i + LA_WORD_SIZE + INT_ARG_CNT;
2026 if (rd->memuse < (i + LA_WORD_SIZE + 3))
2027 rd->memuse = i + LA_WORD_SIZE + 3;
2030 # if defined(__I386__)
2031 if (rd->memuse < i + 3)
2032 rd->memuse = i + 3; /* n integer args spilled on stack */
2035 rd->memuse = i; /* n integer args spilled on stack */
2036 # endif /* defined(__I386__) */
2040 /* check INT type here? Currently typecheck does this. */
2041 if (!(copy->flags & SAVEDVAR)) {
2042 copy->varkind = ARGVAR;
2043 copy->varnum = i + INT_ARG_CNT;
2044 copy->flags |= INMEMORY;
2045 #if defined(SPECIALMEMUSE)
2046 # if defined(__DARWIN__)
2047 copy->regoff = i + LA_WORD_SIZE + INT_ARG_CNT;
2049 copy->regoff = i + LA_WORD_SIZE + 3;
2052 # if defined(__I386__)
2053 copy->regoff = i + 3;
2056 # endif /* defined(__I386__) */
2057 #endif /* defined(SPECIALMEMUSE) */
2062 copy->flags |= SAVEDVAR;
2070 case ICMD_CLEAR_ARGREN:
2071 for (i = iptr->op1; i < cd->maxlocals; i++)
2073 iptr->opc = opcode = ICMD_NOP;
2077 case ICMD_READONLY_ARG:
2078 case ICMD_READONLY_ARG+1:
2079 case ICMD_READONLY_ARG+2:
2080 case ICMD_READONLY_ARG+3:
2081 case ICMD_READONLY_ARG+4:
2084 if (curstack->varkind == LOCALVAR) {
2085 i = curstack->varnum;
2086 argren[iptr->op1] = i;
2089 opcode = iptr->opc = opcode - ICMD_READONLY_ARG + ICMD_ISTORE;
2096 new_exception_message(string_java_lang_InternalError,
2103 } /* while instructions */
2105 bptr->outstack = curstack;
2106 bptr->outdepth = stackdepth;
2110 superblockend = true;
2112 } /* while blocks */
2113 } while (repeat && !deadcode);
2115 #if defined(STATISTICS)
2117 if (m->basicblockcount > count_max_basic_blocks)
2118 count_max_basic_blocks = m->basicblockcount;
2119 count_basic_blocks += m->basicblockcount;
2120 if (m->instructioncount > count_max_javainstr) count_max_javainstr = m->instructioncount;
2121 count_javainstr += m->instructioncount;
2122 if (m->stackcount > count_upper_bound_new_stack)
2123 count_upper_bound_new_stack = m->stackcount;
2124 if ((new - m->stack) > count_max_new_stack)
2125 count_max_new_stack = (new - m->stack);
2127 b_count = m->basicblockcount;
2128 bptr = m->basicblocks;
2129 while (--b_count >= 0) {
2130 if (bptr->flags > BBREACHED) {
2131 if (bptr->indepth >= 10)
2132 count_block_stack[10]++;
2134 count_block_stack[bptr->indepth]++;
2137 count_block_size_distribution[len]++;
2139 count_block_size_distribution[10]++;
2141 count_block_size_distribution[11]++;
2143 count_block_size_distribution[12]++;
2145 count_block_size_distribution[13]++;
2147 count_block_size_distribution[14]++;
2149 count_block_size_distribution[15]++;
2151 count_block_size_distribution[16]++;
2153 count_block_size_distribution[17]++;
2159 count_analyse_iterations[0]++;
2160 else if (loops == 2)
2161 count_analyse_iterations[1]++;
2162 else if (loops == 3)
2163 count_analyse_iterations[2]++;
2164 else if (loops == 4)
2165 count_analyse_iterations[3]++;
2167 count_analyse_iterations[4]++;
2169 if (m->basicblockcount <= 5)
2170 count_method_bb_distribution[0]++;
2171 else if (m->basicblockcount <= 10)
2172 count_method_bb_distribution[1]++;
2173 else if (m->basicblockcount <= 15)
2174 count_method_bb_distribution[2]++;
2175 else if (m->basicblockcount <= 20)
2176 count_method_bb_distribution[3]++;
2177 else if (m->basicblockcount <= 30)
2178 count_method_bb_distribution[4]++;
2179 else if (m->basicblockcount <= 40)
2180 count_method_bb_distribution[5]++;
2181 else if (m->basicblockcount <= 50)
2182 count_method_bb_distribution[6]++;
2183 else if (m->basicblockcount <= 75)
2184 count_method_bb_distribution[7]++;
2186 count_method_bb_distribution[8]++;
2190 /* just return methodinfo* to signal everything was ok */
2196 /**********************************************************************/
2197 /* DEBUGGING HELPERS */
2198 /**********************************************************************/
2200 void icmd_print_stack(codegendata *cd, stackptr s)
2212 j = cd->maxstack - i;
2217 /* DEBUG */ /*printf("(%d,%d,%d,%d)",s->varkind,s->flags,s->regoff,s->varnum); fflush(stdout);*/
2218 if (s->flags & SAVEDVAR)
2219 switch (s->varkind) {
2221 if (s->flags & INMEMORY)
2222 printf(" M%02d", s->regoff);
2223 #ifdef HAS_ADDRESS_REGISTER_FILE
2224 else if (s->type == TYPE_ADR)
2225 printf(" R%02d", s->regoff);
2227 else if (IS_FLT_DBL_TYPE(s->type))
2228 printf(" F%02d", s->regoff);
2230 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2231 if (IS_2_WORD_TYPE(s->type))
2232 printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
2233 regs[GET_HIGH_REG(s->regoff)]);
2236 printf(" %3s", regs[s->regoff]);
2240 printf(" I%02d", s->varnum);
2243 printf(" L%02d", s->varnum);
2246 if (s->varnum == -1) {
2248 /* varkind ARGVAR "misused for this special case */
2250 } else /* "normal" Argvar */
2251 printf(" A%02d", s->varnum);
2252 #ifdef INVOKE_NEW_DEBUG
2253 if (s->flags & INMEMORY)
2254 printf("(M%i)", s->regoff);
2256 printf("(R%i)", s->regoff);
2260 printf(" !%02d", j);
2263 switch (s->varkind) {
2265 if (s->flags & INMEMORY)
2266 printf(" m%02d", s->regoff);
2267 #ifdef HAS_ADDRESS_REGISTER_FILE
2268 else if (s->type == TYPE_ADR)
2269 printf(" r%02d", s->regoff);
2271 else if (IS_FLT_DBL_TYPE(s->type))
2272 printf(" f%02d", s->regoff);
2274 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2275 if (IS_2_WORD_TYPE(s->type))
2276 printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
2277 regs[GET_HIGH_REG(s->regoff)]);
2280 printf(" %3s", regs[s->regoff]);
2284 printf(" i%02d", s->varnum);
2287 printf(" l%02d", s->varnum);
2290 if (s->varnum == -1) {
2292 /* varkind ARGVAR "misused for this special case */
2294 } else /* "normal" Argvar */
2295 printf(" a%02d", s->varnum);
2296 #ifdef INVOKE_NEW_DEBUG
2297 if (s->flags & INMEMORY)
2298 printf("(M%i)", s->regoff);
2300 printf("(R%i)", s->regoff);
2304 printf(" ?%02d", j);
2312 static void print_reg(stackptr s) {
2314 if (s->flags & SAVEDVAR)
2315 switch (s->varkind) {
2317 if (s->flags & INMEMORY)
2318 printf(" tm%02d", s->regoff);
2320 printf(" tr%02d", s->regoff);
2323 printf(" s %02d", s->varnum);
2326 printf(" l %02d", s->varnum);
2329 printf(" a %02d", s->varnum);
2332 printf(" ! %02d", s->varnum);
2335 switch (s->varkind) {
2337 if (s->flags & INMEMORY)
2338 printf(" Tm%02d", s->regoff);
2340 printf(" Tr%02d", s->regoff);
2343 printf(" S %02d", s->varnum);
2346 printf(" L %02d", s->varnum);
2349 printf(" A %02d", s->varnum);
2352 printf(" ? %02d", s->varnum);
2362 static char *jit_type[] = {
2371 void show_icmd_method(methodinfo *m, codegendata *cd, registerdata *rd)
2378 utf_fprint_classname(stdout, m->class->name);
2380 utf_fprint(stdout, m->name);
2381 utf_fprint(stdout, m->descriptor);
2382 printf("\n\nMax locals: %d\n", (int) cd->maxlocals);
2383 printf("Max stack: %d\n", (int) cd->maxstack);
2385 printf("Line number table length: %d\n", m->linenumbercount);
2387 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
2388 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
2389 printf(" L%03d ... ", ex->start->debug_nr );
2390 printf("L%03d = ", ex->end->debug_nr);
2391 printf("L%03d", ex->handler->debug_nr);
2392 printf(" (catchtype: ");
2393 if (ex->catchtype.any)
2394 if (IS_CLASSREF(ex->catchtype))
2395 utf_display_classname(ex->catchtype.ref->name);
2397 utf_display_classname(ex->catchtype.cls->name);
2403 printf("Local Table:\n");
2404 for (i = 0; i < cd->maxlocals; i++) {
2405 printf(" %3d: ", i);
2406 for (j = TYPE_INT; j <= TYPE_ADR; j++)
2407 if (rd->locals[i][j].type >= 0) {
2408 printf(" (%s) ", jit_type[j]);
2409 if (rd->locals[i][j].flags & INMEMORY)
2410 printf("m%2d", rd->locals[i][j].regoff);
2411 #ifdef HAS_ADDRESS_REGISTER_FILE
2412 else if (j == TYPE_ADR)
2413 printf("r%02d", rd->locals[i][j].regoff);
2415 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2416 printf("f%02d", rd->locals[i][j].regoff);
2418 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2419 if (IS_2_WORD_TYPE(j))
2421 regs[GET_LOW_REG(rd->locals[i][j].regoff)],
2422 regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
2425 printf("%3s", regs[rd->locals[i][j].regoff]);
2434 printf("Interface Table:\n");
2435 for (i = 0; i < cd->maxstack; i++) {
2436 if ((rd->interfaces[i][0].type >= 0) ||
2437 (rd->interfaces[i][1].type >= 0) ||
2438 (rd->interfaces[i][2].type >= 0) ||
2439 (rd->interfaces[i][3].type >= 0) ||
2440 (rd->interfaces[i][4].type >= 0)) {
2441 printf(" %3d: ", i);
2442 for (j = TYPE_INT; j <= TYPE_ADR; j++)
2443 if (rd->interfaces[i][j].type >= 0) {
2444 printf(" (%s) ", jit_type[j]);
2445 if (rd->interfaces[i][j].flags & SAVEDVAR) {
2446 if (rd->interfaces[i][j].flags & INMEMORY)
2447 printf("M%2d", rd->interfaces[i][j].regoff);
2448 #ifdef HAS_ADDRESS_REGISTER_FILE
2449 else if (j == TYPE_ADR)
2450 printf("R%02d", rd->interfaces[i][j].regoff);
2452 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2453 printf("F%02d", rd->interfaces[i][j].regoff);
2455 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2456 if (IS_2_WORD_TYPE(j))
2458 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
2459 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
2462 printf("%3s",regs[rd->interfaces[i][j].regoff]);
2466 if (rd->interfaces[i][j].flags & INMEMORY)
2467 printf("m%2d", rd->interfaces[i][j].regoff);
2468 #ifdef HAS_ADDRESS_REGISTER_FILE
2469 else if (j == TYPE_ADR)
2470 printf("r%02d", rd->interfaces[i][j].regoff);
2472 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2473 printf("f%02d", rd->interfaces[i][j].regoff);
2475 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2476 if (IS_2_WORD_TYPE(j))
2478 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
2479 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
2482 printf("%3s",regs[rd->interfaces[i][j].regoff]);
2493 if (showdisassemble) {
2494 #if defined(__I386__) || defined(__X86_64__)
2498 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen);
2499 for (i = 0; i < m->basicblocks[0].mpc;) {
2500 a = disassinstr(u1ptr);
2505 #elif defined(__XDSPCORE__)
2509 s4ptr = (s4 *) ((ptrint) m->mcode + cd->dseglen);
2510 for (i = 0; i < m->basicblocks[0].mpc;) {
2511 a = disassinstr(stdout, s4ptr);
2520 s4ptr = (s4 *) ((ptrint) m->mcode + cd->dseglen);
2521 for (i = 0; i < m->basicblocks[0].mpc; i += 4, s4ptr++) {
2528 for (bptr = m->basicblocks; bptr != NULL; bptr = bptr->next) {
2529 show_icmd_block(m, cd, bptr);
2534 void show_icmd_block(methodinfo *m, codegendata *cd, basicblock *bptr)
2540 if (bptr->flags != BBDELETED) {
2541 deadcode = bptr->flags <= BBREACHED;
2544 for (j = cd->maxstack; j > 0; j--)
2547 icmd_print_stack(cd, bptr->instack);
2548 printf("] L%03d(%d - %d) flags=%d:\n", bptr->debug_nr, bptr->icount, bptr->pre_count,bptr->flags);
2549 iptr = bptr->iinstr;
2551 for (i = 0; i < bptr->icount; i++, iptr++) {
2554 for (j = cd->maxstack; j > 0; j--)
2558 icmd_print_stack(cd, iptr->dst);
2559 printf("] %4d ", i);
2562 if (icmd_uses_tmp[iptr->opc][0])
2566 if (icmd_uses_tmp[iptr->opc][1])
2570 if (icmd_uses_tmp[iptr->opc][2])
2576 show_icmd(iptr, deadcode);
2580 if (showdisassemble && (!deadcode)) {
2581 #if defined(__I386__) || defined(__X86_64__)
2587 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen + i);
2589 if (bptr->next != NULL) {
2590 for (; i < bptr->next->mpc; ) {
2591 a = disassinstr(u1ptr);
2598 for (; u1ptr < (u1 *) ((ptrint) m->mcode + m->mcodelength); ) {
2599 a = disassinstr(u1ptr);
2605 #elif defined(__XDSPCORE__)
2611 s4ptr = (s4 *) ((ptrint) m->mcode + cd->dseglen + i);
2613 if (bptr->next != NULL) {
2614 for (; i < bptr->next->mpc;) {
2615 a = disassinstr(stdout, s4ptr);
2623 for (; s4ptr < (s4 *) ((ptrint) m->mcode + m->mcodelength); ) {
2624 a = disassinstr(stdout, s4ptr);
2635 s4ptr = (s4 *) ((ptrint) m->mcode + cd->dseglen + i);
2637 if (bptr->next != NULL) {
2638 for (; i < bptr->next->mpc; i += 4, s4ptr++)
2643 for (; s4ptr < (s4 *) ((ptrint) m->mcode + m->mcodelength); i += 4, s4ptr++)
2653 void show_icmd(instruction *iptr, bool deadcode)
2659 printf("%s", icmd_names[iptr->opc]);
2661 switch (iptr->opc) {
2662 case ICMD_IADDCONST:
2663 case ICMD_ISUBCONST:
2664 case ICMD_IMULCONST:
2668 case ICMD_IANDCONST:
2670 case ICMD_IXORCONST:
2671 case ICMD_ISHLCONST:
2672 case ICMD_ISHRCONST:
2673 case ICMD_IUSHRCONST:
2674 case ICMD_LSHLCONST:
2675 case ICMD_LSHRCONST:
2676 case ICMD_LUSHRCONST:
2678 case ICMD_ELSE_ICONST:
2679 case ICMD_IASTORECONST:
2680 case ICMD_BASTORECONST:
2681 case ICMD_CASTORECONST:
2682 case ICMD_SASTORECONST:
2683 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
2686 case ICMD_IFEQ_ICONST:
2687 case ICMD_IFNE_ICONST:
2688 case ICMD_IFLT_ICONST:
2689 case ICMD_IFGE_ICONST:
2690 case ICMD_IFGT_ICONST:
2691 case ICMD_IFLE_ICONST:
2692 printf("(%d) %d", iptr[1].op1, iptr->val.i);
2695 case ICMD_LADDCONST:
2696 case ICMD_LSUBCONST:
2697 case ICMD_LMULCONST:
2701 case ICMD_LANDCONST:
2703 case ICMD_LXORCONST:
2705 case ICMD_LASTORECONST:
2706 #if SIZEOF_VOID_P == 4
2707 printf(" %lld (0x%016llx)", iptr->val.l, iptr->val.l);
2709 printf(" %ld (0x%016lx)", iptr->val.l, iptr->val.l);
2714 printf(" %f (0x%08x)", iptr->val.f, iptr->val.i);
2718 #if SIZEOF_VOID_P == 4
2719 printf(" %g (0x%016llx)", iptr->val.d, iptr->val.l);
2721 printf(" %g (0x%016lx)", iptr->val.d, iptr->val.l);
2726 case ICMD_AASTORECONST:
2727 printf(" %p", iptr->val.a);
2733 printf(" %d, ", ((fieldinfo *) iptr->val.a)->offset);
2735 printf(" (NOT RESOLVED), ");
2736 utf_display_classname(((unresolved_field *) iptr->target)->fieldref->classref->name);
2738 utf_display(((unresolved_field *) iptr->target)->fieldref->name);
2740 utf_display(((unresolved_field *) iptr->target)->fieldref->descriptor);
2744 case ICMD_PUTSTATIC:
2745 case ICMD_GETSTATIC:
2747 if (!((fieldinfo *) iptr->val.a)->class->initialized)
2748 printf(" (NOT INITIALIZED) ");
2752 printf(" (NOT RESOLVED) ");
2753 utf_display_classname(((unresolved_field *) iptr->target)->fieldref->classref->name);
2755 utf_display(((unresolved_field *) iptr->target)->fieldref->name);
2757 utf_display(((unresolved_field *) iptr->target)->fieldref->descriptor);
2761 case ICMD_PUTSTATICCONST:
2762 case ICMD_PUTFIELDCONST:
2763 switch (iptr[1].op1) {
2765 printf(" %d,", iptr->val.i);
2768 #if SIZEOF_VOID_P == 4
2769 printf(" %lld,", iptr->val.l);
2771 printf(" %ld,", iptr->val.l);
2775 printf(" %p,", iptr->val.a);
2778 printf(" %g,", iptr->val.f);
2781 printf(" %g,", iptr->val.d);
2784 if (iptr->opc == ICMD_PUTFIELDCONST)
2785 printf(" NOT RESOLVED,");
2787 utf_display_classname(((unresolved_field *) iptr[1].target)->fieldref->classref->name);
2789 utf_display(((unresolved_field *) iptr[1].target)->fieldref->name);
2791 utf_display(((unresolved_field *) iptr[1].target)->fieldref->descriptor);
2796 printf(" %d + %d", iptr->op1, iptr->val.i);
2831 printf(" %d", iptr->op1);
2836 utf_display_classname(((classinfo *) iptr->val.a)->name);
2840 switch (iptr->op1) {
2868 case ICMD_ANEWARRAY:
2871 utf_display_classname(((classinfo *) iptr->val.a)->name);
2875 case ICMD_MULTIANEWARRAY:
2877 printf(" (NOT RESOLVED) %d ",iptr->op1);
2878 utf_display(((constant_classref *) iptr->val.a)->name);
2880 printf(" %d ",iptr->op1);
2881 utf_display_classname(((vftbl_t *) iptr->val.a)->class->name);
2885 case ICMD_CHECKCAST:
2886 case ICMD_INSTANCEOF:
2888 classinfo *c = iptr->val.a;
2890 if (c->flags & ACC_INTERFACE)
2891 printf(" (INTERFACE) ");
2893 printf(" (CLASS,%3d) ", c->vftbl->diffval);
2895 printf(" (NOT RESOLVED) ");
2897 utf_display_classname(((constant_classref *) iptr->target)->name);
2901 case ICMD_ARRAYCHECKCAST:
2903 classinfo *c = ((vftbl_t *) iptr->target)->class;
2904 if (c->flags & ACC_INTERFACE)
2905 printf(" (INTERFACE) ");
2907 printf(" (CLASS,%3d) ", c->vftbl->diffval);
2908 utf_display_classname(c->name);
2910 printf(" (NOT RESOLVED) ");
2911 utf_display_classname(((constant_classref *) iptr->target)->name);
2915 case ICMD_INLINE_START:
2916 printf("\t\t\t%s.%s%s depth=%i",iptr->method->class->name->text,iptr->method->name->text,iptr->method->descriptor->text, iptr->op1);
2918 case ICMD_INLINE_END:
2922 printf(" %s", ((builtintable_entry *) iptr->val.a)->name);
2925 case ICMD_INVOKEVIRTUAL:
2926 case ICMD_INVOKESPECIAL:
2927 case ICMD_INVOKESTATIC:
2928 case ICMD_INVOKEINTERFACE:
2930 printf(" (NOT RESOLVED) ");
2933 utf_display_classname(((unresolved_method *) iptr->target)->methodref->classref->name);
2935 utf_display(((unresolved_method *) iptr->target)->methodref->name);
2936 utf_display(((unresolved_method *) iptr->target)->methodref->descriptor);
2945 if (deadcode || !iptr->target)
2946 printf("(%d) op1=%d", iptr->val.i, iptr->op1);
2948 printf("(%d) L%03d", iptr->val.i, ((basicblock *) iptr->target)->debug_nr);
2957 if (deadcode || !iptr->target)
2958 #if SIZEOF_VOID_P == 4
2959 printf("(%lld) op1=%d", iptr->val.l, iptr->op1);
2961 printf("(%ld) op1=%d", iptr->val.l, iptr->op1);
2964 #if SIZEOF_VOID_P == 4
2965 printf("(%lld) L%03d", iptr->val.l, ((basicblock *) iptr->target)->debug_nr);
2967 printf("(%ld) L%03d", iptr->val.l, ((basicblock *) iptr->target)->debug_nr);
2974 case ICMD_IFNONNULL:
2975 case ICMD_IF_ICMPEQ:
2976 case ICMD_IF_ICMPNE:
2977 case ICMD_IF_ICMPLT:
2978 case ICMD_IF_ICMPGE:
2979 case ICMD_IF_ICMPGT:
2980 case ICMD_IF_ICMPLE:
2981 case ICMD_IF_LCMPEQ:
2982 case ICMD_IF_LCMPNE:
2983 case ICMD_IF_LCMPLT:
2984 case ICMD_IF_LCMPGE:
2985 case ICMD_IF_LCMPGT:
2986 case ICMD_IF_LCMPLE:
2987 case ICMD_IF_ACMPEQ:
2988 case ICMD_IF_ACMPNE:
2989 if (deadcode || !iptr->target)
2990 printf(" op1=%d", iptr->op1);
2992 printf(" L%03d", ((basicblock *) iptr->target)->debug_nr);
2995 case ICMD_TABLESWITCH:
2996 s4ptr = (s4*)iptr->val.a;
2998 if (deadcode || !iptr->target) {
2999 printf(" %d;", *s4ptr);
3002 tptr = (void **) iptr->target;
3003 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
3007 s4ptr++; /* skip default */
3008 j = *s4ptr++; /* low */
3009 j = *s4ptr++ - j; /* high */
3011 if (deadcode || !*tptr)
3012 printf(" %d", *s4ptr++);
3014 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
3021 case ICMD_LOOKUPSWITCH:
3022 s4ptr = (s4*)iptr->val.a;
3024 if (deadcode || !iptr->target) {
3025 printf(" %d;", *s4ptr);
3028 tptr = (void **) iptr->target;
3029 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
3032 s4ptr++; /* default */
3033 j = *s4ptr++; /* count */
3036 if (deadcode || !*tptr) {
3037 s4ptr++; /* skip value */
3038 printf(" %d",*s4ptr++);
3041 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
3047 printf(" Line number: %d, method:",iptr->line);
3049 utf_display(iptr->method->class->name);
3051 utf_display(iptr->method->name); */
3056 * These are local overrides for various environment variables in Emacs.
3057 * Please do not remove this and leave it at the end of the file, where
3058 * Emacs will automagically detect them.
3059 * ---------------------------------------------------------------------
3062 * indent-tabs-mode: t