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 3331 2005-10-04 18:54:33Z 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);
304 case ICMD_IFEQ_ICONST:
305 case ICMD_IFNE_ICONST:
306 case ICMD_IFLT_ICONST:
307 case ICMD_IFGE_ICONST:
308 case ICMD_IFGT_ICONST:
309 case ICMD_IFLE_ICONST:
310 case ICMD_ELSE_ICONST:
315 #if defined(ENABLE_INTRP)
318 rd->locals[iptr->op1][TYPE_ADR].type = TYPE_ADR;
320 COUNT(count_pcmd_return);
322 superblockend = true;
325 /* pop 0 push 1 const */
328 COUNT(count_pcmd_load);
330 switch (iptr[1].opc) {
332 iptr[0].opc = ICMD_IADDCONST;
334 iptr[1].opc = ICMD_NOP;
335 OP1_1(TYPE_INT, TYPE_INT);
336 COUNT(count_pcmd_op);
339 iptr[0].opc = ICMD_ISUBCONST;
340 goto icmd_iconst_tail;
341 #if SUPPORT_CONST_MUL
343 iptr[0].opc = ICMD_IMULCONST;
344 goto icmd_iconst_tail;
345 #else /* SUPPORT_CONST_MUL */
347 if (iptr[0].val.i == 0x00000002)
349 else if (iptr[0].val.i == 0x00000004)
351 else if (iptr[0].val.i == 0x00000008)
353 else if (iptr[0].val.i == 0x00000010)
355 else if (iptr[0].val.i == 0x00000020)
357 else if (iptr[0].val.i == 0x00000040)
359 else if (iptr[0].val.i == 0x00000080)
361 else if (iptr[0].val.i == 0x00000100)
363 else if (iptr[0].val.i == 0x00000200)
365 else if (iptr[0].val.i == 0x00000400)
367 else if (iptr[0].val.i == 0x00000800)
369 else if (iptr[0].val.i == 0x00001000)
371 else if (iptr[0].val.i == 0x00002000)
373 else if (iptr[0].val.i == 0x00004000)
375 else if (iptr[0].val.i == 0x00008000)
377 else if (iptr[0].val.i == 0x00010000)
379 else if (iptr[0].val.i == 0x00020000)
381 else if (iptr[0].val.i == 0x00040000)
383 else if (iptr[0].val.i == 0x00080000)
385 else if (iptr[0].val.i == 0x00100000)
387 else if (iptr[0].val.i == 0x00200000)
389 else if (iptr[0].val.i == 0x00400000)
391 else if (iptr[0].val.i == 0x00800000)
393 else if (iptr[0].val.i == 0x01000000)
395 else if (iptr[0].val.i == 0x02000000)
397 else if (iptr[0].val.i == 0x04000000)
399 else if (iptr[0].val.i == 0x08000000)
401 else if (iptr[0].val.i == 0x10000000)
403 else if (iptr[0].val.i == 0x20000000)
405 else if (iptr[0].val.i == 0x40000000)
407 else if (iptr[0].val.i == 0x80000000)
413 iptr[0].opc = ICMD_IMULPOW2;
414 goto icmd_iconst_tail;
415 #endif /* SUPPORT_CONST_MUL */
417 if (iptr[0].val.i == 0x00000002)
419 else if (iptr[0].val.i == 0x00000004)
421 else if (iptr[0].val.i == 0x00000008)
423 else if (iptr[0].val.i == 0x00000010)
425 else if (iptr[0].val.i == 0x00000020)
427 else if (iptr[0].val.i == 0x00000040)
429 else if (iptr[0].val.i == 0x00000080)
431 else if (iptr[0].val.i == 0x00000100)
433 else if (iptr[0].val.i == 0x00000200)
435 else if (iptr[0].val.i == 0x00000400)
437 else if (iptr[0].val.i == 0x00000800)
439 else if (iptr[0].val.i == 0x00001000)
441 else if (iptr[0].val.i == 0x00002000)
443 else if (iptr[0].val.i == 0x00004000)
445 else if (iptr[0].val.i == 0x00008000)
447 else if (iptr[0].val.i == 0x00010000)
449 else if (iptr[0].val.i == 0x00020000)
451 else if (iptr[0].val.i == 0x00040000)
453 else if (iptr[0].val.i == 0x00080000)
455 else if (iptr[0].val.i == 0x00100000)
457 else if (iptr[0].val.i == 0x00200000)
459 else if (iptr[0].val.i == 0x00400000)
461 else if (iptr[0].val.i == 0x00800000)
463 else if (iptr[0].val.i == 0x01000000)
465 else if (iptr[0].val.i == 0x02000000)
467 else if (iptr[0].val.i == 0x04000000)
469 else if (iptr[0].val.i == 0x08000000)
471 else if (iptr[0].val.i == 0x10000000)
473 else if (iptr[0].val.i == 0x20000000)
475 else if (iptr[0].val.i == 0x40000000)
477 else if (iptr[0].val.i == 0x80000000)
483 iptr[0].opc = ICMD_IDIVPOW2;
484 goto icmd_iconst_tail;
486 /*log_text("stack.c: ICMD_ICONST/ICMD_IREM");*/
487 if ((iptr[0].val.i == 0x00000002) ||
488 (iptr[0].val.i == 0x00000004) ||
489 (iptr[0].val.i == 0x00000008) ||
490 (iptr[0].val.i == 0x00000010) ||
491 (iptr[0].val.i == 0x00000020) ||
492 (iptr[0].val.i == 0x00000040) ||
493 (iptr[0].val.i == 0x00000080) ||
494 (iptr[0].val.i == 0x00000100) ||
495 (iptr[0].val.i == 0x00000200) ||
496 (iptr[0].val.i == 0x00000400) ||
497 (iptr[0].val.i == 0x00000800) ||
498 (iptr[0].val.i == 0x00001000) ||
499 (iptr[0].val.i == 0x00002000) ||
500 (iptr[0].val.i == 0x00004000) ||
501 (iptr[0].val.i == 0x00008000) ||
502 (iptr[0].val.i == 0x00010000) ||
503 (iptr[0].val.i == 0x00020000) ||
504 (iptr[0].val.i == 0x00040000) ||
505 (iptr[0].val.i == 0x00080000) ||
506 (iptr[0].val.i == 0x00100000) ||
507 (iptr[0].val.i == 0x00200000) ||
508 (iptr[0].val.i == 0x00400000) ||
509 (iptr[0].val.i == 0x00800000) ||
510 (iptr[0].val.i == 0x01000000) ||
511 (iptr[0].val.i == 0x02000000) ||
512 (iptr[0].val.i == 0x04000000) ||
513 (iptr[0].val.i == 0x08000000) ||
514 (iptr[0].val.i == 0x10000000) ||
515 (iptr[0].val.i == 0x20000000) ||
516 (iptr[0].val.i == 0x40000000) ||
517 (iptr[0].val.i == 0x80000000)) {
518 iptr[0].opc = ICMD_IREMPOW2;
520 goto icmd_iconst_tail;
524 #if SUPPORT_CONST_LOGICAL
526 iptr[0].opc = ICMD_IANDCONST;
527 goto icmd_iconst_tail;
529 iptr[0].opc = ICMD_IORCONST;
530 goto icmd_iconst_tail;
532 iptr[0].opc = ICMD_IXORCONST;
533 goto icmd_iconst_tail;
534 #endif /* SUPPORT_CONST_LOGICAL */
536 iptr[0].opc = ICMD_ISHLCONST;
537 goto icmd_iconst_tail;
539 iptr[0].opc = ICMD_ISHRCONST;
540 goto icmd_iconst_tail;
542 iptr[0].opc = ICMD_IUSHRCONST;
543 goto icmd_iconst_tail;
544 #if SUPPORT_LONG_SHIFT
546 iptr[0].opc = ICMD_LSHLCONST;
547 goto icmd_lconst_tail;
549 iptr[0].opc = ICMD_LSHRCONST;
550 goto icmd_lconst_tail;
552 iptr[0].opc = ICMD_LUSHRCONST;
553 goto icmd_lconst_tail;
554 #endif /* SUPPORT_LONG_SHIFT */
556 iptr[0].opc = ICMD_IFEQ;
558 iptr[0].op1 = iptr[1].op1;
559 /* IF_ICMPxx is the last instruction in the */
560 /* basic block, just remove it */
561 /* iptr[1].opc = ICMD_NOP; */
566 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
568 iptr[0].target = (void *) tbptr;
570 MARKREACHED(tbptr, copy);
571 COUNT(count_pcmd_bra);
574 iptr[0].opc = ICMD_IFLT;
575 goto icmd_if_icmp_tail;
577 iptr[0].opc = ICMD_IFLE;
578 goto icmd_if_icmp_tail;
580 iptr[0].opc = ICMD_IFNE;
581 goto icmd_if_icmp_tail;
583 iptr[0].opc = ICMD_IFGT;
584 goto icmd_if_icmp_tail;
586 iptr[0].opc = ICMD_IFGE;
587 goto icmd_if_icmp_tail;
589 #if SUPPORT_CONST_STORE
594 # if defined(ENABLE_INTRP)
597 #if SUPPORT_CONST_STORE_ZERO_ONLY
598 if (iptr[0].val.i == 0) {
599 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
600 switch (iptr[1].opc) {
602 iptr[0].opc = ICMD_IASTORECONST;
605 iptr[0].opc = ICMD_BASTORECONST;
608 iptr[0].opc = ICMD_CASTORECONST;
611 iptr[0].opc = ICMD_SASTORECONST;
615 iptr[1].opc = ICMD_NOP;
616 OPTT2_0(TYPE_INT, TYPE_ADR);
617 COUNT(count_pcmd_op);
618 #if SUPPORT_CONST_STORE_ZERO_ONLY
621 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
622 # if defined(ENABLE_INTRP)
630 #if SUPPORT_CONST_STORE_ZERO_ONLY
631 if (iptr[0].val.i == 0) {
632 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
633 switch (iptr[1].opc) {
635 iptr[0].opc = ICMD_PUTSTATICCONST;
639 iptr[0].opc = ICMD_PUTFIELDCONST;
644 iptr[1].opc = ICMD_NOP;
645 iptr[0].op1 = TYPE_INT;
646 COUNT(count_pcmd_op);
647 #if SUPPORT_CONST_STORE_ZERO_ONLY
650 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
652 #endif /* SUPPORT_CONST_STORE */
662 COUNT(count_pcmd_load);
664 switch (iptr[1].opc) {
667 iptr[0].opc = ICMD_LADDCONST;
669 iptr[1].opc = ICMD_NOP;
670 OP1_1(TYPE_LNG,TYPE_LNG);
671 COUNT(count_pcmd_op);
674 iptr[0].opc = ICMD_LSUBCONST;
675 goto icmd_lconst_tail;
676 #endif /* SUPPORT_LONG_ADD */
677 #if SUPPORT_LONG_MUL && SUPPORT_CONST_MUL
679 iptr[0].opc = ICMD_LMULCONST;
680 goto icmd_lconst_tail;
681 #else /* SUPPORT_LONG_MUL && SUPPORT_CONST_MUL */
682 # if SUPPORT_LONG_SHIFT
684 if (iptr[0].val.l == 0x00000002)
686 else if (iptr[0].val.l == 0x00000004)
688 else if (iptr[0].val.l == 0x00000008)
690 else if (iptr[0].val.l == 0x00000010)
692 else if (iptr[0].val.l == 0x00000020)
694 else if (iptr[0].val.l == 0x00000040)
696 else if (iptr[0].val.l == 0x00000080)
698 else if (iptr[0].val.l == 0x00000100)
700 else if (iptr[0].val.l == 0x00000200)
702 else if (iptr[0].val.l == 0x00000400)
704 else if (iptr[0].val.l == 0x00000800)
706 else if (iptr[0].val.l == 0x00001000)
708 else if (iptr[0].val.l == 0x00002000)
710 else if (iptr[0].val.l == 0x00004000)
712 else if (iptr[0].val.l == 0x00008000)
714 else if (iptr[0].val.l == 0x00010000)
716 else if (iptr[0].val.l == 0x00020000)
718 else if (iptr[0].val.l == 0x00040000)
720 else if (iptr[0].val.l == 0x00080000)
722 else if (iptr[0].val.l == 0x00100000)
724 else if (iptr[0].val.l == 0x00200000)
726 else if (iptr[0].val.l == 0x00400000)
728 else if (iptr[0].val.l == 0x00800000)
730 else if (iptr[0].val.l == 0x01000000)
732 else if (iptr[0].val.l == 0x02000000)
734 else if (iptr[0].val.l == 0x04000000)
736 else if (iptr[0].val.l == 0x08000000)
738 else if (iptr[0].val.l == 0x10000000)
740 else if (iptr[0].val.l == 0x20000000)
742 else if (iptr[0].val.l == 0x40000000)
744 else if (iptr[0].val.l == 0x80000000)
750 iptr[0].opc = ICMD_LMULPOW2;
751 goto icmd_lconst_tail;
752 # endif /* SUPPORT_LONG_SHIFT */
753 #endif /* SUPPORT_LONG_MUL && SUPPORT_CONST_MUL */
756 if (iptr[0].val.l == 0x00000002)
758 else if (iptr[0].val.l == 0x00000004)
760 else if (iptr[0].val.l == 0x00000008)
762 else if (iptr[0].val.l == 0x00000010)
764 else if (iptr[0].val.l == 0x00000020)
766 else if (iptr[0].val.l == 0x00000040)
768 else if (iptr[0].val.l == 0x00000080)
770 else if (iptr[0].val.l == 0x00000100)
772 else if (iptr[0].val.l == 0x00000200)
774 else if (iptr[0].val.l == 0x00000400)
776 else if (iptr[0].val.l == 0x00000800)
778 else if (iptr[0].val.l == 0x00001000)
780 else if (iptr[0].val.l == 0x00002000)
782 else if (iptr[0].val.l == 0x00004000)
784 else if (iptr[0].val.l == 0x00008000)
786 else if (iptr[0].val.l == 0x00010000)
788 else if (iptr[0].val.l == 0x00020000)
790 else if (iptr[0].val.l == 0x00040000)
792 else if (iptr[0].val.l == 0x00080000)
794 else if (iptr[0].val.l == 0x00100000)
796 else if (iptr[0].val.l == 0x00200000)
798 else if (iptr[0].val.l == 0x00400000)
800 else if (iptr[0].val.l == 0x00800000)
802 else if (iptr[0].val.l == 0x01000000)
804 else if (iptr[0].val.l == 0x02000000)
806 else if (iptr[0].val.l == 0x04000000)
808 else if (iptr[0].val.l == 0x08000000)
810 else if (iptr[0].val.l == 0x10000000)
812 else if (iptr[0].val.l == 0x20000000)
814 else if (iptr[0].val.l == 0x40000000)
816 else if (iptr[0].val.l == 0x80000000)
822 iptr[0].opc = ICMD_LDIVPOW2;
823 goto icmd_lconst_tail;
825 if ((iptr[0].val.l == 0x00000002) ||
826 (iptr[0].val.l == 0x00000004) ||
827 (iptr[0].val.l == 0x00000008) ||
828 (iptr[0].val.l == 0x00000010) ||
829 (iptr[0].val.l == 0x00000020) ||
830 (iptr[0].val.l == 0x00000040) ||
831 (iptr[0].val.l == 0x00000080) ||
832 (iptr[0].val.l == 0x00000100) ||
833 (iptr[0].val.l == 0x00000200) ||
834 (iptr[0].val.l == 0x00000400) ||
835 (iptr[0].val.l == 0x00000800) ||
836 (iptr[0].val.l == 0x00001000) ||
837 (iptr[0].val.l == 0x00002000) ||
838 (iptr[0].val.l == 0x00004000) ||
839 (iptr[0].val.l == 0x00008000) ||
840 (iptr[0].val.l == 0x00010000) ||
841 (iptr[0].val.l == 0x00020000) ||
842 (iptr[0].val.l == 0x00040000) ||
843 (iptr[0].val.l == 0x00080000) ||
844 (iptr[0].val.l == 0x00100000) ||
845 (iptr[0].val.l == 0x00200000) ||
846 (iptr[0].val.l == 0x00400000) ||
847 (iptr[0].val.l == 0x00800000) ||
848 (iptr[0].val.l == 0x01000000) ||
849 (iptr[0].val.l == 0x02000000) ||
850 (iptr[0].val.l == 0x04000000) ||
851 (iptr[0].val.l == 0x08000000) ||
852 (iptr[0].val.l == 0x10000000) ||
853 (iptr[0].val.l == 0x20000000) ||
854 (iptr[0].val.l == 0x40000000) ||
855 (iptr[0].val.l == 0x80000000)) {
856 iptr[0].opc = ICMD_LREMPOW2;
858 goto icmd_lconst_tail;
862 #endif /* SUPPORT_LONG_DIV */
863 #if SUPPORT_LONG_LOGICAL && SUPPORT_CONST_LOGICAL
866 iptr[0].opc = ICMD_LANDCONST;
867 goto icmd_lconst_tail;
869 iptr[0].opc = ICMD_LORCONST;
870 goto icmd_lconst_tail;
872 iptr[0].opc = ICMD_LXORCONST;
873 goto icmd_lconst_tail;
874 #endif /* SUPPORT_LONG_LOGICAL && SUPPORT_CONST_LOGICAL */
875 #if !defined(NOLONG_CONDITIONAL)
877 if ((len > 1) && (iptr[2].val.i == 0)) {
878 switch (iptr[2].opc) {
880 iptr[0].opc = ICMD_IF_LEQ;
881 icmd_lconst_lcmp_tail:
882 iptr[0].op1 = iptr[2].op1;
885 /* iptr[1].opc = ICMD_NOP;
886 iptr[2].opc = ICMD_NOP; */
888 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
890 iptr[0].target = (void *) tbptr;
892 MARKREACHED(tbptr, copy);
893 COUNT(count_pcmd_bra);
894 COUNT(count_pcmd_op);
897 iptr[0].opc = ICMD_IF_LNE;
898 goto icmd_lconst_lcmp_tail;
900 iptr[0].opc = ICMD_IF_LLT;
901 goto icmd_lconst_lcmp_tail;
903 iptr[0].opc = ICMD_IF_LGT;
904 goto icmd_lconst_lcmp_tail;
906 iptr[0].opc = ICMD_IF_LLE;
907 goto icmd_lconst_lcmp_tail;
909 iptr[0].opc = ICMD_IF_LGE;
910 goto icmd_lconst_lcmp_tail;
913 } /* switch (iptr[2].opc) */
914 } /* if (iptr[2].val.i == 0) */
918 #endif /* !defined(NOLONG_CONDITIONAL) */
920 #if SUPPORT_CONST_STORE
922 # if defined(ENABLE_INTRP)
925 #if SUPPORT_CONST_STORE_ZERO_ONLY
926 if (iptr[0].val.l == 0) {
927 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
928 iptr[0].opc = ICMD_LASTORECONST;
929 iptr[1].opc = ICMD_NOP;
930 OPTT2_0(TYPE_INT, TYPE_ADR);
931 COUNT(count_pcmd_op);
932 #if SUPPORT_CONST_STORE_ZERO_ONLY
935 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
936 # if defined(ENABLE_INTRP)
944 #if SUPPORT_CONST_STORE_ZERO_ONLY
945 if (iptr[0].val.l == 0) {
946 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
947 switch (iptr[1].opc) {
949 iptr[0].opc = ICMD_PUTSTATICCONST;
953 iptr[0].opc = ICMD_PUTFIELDCONST;
958 iptr[1].opc = ICMD_NOP;
959 iptr[0].op1 = TYPE_LNG;
960 COUNT(count_pcmd_op);
961 #if SUPPORT_CONST_STORE_ZERO_ONLY
964 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
966 #endif /* SUPPORT_CONST_STORE */
976 COUNT(count_pcmd_load);
981 COUNT(count_pcmd_load);
986 COUNT(count_pcmd_load);
987 #if SUPPORT_CONST_STORE
988 if (len > 0 && iptr->val.a == 0) {
989 switch (iptr[1].opc) {
990 #if !defined(__POWERPC__) && !defined(__X86_64__) && !defined(__I386__) && !defined(__ALPHA__) && !defined(__MIPS__)
992 if (iptr[1].val.fp != BUILTIN_aastore) {
1000 switch (iptr[1].opc) {
1002 iptr[0].opc = ICMD_AASTORECONST;
1003 OPTT2_0(TYPE_INT, TYPE_ADR);
1005 case ICMD_PUTSTATIC:
1006 iptr[0].opc = ICMD_PUTSTATICCONST;
1007 iptr[0].op1 = TYPE_ADR;
1011 iptr[0].opc = ICMD_PUTFIELDCONST;
1012 iptr[0].op1 = TYPE_ADR;
1017 iptr[1].opc = ICMD_NOP;
1018 COUNT(count_pcmd_op);
1022 PUSHCONST(TYPE_ADR);
1025 #endif /* SUPPORT_CONST_STORE */
1026 PUSHCONST(TYPE_ADR);
1029 /* pop 0 push 1 load */
1036 COUNT(count_load_instruction);
1037 i = opcode - ICMD_ILOAD;
1038 iptr->op1 = argren[iptr->op1];
1039 #if defined(ENABLE_INTRP)
1042 rd->locals[iptr->op1][i].type = i;
1043 LOAD(i, LOCALVAR, iptr->op1);
1053 COUNT(count_check_null);
1054 COUNT(count_check_bound);
1055 COUNT(count_pcmd_mem);
1056 OP2IAT_1(opcode - ICMD_IALOAD);
1062 COUNT(count_check_null);
1063 COUNT(count_check_bound);
1064 COUNT(count_pcmd_mem);
1068 /* pop 0 push 0 iinc */
1071 #if defined(STATISTICS)
1075 count_store_depth[10]++;
1077 count_store_depth[i]++;
1083 if ((copy->varkind == LOCALVAR) &&
1084 (copy->varnum == iptr->op1)) {
1085 copy->varkind = TEMPVAR;
1094 /* pop 1 push 0 store */
1104 i = opcode - ICMD_ISTORE;
1105 #if defined(ENABLE_INTRP)
1108 rd->locals[iptr->op1][i].type = i;
1109 #if defined(STATISTICS)
1114 count_store_length[20]++;
1116 count_store_length[i]++;
1119 count_store_depth[10]++;
1121 count_store_depth[i]++;
1124 copy = curstack->prev;
1127 if ((copy->varkind == LOCALVAR) &&
1128 (copy->varnum == iptr->op1)) {
1129 copy->varkind = TEMPVAR;
1135 if ((new - curstack) == 1) {
1136 curstack->varkind = LOCALVAR;
1137 curstack->varnum = iptr->op1;
1139 STORE(opcode - ICMD_ISTORE);
1145 COUNT(count_check_null);
1146 COUNT(count_check_bound);
1147 COUNT(count_pcmd_mem);
1149 bte = (builtintable_entry *) iptr->val.a;
1153 if (md->memuse > rd->memuse)
1154 rd->memuse = md->memuse;
1155 if (md->argintreguse > rd->argintreguse)
1156 rd->argintreguse = md->argintreguse;
1158 /* make all stack variables saved */
1162 copy->flags |= SAVEDVAR;
1173 COUNT(count_check_null);
1174 COUNT(count_check_bound);
1175 COUNT(count_pcmd_mem);
1176 OP3TIA_0(opcode - ICMD_IASTORE);
1182 COUNT(count_check_null);
1183 COUNT(count_check_bound);
1184 COUNT(count_pcmd_mem);
1191 #ifdef TYPECHECK_STACK_COMPCAT
1194 if (IS_2_WORD_TYPE(curstack->type)) {
1195 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1208 md_return_alloc(m, rd, opcode - ICMD_IRETURN, curstack);
1209 COUNT(count_pcmd_return);
1210 OP1_0(opcode - ICMD_IRETURN);
1211 superblockend = true;
1215 COUNT(count_check_null);
1219 superblockend = true;
1222 case ICMD_PUTSTATIC:
1223 COUNT(count_pcmd_mem);
1227 /* pop 1 push 0 branch */
1230 case ICMD_IFNONNULL:
1231 COUNT(count_pcmd_bra);
1233 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1235 iptr[0].target = (void *) tbptr;
1237 MARKREACHED(tbptr, copy);
1246 COUNT(count_pcmd_bra);
1247 #if CONDITIONAL_LOADCONST
1248 # if defined(ENABLE_INTRP)
1251 tbptr = m->basicblocks + b_index;
1252 if ((b_count >= 3) &&
1253 ((b_index + 2) == m->basicblockindex[iptr[0].op1]) &&
1254 (tbptr[1].pre_count == 1) &&
1255 (tbptr[1].iinstr[0].opc == ICMD_ICONST) &&
1256 (tbptr[1].iinstr[1].opc == ICMD_GOTO) &&
1257 ((b_index + 3) == m->basicblockindex[tbptr[1].iinstr[1].op1]) &&
1258 (tbptr[2].pre_count == 1) &&
1259 (tbptr[2].iinstr[0].opc == ICMD_ICONST) &&
1260 (tbptr[2].icount==1)) {
1261 /*printf("tbptr[2].icount=%d\n",tbptr[2].icount);*/
1262 OP1_1(TYPE_INT, TYPE_INT);
1263 switch (iptr[0].opc) {
1265 iptr[0].opc = ICMD_IFNE_ICONST;
1268 iptr[0].opc = ICMD_IFEQ_ICONST;
1271 iptr[0].opc = ICMD_IFGE_ICONST;
1274 iptr[0].opc = ICMD_IFLT_ICONST;
1277 iptr[0].opc = ICMD_IFLE_ICONST;
1280 iptr[0].opc = ICMD_IFGT_ICONST;
1284 iptr[0].val.i = iptr[1].val.i;
1285 iptr[1].opc = ICMD_ELSE_ICONST;
1286 iptr[1].val.i = iptr[3].val.i;
1287 iptr[2].opc = ICMD_NOP;
1288 iptr[3].opc = ICMD_NOP;
1290 /* HACK: save compare value in iptr[1].op1 */
1291 iptr[1].op1 = iptr[0].val.i;
1292 iptr[0].val.i = tbptr[1].iinstr[0].val.i;
1293 iptr[1].opc = ICMD_ELSE_ICONST;
1294 iptr[1].val.i = tbptr[2].iinstr[0].val.i;
1295 tbptr[1].iinstr[0].opc = ICMD_NOP;
1296 tbptr[1].iinstr[1].opc = ICMD_NOP;
1297 tbptr[2].iinstr[0].opc = ICMD_NOP;
1299 tbptr[1].flags = BBDELETED;
1300 tbptr[2].flags = BBDELETED;
1301 tbptr[1].icount = 0;
1302 tbptr[2].icount = 0;
1303 if (tbptr[3].pre_count == 2) {
1304 len += tbptr[3].icount + 3;
1305 bptr->icount += tbptr[3].icount + 3;
1306 tbptr[3].flags = BBDELETED;
1307 tbptr[3].icount = 0;
1317 # if defined(ENABLE_INTRP)
1321 #endif /* CONDITIONAL_LOADCONST */
1325 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1327 iptr[0].target = (void *) tbptr;
1329 MARKREACHED(tbptr, copy);
1332 /* pop 0 push 0 branch */
1335 COUNT(count_pcmd_bra);
1336 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1338 iptr[0].target = (void *) tbptr;
1340 MARKREACHED(tbptr, copy);
1342 superblockend = true;
1345 /* pop 1 push 0 table branch */
1347 case ICMD_TABLESWITCH:
1348 COUNT(count_pcmd_table);
1350 s4ptr = iptr->val.a;
1351 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1352 MARKREACHED(tbptr, copy);
1353 i = *s4ptr++; /* low */
1354 i = *s4ptr++ - i + 1; /* high */
1356 tptr = DMNEW(void*, i+1);
1357 iptr->target = (void *) tptr;
1359 tptr[0] = (void *) tbptr;
1363 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1365 tptr[0] = (void *) tbptr;
1368 MARKREACHED(tbptr, copy);
1371 superblockend = true;
1374 /* pop 1 push 0 table branch */
1376 case ICMD_LOOKUPSWITCH:
1377 COUNT(count_pcmd_table);
1379 s4ptr = iptr->val.a;
1380 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1381 MARKREACHED(tbptr, copy);
1382 i = *s4ptr++; /* count */
1384 tptr = DMNEW(void*, i+1);
1385 iptr->target = (void *) tptr;
1387 tptr[0] = (void *) tbptr;
1391 tbptr = m->basicblocks + m->basicblockindex[s4ptr[1]];
1393 tptr[0] = (void *) tbptr;
1396 MARKREACHED(tbptr, copy);
1400 superblockend = true;
1403 case ICMD_MONITORENTER:
1404 COUNT(count_check_null);
1405 case ICMD_MONITOREXIT:
1409 /* pop 2 push 0 branch */
1411 case ICMD_IF_ICMPEQ:
1412 case ICMD_IF_ICMPNE:
1413 case ICMD_IF_ICMPLT:
1414 case ICMD_IF_ICMPGE:
1415 case ICMD_IF_ICMPGT:
1416 case ICMD_IF_ICMPLE:
1417 COUNT(count_pcmd_bra);
1419 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1421 iptr[0].target = (void *) tbptr;
1423 MARKREACHED(tbptr, copy);
1426 case ICMD_IF_ACMPEQ:
1427 case ICMD_IF_ACMPNE:
1428 COUNT(count_pcmd_bra);
1430 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1432 iptr[0].target = (void *) tbptr;
1434 MARKREACHED(tbptr, copy);
1440 COUNT(count_check_null);
1441 COUNT(count_pcmd_mem);
1442 OPTT2_0(iptr->op1,TYPE_ADR);
1447 if (!IS_2_WORD_TYPE(curstack->type)) {
1449 #ifdef TYPECHECK_STACK_COMPCAT
1452 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1453 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1458 OP1_0ANY; /* second pop */
1461 iptr->opc = ICMD_POP;
1465 /* pop 0 push 1 dup */
1468 #ifdef TYPECHECK_STACK_COMPCAT
1471 if (IS_2_WORD_TYPE(curstack->type)) {
1472 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1477 COUNT(count_dup_instruction);
1483 if (IS_2_WORD_TYPE(curstack->type)) {
1485 iptr->opc = ICMD_DUP;
1490 /* ..., ????, cat1 */
1491 #ifdef TYPECHECK_STACK_COMPCAT
1493 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1494 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1500 NEWSTACK(copy->prev->type, copy->prev->varkind,
1501 copy->prev->varnum);
1502 NEWSTACK(copy->type, copy->varkind,
1509 /* pop 2 push 3 dup */
1512 #ifdef TYPECHECK_STACK_COMPCAT
1515 if (IS_2_WORD_TYPE(curstack->type) ||
1516 IS_2_WORD_TYPE(curstack->prev->type)) {
1517 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1527 if (IS_2_WORD_TYPE(curstack->type)) {
1528 /* ..., ????, cat2 */
1529 #ifdef TYPECHECK_STACK_COMPCAT
1531 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1532 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1537 iptr->opc = ICMD_DUP_X1;
1541 /* ..., ????, cat1 */
1542 #ifdef TYPECHECK_STACK_COMPCAT
1545 if (IS_2_WORD_TYPE(curstack->prev->type)
1546 || IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1547 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1556 /* pop 3 push 4 dup */
1560 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1561 /* ..., cat2, ???? */
1562 #ifdef TYPECHECK_STACK_COMPCAT
1564 if (IS_2_WORD_TYPE(curstack->type)) {
1565 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1570 iptr->opc = ICMD_DUP_X1;
1574 /* ..., cat1, ???? */
1575 #ifdef TYPECHECK_STACK_COMPCAT
1578 if (IS_2_WORD_TYPE(curstack->type)
1579 || IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1580 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1591 if (IS_2_WORD_TYPE(curstack->type)) {
1592 /* ..., ????, cat2 */
1593 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1594 /* ..., cat2, cat2 */
1595 iptr->opc = ICMD_DUP_X1;
1599 /* ..., cat1, cat2 */
1600 #ifdef TYPECHECK_STACK_COMPCAT
1603 if (IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1604 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1609 iptr->opc = ICMD_DUP_X2;
1615 /* ..., ????, ????, cat1 */
1616 if (IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1617 /* ..., cat2, ????, cat1 */
1618 #ifdef TYPECHECK_STACK_COMPCAT
1620 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1621 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1626 iptr->opc = ICMD_DUP2_X1;
1630 /* ..., cat1, ????, cat1 */
1631 #ifdef TYPECHECK_STACK_COMPCAT
1634 if (IS_2_WORD_TYPE(curstack->prev->type)
1635 || IS_2_WORD_TYPE(curstack->prev->prev->prev->type)) {
1636 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1646 /* pop 2 push 2 swap */
1649 #ifdef TYPECHECK_STACK_COMPCAT
1652 if (IS_2_WORD_TYPE(curstack->type)
1653 || IS_2_WORD_TYPE(curstack->prev->type)) {
1654 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1666 #if !SUPPORT_DIVISION
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;
1683 #endif /* !SUPPORT_DIVISION */
1694 COUNT(count_pcmd_op);
1700 #if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
1701 bte = (builtintable_entry *) iptr->val.a;
1705 if (md->memuse > rd->memuse)
1706 rd->memuse = md->memuse;
1707 if (md->argintreguse > rd->argintreguse)
1708 rd->argintreguse = md->argintreguse;
1710 /* make all stack variables saved */
1714 copy->flags |= SAVEDVAR;
1717 #endif /* !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV) */
1722 #if SUPPORT_LONG_LOGICAL
1726 #endif /* SUPPORT_LONG_LOGICAL */
1727 COUNT(count_pcmd_op);
1734 COUNT(count_pcmd_op);
1743 COUNT(count_pcmd_op);
1752 COUNT(count_pcmd_op);
1757 COUNT(count_pcmd_op);
1758 #if !defined(NOLONG_CONDITIONAL)
1759 if ((len > 0) && (iptr[1].val.i == 0)) {
1760 switch (iptr[1].opc) {
1762 iptr[0].opc = ICMD_IF_LCMPEQ;
1764 iptr[0].op1 = iptr[1].op1;
1767 /* iptr[1].opc = ICMD_NOP; */
1769 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1771 iptr[0].target = (void *) tbptr;
1773 MARKREACHED(tbptr, copy);
1774 COUNT(count_pcmd_bra);
1777 iptr[0].opc = ICMD_IF_LCMPNE;
1778 goto icmd_lcmp_if_tail;
1780 iptr[0].opc = ICMD_IF_LCMPLT;
1781 goto icmd_lcmp_if_tail;
1783 iptr[0].opc = ICMD_IF_LCMPGT;
1784 goto icmd_lcmp_if_tail;
1786 iptr[0].opc = ICMD_IF_LCMPLE;
1787 goto icmd_lcmp_if_tail;
1789 iptr[0].opc = ICMD_IF_LCMPGE;
1790 goto icmd_lcmp_if_tail;
1792 OPTT2_1(TYPE_LNG, TYPE_INT);
1797 OPTT2_1(TYPE_LNG, TYPE_INT);
1801 COUNT(count_pcmd_op);
1802 OPTT2_1(TYPE_FLT, TYPE_INT);
1806 COUNT(count_pcmd_op);
1807 OPTT2_1(TYPE_DBL, TYPE_INT);
1815 case ICMD_INT2SHORT:
1816 COUNT(count_pcmd_op);
1817 OP1_1(TYPE_INT, TYPE_INT);
1820 COUNT(count_pcmd_op);
1821 OP1_1(TYPE_LNG, TYPE_LNG);
1824 COUNT(count_pcmd_op);
1825 OP1_1(TYPE_FLT, TYPE_FLT);
1828 COUNT(count_pcmd_op);
1829 OP1_1(TYPE_DBL, TYPE_DBL);
1833 COUNT(count_pcmd_op);
1834 OP1_1(TYPE_INT, TYPE_LNG);
1837 COUNT(count_pcmd_op);
1838 OP1_1(TYPE_INT, TYPE_FLT);
1841 COUNT(count_pcmd_op);
1842 OP1_1(TYPE_INT, TYPE_DBL);
1845 COUNT(count_pcmd_op);
1846 OP1_1(TYPE_LNG, TYPE_INT);
1849 COUNT(count_pcmd_op);
1850 OP1_1(TYPE_LNG, TYPE_FLT);
1853 COUNT(count_pcmd_op);
1854 OP1_1(TYPE_LNG, TYPE_DBL);
1857 COUNT(count_pcmd_op);
1858 OP1_1(TYPE_FLT, TYPE_INT);
1861 COUNT(count_pcmd_op);
1862 OP1_1(TYPE_FLT, TYPE_LNG);
1865 COUNT(count_pcmd_op);
1866 OP1_1(TYPE_FLT, TYPE_DBL);
1869 COUNT(count_pcmd_op);
1870 OP1_1(TYPE_DBL, TYPE_INT);
1873 COUNT(count_pcmd_op);
1874 OP1_1(TYPE_DBL, TYPE_LNG);
1877 COUNT(count_pcmd_op);
1878 OP1_1(TYPE_DBL, TYPE_FLT);
1881 case ICMD_CHECKCAST:
1882 OP1_1(TYPE_ADR, TYPE_ADR);
1885 case ICMD_ARRAYCHECKCAST:
1886 bte = (builtintable_entry *) iptr->val.a;
1889 if (md->memuse > rd->memuse)
1890 rd->memuse = md->memuse;
1891 if (md->argintreguse > rd->argintreguse)
1892 rd->argintreguse = md->argintreguse;
1894 /* make all stack variables saved */
1898 copy->flags |= SAVEDVAR;
1902 OP1_1(TYPE_ADR, TYPE_ADR);
1905 case ICMD_INSTANCEOF:
1906 case ICMD_ARRAYLENGTH:
1907 OP1_1(TYPE_ADR, TYPE_INT);
1911 case ICMD_ANEWARRAY:
1912 OP1_1(TYPE_INT, TYPE_ADR);
1916 COUNT(count_check_null);
1917 COUNT(count_pcmd_mem);
1918 OP1_1(TYPE_ADR, iptr->op1);
1923 case ICMD_GETSTATIC:
1924 COUNT(count_pcmd_mem);
1934 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1936 iptr[0].target = (void *) tbptr;
1938 /* This is a dirty hack. The typechecker
1939 * needs it because the OP1_0ANY below
1940 * overwrites iptr->dst.
1942 iptr->val.a = (void *) iptr->dst;
1944 tbptr->type = BBTYPE_SBR;
1946 /* We need to check for overflow right here because
1947 * the pushed value is poped after MARKREACHED. */
1949 MARKREACHED(tbptr, copy);
1953 /* pop many push any */
1956 #if defined(USEBUILTINTABLE)
1959 bte = (builtintable_entry *) iptr->val.a;
1963 case ICMD_INVOKESTATIC:
1964 case ICMD_INVOKESPECIAL:
1965 case ICMD_INVOKEVIRTUAL:
1966 case ICMD_INVOKEINTERFACE:
1967 COUNT(count_pcmd_met);
1969 md = um->methodref->parseddesc.md;
1970 /* if (lm->flags & ACC_STATIC) */
1971 /* {COUNT(count_check_null);} */
1976 if (md->memuse > rd->memuse)
1977 rd->memuse = md->memuse;
1978 if (md->argintreguse > rd->argintreguse)
1979 rd->argintreguse = md->argintreguse;
1980 if (md->argfltreguse > rd->argfltreguse)
1981 rd->argfltreguse = md->argfltreguse;
1986 for (i-- ; i >= 0; i--) {
1987 #if defined(SUPPORT_PASS_FLOATARGS_IN_INTREGS)
1988 /* If we pass float arguments in integer argument registers, we
1989 * are not allowed to precolor them here. Floats have to be moved
1990 * to this regs explicitly in codegen().
1991 * Only arguments that are passed by stack anyway can be precolored
1992 * (michi 2005/07/24) */
1993 if (!(copy->flags & SAVEDVAR) &&
1994 (!IS_FLT_DBL_TYPE(copy->type) || md->params[i].inmemory)) {
1996 if (!(copy->flags & SAVEDVAR)) {
1998 copy->varkind = ARGVAR;
2001 #if defined(ENABLE_INTRP)
2004 if (md->params[i].inmemory) {
2005 copy->flags = INMEMORY;
2006 copy->regoff = md->params[i].regoff;
2009 if (IS_FLT_DBL_TYPE(copy->type))
2010 #if defined(SUPPORT_PASS_FLOATARGS_IN_INTREGS)
2014 rd->argfltregs[md->params[i].regoff];
2017 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2018 if (IS_2_WORD_TYPE(copy->type))
2019 copy->regoff = PACK_REGS(
2020 rd->argintregs[GET_LOW_REG(md->params[i].regoff)],
2021 rd->argintregs[GET_HIGH_REG(md->params[i].regoff)]);
2025 rd->argintregs[md->params[i].regoff];
2028 #if defined(ENABLE_INTRP)
2036 copy->flags |= SAVEDVAR;
2042 if (md->returntype.type != TYPE_VOID)
2043 OP0_1(md->returntype.type);
2046 case ICMD_INLINE_START:
2047 case ICMD_INLINE_END:
2051 case ICMD_MULTIANEWARRAY:
2052 if (rd->argintreguse < 3)
2053 rd->argintreguse = 3;
2058 #if defined(SPECIALMEMUSE)
2059 # if defined(__DARWIN__)
2060 if (rd->memuse < (i + INT_ARG_CNT + LA_WORD_SIZE))
2061 rd->memuse = i + LA_WORD_SIZE + INT_ARG_CNT;
2063 if (rd->memuse < (i + LA_WORD_SIZE + 3))
2064 rd->memuse = i + LA_WORD_SIZE + 3;
2067 # if defined(__I386__)
2068 if (rd->memuse < i + 3)
2069 rd->memuse = i + 3; /* n integer args spilled on stack */
2072 rd->memuse = i; /* n integer args spilled on stack */
2073 # endif /* defined(__I386__) */
2077 /* check INT type here? Currently typecheck does this. */
2078 if (!(copy->flags & SAVEDVAR)) {
2079 copy->varkind = ARGVAR;
2080 copy->varnum = i + INT_ARG_CNT;
2081 copy->flags |= INMEMORY;
2082 #if defined(SPECIALMEMUSE)
2083 # if defined(__DARWIN__)
2084 copy->regoff = i + LA_WORD_SIZE + INT_ARG_CNT;
2086 copy->regoff = i + LA_WORD_SIZE + 3;
2089 # if defined(__I386__)
2090 copy->regoff = i + 3;
2093 # endif /* defined(__I386__) */
2094 #endif /* defined(SPECIALMEMUSE) */
2099 copy->flags |= SAVEDVAR;
2107 case ICMD_CLEAR_ARGREN:
2108 for (i = iptr->op1; i < cd->maxlocals; i++)
2110 iptr->opc = opcode = ICMD_NOP;
2114 case ICMD_READONLY_ARG:
2115 case ICMD_READONLY_ARG+1:
2116 case ICMD_READONLY_ARG+2:
2117 case ICMD_READONLY_ARG+3:
2118 case ICMD_READONLY_ARG+4:
2121 if (curstack->varkind == LOCALVAR) {
2122 i = curstack->varnum;
2123 argren[iptr->op1] = i;
2126 opcode = iptr->opc = opcode - ICMD_READONLY_ARG + ICMD_ISTORE;
2133 new_exception_message(string_java_lang_InternalError,
2140 } /* while instructions */
2142 bptr->outstack = curstack;
2143 bptr->outdepth = stackdepth;
2147 superblockend = true;
2149 } /* while blocks */
2150 } while (repeat && !deadcode);
2152 #if defined(STATISTICS)
2154 if (m->basicblockcount > count_max_basic_blocks)
2155 count_max_basic_blocks = m->basicblockcount;
2156 count_basic_blocks += m->basicblockcount;
2157 if (m->instructioncount > count_max_javainstr) count_max_javainstr = m->instructioncount;
2158 count_javainstr += m->instructioncount;
2159 if (m->stackcount > count_upper_bound_new_stack)
2160 count_upper_bound_new_stack = m->stackcount;
2161 if ((new - m->stack) > count_max_new_stack)
2162 count_max_new_stack = (new - m->stack);
2164 b_count = m->basicblockcount;
2165 bptr = m->basicblocks;
2166 while (--b_count >= 0) {
2167 if (bptr->flags > BBREACHED) {
2168 if (bptr->indepth >= 10)
2169 count_block_stack[10]++;
2171 count_block_stack[bptr->indepth]++;
2174 count_block_size_distribution[len]++;
2176 count_block_size_distribution[10]++;
2178 count_block_size_distribution[11]++;
2180 count_block_size_distribution[12]++;
2182 count_block_size_distribution[13]++;
2184 count_block_size_distribution[14]++;
2186 count_block_size_distribution[15]++;
2188 count_block_size_distribution[16]++;
2190 count_block_size_distribution[17]++;
2196 count_analyse_iterations[0]++;
2197 else if (loops == 2)
2198 count_analyse_iterations[1]++;
2199 else if (loops == 3)
2200 count_analyse_iterations[2]++;
2201 else if (loops == 4)
2202 count_analyse_iterations[3]++;
2204 count_analyse_iterations[4]++;
2206 if (m->basicblockcount <= 5)
2207 count_method_bb_distribution[0]++;
2208 else if (m->basicblockcount <= 10)
2209 count_method_bb_distribution[1]++;
2210 else if (m->basicblockcount <= 15)
2211 count_method_bb_distribution[2]++;
2212 else if (m->basicblockcount <= 20)
2213 count_method_bb_distribution[3]++;
2214 else if (m->basicblockcount <= 30)
2215 count_method_bb_distribution[4]++;
2216 else if (m->basicblockcount <= 40)
2217 count_method_bb_distribution[5]++;
2218 else if (m->basicblockcount <= 50)
2219 count_method_bb_distribution[6]++;
2220 else if (m->basicblockcount <= 75)
2221 count_method_bb_distribution[7]++;
2223 count_method_bb_distribution[8]++;
2227 /* just return methodinfo* to signal everything was ok */
2233 /**********************************************************************/
2234 /* DEBUGGING HELPERS */
2235 /**********************************************************************/
2237 void icmd_print_stack(codegendata *cd, stackptr s)
2249 j = cd->maxstack - i;
2255 if (s->flags & SAVEDVAR)
2256 switch (s->varkind) {
2258 if (s->flags & INMEMORY)
2259 printf(" M%02d", s->regoff);
2260 #ifdef HAS_ADDRESS_REGISTER_FILE
2261 else if (s->type == TYPE_ADR)
2262 printf(" R%02d", s->regoff);
2264 else if (IS_FLT_DBL_TYPE(s->type))
2265 printf(" F%02d", s->regoff);
2267 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2268 if (IS_2_WORD_TYPE(s->type))
2269 printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
2270 regs[GET_HIGH_REG(s->regoff)]);
2273 #if defined(ENABLE_INTRP)
2274 printf(" %3d", s->regoff);
2276 printf(" %3s", regs[s->regoff]);
2281 printf(" I%02d", s->varnum);
2284 printf(" L%02d", s->varnum);
2287 if (s->varnum == -1) {
2289 /* varkind ARGVAR "misused for this special case */
2291 } else /* "normal" Argvar */
2292 printf(" A%02d", s->varnum);
2293 #ifdef INVOKE_NEW_DEBUG
2294 if (s->flags & INMEMORY)
2295 printf("(M%i)", s->regoff);
2297 printf("(R%i)", s->regoff);
2301 printf(" !%02d", j);
2304 switch (s->varkind) {
2306 if (s->flags & INMEMORY)
2307 printf(" m%02d", s->regoff);
2308 #ifdef HAS_ADDRESS_REGISTER_FILE
2309 else if (s->type == TYPE_ADR)
2310 printf(" r%02d", s->regoff);
2312 else if (IS_FLT_DBL_TYPE(s->type))
2313 printf(" f%02d", s->regoff);
2315 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2316 if (IS_2_WORD_TYPE(s->type))
2317 printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
2318 regs[GET_HIGH_REG(s->regoff)]);
2321 #if defined(ENABLE_INTRP)
2322 printf(" %3d", s->regoff);
2324 printf(" %3s", regs[s->regoff]);
2329 printf(" i%02d", s->varnum);
2332 printf(" l%02d", s->varnum);
2335 if (s->varnum == -1) {
2337 /* varkind ARGVAR "misused for this special case */
2339 } else /* "normal" Argvar */
2340 printf(" a%02d", s->varnum);
2341 #ifdef INVOKE_NEW_DEBUG
2342 if (s->flags & INMEMORY)
2343 printf("(M%i)", s->regoff);
2345 printf("(R%i)", s->regoff);
2349 printf(" ?%02d", j);
2357 static void print_reg(stackptr s) {
2359 if (s->flags & SAVEDVAR)
2360 switch (s->varkind) {
2362 if (s->flags & INMEMORY)
2363 printf(" tm%02d", s->regoff);
2365 printf(" tr%02d", s->regoff);
2368 printf(" s %02d", s->varnum);
2371 printf(" l %02d", s->varnum);
2374 printf(" a %02d", s->varnum);
2377 printf(" ! %02d", s->varnum);
2380 switch (s->varkind) {
2382 if (s->flags & INMEMORY)
2383 printf(" Tm%02d", s->regoff);
2385 printf(" Tr%02d", s->regoff);
2388 printf(" S %02d", s->varnum);
2391 printf(" L %02d", s->varnum);
2394 printf(" A %02d", s->varnum);
2397 printf(" ? %02d", s->varnum);
2407 static char *jit_type[] = {
2416 /* show_icmd_method ************************************************************
2420 *******************************************************************************/
2422 void show_icmd_method(methodinfo *m, codegendata *cd, registerdata *rd)
2429 #if defined(USE_THREADS)
2430 /* We need to enter a lock here, since the binutils disassembler is not */
2431 /* reentrant-able and we could not read functions printed at the same */
2434 builtin_monitorenter(&show_icmd_lock);
2438 utf_fprint_classname(stdout, m->class->name);
2440 utf_fprint(stdout, m->name);
2441 utf_fprint(stdout, m->descriptor);
2442 printf("\n\nMax locals: %d\n", (int) cd->maxlocals);
2443 printf("Max stack: %d\n", (int) cd->maxstack);
2444 printf("Line number table length: %d\n", m->linenumbercount);
2446 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
2447 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
2448 printf(" L%03d ... ", ex->start->debug_nr );
2449 printf("L%03d = ", ex->end->debug_nr);
2450 printf("L%03d", ex->handler->debug_nr);
2451 printf(" (catchtype: ");
2452 if (ex->catchtype.any)
2453 if (IS_CLASSREF(ex->catchtype))
2454 utf_display_classname(ex->catchtype.ref->name);
2456 utf_display_classname(ex->catchtype.cls->name);
2462 printf("Local Table:\n");
2463 for (i = 0; i < cd->maxlocals; i++) {
2464 printf(" %3d: ", i);
2465 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
2466 #if defined(ENABLE_INTRP)
2469 if (rd->locals[i][j].type >= 0) {
2470 printf(" (%s) ", jit_type[j]);
2471 if (rd->locals[i][j].flags & INMEMORY)
2472 printf("m%2d", rd->locals[i][j].regoff);
2473 #ifdef HAS_ADDRESS_REGISTER_FILE
2474 else if (j == TYPE_ADR)
2475 printf("r%02d", rd->locals[i][j].regoff);
2477 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2478 printf("f%02d", rd->locals[i][j].regoff);
2480 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2481 if (IS_2_WORD_TYPE(j))
2483 regs[GET_LOW_REG(rd->locals[i][j].regoff)],
2484 regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
2487 printf("%3s", regs[rd->locals[i][j].regoff]);
2490 #if defined(ENABLE_INTRP)
2501 #if defined(ENABLE_INTRP)
2504 printf("Interface Table:\n");
2505 for (i = 0; i < cd->maxstack; i++) {
2506 if ((rd->interfaces[i][0].type >= 0) ||
2507 (rd->interfaces[i][1].type >= 0) ||
2508 (rd->interfaces[i][2].type >= 0) ||
2509 (rd->interfaces[i][3].type >= 0) ||
2510 (rd->interfaces[i][4].type >= 0)) {
2511 printf(" %3d: ", i);
2512 for (j = TYPE_INT; j <= TYPE_ADR; j++)
2513 if (rd->interfaces[i][j].type >= 0) {
2514 printf(" (%s) ", jit_type[j]);
2515 if (rd->interfaces[i][j].flags & SAVEDVAR) {
2516 if (rd->interfaces[i][j].flags & INMEMORY)
2517 printf("M%2d", rd->interfaces[i][j].regoff);
2518 #ifdef HAS_ADDRESS_REGISTER_FILE
2519 else if (j == TYPE_ADR)
2520 printf("R%02d", rd->interfaces[i][j].regoff);
2522 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2523 printf("F%02d", rd->interfaces[i][j].regoff);
2525 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2526 if (IS_2_WORD_TYPE(j))
2528 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
2529 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
2532 printf("%3s",regs[rd->interfaces[i][j].regoff]);
2536 if (rd->interfaces[i][j].flags & INMEMORY)
2537 printf("m%2d", rd->interfaces[i][j].regoff);
2538 #ifdef HAS_ADDRESS_REGISTER_FILE
2539 else if (j == TYPE_ADR)
2540 printf("r%02d", rd->interfaces[i][j].regoff);
2542 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2543 printf("f%02d", rd->interfaces[i][j].regoff);
2545 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2546 if (IS_2_WORD_TYPE(j))
2548 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
2549 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
2552 printf("%3s",regs[rd->interfaces[i][j].regoff]);
2561 #if defined(ENABLE_INTRP)
2568 /* show code before first basic block */
2570 if (opt_showdisassemble) {
2571 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen);
2573 for (; u1ptr < (u1 *) ((ptrint) m->mcode + cd->dseglen + m->basicblocks[0].mpc);)
2574 u1ptr = disassinstr(u1ptr);
2579 /* show code of all basic blocks */
2581 for (bptr = m->basicblocks; bptr != NULL; bptr = bptr->next) {
2582 show_icmd_block(m, cd, bptr);
2585 /* show stubs code */
2587 if (opt_showdisassemble && opt_showexceptionstubs) {
2588 printf("\nException stubs code:\n");
2589 printf("Length: %d\n\n", (s4) (m->mcodelength -
2590 ((ptrint) cd->dseglen +
2591 m->basicblocks[m->basicblockcount].mpc)));
2593 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen +
2594 m->basicblocks[m->basicblockcount].mpc);
2596 for (; (ptrint) u1ptr < ((ptrint) m->mcode + m->mcodelength);)
2597 u1ptr = disassinstr(u1ptr);
2602 #if defined(USE_THREADS)
2603 builtin_monitorexit(&show_icmd_lock);
2608 void show_icmd_block(methodinfo *m, codegendata *cd, basicblock *bptr)
2615 if (bptr->flags != BBDELETED) {
2616 deadcode = bptr->flags <= BBREACHED;
2619 for (j = cd->maxstack; j > 0; j--)
2622 icmd_print_stack(cd, bptr->instack);
2623 printf("] L%03d(%d - %d) flags=%d:\n", bptr->debug_nr, bptr->icount, bptr->pre_count,bptr->flags);
2624 iptr = bptr->iinstr;
2626 for (i = 0; i < bptr->icount; i++, iptr++) {
2629 for (j = cd->maxstack; j > 0; j--)
2633 icmd_print_stack(cd, iptr->dst);
2634 printf("] %5d (line: %5d) ", i, iptr->line);
2637 if (icmd_uses_tmp[iptr->opc][0])
2641 if (icmd_uses_tmp[iptr->opc][1])
2645 if (icmd_uses_tmp[iptr->opc][2])
2651 show_icmd(iptr, deadcode);
2655 if (opt_showdisassemble && (!deadcode)) {
2657 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen + bptr->mpc);
2659 if (bptr->next != NULL) {
2660 for (; u1ptr < (u1 *) ((ptrint) m->mcode + cd->dseglen + bptr->next->mpc);)
2661 u1ptr = disassinstr(u1ptr);
2664 for (; u1ptr < (u1 *) ((ptrint) m->mcode + m->mcodelength);)
2665 u1ptr = disassinstr(u1ptr);
2673 void show_icmd(instruction *iptr, bool deadcode)
2679 printf("%s", icmd_names[iptr->opc]);
2681 switch (iptr->opc) {
2682 case ICMD_IADDCONST:
2683 case ICMD_ISUBCONST:
2684 case ICMD_IMULCONST:
2688 case ICMD_IANDCONST:
2690 case ICMD_IXORCONST:
2691 case ICMD_ISHLCONST:
2692 case ICMD_ISHRCONST:
2693 case ICMD_IUSHRCONST:
2694 case ICMD_LSHLCONST:
2695 case ICMD_LSHRCONST:
2696 case ICMD_LUSHRCONST:
2698 case ICMD_ELSE_ICONST:
2699 case ICMD_IASTORECONST:
2700 case ICMD_BASTORECONST:
2701 case ICMD_CASTORECONST:
2702 case ICMD_SASTORECONST:
2703 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
2706 case ICMD_IFEQ_ICONST:
2707 case ICMD_IFNE_ICONST:
2708 case ICMD_IFLT_ICONST:
2709 case ICMD_IFGE_ICONST:
2710 case ICMD_IFGT_ICONST:
2711 case ICMD_IFLE_ICONST:
2712 printf("(%d) %d", iptr[1].op1, iptr->val.i);
2715 case ICMD_LADDCONST:
2716 case ICMD_LSUBCONST:
2717 case ICMD_LMULCONST:
2721 case ICMD_LANDCONST:
2723 case ICMD_LXORCONST:
2725 case ICMD_LASTORECONST:
2726 #if SIZEOF_VOID_P == 4
2727 printf(" %lld (0x%016llx)", iptr->val.l, iptr->val.l);
2729 printf(" %ld (0x%016lx)", iptr->val.l, iptr->val.l);
2734 printf(" %f (0x%08x)", iptr->val.f, iptr->val.i);
2738 #if SIZEOF_VOID_P == 4
2739 printf(" %g (0x%016llx)", iptr->val.d, iptr->val.l);
2741 printf(" %g (0x%016lx)", iptr->val.d, iptr->val.l);
2746 case ICMD_AASTORECONST:
2747 printf(" %p", iptr->val.a);
2753 printf(" %d, ", ((fieldinfo *) iptr->val.a)->offset);
2755 printf(" (NOT RESOLVED), ");
2756 utf_display_classname(((unresolved_field *) iptr->target)->fieldref->classref->name);
2758 utf_display(((unresolved_field *) iptr->target)->fieldref->name);
2760 utf_display(((unresolved_field *) iptr->target)->fieldref->descriptor);
2764 case ICMD_PUTSTATIC:
2765 case ICMD_GETSTATIC:
2767 if (!((fieldinfo *) iptr->val.a)->class->initialized)
2768 printf(" (NOT INITIALIZED) ");
2772 printf(" (NOT RESOLVED) ");
2773 utf_display_classname(((unresolved_field *) iptr->target)->fieldref->classref->name);
2775 utf_display(((unresolved_field *) iptr->target)->fieldref->name);
2777 utf_display(((unresolved_field *) iptr->target)->fieldref->descriptor);
2781 case ICMD_PUTSTATICCONST:
2782 case ICMD_PUTFIELDCONST:
2783 switch (iptr[1].op1) {
2785 printf(" %d,", iptr->val.i);
2788 #if SIZEOF_VOID_P == 4
2789 printf(" %lld,", iptr->val.l);
2791 printf(" %ld,", iptr->val.l);
2795 printf(" %p,", iptr->val.a);
2798 printf(" %g,", iptr->val.f);
2801 printf(" %g,", iptr->val.d);
2804 if (iptr->opc == ICMD_PUTFIELDCONST)
2805 printf(" NOT RESOLVED,");
2807 utf_display_classname(((unresolved_field *) iptr[1].target)->fieldref->classref->name);
2809 utf_display(((unresolved_field *) iptr[1].target)->fieldref->name);
2811 utf_display(((unresolved_field *) iptr[1].target)->fieldref->descriptor);
2816 printf(" %d + %d", iptr->op1, iptr->val.i);
2851 printf(" %d", iptr->op1);
2856 utf_display_classname(((classinfo *) iptr->val.a)->name);
2860 switch (iptr->op1) {
2888 case ICMD_ANEWARRAY:
2891 utf_display_classname(((classinfo *) iptr->val.a)->name);
2895 case ICMD_MULTIANEWARRAY:
2897 printf(" (NOT RESOLVED) %d ",iptr->op1);
2898 utf_display(((constant_classref *) iptr->val.a)->name);
2900 printf(" %d ",iptr->op1);
2901 utf_display_classname(((vftbl_t *) iptr->val.a)->class->name);
2905 case ICMD_CHECKCAST:
2906 case ICMD_INSTANCEOF:
2908 classinfo *c = iptr->val.a;
2910 if (c->flags & ACC_INTERFACE)
2911 printf(" (INTERFACE) ");
2913 printf(" (CLASS,%3d) ", c->vftbl->diffval);
2915 printf(" (NOT RESOLVED) ");
2917 utf_display_classname(((constant_classref *) iptr->target)->name);
2921 case ICMD_ARRAYCHECKCAST:
2923 classinfo *c = ((vftbl_t *) iptr->target)->class;
2924 if (c->flags & ACC_INTERFACE)
2925 printf(" (INTERFACE) ");
2927 printf(" (CLASS,%3d) ", c->vftbl->diffval);
2928 utf_display_classname(c->name);
2930 printf(" (NOT RESOLVED) ");
2931 utf_display_classname(((constant_classref *) iptr->target)->name);
2935 case ICMD_INLINE_START:
2937 utf_display_classname(iptr->method->class->name);
2939 utf_display_classname(iptr->method->name);
2940 utf_display_classname(iptr->method->descriptor);
2941 printf(", depth=%i", iptr->op1);
2943 case ICMD_INLINE_END:
2947 printf(" %s", ((builtintable_entry *) iptr->val.a)->name);
2950 case ICMD_INVOKEVIRTUAL:
2951 case ICMD_INVOKESPECIAL:
2952 case ICMD_INVOKESTATIC:
2953 case ICMD_INVOKEINTERFACE:
2955 printf(" (NOT RESOLVED) ");
2958 utf_display_classname(((unresolved_method *) iptr->target)->methodref->classref->name);
2960 utf_display(((unresolved_method *) iptr->target)->methodref->name);
2961 utf_display(((unresolved_method *) iptr->target)->methodref->descriptor);
2970 if (deadcode || !iptr->target)
2971 printf("(%d) op1=%d", iptr->val.i, iptr->op1);
2973 printf("(%d) L%03d", iptr->val.i, ((basicblock *) iptr->target)->debug_nr);
2982 if (deadcode || !iptr->target)
2983 #if SIZEOF_VOID_P == 4
2984 printf("(%lld) op1=%d", iptr->val.l, iptr->op1);
2986 printf("(%ld) op1=%d", iptr->val.l, iptr->op1);
2989 #if SIZEOF_VOID_P == 4
2990 printf("(%lld) L%03d", iptr->val.l, ((basicblock *) iptr->target)->debug_nr);
2992 printf("(%ld) L%03d", iptr->val.l, ((basicblock *) iptr->target)->debug_nr);
2999 case ICMD_IFNONNULL:
3000 case ICMD_IF_ICMPEQ:
3001 case ICMD_IF_ICMPNE:
3002 case ICMD_IF_ICMPLT:
3003 case ICMD_IF_ICMPGE:
3004 case ICMD_IF_ICMPGT:
3005 case ICMD_IF_ICMPLE:
3006 case ICMD_IF_LCMPEQ:
3007 case ICMD_IF_LCMPNE:
3008 case ICMD_IF_LCMPLT:
3009 case ICMD_IF_LCMPGE:
3010 case ICMD_IF_LCMPGT:
3011 case ICMD_IF_LCMPLE:
3012 case ICMD_IF_ACMPEQ:
3013 case ICMD_IF_ACMPNE:
3014 if (deadcode || !iptr->target)
3015 printf(" op1=%d", iptr->op1);
3017 printf(" L%03d", ((basicblock *) iptr->target)->debug_nr);
3020 case ICMD_TABLESWITCH:
3021 s4ptr = (s4*)iptr->val.a;
3023 if (deadcode || !iptr->target) {
3024 printf(" %d;", *s4ptr);
3027 tptr = (void **) iptr->target;
3028 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
3032 s4ptr++; /* skip default */
3033 j = *s4ptr++; /* low */
3034 j = *s4ptr++ - j; /* high */
3036 if (deadcode || !*tptr)
3037 printf(" %d", *s4ptr++);
3039 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
3046 case ICMD_LOOKUPSWITCH:
3047 s4ptr = (s4*)iptr->val.a;
3049 if (deadcode || !iptr->target) {
3050 printf(" %d;", *s4ptr);
3053 tptr = (void **) iptr->target;
3054 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
3057 s4ptr++; /* default */
3058 j = *s4ptr++; /* count */
3061 if (deadcode || !*tptr) {
3062 s4ptr++; /* skip value */
3063 printf(" %d",*s4ptr++);
3066 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
3076 * These are local overrides for various environment variables in Emacs.
3077 * Please do not remove this and leave it at the end of the file, where
3078 * Emacs will automagically detect them.
3079 * ---------------------------------------------------------------------
3082 * indent-tabs-mode: t