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 3218 2005-09-19 13:25:47Z 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/disass.h"
59 #include "vm/jit/jit.h"
60 #include "vm/jit/reg.h"
61 #include "vm/jit/stack.h"
62 #include "vm/jit/lsra.h"
65 /* global variables ***********************************************************/
67 #if defined(USE_THREADS)
68 static java_objectheader show_icmd_lock;
72 /* stack_init ******************************************************************
74 Initialized the stack analysis subsystem (called by jit_init).
76 *******************************************************************************/
80 #if defined(USE_THREADS)
81 /* initialize the show lock */
83 show_icmd_lock.monitorPtr = get_dummyLR();
92 /**********************************************************************/
94 /**********************************************************************/
96 /* analyse_stack uses the intermediate code created by parse.c to
97 * build a model of the JVM operand stack for the current method.
99 * The following checks are performed:
100 * - check for operand stack underflow (before each instruction)
101 * - check for operand stack overflow (after[1] each instruction)
102 * - check for matching stack depth at merging points
103 * - check for matching basic types[2] at merging points
104 * - check basic types for instruction input (except for BUILTIN*
105 * opcodes, INVOKE* opcodes and MULTIANEWARRAY)
107 * [1]) Checking this after the instruction should be ok. parse.c
108 * counts the number of required stack slots in such a way that it is
109 * only vital that we don't exceed `maxstack` at basic block
112 * [2]) 'basic types' means the distinction between INT, LONG, FLOAT,
113 * DOUBLE and ADDRESS types. Subtypes of INT and different ADDRESS
114 * types are not discerned.
117 methodinfo *analyse_stack(methodinfo *m, codegendata *cd, registerdata *rd)
125 int opcode, i, len, loops;
126 int superblockend, repeat, deadcode;
134 builtintable_entry *bte;
135 unresolved_method *um;
142 argren = DMNEW(s4, cd->maxlocals); /* table for argument renaming */
143 for (i = 0; i < cd->maxlocals; i++)
148 m->basicblocks[0].flags = BBREACHED;
149 m->basicblocks[0].instack = 0;
150 m->basicblocks[0].indepth = 0;
152 for (i = 0; i < cd->exceptiontablelength; i++) {
153 bptr = &m->basicblocks[m->basicblockindex[cd->exceptiontable[i].handlerpc]];
154 bptr->flags = BBREACHED;
155 bptr->type = BBTYPE_EXH;
158 bptr->pre_count = 10000;
163 #if CONDITIONAL_LOADCONST
164 b_count = m->basicblockcount;
165 bptr = m->basicblocks;
166 while (--b_count >= 0) {
167 if (bptr->icount != 0) {
168 iptr = bptr->iinstr + bptr->icount - 1;
201 m->basicblocks[m->basicblockindex[iptr->op1]].pre_count++;
204 case ICMD_TABLESWITCH:
206 m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
207 i = *s4ptr++; /* low */
208 i = *s4ptr++ - i + 1; /* high */
210 m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
214 case ICMD_LOOKUPSWITCH:
216 m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
217 i = *s4ptr++; /* count */
219 m->basicblocks[m->basicblockindex[s4ptr[1]]].pre_count++;
230 #endif /* CONDITIONAL_LOADCONST */
235 b_count = m->basicblockcount;
236 bptr = m->basicblocks;
237 superblockend = true;
242 while (--b_count >= 0) {
243 if (bptr->flags == BBDELETED) {
246 } else if (superblockend && (bptr->flags < BBREACHED)) {
249 } else if (bptr->flags <= BBREACHED) {
251 stackdepth = bptr->indepth;
253 } else if (bptr->flags < BBREACHED) {
255 bptr->instack = copy;
256 bptr->indepth = stackdepth;
258 } else if (bptr->indepth != stackdepth) {
259 show_icmd_method(m, cd, rd);
260 printf("Block: %d, required depth: %d, current depth: %d\n", bptr->debug_nr, bptr->indepth, stackdepth);
261 log_text("Stack depth mismatch");
265 curstack = bptr->instack;
267 superblockend = false;
268 bptr->flags = BBFINISHED;
271 b_index = bptr - m->basicblocks;
275 /* XXX TWISTI: why is this set to NULL here? */
276 /* iptr->target = NULL; */
278 #if defined(USEBUILTINTABLE)
279 # if defined(ENABLE_INTRP)
282 bte = builtintable_get_automatic(opcode);
284 if (bte && bte->opcode == opcode) {
285 iptr->opc = ICMD_BUILTIN;
286 iptr->op1 = bte->md->paramcount;
288 m->isleafmethod = false;
291 # if defined(ENABLE_INTRP)
294 #endif /* defined(USEBUILTINTABLE) */
301 COUNT(count_check_null);
303 case ICMD_CHECKASIZE:
304 case ICMD_CHECKEXCEPTION:
306 case ICMD_IFEQ_ICONST:
307 case ICMD_IFNE_ICONST:
308 case ICMD_IFLT_ICONST:
309 case ICMD_IFGE_ICONST:
310 case ICMD_IFGT_ICONST:
311 case ICMD_IFLE_ICONST:
312 case ICMD_ELSE_ICONST:
317 #if defined(ENABLE_INTRP)
320 rd->locals[iptr->op1][TYPE_ADR].type = TYPE_ADR;
322 COUNT(count_pcmd_return);
324 superblockend = true;
327 /* pop 0 push 1 const */
330 COUNT(count_pcmd_load);
332 switch (iptr[1].opc) {
334 iptr[0].opc = ICMD_IADDCONST;
336 iptr[1].opc = ICMD_NOP;
337 OP1_1(TYPE_INT, TYPE_INT);
338 COUNT(count_pcmd_op);
341 iptr[0].opc = ICMD_ISUBCONST;
342 goto icmd_iconst_tail;
343 #if SUPPORT_CONST_MUL
345 iptr[0].opc = ICMD_IMULCONST;
346 goto icmd_iconst_tail;
347 #else /* SUPPORT_CONST_MUL */
349 if (iptr[0].val.i == 0x00000002)
351 else if (iptr[0].val.i == 0x00000004)
353 else if (iptr[0].val.i == 0x00000008)
355 else if (iptr[0].val.i == 0x00000010)
357 else if (iptr[0].val.i == 0x00000020)
359 else if (iptr[0].val.i == 0x00000040)
361 else if (iptr[0].val.i == 0x00000080)
363 else if (iptr[0].val.i == 0x00000100)
365 else if (iptr[0].val.i == 0x00000200)
367 else if (iptr[0].val.i == 0x00000400)
369 else if (iptr[0].val.i == 0x00000800)
371 else if (iptr[0].val.i == 0x00001000)
373 else if (iptr[0].val.i == 0x00002000)
375 else if (iptr[0].val.i == 0x00004000)
377 else if (iptr[0].val.i == 0x00008000)
379 else if (iptr[0].val.i == 0x00010000)
381 else if (iptr[0].val.i == 0x00020000)
383 else if (iptr[0].val.i == 0x00040000)
385 else if (iptr[0].val.i == 0x00080000)
387 else if (iptr[0].val.i == 0x00100000)
389 else if (iptr[0].val.i == 0x00200000)
391 else if (iptr[0].val.i == 0x00400000)
393 else if (iptr[0].val.i == 0x00800000)
395 else if (iptr[0].val.i == 0x01000000)
397 else if (iptr[0].val.i == 0x02000000)
399 else if (iptr[0].val.i == 0x04000000)
401 else if (iptr[0].val.i == 0x08000000)
403 else if (iptr[0].val.i == 0x10000000)
405 else if (iptr[0].val.i == 0x20000000)
407 else if (iptr[0].val.i == 0x40000000)
409 else if (iptr[0].val.i == 0x80000000)
415 iptr[0].opc = ICMD_IMULPOW2;
416 goto icmd_iconst_tail;
417 #endif /* SUPPORT_CONST_MUL */
419 if (iptr[0].val.i == 0x00000002)
421 else if (iptr[0].val.i == 0x00000004)
423 else if (iptr[0].val.i == 0x00000008)
425 else if (iptr[0].val.i == 0x00000010)
427 else if (iptr[0].val.i == 0x00000020)
429 else if (iptr[0].val.i == 0x00000040)
431 else if (iptr[0].val.i == 0x00000080)
433 else if (iptr[0].val.i == 0x00000100)
435 else if (iptr[0].val.i == 0x00000200)
437 else if (iptr[0].val.i == 0x00000400)
439 else if (iptr[0].val.i == 0x00000800)
441 else if (iptr[0].val.i == 0x00001000)
443 else if (iptr[0].val.i == 0x00002000)
445 else if (iptr[0].val.i == 0x00004000)
447 else if (iptr[0].val.i == 0x00008000)
449 else if (iptr[0].val.i == 0x00010000)
451 else if (iptr[0].val.i == 0x00020000)
453 else if (iptr[0].val.i == 0x00040000)
455 else if (iptr[0].val.i == 0x00080000)
457 else if (iptr[0].val.i == 0x00100000)
459 else if (iptr[0].val.i == 0x00200000)
461 else if (iptr[0].val.i == 0x00400000)
463 else if (iptr[0].val.i == 0x00800000)
465 else if (iptr[0].val.i == 0x01000000)
467 else if (iptr[0].val.i == 0x02000000)
469 else if (iptr[0].val.i == 0x04000000)
471 else if (iptr[0].val.i == 0x08000000)
473 else if (iptr[0].val.i == 0x10000000)
475 else if (iptr[0].val.i == 0x20000000)
477 else if (iptr[0].val.i == 0x40000000)
479 else if (iptr[0].val.i == 0x80000000)
485 iptr[0].opc = ICMD_IDIVPOW2;
486 goto icmd_iconst_tail;
488 /*log_text("stack.c: ICMD_ICONST/ICMD_IREM");*/
489 if ((iptr[0].val.i == 0x00000002) ||
490 (iptr[0].val.i == 0x00000004) ||
491 (iptr[0].val.i == 0x00000008) ||
492 (iptr[0].val.i == 0x00000010) ||
493 (iptr[0].val.i == 0x00000020) ||
494 (iptr[0].val.i == 0x00000040) ||
495 (iptr[0].val.i == 0x00000080) ||
496 (iptr[0].val.i == 0x00000100) ||
497 (iptr[0].val.i == 0x00000200) ||
498 (iptr[0].val.i == 0x00000400) ||
499 (iptr[0].val.i == 0x00000800) ||
500 (iptr[0].val.i == 0x00001000) ||
501 (iptr[0].val.i == 0x00002000) ||
502 (iptr[0].val.i == 0x00004000) ||
503 (iptr[0].val.i == 0x00008000) ||
504 (iptr[0].val.i == 0x00010000) ||
505 (iptr[0].val.i == 0x00020000) ||
506 (iptr[0].val.i == 0x00040000) ||
507 (iptr[0].val.i == 0x00080000) ||
508 (iptr[0].val.i == 0x00100000) ||
509 (iptr[0].val.i == 0x00200000) ||
510 (iptr[0].val.i == 0x00400000) ||
511 (iptr[0].val.i == 0x00800000) ||
512 (iptr[0].val.i == 0x01000000) ||
513 (iptr[0].val.i == 0x02000000) ||
514 (iptr[0].val.i == 0x04000000) ||
515 (iptr[0].val.i == 0x08000000) ||
516 (iptr[0].val.i == 0x10000000) ||
517 (iptr[0].val.i == 0x20000000) ||
518 (iptr[0].val.i == 0x40000000) ||
519 (iptr[0].val.i == 0x80000000)) {
520 iptr[0].opc = ICMD_IREMPOW2;
522 goto icmd_iconst_tail;
526 #if SUPPORT_CONST_LOGICAL
528 iptr[0].opc = ICMD_IANDCONST;
529 goto icmd_iconst_tail;
531 iptr[0].opc = ICMD_IORCONST;
532 goto icmd_iconst_tail;
534 iptr[0].opc = ICMD_IXORCONST;
535 goto icmd_iconst_tail;
536 #endif /* SUPPORT_CONST_LOGICAL */
538 iptr[0].opc = ICMD_ISHLCONST;
539 goto icmd_iconst_tail;
541 iptr[0].opc = ICMD_ISHRCONST;
542 goto icmd_iconst_tail;
544 iptr[0].opc = ICMD_IUSHRCONST;
545 goto icmd_iconst_tail;
546 #if SUPPORT_LONG_SHIFT
548 iptr[0].opc = ICMD_LSHLCONST;
549 goto icmd_lconst_tail;
551 iptr[0].opc = ICMD_LSHRCONST;
552 goto icmd_lconst_tail;
554 iptr[0].opc = ICMD_LUSHRCONST;
555 goto icmd_lconst_tail;
556 #endif /* SUPPORT_LONG_SHIFT */
558 iptr[0].opc = ICMD_IFEQ;
560 iptr[0].op1 = iptr[1].op1;
561 /* IF_ICMPxx is the last instruction in the */
562 /* basic block, just remove it */
563 /* iptr[1].opc = ICMD_NOP; */
568 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
570 iptr[0].target = (void *) tbptr;
572 MARKREACHED(tbptr, copy);
573 COUNT(count_pcmd_bra);
576 iptr[0].opc = ICMD_IFLT;
577 goto icmd_if_icmp_tail;
579 iptr[0].opc = ICMD_IFLE;
580 goto icmd_if_icmp_tail;
582 iptr[0].opc = ICMD_IFNE;
583 goto icmd_if_icmp_tail;
585 iptr[0].opc = ICMD_IFGT;
586 goto icmd_if_icmp_tail;
588 iptr[0].opc = ICMD_IFGE;
589 goto icmd_if_icmp_tail;
591 #if SUPPORT_CONST_STORE
596 # if defined(ENABLE_INTRP)
599 #if SUPPORT_CONST_STORE_ZERO_ONLY
600 if (iptr[0].val.i == 0) {
601 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
602 switch (iptr[1].opc) {
604 iptr[0].opc = ICMD_IASTORECONST;
607 iptr[0].opc = ICMD_BASTORECONST;
610 iptr[0].opc = ICMD_CASTORECONST;
613 iptr[0].opc = ICMD_SASTORECONST;
617 iptr[1].opc = ICMD_NOP;
618 OPTT2_0(TYPE_INT, TYPE_ADR);
619 COUNT(count_pcmd_op);
620 #if SUPPORT_CONST_STORE_ZERO_ONLY
623 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
624 # if defined(ENABLE_INTRP)
632 #if SUPPORT_CONST_STORE_ZERO_ONLY
633 if (iptr[0].val.i == 0) {
634 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
635 switch (iptr[1].opc) {
637 iptr[0].opc = ICMD_PUTSTATICCONST;
641 iptr[0].opc = ICMD_PUTFIELDCONST;
646 iptr[1].opc = ICMD_NOP;
647 iptr[0].op1 = TYPE_INT;
648 COUNT(count_pcmd_op);
649 #if SUPPORT_CONST_STORE_ZERO_ONLY
652 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
654 #endif /* SUPPORT_CONST_STORE */
664 COUNT(count_pcmd_load);
666 switch (iptr[1].opc) {
669 iptr[0].opc = ICMD_LADDCONST;
671 iptr[1].opc = ICMD_NOP;
672 OP1_1(TYPE_LNG,TYPE_LNG);
673 COUNT(count_pcmd_op);
676 iptr[0].opc = ICMD_LSUBCONST;
677 goto icmd_lconst_tail;
678 #endif /* SUPPORT_LONG_ADD */
679 #if SUPPORT_LONG_MUL && SUPPORT_CONST_MUL
681 iptr[0].opc = ICMD_LMULCONST;
682 goto icmd_lconst_tail;
683 #else /* SUPPORT_LONG_MUL && SUPPORT_CONST_MUL */
684 # if SUPPORT_LONG_SHIFT
686 if (iptr[0].val.l == 0x00000002)
688 else if (iptr[0].val.l == 0x00000004)
690 else if (iptr[0].val.l == 0x00000008)
692 else if (iptr[0].val.l == 0x00000010)
694 else if (iptr[0].val.l == 0x00000020)
696 else if (iptr[0].val.l == 0x00000040)
698 else if (iptr[0].val.l == 0x00000080)
700 else if (iptr[0].val.l == 0x00000100)
702 else if (iptr[0].val.l == 0x00000200)
704 else if (iptr[0].val.l == 0x00000400)
706 else if (iptr[0].val.l == 0x00000800)
708 else if (iptr[0].val.l == 0x00001000)
710 else if (iptr[0].val.l == 0x00002000)
712 else if (iptr[0].val.l == 0x00004000)
714 else if (iptr[0].val.l == 0x00008000)
716 else if (iptr[0].val.l == 0x00010000)
718 else if (iptr[0].val.l == 0x00020000)
720 else if (iptr[0].val.l == 0x00040000)
722 else if (iptr[0].val.l == 0x00080000)
724 else if (iptr[0].val.l == 0x00100000)
726 else if (iptr[0].val.l == 0x00200000)
728 else if (iptr[0].val.l == 0x00400000)
730 else if (iptr[0].val.l == 0x00800000)
732 else if (iptr[0].val.l == 0x01000000)
734 else if (iptr[0].val.l == 0x02000000)
736 else if (iptr[0].val.l == 0x04000000)
738 else if (iptr[0].val.l == 0x08000000)
740 else if (iptr[0].val.l == 0x10000000)
742 else if (iptr[0].val.l == 0x20000000)
744 else if (iptr[0].val.l == 0x40000000)
746 else if (iptr[0].val.l == 0x80000000)
752 iptr[0].opc = ICMD_LMULPOW2;
753 goto icmd_lconst_tail;
754 # endif /* SUPPORT_LONG_SHIFT */
755 #endif /* SUPPORT_LONG_MUL && SUPPORT_CONST_MUL */
758 if (iptr[0].val.l == 0x00000002)
760 else if (iptr[0].val.l == 0x00000004)
762 else if (iptr[0].val.l == 0x00000008)
764 else if (iptr[0].val.l == 0x00000010)
766 else if (iptr[0].val.l == 0x00000020)
768 else if (iptr[0].val.l == 0x00000040)
770 else if (iptr[0].val.l == 0x00000080)
772 else if (iptr[0].val.l == 0x00000100)
774 else if (iptr[0].val.l == 0x00000200)
776 else if (iptr[0].val.l == 0x00000400)
778 else if (iptr[0].val.l == 0x00000800)
780 else if (iptr[0].val.l == 0x00001000)
782 else if (iptr[0].val.l == 0x00002000)
784 else if (iptr[0].val.l == 0x00004000)
786 else if (iptr[0].val.l == 0x00008000)
788 else if (iptr[0].val.l == 0x00010000)
790 else if (iptr[0].val.l == 0x00020000)
792 else if (iptr[0].val.l == 0x00040000)
794 else if (iptr[0].val.l == 0x00080000)
796 else if (iptr[0].val.l == 0x00100000)
798 else if (iptr[0].val.l == 0x00200000)
800 else if (iptr[0].val.l == 0x00400000)
802 else if (iptr[0].val.l == 0x00800000)
804 else if (iptr[0].val.l == 0x01000000)
806 else if (iptr[0].val.l == 0x02000000)
808 else if (iptr[0].val.l == 0x04000000)
810 else if (iptr[0].val.l == 0x08000000)
812 else if (iptr[0].val.l == 0x10000000)
814 else if (iptr[0].val.l == 0x20000000)
816 else if (iptr[0].val.l == 0x40000000)
818 else if (iptr[0].val.l == 0x80000000)
824 iptr[0].opc = ICMD_LDIVPOW2;
825 goto icmd_lconst_tail;
827 if ((iptr[0].val.l == 0x00000002) ||
828 (iptr[0].val.l == 0x00000004) ||
829 (iptr[0].val.l == 0x00000008) ||
830 (iptr[0].val.l == 0x00000010) ||
831 (iptr[0].val.l == 0x00000020) ||
832 (iptr[0].val.l == 0x00000040) ||
833 (iptr[0].val.l == 0x00000080) ||
834 (iptr[0].val.l == 0x00000100) ||
835 (iptr[0].val.l == 0x00000200) ||
836 (iptr[0].val.l == 0x00000400) ||
837 (iptr[0].val.l == 0x00000800) ||
838 (iptr[0].val.l == 0x00001000) ||
839 (iptr[0].val.l == 0x00002000) ||
840 (iptr[0].val.l == 0x00004000) ||
841 (iptr[0].val.l == 0x00008000) ||
842 (iptr[0].val.l == 0x00010000) ||
843 (iptr[0].val.l == 0x00020000) ||
844 (iptr[0].val.l == 0x00040000) ||
845 (iptr[0].val.l == 0x00080000) ||
846 (iptr[0].val.l == 0x00100000) ||
847 (iptr[0].val.l == 0x00200000) ||
848 (iptr[0].val.l == 0x00400000) ||
849 (iptr[0].val.l == 0x00800000) ||
850 (iptr[0].val.l == 0x01000000) ||
851 (iptr[0].val.l == 0x02000000) ||
852 (iptr[0].val.l == 0x04000000) ||
853 (iptr[0].val.l == 0x08000000) ||
854 (iptr[0].val.l == 0x10000000) ||
855 (iptr[0].val.l == 0x20000000) ||
856 (iptr[0].val.l == 0x40000000) ||
857 (iptr[0].val.l == 0x80000000)) {
858 iptr[0].opc = ICMD_LREMPOW2;
860 goto icmd_lconst_tail;
864 #endif /* SUPPORT_LONG_DIV */
865 #if SUPPORT_LONG_LOGICAL && SUPPORT_CONST_LOGICAL
868 iptr[0].opc = ICMD_LANDCONST;
869 goto icmd_lconst_tail;
871 iptr[0].opc = ICMD_LORCONST;
872 goto icmd_lconst_tail;
874 iptr[0].opc = ICMD_LXORCONST;
875 goto icmd_lconst_tail;
876 #endif /* SUPPORT_LONG_LOGICAL && SUPPORT_CONST_LOGICAL */
877 #if !defined(NOLONG_CONDITIONAL)
879 if ((len > 1) && (iptr[2].val.i == 0)) {
880 switch (iptr[2].opc) {
882 iptr[0].opc = ICMD_IF_LEQ;
883 icmd_lconst_lcmp_tail:
884 iptr[0].op1 = iptr[2].op1;
887 /* iptr[1].opc = ICMD_NOP;
888 iptr[2].opc = ICMD_NOP; */
890 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
892 iptr[0].target = (void *) tbptr;
894 MARKREACHED(tbptr, copy);
895 COUNT(count_pcmd_bra);
896 COUNT(count_pcmd_op);
899 iptr[0].opc = ICMD_IF_LNE;
900 goto icmd_lconst_lcmp_tail;
902 iptr[0].opc = ICMD_IF_LLT;
903 goto icmd_lconst_lcmp_tail;
905 iptr[0].opc = ICMD_IF_LGT;
906 goto icmd_lconst_lcmp_tail;
908 iptr[0].opc = ICMD_IF_LLE;
909 goto icmd_lconst_lcmp_tail;
911 iptr[0].opc = ICMD_IF_LGE;
912 goto icmd_lconst_lcmp_tail;
915 } /* switch (iptr[2].opc) */
916 } /* if (iptr[2].val.i == 0) */
920 #endif /* !defined(NOLONG_CONDITIONAL) */
922 #if SUPPORT_CONST_STORE
924 # if defined(ENABLE_INTRP)
927 #if SUPPORT_CONST_STORE_ZERO_ONLY
928 if (iptr[0].val.l == 0) {
929 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
930 iptr[0].opc = ICMD_LASTORECONST;
931 iptr[1].opc = ICMD_NOP;
932 OPTT2_0(TYPE_INT, TYPE_ADR);
933 COUNT(count_pcmd_op);
934 #if SUPPORT_CONST_STORE_ZERO_ONLY
937 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
938 # if defined(ENABLE_INTRP)
946 #if SUPPORT_CONST_STORE_ZERO_ONLY
947 if (iptr[0].val.l == 0) {
948 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
949 switch (iptr[1].opc) {
951 iptr[0].opc = ICMD_PUTSTATICCONST;
955 iptr[0].opc = ICMD_PUTFIELDCONST;
960 iptr[1].opc = ICMD_NOP;
961 iptr[0].op1 = TYPE_LNG;
962 COUNT(count_pcmd_op);
963 #if SUPPORT_CONST_STORE_ZERO_ONLY
966 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
968 #endif /* SUPPORT_CONST_STORE */
978 COUNT(count_pcmd_load);
983 COUNT(count_pcmd_load);
988 COUNT(count_pcmd_load);
989 #if SUPPORT_CONST_STORE
990 if (len > 0 && iptr->val.a == 0) {
991 switch (iptr[1].opc) {
992 #if !defined(__POWERPC__) && !defined(__X86_64__) && !defined(__I386__) && !defined(__ALPHA__) && !defined(__MIPS__)
994 if (iptr[1].val.fp != BUILTIN_aastore) {
1000 case ICMD_PUTSTATIC:
1002 switch (iptr[1].opc) {
1004 iptr[0].opc = ICMD_AASTORECONST;
1005 OPTT2_0(TYPE_INT, TYPE_ADR);
1007 case ICMD_PUTSTATIC:
1008 iptr[0].opc = ICMD_PUTSTATICCONST;
1009 iptr[0].op1 = TYPE_ADR;
1013 iptr[0].opc = ICMD_PUTFIELDCONST;
1014 iptr[0].op1 = TYPE_ADR;
1019 iptr[1].opc = ICMD_NOP;
1020 COUNT(count_pcmd_op);
1024 PUSHCONST(TYPE_ADR);
1027 #endif /* SUPPORT_CONST_STORE */
1028 PUSHCONST(TYPE_ADR);
1031 /* pop 0 push 1 load */
1038 COUNT(count_load_instruction);
1039 i = opcode - ICMD_ILOAD;
1040 iptr->op1 = argren[iptr->op1];
1041 #if defined(ENABLE_INTRP)
1044 rd->locals[iptr->op1][i].type = i;
1045 LOAD(i, LOCALVAR, iptr->op1);
1055 COUNT(count_check_null);
1056 COUNT(count_check_bound);
1057 COUNT(count_pcmd_mem);
1058 OP2IAT_1(opcode - ICMD_IALOAD);
1064 COUNT(count_check_null);
1065 COUNT(count_check_bound);
1066 COUNT(count_pcmd_mem);
1070 /* pop 0 push 0 iinc */
1073 #if defined(STATISTICS)
1077 count_store_depth[10]++;
1079 count_store_depth[i]++;
1085 if ((copy->varkind == LOCALVAR) &&
1086 (copy->varnum == iptr->op1)) {
1087 copy->varkind = TEMPVAR;
1096 /* pop 1 push 0 store */
1106 i = opcode - ICMD_ISTORE;
1107 #if defined(ENABLE_INTRP)
1110 rd->locals[iptr->op1][i].type = i;
1111 #if defined(STATISTICS)
1116 count_store_length[20]++;
1118 count_store_length[i]++;
1121 count_store_depth[10]++;
1123 count_store_depth[i]++;
1126 copy = curstack->prev;
1129 if ((copy->varkind == LOCALVAR) &&
1130 (copy->varnum == iptr->op1)) {
1131 copy->varkind = TEMPVAR;
1137 if ((new - curstack) == 1) {
1138 curstack->varkind = LOCALVAR;
1139 curstack->varnum = iptr->op1;
1141 STORE(opcode - ICMD_ISTORE);
1147 COUNT(count_check_null);
1148 COUNT(count_check_bound);
1149 COUNT(count_pcmd_mem);
1151 bte = (builtintable_entry *) iptr->val.a;
1155 if (md->memuse > rd->memuse)
1156 rd->memuse = md->memuse;
1157 if (md->argintreguse > rd->argintreguse)
1158 rd->argintreguse = md->argintreguse;
1160 /* make all stack variables saved */
1164 copy->flags |= SAVEDVAR;
1175 COUNT(count_check_null);
1176 COUNT(count_check_bound);
1177 COUNT(count_pcmd_mem);
1178 OP3TIA_0(opcode - ICMD_IASTORE);
1184 COUNT(count_check_null);
1185 COUNT(count_check_bound);
1186 COUNT(count_pcmd_mem);
1193 #ifdef TYPECHECK_STACK_COMPCAT
1196 if (IS_2_WORD_TYPE(curstack->type)) {
1197 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1210 md_return_alloc(m, rd, opcode - ICMD_IRETURN, curstack);
1211 COUNT(count_pcmd_return);
1212 OP1_0(opcode - ICMD_IRETURN);
1213 superblockend = true;
1217 COUNT(count_check_null);
1221 superblockend = true;
1224 case ICMD_PUTSTATIC:
1225 COUNT(count_pcmd_mem);
1229 /* pop 1 push 0 branch */
1232 case ICMD_IFNONNULL:
1233 COUNT(count_pcmd_bra);
1235 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1237 iptr[0].target = (void *) tbptr;
1239 MARKREACHED(tbptr, copy);
1248 COUNT(count_pcmd_bra);
1249 #if CONDITIONAL_LOADCONST
1250 # if defined(ENABLE_INTRP)
1253 tbptr = m->basicblocks + b_index;
1254 if ((b_count >= 3) &&
1255 ((b_index + 2) == m->basicblockindex[iptr[0].op1]) &&
1256 (tbptr[1].pre_count == 1) &&
1257 (tbptr[1].iinstr[0].opc == ICMD_ICONST) &&
1258 (tbptr[1].iinstr[1].opc == ICMD_GOTO) &&
1259 ((b_index + 3) == m->basicblockindex[tbptr[1].iinstr[1].op1]) &&
1260 (tbptr[2].pre_count == 1) &&
1261 (tbptr[2].iinstr[0].opc == ICMD_ICONST) &&
1262 (tbptr[2].icount==1)) {
1263 /*printf("tbptr[2].icount=%d\n",tbptr[2].icount);*/
1264 OP1_1(TYPE_INT, TYPE_INT);
1265 switch (iptr[0].opc) {
1267 iptr[0].opc = ICMD_IFNE_ICONST;
1270 iptr[0].opc = ICMD_IFEQ_ICONST;
1273 iptr[0].opc = ICMD_IFGE_ICONST;
1276 iptr[0].opc = ICMD_IFLT_ICONST;
1279 iptr[0].opc = ICMD_IFLE_ICONST;
1282 iptr[0].opc = ICMD_IFGT_ICONST;
1286 iptr[0].val.i = iptr[1].val.i;
1287 iptr[1].opc = ICMD_ELSE_ICONST;
1288 iptr[1].val.i = iptr[3].val.i;
1289 iptr[2].opc = ICMD_NOP;
1290 iptr[3].opc = ICMD_NOP;
1292 /* HACK: save compare value in iptr[1].op1 */
1293 iptr[1].op1 = iptr[0].val.i;
1294 iptr[0].val.i = tbptr[1].iinstr[0].val.i;
1295 iptr[1].opc = ICMD_ELSE_ICONST;
1296 iptr[1].val.i = tbptr[2].iinstr[0].val.i;
1297 tbptr[1].iinstr[0].opc = ICMD_NOP;
1298 tbptr[1].iinstr[1].opc = ICMD_NOP;
1299 tbptr[2].iinstr[0].opc = ICMD_NOP;
1301 tbptr[1].flags = BBDELETED;
1302 tbptr[2].flags = BBDELETED;
1303 tbptr[1].icount = 0;
1304 tbptr[2].icount = 0;
1305 if (tbptr[3].pre_count == 2) {
1306 len += tbptr[3].icount + 3;
1307 bptr->icount += tbptr[3].icount + 3;
1308 tbptr[3].flags = BBDELETED;
1309 tbptr[3].icount = 0;
1319 # if defined(ENABLE_INTRP)
1323 #endif /* CONDITIONAL_LOADCONST */
1327 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1329 iptr[0].target = (void *) tbptr;
1331 MARKREACHED(tbptr, copy);
1334 /* pop 0 push 0 branch */
1337 COUNT(count_pcmd_bra);
1338 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1340 iptr[0].target = (void *) tbptr;
1342 MARKREACHED(tbptr, copy);
1344 superblockend = true;
1347 /* pop 1 push 0 table branch */
1349 case ICMD_TABLESWITCH:
1350 COUNT(count_pcmd_table);
1352 s4ptr = iptr->val.a;
1353 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1354 MARKREACHED(tbptr, copy);
1355 i = *s4ptr++; /* low */
1356 i = *s4ptr++ - i + 1; /* high */
1358 tptr = DMNEW(void*, i+1);
1359 iptr->target = (void *) tptr;
1361 tptr[0] = (void *) tbptr;
1365 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1367 tptr[0] = (void *) tbptr;
1370 MARKREACHED(tbptr, copy);
1373 superblockend = true;
1376 /* pop 1 push 0 table branch */
1378 case ICMD_LOOKUPSWITCH:
1379 COUNT(count_pcmd_table);
1381 s4ptr = iptr->val.a;
1382 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1383 MARKREACHED(tbptr, copy);
1384 i = *s4ptr++; /* count */
1386 tptr = DMNEW(void*, i+1);
1387 iptr->target = (void *) tptr;
1389 tptr[0] = (void *) tbptr;
1393 tbptr = m->basicblocks + m->basicblockindex[s4ptr[1]];
1395 tptr[0] = (void *) tbptr;
1398 MARKREACHED(tbptr, copy);
1402 superblockend = true;
1405 case ICMD_MONITORENTER:
1406 COUNT(count_check_null);
1407 case ICMD_MONITOREXIT:
1411 /* pop 2 push 0 branch */
1413 case ICMD_IF_ICMPEQ:
1414 case ICMD_IF_ICMPNE:
1415 case ICMD_IF_ICMPLT:
1416 case ICMD_IF_ICMPGE:
1417 case ICMD_IF_ICMPGT:
1418 case ICMD_IF_ICMPLE:
1419 COUNT(count_pcmd_bra);
1421 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1423 iptr[0].target = (void *) tbptr;
1425 MARKREACHED(tbptr, copy);
1428 case ICMD_IF_ACMPEQ:
1429 case ICMD_IF_ACMPNE:
1430 COUNT(count_pcmd_bra);
1432 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1434 iptr[0].target = (void *) tbptr;
1436 MARKREACHED(tbptr, copy);
1442 COUNT(count_check_null);
1443 COUNT(count_pcmd_mem);
1444 OPTT2_0(iptr->op1,TYPE_ADR);
1449 if (!IS_2_WORD_TYPE(curstack->type)) {
1451 #ifdef TYPECHECK_STACK_COMPCAT
1454 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1455 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1460 OP1_0ANY; /* second pop */
1463 iptr->opc = ICMD_POP;
1467 /* pop 0 push 1 dup */
1470 #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 COUNT(count_dup_instruction);
1485 if (IS_2_WORD_TYPE(curstack->type)) {
1487 iptr->opc = ICMD_DUP;
1492 /* ..., ????, cat1 */
1493 #ifdef TYPECHECK_STACK_COMPCAT
1495 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1496 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1502 NEWSTACK(copy->prev->type, copy->prev->varkind,
1503 copy->prev->varnum);
1504 NEWSTACK(copy->type, copy->varkind,
1511 /* pop 2 push 3 dup */
1514 #ifdef TYPECHECK_STACK_COMPCAT
1517 if (IS_2_WORD_TYPE(curstack->type) ||
1518 IS_2_WORD_TYPE(curstack->prev->type)) {
1519 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1529 if (IS_2_WORD_TYPE(curstack->type)) {
1530 /* ..., ????, cat2 */
1531 #ifdef TYPECHECK_STACK_COMPCAT
1533 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1534 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1539 iptr->opc = ICMD_DUP_X1;
1543 /* ..., ????, cat1 */
1544 #ifdef TYPECHECK_STACK_COMPCAT
1547 if (IS_2_WORD_TYPE(curstack->prev->type)
1548 || IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1549 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1558 /* pop 3 push 4 dup */
1562 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1563 /* ..., cat2, ???? */
1564 #ifdef TYPECHECK_STACK_COMPCAT
1566 if (IS_2_WORD_TYPE(curstack->type)) {
1567 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1572 iptr->opc = ICMD_DUP_X1;
1576 /* ..., cat1, ???? */
1577 #ifdef TYPECHECK_STACK_COMPCAT
1580 if (IS_2_WORD_TYPE(curstack->type)
1581 || IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1582 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1593 if (IS_2_WORD_TYPE(curstack->type)) {
1594 /* ..., ????, cat2 */
1595 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1596 /* ..., cat2, cat2 */
1597 iptr->opc = ICMD_DUP_X1;
1601 /* ..., cat1, cat2 */
1602 #ifdef TYPECHECK_STACK_COMPCAT
1605 if (IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1606 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1611 iptr->opc = ICMD_DUP_X2;
1617 /* ..., ????, ????, cat1 */
1618 if (IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1619 /* ..., cat2, ????, cat1 */
1620 #ifdef TYPECHECK_STACK_COMPCAT
1622 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1623 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1628 iptr->opc = ICMD_DUP2_X1;
1632 /* ..., cat1, ????, cat1 */
1633 #ifdef TYPECHECK_STACK_COMPCAT
1636 if (IS_2_WORD_TYPE(curstack->prev->type)
1637 || IS_2_WORD_TYPE(curstack->prev->prev->prev->type)) {
1638 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1648 /* pop 2 push 2 swap */
1651 #ifdef TYPECHECK_STACK_COMPCAT
1654 if (IS_2_WORD_TYPE(curstack->type)
1655 || IS_2_WORD_TYPE(curstack->prev->type)) {
1656 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1668 #if !SUPPORT_DIVISION
1669 bte = (builtintable_entry *) iptr->val.a;
1673 if (md->memuse > rd->memuse)
1674 rd->memuse = md->memuse;
1675 if (md->argintreguse > rd->argintreguse)
1676 rd->argintreguse = md->argintreguse;
1678 /* make all stack variables saved */
1682 copy->flags |= SAVEDVAR;
1685 #endif /* !SUPPORT_DIVISION */
1696 COUNT(count_pcmd_op);
1702 #if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
1703 bte = (builtintable_entry *) iptr->val.a;
1707 if (md->memuse > rd->memuse)
1708 rd->memuse = md->memuse;
1709 if (md->argintreguse > rd->argintreguse)
1710 rd->argintreguse = md->argintreguse;
1712 /* make all stack variables saved */
1716 copy->flags |= SAVEDVAR;
1719 #endif /* !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV) */
1724 #if SUPPORT_LONG_LOGICAL
1728 #endif /* SUPPORT_LONG_LOGICAL */
1729 COUNT(count_pcmd_op);
1736 COUNT(count_pcmd_op);
1745 COUNT(count_pcmd_op);
1754 COUNT(count_pcmd_op);
1759 COUNT(count_pcmd_op);
1760 #if !defined(NOLONG_CONDITIONAL)
1761 if ((len > 0) && (iptr[1].val.i == 0)) {
1762 switch (iptr[1].opc) {
1764 iptr[0].opc = ICMD_IF_LCMPEQ;
1766 iptr[0].op1 = iptr[1].op1;
1769 /* iptr[1].opc = ICMD_NOP; */
1771 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1773 iptr[0].target = (void *) tbptr;
1775 MARKREACHED(tbptr, copy);
1776 COUNT(count_pcmd_bra);
1779 iptr[0].opc = ICMD_IF_LCMPNE;
1780 goto icmd_lcmp_if_tail;
1782 iptr[0].opc = ICMD_IF_LCMPLT;
1783 goto icmd_lcmp_if_tail;
1785 iptr[0].opc = ICMD_IF_LCMPGT;
1786 goto icmd_lcmp_if_tail;
1788 iptr[0].opc = ICMD_IF_LCMPLE;
1789 goto icmd_lcmp_if_tail;
1791 iptr[0].opc = ICMD_IF_LCMPGE;
1792 goto icmd_lcmp_if_tail;
1794 OPTT2_1(TYPE_LNG, TYPE_INT);
1799 OPTT2_1(TYPE_LNG, TYPE_INT);
1803 COUNT(count_pcmd_op);
1804 OPTT2_1(TYPE_FLT, TYPE_INT);
1808 COUNT(count_pcmd_op);
1809 OPTT2_1(TYPE_DBL, TYPE_INT);
1817 case ICMD_INT2SHORT:
1818 COUNT(count_pcmd_op);
1819 OP1_1(TYPE_INT, TYPE_INT);
1822 COUNT(count_pcmd_op);
1823 OP1_1(TYPE_LNG, TYPE_LNG);
1826 COUNT(count_pcmd_op);
1827 OP1_1(TYPE_FLT, TYPE_FLT);
1830 COUNT(count_pcmd_op);
1831 OP1_1(TYPE_DBL, TYPE_DBL);
1835 COUNT(count_pcmd_op);
1836 OP1_1(TYPE_INT, TYPE_LNG);
1839 COUNT(count_pcmd_op);
1840 OP1_1(TYPE_INT, TYPE_FLT);
1843 COUNT(count_pcmd_op);
1844 OP1_1(TYPE_INT, TYPE_DBL);
1847 COUNT(count_pcmd_op);
1848 OP1_1(TYPE_LNG, TYPE_INT);
1851 COUNT(count_pcmd_op);
1852 OP1_1(TYPE_LNG, TYPE_FLT);
1855 COUNT(count_pcmd_op);
1856 OP1_1(TYPE_LNG, TYPE_DBL);
1859 COUNT(count_pcmd_op);
1860 OP1_1(TYPE_FLT, TYPE_INT);
1863 COUNT(count_pcmd_op);
1864 OP1_1(TYPE_FLT, TYPE_LNG);
1867 COUNT(count_pcmd_op);
1868 OP1_1(TYPE_FLT, TYPE_DBL);
1871 COUNT(count_pcmd_op);
1872 OP1_1(TYPE_DBL, TYPE_INT);
1875 COUNT(count_pcmd_op);
1876 OP1_1(TYPE_DBL, TYPE_LNG);
1879 COUNT(count_pcmd_op);
1880 OP1_1(TYPE_DBL, TYPE_FLT);
1883 case ICMD_CHECKCAST:
1884 OP1_1(TYPE_ADR, TYPE_ADR);
1887 case ICMD_ARRAYCHECKCAST:
1888 bte = (builtintable_entry *) iptr->val.a;
1891 if (md->memuse > rd->memuse)
1892 rd->memuse = md->memuse;
1893 if (md->argintreguse > rd->argintreguse)
1894 rd->argintreguse = md->argintreguse;
1896 /* make all stack variables saved */
1900 copy->flags |= SAVEDVAR;
1904 OP1_1(TYPE_ADR, TYPE_ADR);
1907 case ICMD_INSTANCEOF:
1908 case ICMD_ARRAYLENGTH:
1909 OP1_1(TYPE_ADR, TYPE_INT);
1913 case ICMD_ANEWARRAY:
1914 OP1_1(TYPE_INT, TYPE_ADR);
1918 COUNT(count_check_null);
1919 COUNT(count_pcmd_mem);
1920 OP1_1(TYPE_ADR, iptr->op1);
1925 case ICMD_GETSTATIC:
1926 COUNT(count_pcmd_mem);
1936 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1938 iptr[0].target = (void *) tbptr;
1940 /* This is a dirty hack. The typechecker
1941 * needs it because the OP1_0ANY below
1942 * overwrites iptr->dst.
1944 iptr->val.a = (void *) iptr->dst;
1946 tbptr->type = BBTYPE_SBR;
1948 /* We need to check for overflow right here because
1949 * the pushed value is poped after MARKREACHED. */
1951 MARKREACHED(tbptr, copy);
1955 /* pop many push any */
1958 #if defined(USEBUILTINTABLE)
1961 bte = (builtintable_entry *) iptr->val.a;
1965 case ICMD_INVOKESTATIC:
1966 case ICMD_INVOKESPECIAL:
1967 case ICMD_INVOKEVIRTUAL:
1968 case ICMD_INVOKEINTERFACE:
1969 COUNT(count_pcmd_met);
1971 md = um->methodref->parseddesc.md;
1972 /* if (lm->flags & ACC_STATIC) */
1973 /* {COUNT(count_check_null);} */
1977 if (md->memuse > rd->memuse)
1978 rd->memuse = md->memuse;
1979 if (md->argintreguse > rd->argintreguse)
1980 rd->argintreguse = md->argintreguse;
1981 if (md->argfltreguse > rd->argfltreguse)
1982 rd->argfltreguse = md->argfltreguse;
1987 for (i-- ; i >= 0; i--) {
1988 #if defined(SUPPORT_PASS_FLOATARGS_IN_INTREGS)
1989 /* If we pass float arguments in integer argument registers, we
1990 * are not allowed to precolor them here. Floats have to be moved
1991 * to this regs explicitly in codegen().
1992 * Only arguments that are passed by stack anyway can be precolored
1993 * (michi 2005/07/24) */
1994 if (!(copy->flags & SAVEDVAR) &&
1995 (!IS_FLT_DBL_TYPE(copy->type) || md->params[i].inmemory)) {
1997 if (!(copy->flags & SAVEDVAR)) {
1999 copy->varkind = ARGVAR;
2002 #if defined(ENABLE_INTRP)
2005 if (md->params[i].inmemory) {
2006 copy->flags = INMEMORY;
2007 copy->regoff = md->params[i].regoff;
2010 if (IS_FLT_DBL_TYPE(copy->type))
2011 #if defined(SUPPORT_PASS_FLOATARGS_IN_INTREGS)
2015 rd->argfltregs[md->params[i].regoff];
2018 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2019 if (IS_2_WORD_TYPE(copy->type))
2020 copy->regoff = PACK_REGS(
2021 rd->argintregs[GET_LOW_REG(md->params[i].regoff)],
2022 rd->argintregs[GET_HIGH_REG(md->params[i].regoff)]);
2026 rd->argintregs[md->params[i].regoff];
2029 #if defined(ENABLE_INTRP)
2037 copy->flags |= SAVEDVAR;
2043 if (md->returntype.type != TYPE_VOID)
2044 OP0_1(md->returntype.type);
2047 case ICMD_INLINE_START:
2048 case ICMD_INLINE_END:
2052 case ICMD_MULTIANEWARRAY:
2053 if (rd->argintreguse < 3)
2054 rd->argintreguse = 3;
2059 #if defined(SPECIALMEMUSE)
2060 # if defined(__DARWIN__)
2061 if (rd->memuse < (i + INT_ARG_CNT + LA_WORD_SIZE))
2062 rd->memuse = i + LA_WORD_SIZE + INT_ARG_CNT;
2064 if (rd->memuse < (i + LA_WORD_SIZE + 3))
2065 rd->memuse = i + LA_WORD_SIZE + 3;
2068 # if defined(__I386__)
2069 if (rd->memuse < i + 3)
2070 rd->memuse = i + 3; /* n integer args spilled on stack */
2073 rd->memuse = i; /* n integer args spilled on stack */
2074 # endif /* defined(__I386__) */
2078 /* check INT type here? Currently typecheck does this. */
2079 if (!(copy->flags & SAVEDVAR)) {
2080 copy->varkind = ARGVAR;
2081 copy->varnum = i + INT_ARG_CNT;
2082 copy->flags |= INMEMORY;
2083 #if defined(SPECIALMEMUSE)
2084 # if defined(__DARWIN__)
2085 copy->regoff = i + LA_WORD_SIZE + INT_ARG_CNT;
2087 copy->regoff = i + LA_WORD_SIZE + 3;
2090 # if defined(__I386__)
2091 copy->regoff = i + 3;
2094 # endif /* defined(__I386__) */
2095 #endif /* defined(SPECIALMEMUSE) */
2100 copy->flags |= SAVEDVAR;
2108 case ICMD_CLEAR_ARGREN:
2109 for (i = iptr->op1; i < cd->maxlocals; i++)
2111 iptr->opc = opcode = ICMD_NOP;
2115 case ICMD_READONLY_ARG:
2116 case ICMD_READONLY_ARG+1:
2117 case ICMD_READONLY_ARG+2:
2118 case ICMD_READONLY_ARG+3:
2119 case ICMD_READONLY_ARG+4:
2122 if (curstack->varkind == LOCALVAR) {
2123 i = curstack->varnum;
2124 argren[iptr->op1] = i;
2127 opcode = iptr->opc = opcode - ICMD_READONLY_ARG + ICMD_ISTORE;
2134 new_exception_message(string_java_lang_InternalError,
2141 } /* while instructions */
2143 bptr->outstack = curstack;
2144 bptr->outdepth = stackdepth;
2148 superblockend = true;
2150 } /* while blocks */
2151 } while (repeat && !deadcode);
2153 #if defined(STATISTICS)
2155 if (m->basicblockcount > count_max_basic_blocks)
2156 count_max_basic_blocks = m->basicblockcount;
2157 count_basic_blocks += m->basicblockcount;
2158 if (m->instructioncount > count_max_javainstr) count_max_javainstr = m->instructioncount;
2159 count_javainstr += m->instructioncount;
2160 if (m->stackcount > count_upper_bound_new_stack)
2161 count_upper_bound_new_stack = m->stackcount;
2162 if ((new - m->stack) > count_max_new_stack)
2163 count_max_new_stack = (new - m->stack);
2165 b_count = m->basicblockcount;
2166 bptr = m->basicblocks;
2167 while (--b_count >= 0) {
2168 if (bptr->flags > BBREACHED) {
2169 if (bptr->indepth >= 10)
2170 count_block_stack[10]++;
2172 count_block_stack[bptr->indepth]++;
2175 count_block_size_distribution[len]++;
2177 count_block_size_distribution[10]++;
2179 count_block_size_distribution[11]++;
2181 count_block_size_distribution[12]++;
2183 count_block_size_distribution[13]++;
2185 count_block_size_distribution[14]++;
2187 count_block_size_distribution[15]++;
2189 count_block_size_distribution[16]++;
2191 count_block_size_distribution[17]++;
2197 count_analyse_iterations[0]++;
2198 else if (loops == 2)
2199 count_analyse_iterations[1]++;
2200 else if (loops == 3)
2201 count_analyse_iterations[2]++;
2202 else if (loops == 4)
2203 count_analyse_iterations[3]++;
2205 count_analyse_iterations[4]++;
2207 if (m->basicblockcount <= 5)
2208 count_method_bb_distribution[0]++;
2209 else if (m->basicblockcount <= 10)
2210 count_method_bb_distribution[1]++;
2211 else if (m->basicblockcount <= 15)
2212 count_method_bb_distribution[2]++;
2213 else if (m->basicblockcount <= 20)
2214 count_method_bb_distribution[3]++;
2215 else if (m->basicblockcount <= 30)
2216 count_method_bb_distribution[4]++;
2217 else if (m->basicblockcount <= 40)
2218 count_method_bb_distribution[5]++;
2219 else if (m->basicblockcount <= 50)
2220 count_method_bb_distribution[6]++;
2221 else if (m->basicblockcount <= 75)
2222 count_method_bb_distribution[7]++;
2224 count_method_bb_distribution[8]++;
2228 /* just return methodinfo* to signal everything was ok */
2234 /**********************************************************************/
2235 /* DEBUGGING HELPERS */
2236 /**********************************************************************/
2238 void icmd_print_stack(codegendata *cd, stackptr s)
2250 j = cd->maxstack - i;
2256 if (s->flags & SAVEDVAR)
2257 switch (s->varkind) {
2259 if (s->flags & INMEMORY)
2260 printf(" M%02d", s->regoff);
2261 #ifdef HAS_ADDRESS_REGISTER_FILE
2262 else if (s->type == TYPE_ADR)
2263 printf(" R%02d", s->regoff);
2265 else if (IS_FLT_DBL_TYPE(s->type))
2266 printf(" F%02d", s->regoff);
2268 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2269 if (IS_2_WORD_TYPE(s->type))
2270 printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
2271 regs[GET_HIGH_REG(s->regoff)]);
2274 #if defined(ENABLE_INTRP)
2275 printf(" %3d", s->regoff);
2277 printf(" %3s", regs[s->regoff]);
2282 printf(" I%02d", s->varnum);
2285 printf(" L%02d", s->varnum);
2288 if (s->varnum == -1) {
2290 /* varkind ARGVAR "misused for this special case */
2292 } else /* "normal" Argvar */
2293 printf(" A%02d", s->varnum);
2294 #ifdef INVOKE_NEW_DEBUG
2295 if (s->flags & INMEMORY)
2296 printf("(M%i)", s->regoff);
2298 printf("(R%i)", s->regoff);
2302 printf(" !%02d", j);
2305 switch (s->varkind) {
2307 if (s->flags & INMEMORY)
2308 printf(" m%02d", s->regoff);
2309 #ifdef HAS_ADDRESS_REGISTER_FILE
2310 else if (s->type == TYPE_ADR)
2311 printf(" r%02d", s->regoff);
2313 else if (IS_FLT_DBL_TYPE(s->type))
2314 printf(" f%02d", s->regoff);
2316 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2317 if (IS_2_WORD_TYPE(s->type))
2318 printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
2319 regs[GET_HIGH_REG(s->regoff)]);
2322 #if defined(ENABLE_INTRP)
2323 printf(" %3d", s->regoff);
2325 printf(" %3s", regs[s->regoff]);
2330 printf(" i%02d", s->varnum);
2333 printf(" l%02d", s->varnum);
2336 if (s->varnum == -1) {
2338 /* varkind ARGVAR "misused for this special case */
2340 } else /* "normal" Argvar */
2341 printf(" a%02d", s->varnum);
2342 #ifdef INVOKE_NEW_DEBUG
2343 if (s->flags & INMEMORY)
2344 printf("(M%i)", s->regoff);
2346 printf("(R%i)", s->regoff);
2350 printf(" ?%02d", j);
2358 static void print_reg(stackptr s) {
2360 if (s->flags & SAVEDVAR)
2361 switch (s->varkind) {
2363 if (s->flags & INMEMORY)
2364 printf(" tm%02d", s->regoff);
2366 printf(" tr%02d", s->regoff);
2369 printf(" s %02d", s->varnum);
2372 printf(" l %02d", s->varnum);
2375 printf(" a %02d", s->varnum);
2378 printf(" ! %02d", s->varnum);
2381 switch (s->varkind) {
2383 if (s->flags & INMEMORY)
2384 printf(" Tm%02d", s->regoff);
2386 printf(" Tr%02d", s->regoff);
2389 printf(" S %02d", s->varnum);
2392 printf(" L %02d", s->varnum);
2395 printf(" A %02d", s->varnum);
2398 printf(" ? %02d", s->varnum);
2408 static char *jit_type[] = {
2417 /* show_icmd_method ************************************************************
2421 *******************************************************************************/
2423 void show_icmd_method(methodinfo *m, codegendata *cd, registerdata *rd)
2430 #if defined(USE_THREADS)
2431 /* We need to enter a lock here, since the binutils disassembler is not */
2432 /* reentrant-able and we could not read functions printed at the same */
2435 builtin_monitorenter(&show_icmd_lock);
2439 utf_fprint_classname(stdout, m->class->name);
2441 utf_fprint(stdout, m->name);
2442 utf_fprint(stdout, m->descriptor);
2443 printf("\n\nMax locals: %d\n", (int) cd->maxlocals);
2444 printf("Max stack: %d\n", (int) cd->maxstack);
2445 printf("Line number table length: %d\n", m->linenumbercount);
2447 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
2448 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
2449 printf(" L%03d ... ", ex->start->debug_nr );
2450 printf("L%03d = ", ex->end->debug_nr);
2451 printf("L%03d", ex->handler->debug_nr);
2452 printf(" (catchtype: ");
2453 if (ex->catchtype.any)
2454 if (IS_CLASSREF(ex->catchtype))
2455 utf_display_classname(ex->catchtype.ref->name);
2457 utf_display_classname(ex->catchtype.cls->name);
2463 printf("Local Table:\n");
2464 for (i = 0; i < cd->maxlocals; i++) {
2465 printf(" %3d: ", i);
2466 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
2467 #if defined(ENABLE_INTRP)
2470 if (rd->locals[i][j].type >= 0) {
2471 printf(" (%s) ", jit_type[j]);
2472 if (rd->locals[i][j].flags & INMEMORY)
2473 printf("m%2d", rd->locals[i][j].regoff);
2474 #ifdef HAS_ADDRESS_REGISTER_FILE
2475 else if (j == TYPE_ADR)
2476 printf("r%02d", rd->locals[i][j].regoff);
2478 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2479 printf("f%02d", rd->locals[i][j].regoff);
2481 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2482 if (IS_2_WORD_TYPE(j))
2484 regs[GET_LOW_REG(rd->locals[i][j].regoff)],
2485 regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
2488 printf("%3s", regs[rd->locals[i][j].regoff]);
2491 #if defined(ENABLE_INTRP)
2502 #if defined(ENABLE_INTRP)
2505 printf("Interface Table:\n");
2506 for (i = 0; i < cd->maxstack; i++) {
2507 if ((rd->interfaces[i][0].type >= 0) ||
2508 (rd->interfaces[i][1].type >= 0) ||
2509 (rd->interfaces[i][2].type >= 0) ||
2510 (rd->interfaces[i][3].type >= 0) ||
2511 (rd->interfaces[i][4].type >= 0)) {
2512 printf(" %3d: ", i);
2513 for (j = TYPE_INT; j <= TYPE_ADR; j++)
2514 if (rd->interfaces[i][j].type >= 0) {
2515 printf(" (%s) ", jit_type[j]);
2516 if (rd->interfaces[i][j].flags & SAVEDVAR) {
2517 if (rd->interfaces[i][j].flags & INMEMORY)
2518 printf("M%2d", rd->interfaces[i][j].regoff);
2519 #ifdef HAS_ADDRESS_REGISTER_FILE
2520 else if (j == TYPE_ADR)
2521 printf("R%02d", rd->interfaces[i][j].regoff);
2523 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2524 printf("F%02d", rd->interfaces[i][j].regoff);
2526 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2527 if (IS_2_WORD_TYPE(j))
2529 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
2530 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
2533 printf("%3s",regs[rd->interfaces[i][j].regoff]);
2537 if (rd->interfaces[i][j].flags & INMEMORY)
2538 printf("m%2d", rd->interfaces[i][j].regoff);
2539 #ifdef HAS_ADDRESS_REGISTER_FILE
2540 else if (j == TYPE_ADR)
2541 printf("r%02d", rd->interfaces[i][j].regoff);
2543 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2544 printf("f%02d", rd->interfaces[i][j].regoff);
2546 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2547 if (IS_2_WORD_TYPE(j))
2549 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
2550 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
2553 printf("%3s",regs[rd->interfaces[i][j].regoff]);
2562 #if defined(ENABLE_INTRP)
2569 /* show code before first basic block */
2571 if (opt_showdisassemble) {
2572 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen);
2574 for (; u1ptr < (u1 *) ((ptrint) m->mcode + cd->dseglen + m->basicblocks[0].mpc);)
2575 u1ptr = disassinstr(u1ptr);
2580 /* show code of all basic blocks */
2582 for (bptr = m->basicblocks; bptr != NULL; bptr = bptr->next) {
2583 show_icmd_block(m, cd, bptr);
2586 /* show stubs code */
2588 if (opt_showdisassemble && opt_showexceptionstubs) {
2589 printf("\nException stubs code:\n");
2590 printf("Length: %d\n\n", (s4) (m->mcodelength -
2591 ((ptrint) cd->dseglen +
2592 m->basicblocks[m->basicblockcount].mpc)));
2594 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen +
2595 m->basicblocks[m->basicblockcount].mpc);
2597 for (; (ptrint) u1ptr < ((ptrint) m->mcode + m->mcodelength);)
2598 u1ptr = disassinstr(u1ptr);
2603 #if defined(USE_THREADS)
2604 builtin_monitorexit(&show_icmd_lock);
2609 void show_icmd_block(methodinfo *m, codegendata *cd, basicblock *bptr)
2616 if (bptr->flags != BBDELETED) {
2617 deadcode = bptr->flags <= BBREACHED;
2620 for (j = cd->maxstack; j > 0; j--)
2623 icmd_print_stack(cd, bptr->instack);
2624 printf("] L%03d(%d - %d) flags=%d:\n", bptr->debug_nr, bptr->icount, bptr->pre_count,bptr->flags);
2625 iptr = bptr->iinstr;
2627 for (i = 0; i < bptr->icount; i++, iptr++) {
2630 for (j = cd->maxstack; j > 0; j--)
2634 icmd_print_stack(cd, iptr->dst);
2635 printf("] %5d (line: %5d) ", i, iptr->line);
2638 if (icmd_uses_tmp[iptr->opc][0])
2642 if (icmd_uses_tmp[iptr->opc][1])
2646 if (icmd_uses_tmp[iptr->opc][2])
2652 show_icmd(iptr, deadcode);
2656 if (opt_showdisassemble && (!deadcode)) {
2658 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen + bptr->mpc);
2660 if (bptr->next != NULL) {
2661 for (; u1ptr < (u1 *) ((ptrint) m->mcode + cd->dseglen + bptr->next->mpc);)
2662 u1ptr = disassinstr(u1ptr);
2665 for (; u1ptr < (u1 *) ((ptrint) m->mcode + m->mcodelength);)
2666 u1ptr = disassinstr(u1ptr);
2674 void show_icmd(instruction *iptr, bool deadcode)
2680 printf("%s", icmd_names[iptr->opc]);
2682 switch (iptr->opc) {
2683 case ICMD_IADDCONST:
2684 case ICMD_ISUBCONST:
2685 case ICMD_IMULCONST:
2689 case ICMD_IANDCONST:
2691 case ICMD_IXORCONST:
2692 case ICMD_ISHLCONST:
2693 case ICMD_ISHRCONST:
2694 case ICMD_IUSHRCONST:
2695 case ICMD_LSHLCONST:
2696 case ICMD_LSHRCONST:
2697 case ICMD_LUSHRCONST:
2699 case ICMD_ELSE_ICONST:
2700 case ICMD_IASTORECONST:
2701 case ICMD_BASTORECONST:
2702 case ICMD_CASTORECONST:
2703 case ICMD_SASTORECONST:
2704 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
2707 case ICMD_IFEQ_ICONST:
2708 case ICMD_IFNE_ICONST:
2709 case ICMD_IFLT_ICONST:
2710 case ICMD_IFGE_ICONST:
2711 case ICMD_IFGT_ICONST:
2712 case ICMD_IFLE_ICONST:
2713 printf("(%d) %d", iptr[1].op1, iptr->val.i);
2716 case ICMD_LADDCONST:
2717 case ICMD_LSUBCONST:
2718 case ICMD_LMULCONST:
2722 case ICMD_LANDCONST:
2724 case ICMD_LXORCONST:
2726 case ICMD_LASTORECONST:
2727 #if SIZEOF_VOID_P == 4
2728 printf(" %lld (0x%016llx)", iptr->val.l, iptr->val.l);
2730 printf(" %ld (0x%016lx)", iptr->val.l, iptr->val.l);
2735 printf(" %f (0x%08x)", iptr->val.f, iptr->val.i);
2739 #if SIZEOF_VOID_P == 4
2740 printf(" %g (0x%016llx)", iptr->val.d, iptr->val.l);
2742 printf(" %g (0x%016lx)", iptr->val.d, iptr->val.l);
2747 case ICMD_AASTORECONST:
2748 printf(" %p", iptr->val.a);
2754 printf(" %d, ", ((fieldinfo *) iptr->val.a)->offset);
2756 printf(" (NOT RESOLVED), ");
2757 utf_display_classname(((unresolved_field *) iptr->target)->fieldref->classref->name);
2759 utf_display(((unresolved_field *) iptr->target)->fieldref->name);
2761 utf_display(((unresolved_field *) iptr->target)->fieldref->descriptor);
2765 case ICMD_PUTSTATIC:
2766 case ICMD_GETSTATIC:
2768 if (!((fieldinfo *) iptr->val.a)->class->initialized)
2769 printf(" (NOT INITIALIZED) ");
2773 printf(" (NOT RESOLVED) ");
2774 utf_display_classname(((unresolved_field *) iptr->target)->fieldref->classref->name);
2776 utf_display(((unresolved_field *) iptr->target)->fieldref->name);
2778 utf_display(((unresolved_field *) iptr->target)->fieldref->descriptor);
2782 case ICMD_PUTSTATICCONST:
2783 case ICMD_PUTFIELDCONST:
2784 switch (iptr[1].op1) {
2786 printf(" %d,", iptr->val.i);
2789 #if SIZEOF_VOID_P == 4
2790 printf(" %lld,", iptr->val.l);
2792 printf(" %ld,", iptr->val.l);
2796 printf(" %p,", iptr->val.a);
2799 printf(" %g,", iptr->val.f);
2802 printf(" %g,", iptr->val.d);
2805 if (iptr->opc == ICMD_PUTFIELDCONST)
2806 printf(" NOT RESOLVED,");
2808 utf_display_classname(((unresolved_field *) iptr[1].target)->fieldref->classref->name);
2810 utf_display(((unresolved_field *) iptr[1].target)->fieldref->name);
2812 utf_display(((unresolved_field *) iptr[1].target)->fieldref->descriptor);
2817 printf(" %d + %d", iptr->op1, iptr->val.i);
2852 printf(" %d", iptr->op1);
2857 utf_display_classname(((classinfo *) iptr->val.a)->name);
2861 switch (iptr->op1) {
2889 case ICMD_ANEWARRAY:
2892 utf_display_classname(((classinfo *) iptr->val.a)->name);
2896 case ICMD_MULTIANEWARRAY:
2898 printf(" (NOT RESOLVED) %d ",iptr->op1);
2899 utf_display(((constant_classref *) iptr->val.a)->name);
2901 printf(" %d ",iptr->op1);
2902 utf_display_classname(((vftbl_t *) iptr->val.a)->class->name);
2906 case ICMD_CHECKCAST:
2907 case ICMD_INSTANCEOF:
2909 classinfo *c = iptr->val.a;
2911 if (c->flags & ACC_INTERFACE)
2912 printf(" (INTERFACE) ");
2914 printf(" (CLASS,%3d) ", c->vftbl->diffval);
2916 printf(" (NOT RESOLVED) ");
2918 utf_display_classname(((constant_classref *) iptr->target)->name);
2922 case ICMD_ARRAYCHECKCAST:
2924 classinfo *c = ((vftbl_t *) iptr->target)->class;
2925 if (c->flags & ACC_INTERFACE)
2926 printf(" (INTERFACE) ");
2928 printf(" (CLASS,%3d) ", c->vftbl->diffval);
2929 utf_display_classname(c->name);
2931 printf(" (NOT RESOLVED) ");
2932 utf_display_classname(((constant_classref *) iptr->target)->name);
2936 case ICMD_INLINE_START:
2938 utf_display_classname(iptr->method->class->name);
2940 utf_display_classname(iptr->method->name);
2941 utf_display_classname(iptr->method->descriptor);
2942 printf(", depth=%i", iptr->op1);
2944 case ICMD_INLINE_END:
2948 printf(" %s", ((builtintable_entry *) iptr->val.a)->name);
2951 case ICMD_INVOKEVIRTUAL:
2952 case ICMD_INVOKESPECIAL:
2953 case ICMD_INVOKESTATIC:
2954 case ICMD_INVOKEINTERFACE:
2956 printf(" (NOT RESOLVED) ");
2959 utf_display_classname(((unresolved_method *) iptr->target)->methodref->classref->name);
2961 utf_display(((unresolved_method *) iptr->target)->methodref->name);
2962 utf_display(((unresolved_method *) iptr->target)->methodref->descriptor);
2971 if (deadcode || !iptr->target)
2972 printf("(%d) op1=%d", iptr->val.i, iptr->op1);
2974 printf("(%d) L%03d", iptr->val.i, ((basicblock *) iptr->target)->debug_nr);
2983 if (deadcode || !iptr->target)
2984 #if SIZEOF_VOID_P == 4
2985 printf("(%lld) op1=%d", iptr->val.l, iptr->op1);
2987 printf("(%ld) op1=%d", iptr->val.l, iptr->op1);
2990 #if SIZEOF_VOID_P == 4
2991 printf("(%lld) L%03d", iptr->val.l, ((basicblock *) iptr->target)->debug_nr);
2993 printf("(%ld) L%03d", iptr->val.l, ((basicblock *) iptr->target)->debug_nr);
3000 case ICMD_IFNONNULL:
3001 case ICMD_IF_ICMPEQ:
3002 case ICMD_IF_ICMPNE:
3003 case ICMD_IF_ICMPLT:
3004 case ICMD_IF_ICMPGE:
3005 case ICMD_IF_ICMPGT:
3006 case ICMD_IF_ICMPLE:
3007 case ICMD_IF_LCMPEQ:
3008 case ICMD_IF_LCMPNE:
3009 case ICMD_IF_LCMPLT:
3010 case ICMD_IF_LCMPGE:
3011 case ICMD_IF_LCMPGT:
3012 case ICMD_IF_LCMPLE:
3013 case ICMD_IF_ACMPEQ:
3014 case ICMD_IF_ACMPNE:
3015 if (deadcode || !iptr->target)
3016 printf(" op1=%d", iptr->op1);
3018 printf(" L%03d", ((basicblock *) iptr->target)->debug_nr);
3021 case ICMD_TABLESWITCH:
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);
3033 s4ptr++; /* skip default */
3034 j = *s4ptr++; /* low */
3035 j = *s4ptr++ - j; /* high */
3037 if (deadcode || !*tptr)
3038 printf(" %d", *s4ptr++);
3040 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
3047 case ICMD_LOOKUPSWITCH:
3048 s4ptr = (s4*)iptr->val.a;
3050 if (deadcode || !iptr->target) {
3051 printf(" %d;", *s4ptr);
3054 tptr = (void **) iptr->target;
3055 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
3058 s4ptr++; /* default */
3059 j = *s4ptr++; /* count */
3062 if (deadcode || !*tptr) {
3063 s4ptr++; /* skip value */
3064 printf(" %d",*s4ptr++);
3067 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
3077 * These are local overrides for various environment variables in Emacs.
3078 * Please do not remove this and leave it at the end of the file, where
3079 * Emacs will automagically detect them.
3080 * ---------------------------------------------------------------------
3083 * indent-tabs-mode: t