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 3071 2005-07-20 03:09:11Z michi $
47 #include "mm/memory.h"
48 #include "native/native.h"
49 #include "toolbox/logging.h"
50 #include "vm/global.h"
51 #include "vm/builtin.h"
52 #include "vm/options.h"
53 #include "vm/resolve.h"
54 #include "vm/statistics.h"
55 #include "vm/stringlocal.h"
56 #include "vm/tables.h"
57 #include "vm/jit/codegen.inc.h"
58 #include "vm/jit/jit.h"
59 #include "vm/jit/reg.h"
60 #include "vm/jit/stack.h"
61 #include "vm/jit/lsra.h"
64 /* global variables ***********************************************************/
66 #if defined(USE_THREADS)
67 static java_objectheader show_icmd_lock;
71 /* stack_init ******************************************************************
73 Initialized the stack analysis subsystem (called by jit_init).
75 *******************************************************************************/
79 #if defined(USE_THREADS)
80 /* initialize the show lock */
82 show_icmd_lock.monitorPtr = get_dummyLR();
91 /**********************************************************************/
93 /**********************************************************************/
95 /* analyse_stack uses the intermediate code created by parse.c to
96 * build a model of the JVM operand stack for the current method.
98 * The following checks are performed:
99 * - check for operand stack underflow (before each instruction)
100 * - check for operand stack overflow (after[1] each instruction)
101 * - check for matching stack depth at merging points
102 * - check for matching basic types[2] at merging points
103 * - check basic types for instruction input (except for BUILTIN*
104 * opcodes, INVOKE* opcodes and MULTIANEWARRAY)
106 * [1]) Checking this after the instruction should be ok. parse.c
107 * counts the number of required stack slots in such a way that it is
108 * only vital that we don't exceed `maxstack` at basic block
111 * [2]) 'basic types' means the distinction between INT, LONG, FLOAT,
112 * DOUBLE and ADDRESS types. Subtypes of INT and different ADDRESS
113 * types are not discerned.
116 methodinfo *analyse_stack(methodinfo *m, codegendata *cd, registerdata *rd)
124 int opcode, i, len, loops;
125 int superblockend, repeat, deadcode;
133 builtintable_entry *bte;
134 unresolved_method *um;
141 argren = DMNEW(s4, cd->maxlocals); /* table for argument renaming */
142 for (i = 0; i < cd->maxlocals; i++)
147 m->basicblocks[0].flags = BBREACHED;
148 m->basicblocks[0].instack = 0;
149 m->basicblocks[0].indepth = 0;
151 for (i = 0; i < cd->exceptiontablelength; i++) {
152 bptr = &m->basicblocks[m->basicblockindex[cd->exceptiontable[i].handlerpc]];
153 bptr->flags = BBREACHED;
154 bptr->type = BBTYPE_EXH;
157 bptr->pre_count = 10000;
162 #if CONDITIONAL_LOADCONST
163 b_count = m->basicblockcount;
164 bptr = m->basicblocks;
165 while (--b_count >= 0) {
166 if (bptr->icount != 0) {
167 iptr = bptr->iinstr + bptr->icount - 1;
200 m->basicblocks[m->basicblockindex[iptr->op1]].pre_count++;
203 case ICMD_TABLESWITCH:
205 m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
206 i = *s4ptr++; /* low */
207 i = *s4ptr++ - i + 1; /* high */
209 m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
213 case ICMD_LOOKUPSWITCH:
215 m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
216 i = *s4ptr++; /* count */
218 m->basicblocks[m->basicblockindex[s4ptr[1]]].pre_count++;
229 #endif /* CONDITIONAL_LOADCONST */
234 b_count = m->basicblockcount;
235 bptr = m->basicblocks;
236 superblockend = true;
241 while (--b_count >= 0) {
242 if (bptr->flags == BBDELETED) {
245 } else if (superblockend && (bptr->flags < BBREACHED)) {
248 } else if (bptr->flags <= BBREACHED) {
250 stackdepth = bptr->indepth;
252 } else if (bptr->flags < BBREACHED) {
254 bptr->instack = copy;
255 bptr->indepth = stackdepth;
257 } else if (bptr->indepth != stackdepth) {
258 show_icmd_method(m, cd, rd);
259 printf("Block: %d, required depth: %d, current depth: %d\n", bptr->debug_nr, bptr->indepth, stackdepth);
260 log_text("Stack depth mismatch");
264 curstack = bptr->instack;
266 superblockend = false;
267 bptr->flags = BBFINISHED;
270 b_index = bptr - m->basicblocks;
274 /* XXX TWISTI: why is this set to NULL here? */
275 /* iptr->target = NULL; */
277 #if defined(USEBUILTINTABLE)
278 bte = builtintable_get_automatic(opcode);
280 if (bte && bte->opcode == opcode) {
281 iptr->opc = ICMD_BUILTIN;
282 iptr->op1 = bte->md->paramcount;
284 m->isleafmethod = false;
287 #endif /* defined(USEBUILTINTABLE) */
294 COUNT(count_check_null);
296 case ICMD_CHECKASIZE:
297 case ICMD_CHECKEXCEPTION:
299 case ICMD_IFEQ_ICONST:
300 case ICMD_IFNE_ICONST:
301 case ICMD_IFLT_ICONST:
302 case ICMD_IFGE_ICONST:
303 case ICMD_IFGT_ICONST:
304 case ICMD_IFLE_ICONST:
305 case ICMD_ELSE_ICONST:
310 rd->locals[iptr->op1][TYPE_ADR].type = TYPE_ADR;
312 COUNT(count_pcmd_return);
314 superblockend = true;
317 /* pop 0 push 1 const */
320 COUNT(count_pcmd_load);
322 switch (iptr[1].opc) {
324 iptr[0].opc = ICMD_IADDCONST;
326 iptr[1].opc = ICMD_NOP;
327 OP1_1(TYPE_INT, TYPE_INT);
328 COUNT(count_pcmd_op);
331 iptr[0].opc = ICMD_ISUBCONST;
332 goto icmd_iconst_tail;
333 #if SUPPORT_CONST_MUL
335 iptr[0].opc = ICMD_IMULCONST;
336 goto icmd_iconst_tail;
337 #else /* SUPPORT_CONST_MUL */
339 if (iptr[0].val.i == 0x00000002)
341 else if (iptr[0].val.i == 0x00000004)
343 else if (iptr[0].val.i == 0x00000008)
345 else if (iptr[0].val.i == 0x00000010)
347 else if (iptr[0].val.i == 0x00000020)
349 else if (iptr[0].val.i == 0x00000040)
351 else if (iptr[0].val.i == 0x00000080)
353 else if (iptr[0].val.i == 0x00000100)
355 else if (iptr[0].val.i == 0x00000200)
357 else if (iptr[0].val.i == 0x00000400)
359 else if (iptr[0].val.i == 0x00000800)
361 else if (iptr[0].val.i == 0x00001000)
363 else if (iptr[0].val.i == 0x00002000)
365 else if (iptr[0].val.i == 0x00004000)
367 else if (iptr[0].val.i == 0x00008000)
369 else if (iptr[0].val.i == 0x00010000)
371 else if (iptr[0].val.i == 0x00020000)
373 else if (iptr[0].val.i == 0x00040000)
375 else if (iptr[0].val.i == 0x00080000)
377 else if (iptr[0].val.i == 0x00100000)
379 else if (iptr[0].val.i == 0x00200000)
381 else if (iptr[0].val.i == 0x00400000)
383 else if (iptr[0].val.i == 0x00800000)
385 else if (iptr[0].val.i == 0x01000000)
387 else if (iptr[0].val.i == 0x02000000)
389 else if (iptr[0].val.i == 0x04000000)
391 else if (iptr[0].val.i == 0x08000000)
393 else if (iptr[0].val.i == 0x10000000)
395 else if (iptr[0].val.i == 0x20000000)
397 else if (iptr[0].val.i == 0x40000000)
399 else if (iptr[0].val.i == 0x80000000)
405 iptr[0].opc = ICMD_IMULPOW2;
406 goto icmd_iconst_tail;
407 #endif /* SUPPORT_CONST_MUL */
409 if (iptr[0].val.i == 0x00000002)
411 else if (iptr[0].val.i == 0x00000004)
413 else if (iptr[0].val.i == 0x00000008)
415 else if (iptr[0].val.i == 0x00000010)
417 else if (iptr[0].val.i == 0x00000020)
419 else if (iptr[0].val.i == 0x00000040)
421 else if (iptr[0].val.i == 0x00000080)
423 else if (iptr[0].val.i == 0x00000100)
425 else if (iptr[0].val.i == 0x00000200)
427 else if (iptr[0].val.i == 0x00000400)
429 else if (iptr[0].val.i == 0x00000800)
431 else if (iptr[0].val.i == 0x00001000)
433 else if (iptr[0].val.i == 0x00002000)
435 else if (iptr[0].val.i == 0x00004000)
437 else if (iptr[0].val.i == 0x00008000)
439 else if (iptr[0].val.i == 0x00010000)
441 else if (iptr[0].val.i == 0x00020000)
443 else if (iptr[0].val.i == 0x00040000)
445 else if (iptr[0].val.i == 0x00080000)
447 else if (iptr[0].val.i == 0x00100000)
449 else if (iptr[0].val.i == 0x00200000)
451 else if (iptr[0].val.i == 0x00400000)
453 else if (iptr[0].val.i == 0x00800000)
455 else if (iptr[0].val.i == 0x01000000)
457 else if (iptr[0].val.i == 0x02000000)
459 else if (iptr[0].val.i == 0x04000000)
461 else if (iptr[0].val.i == 0x08000000)
463 else if (iptr[0].val.i == 0x10000000)
465 else if (iptr[0].val.i == 0x20000000)
467 else if (iptr[0].val.i == 0x40000000)
469 else if (iptr[0].val.i == 0x80000000)
475 iptr[0].opc = ICMD_IDIVPOW2;
476 goto icmd_iconst_tail;
478 /*log_text("stack.c: ICMD_ICONST/ICMD_IREM");*/
479 if ((iptr[0].val.i == 0x00000002) ||
480 (iptr[0].val.i == 0x00000004) ||
481 (iptr[0].val.i == 0x00000008) ||
482 (iptr[0].val.i == 0x00000010) ||
483 (iptr[0].val.i == 0x00000020) ||
484 (iptr[0].val.i == 0x00000040) ||
485 (iptr[0].val.i == 0x00000080) ||
486 (iptr[0].val.i == 0x00000100) ||
487 (iptr[0].val.i == 0x00000200) ||
488 (iptr[0].val.i == 0x00000400) ||
489 (iptr[0].val.i == 0x00000800) ||
490 (iptr[0].val.i == 0x00001000) ||
491 (iptr[0].val.i == 0x00002000) ||
492 (iptr[0].val.i == 0x00004000) ||
493 (iptr[0].val.i == 0x00008000) ||
494 (iptr[0].val.i == 0x00010000) ||
495 (iptr[0].val.i == 0x00020000) ||
496 (iptr[0].val.i == 0x00040000) ||
497 (iptr[0].val.i == 0x00080000) ||
498 (iptr[0].val.i == 0x00100000) ||
499 (iptr[0].val.i == 0x00200000) ||
500 (iptr[0].val.i == 0x00400000) ||
501 (iptr[0].val.i == 0x00800000) ||
502 (iptr[0].val.i == 0x01000000) ||
503 (iptr[0].val.i == 0x02000000) ||
504 (iptr[0].val.i == 0x04000000) ||
505 (iptr[0].val.i == 0x08000000) ||
506 (iptr[0].val.i == 0x10000000) ||
507 (iptr[0].val.i == 0x20000000) ||
508 (iptr[0].val.i == 0x40000000) ||
509 (iptr[0].val.i == 0x80000000)) {
510 iptr[0].opc = ICMD_IREMPOW2;
512 goto icmd_iconst_tail;
516 #if SUPPORT_CONST_LOGICAL
518 iptr[0].opc = ICMD_IANDCONST;
519 goto icmd_iconst_tail;
521 iptr[0].opc = ICMD_IORCONST;
522 goto icmd_iconst_tail;
524 iptr[0].opc = ICMD_IXORCONST;
525 goto icmd_iconst_tail;
526 #endif /* SUPPORT_CONST_LOGICAL */
528 iptr[0].opc = ICMD_ISHLCONST;
529 goto icmd_iconst_tail;
531 iptr[0].opc = ICMD_ISHRCONST;
532 goto icmd_iconst_tail;
534 iptr[0].opc = ICMD_IUSHRCONST;
535 goto icmd_iconst_tail;
536 #if SUPPORT_LONG_SHIFT
538 iptr[0].opc = ICMD_LSHLCONST;
539 goto icmd_lconst_tail;
541 iptr[0].opc = ICMD_LSHRCONST;
542 goto icmd_lconst_tail;
544 iptr[0].opc = ICMD_LUSHRCONST;
545 goto icmd_lconst_tail;
546 #endif /* SUPPORT_LONG_SHIFT */
548 iptr[0].opc = ICMD_IFEQ;
550 iptr[0].op1 = iptr[1].op1;
554 /* iptr[1].opc = ICMD_NOP; */
556 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
558 iptr[0].target = (void *) tbptr;
560 MARKREACHED(tbptr, copy);
561 COUNT(count_pcmd_bra);
567 iptr[0].opc = ICMD_IFLT;
568 goto icmd_if_icmp_tail;
570 iptr[0].opc = ICMD_IFLE;
571 goto icmd_if_icmp_tail;
573 iptr[0].opc = ICMD_IFNE;
574 goto icmd_if_icmp_tail;
576 iptr[0].opc = ICMD_IFGT;
577 goto icmd_if_icmp_tail;
579 iptr[0].opc = ICMD_IFGE;
580 goto icmd_if_icmp_tail;
582 #if SUPPORT_CONST_STORE
587 #if SUPPORT_CONST_STORE_ZERO_ONLY
588 if (iptr[0].val.i == 0) {
589 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
590 switch (iptr[1].opc) {
592 iptr[0].opc = ICMD_IASTORECONST;
595 iptr[0].opc = ICMD_BASTORECONST;
598 iptr[0].opc = ICMD_CASTORECONST;
601 iptr[0].opc = ICMD_SASTORECONST;
605 iptr[1].opc = ICMD_NOP;
606 OPTT2_0(TYPE_INT, TYPE_ADR);
607 COUNT(count_pcmd_op);
608 #if SUPPORT_CONST_STORE_ZERO_ONLY
611 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
616 #if SUPPORT_CONST_STORE_ZERO_ONLY
617 if (iptr[0].val.i == 0) {
618 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
619 switch (iptr[1].opc) {
621 iptr[0].opc = ICMD_PUTSTATICCONST;
625 iptr[0].opc = ICMD_PUTFIELDCONST;
630 iptr[1].opc = ICMD_NOP;
631 iptr[0].op1 = TYPE_INT;
632 COUNT(count_pcmd_op);
633 #if SUPPORT_CONST_STORE_ZERO_ONLY
636 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
638 #endif /* SUPPORT_CONST_STORE */
648 COUNT(count_pcmd_load);
650 switch (iptr[1].opc) {
653 iptr[0].opc = ICMD_LADDCONST;
655 iptr[1].opc = ICMD_NOP;
656 OP1_1(TYPE_LNG,TYPE_LNG);
657 COUNT(count_pcmd_op);
660 iptr[0].opc = ICMD_LSUBCONST;
661 goto icmd_lconst_tail;
662 #endif /* SUPPORT_LONG_ADD */
663 #if SUPPORT_LONG_MUL && SUPPORT_CONST_MUL
665 iptr[0].opc = ICMD_LMULCONST;
666 goto icmd_lconst_tail;
667 #else /* SUPPORT_LONG_MUL && SUPPORT_CONST_MUL */
668 # if SUPPORT_LONG_SHIFT
670 if (iptr[0].val.l == 0x00000002)
672 else if (iptr[0].val.l == 0x00000004)
674 else if (iptr[0].val.l == 0x00000008)
676 else if (iptr[0].val.l == 0x00000010)
678 else if (iptr[0].val.l == 0x00000020)
680 else if (iptr[0].val.l == 0x00000040)
682 else if (iptr[0].val.l == 0x00000080)
684 else if (iptr[0].val.l == 0x00000100)
686 else if (iptr[0].val.l == 0x00000200)
688 else if (iptr[0].val.l == 0x00000400)
690 else if (iptr[0].val.l == 0x00000800)
692 else if (iptr[0].val.l == 0x00001000)
694 else if (iptr[0].val.l == 0x00002000)
696 else if (iptr[0].val.l == 0x00004000)
698 else if (iptr[0].val.l == 0x00008000)
700 else if (iptr[0].val.l == 0x00010000)
702 else if (iptr[0].val.l == 0x00020000)
704 else if (iptr[0].val.l == 0x00040000)
706 else if (iptr[0].val.l == 0x00080000)
708 else if (iptr[0].val.l == 0x00100000)
710 else if (iptr[0].val.l == 0x00200000)
712 else if (iptr[0].val.l == 0x00400000)
714 else if (iptr[0].val.l == 0x00800000)
716 else if (iptr[0].val.l == 0x01000000)
718 else if (iptr[0].val.l == 0x02000000)
720 else if (iptr[0].val.l == 0x04000000)
722 else if (iptr[0].val.l == 0x08000000)
724 else if (iptr[0].val.l == 0x10000000)
726 else if (iptr[0].val.l == 0x20000000)
728 else if (iptr[0].val.l == 0x40000000)
730 else if (iptr[0].val.l == 0x80000000)
736 iptr[0].opc = ICMD_LMULPOW2;
737 goto icmd_lconst_tail;
738 # endif /* SUPPORT_LONG_SHIFT */
739 #endif /* SUPPORT_LONG_MUL && SUPPORT_CONST_MUL */
742 if (iptr[0].val.l == 0x00000002)
744 else if (iptr[0].val.l == 0x00000004)
746 else if (iptr[0].val.l == 0x00000008)
748 else if (iptr[0].val.l == 0x00000010)
750 else if (iptr[0].val.l == 0x00000020)
752 else if (iptr[0].val.l == 0x00000040)
754 else if (iptr[0].val.l == 0x00000080)
756 else if (iptr[0].val.l == 0x00000100)
758 else if (iptr[0].val.l == 0x00000200)
760 else if (iptr[0].val.l == 0x00000400)
762 else if (iptr[0].val.l == 0x00000800)
764 else if (iptr[0].val.l == 0x00001000)
766 else if (iptr[0].val.l == 0x00002000)
768 else if (iptr[0].val.l == 0x00004000)
770 else if (iptr[0].val.l == 0x00008000)
772 else if (iptr[0].val.l == 0x00010000)
774 else if (iptr[0].val.l == 0x00020000)
776 else if (iptr[0].val.l == 0x00040000)
778 else if (iptr[0].val.l == 0x00080000)
780 else if (iptr[0].val.l == 0x00100000)
782 else if (iptr[0].val.l == 0x00200000)
784 else if (iptr[0].val.l == 0x00400000)
786 else if (iptr[0].val.l == 0x00800000)
788 else if (iptr[0].val.l == 0x01000000)
790 else if (iptr[0].val.l == 0x02000000)
792 else if (iptr[0].val.l == 0x04000000)
794 else if (iptr[0].val.l == 0x08000000)
796 else if (iptr[0].val.l == 0x10000000)
798 else if (iptr[0].val.l == 0x20000000)
800 else if (iptr[0].val.l == 0x40000000)
802 else if (iptr[0].val.l == 0x80000000)
808 iptr[0].opc = ICMD_LDIVPOW2;
809 goto icmd_lconst_tail;
811 if ((iptr[0].val.l == 0x00000002) ||
812 (iptr[0].val.l == 0x00000004) ||
813 (iptr[0].val.l == 0x00000008) ||
814 (iptr[0].val.l == 0x00000010) ||
815 (iptr[0].val.l == 0x00000020) ||
816 (iptr[0].val.l == 0x00000040) ||
817 (iptr[0].val.l == 0x00000080) ||
818 (iptr[0].val.l == 0x00000100) ||
819 (iptr[0].val.l == 0x00000200) ||
820 (iptr[0].val.l == 0x00000400) ||
821 (iptr[0].val.l == 0x00000800) ||
822 (iptr[0].val.l == 0x00001000) ||
823 (iptr[0].val.l == 0x00002000) ||
824 (iptr[0].val.l == 0x00004000) ||
825 (iptr[0].val.l == 0x00008000) ||
826 (iptr[0].val.l == 0x00010000) ||
827 (iptr[0].val.l == 0x00020000) ||
828 (iptr[0].val.l == 0x00040000) ||
829 (iptr[0].val.l == 0x00080000) ||
830 (iptr[0].val.l == 0x00100000) ||
831 (iptr[0].val.l == 0x00200000) ||
832 (iptr[0].val.l == 0x00400000) ||
833 (iptr[0].val.l == 0x00800000) ||
834 (iptr[0].val.l == 0x01000000) ||
835 (iptr[0].val.l == 0x02000000) ||
836 (iptr[0].val.l == 0x04000000) ||
837 (iptr[0].val.l == 0x08000000) ||
838 (iptr[0].val.l == 0x10000000) ||
839 (iptr[0].val.l == 0x20000000) ||
840 (iptr[0].val.l == 0x40000000) ||
841 (iptr[0].val.l == 0x80000000)) {
842 iptr[0].opc = ICMD_LREMPOW2;
844 goto icmd_lconst_tail;
848 #endif /* SUPPORT_LONG_DIV */
849 #if SUPPORT_LONG_LOGICAL && SUPPORT_CONST_LOGICAL
852 iptr[0].opc = ICMD_LANDCONST;
853 goto icmd_lconst_tail;
855 iptr[0].opc = ICMD_LORCONST;
856 goto icmd_lconst_tail;
858 iptr[0].opc = ICMD_LXORCONST;
859 goto icmd_lconst_tail;
860 #endif /* SUPPORT_LONG_LOGICAL && SUPPORT_CONST_LOGICAL */
861 #if !defined(NOLONG_CONDITIONAL)
863 if ((len > 1) && (iptr[2].val.i == 0)) {
864 switch (iptr[2].opc) {
866 iptr[0].opc = ICMD_IF_LEQ;
867 icmd_lconst_lcmp_tail:
868 iptr[0].op1 = iptr[2].op1;
871 /* iptr[1].opc = ICMD_NOP;
872 iptr[2].opc = ICMD_NOP; */
874 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
876 iptr[0].target = (void *) tbptr;
878 MARKREACHED(tbptr, copy);
879 COUNT(count_pcmd_bra);
880 COUNT(count_pcmd_op);
883 iptr[0].opc = ICMD_IF_LNE;
884 goto icmd_lconst_lcmp_tail;
886 iptr[0].opc = ICMD_IF_LLT;
887 goto icmd_lconst_lcmp_tail;
889 iptr[0].opc = ICMD_IF_LGT;
890 goto icmd_lconst_lcmp_tail;
892 iptr[0].opc = ICMD_IF_LLE;
893 goto icmd_lconst_lcmp_tail;
895 iptr[0].opc = ICMD_IF_LGE;
896 goto icmd_lconst_lcmp_tail;
899 } /* switch (iptr[2].opc) */
900 } /* if (iptr[2].val.i == 0) */
904 #endif /* !defined(NOLONG_CONDITIONAL) */
906 #if SUPPORT_CONST_STORE
908 #if SUPPORT_CONST_STORE_ZERO_ONLY
909 if (iptr[0].val.l == 0) {
910 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
911 iptr[0].opc = ICMD_LASTORECONST;
912 iptr[1].opc = ICMD_NOP;
913 OPTT2_0(TYPE_INT, TYPE_ADR);
914 COUNT(count_pcmd_op);
915 #if SUPPORT_CONST_STORE_ZERO_ONLY
918 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
923 #if SUPPORT_CONST_STORE_ZERO_ONLY
924 if (iptr[0].val.l == 0) {
925 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
926 switch (iptr[1].opc) {
928 iptr[0].opc = ICMD_PUTSTATICCONST;
932 iptr[0].opc = ICMD_PUTFIELDCONST;
937 iptr[1].opc = ICMD_NOP;
938 iptr[0].op1 = TYPE_LNG;
939 COUNT(count_pcmd_op);
940 #if SUPPORT_CONST_STORE_ZERO_ONLY
943 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
945 #endif /* SUPPORT_CONST_STORE */
955 COUNT(count_pcmd_load);
960 COUNT(count_pcmd_load);
965 COUNT(count_pcmd_load);
966 #if SUPPORT_CONST_STORE
967 if (len > 0 && iptr->val.a == 0) {
968 switch (iptr[1].opc) {
969 #if !defined(__POWERPC__) && !defined(__X86_64__) && !defined(__I386__) && !defined(__ALPHA__) && !defined(__MIPS__)
971 if (iptr[1].val.fp != BUILTIN_aastore) {
979 switch (iptr[1].opc) {
981 iptr[0].opc = ICMD_AASTORECONST;
982 OPTT2_0(TYPE_INT, TYPE_ADR);
985 iptr[0].opc = ICMD_PUTSTATICCONST;
986 iptr[0].op1 = TYPE_ADR;
990 iptr[0].opc = ICMD_PUTFIELDCONST;
991 iptr[0].op1 = TYPE_ADR;
996 iptr[1].opc = ICMD_NOP;
997 COUNT(count_pcmd_op);
1001 PUSHCONST(TYPE_ADR);
1004 #endif /* SUPPORT_CONST_STORE */
1005 PUSHCONST(TYPE_ADR);
1008 /* pop 0 push 1 load */
1015 COUNT(count_load_instruction);
1016 i = opcode-ICMD_ILOAD;
1017 iptr->op1 = argren[iptr->op1];
1018 rd->locals[iptr->op1][i].type = i;
1019 LOAD(i, LOCALVAR, iptr->op1);
1029 COUNT(count_check_null);
1030 COUNT(count_check_bound);
1031 COUNT(count_pcmd_mem);
1032 OP2IAT_1(opcode-ICMD_IALOAD);
1038 COUNT(count_check_null);
1039 COUNT(count_check_bound);
1040 COUNT(count_pcmd_mem);
1044 /* pop 0 push 0 iinc */
1047 #if defined(STATISTICS)
1051 count_store_depth[10]++;
1053 count_store_depth[i]++;
1059 if ((copy->varkind == LOCALVAR) &&
1060 (copy->varnum == iptr->op1)) {
1061 copy->varkind = TEMPVAR;
1070 /* pop 1 push 0 store */
1080 i = opcode - ICMD_ISTORE;
1081 rd->locals[iptr->op1][i].type = i;
1082 #if defined(STATISTICS)
1087 count_store_length[20]++;
1089 count_store_length[i]++;
1092 count_store_depth[10]++;
1094 count_store_depth[i]++;
1097 copy = curstack->prev;
1100 if ((copy->varkind == LOCALVAR) &&
1101 (copy->varnum == iptr->op1)) {
1102 copy->varkind = TEMPVAR;
1108 if ((new - curstack) == 1) {
1109 curstack->varkind = LOCALVAR;
1110 curstack->varnum = iptr->op1;
1112 STORE(opcode-ICMD_ISTORE);
1118 COUNT(count_check_null);
1119 COUNT(count_check_bound);
1120 COUNT(count_pcmd_mem);
1122 bte = (builtintable_entry *) iptr->val.a;
1126 if (md->memuse > rd->memuse)
1127 rd->memuse = md->memuse;
1128 if (md->argintreguse > rd->argintreguse)
1129 rd->argintreguse = md->argintreguse;
1131 /* make all stack variables saved */
1135 copy->flags |= SAVEDVAR;
1146 COUNT(count_check_null);
1147 COUNT(count_check_bound);
1148 COUNT(count_pcmd_mem);
1149 OP3TIA_0(opcode - ICMD_IASTORE);
1155 COUNT(count_check_null);
1156 COUNT(count_check_bound);
1157 COUNT(count_pcmd_mem);
1164 #ifdef TYPECHECK_STACK_COMPCAT
1167 if (IS_2_WORD_TYPE(curstack->type)) {
1168 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1181 md_return_alloc(m, rd, opcode - ICMD_IRETURN, curstack);
1182 COUNT(count_pcmd_return);
1183 OP1_0(opcode - ICMD_IRETURN);
1184 superblockend = true;
1188 COUNT(count_check_null);
1192 superblockend = true;
1195 case ICMD_PUTSTATIC:
1196 COUNT(count_pcmd_mem);
1200 /* pop 1 push 0 branch */
1203 case ICMD_IFNONNULL:
1204 COUNT(count_pcmd_bra);
1206 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1208 iptr[0].target = (void *) tbptr;
1210 MARKREACHED(tbptr, copy);
1222 COUNT(count_pcmd_bra);
1223 #if CONDITIONAL_LOADCONST
1224 tbptr = m->basicblocks + b_index;
1225 if ((b_count >= 3) &&
1226 ((b_index + 2) == m->basicblockindex[iptr[0].op1]) &&
1227 (tbptr[1].pre_count == 1) &&
1228 (tbptr[1].iinstr[0].opc == ICMD_ICONST) &&
1229 (tbptr[1].iinstr[1].opc == ICMD_GOTO) &&
1230 ((b_index + 3) == m->basicblockindex[tbptr[1].iinstr[1].op1]) &&
1231 (tbptr[2].pre_count == 1) &&
1232 (tbptr[2].iinstr[0].opc == ICMD_ICONST) &&
1233 (tbptr[2].icount==1)) {
1234 /*printf("tbptr[2].icount=%d\n",tbptr[2].icount);*/
1235 OP1_1(TYPE_INT, TYPE_INT);
1236 switch (iptr[0].opc) {
1238 iptr[0].opc = ICMD_IFNE_ICONST;
1241 iptr[0].opc = ICMD_IFEQ_ICONST;
1244 iptr[0].opc = ICMD_IFGE_ICONST;
1247 iptr[0].opc = ICMD_IFLT_ICONST;
1250 iptr[0].opc = ICMD_IFLE_ICONST;
1253 iptr[0].opc = ICMD_IFGT_ICONST;
1257 iptr[0].val.i = iptr[1].val.i;
1258 iptr[1].opc = ICMD_ELSE_ICONST;
1259 iptr[1].val.i = iptr[3].val.i;
1260 iptr[2].opc = ICMD_NOP;
1261 iptr[3].opc = ICMD_NOP;
1263 /* HACK: save compare value in iptr[1].op1 */
1264 iptr[1].op1 = iptr[0].val.i;
1265 iptr[0].val.i = tbptr[1].iinstr[0].val.i;
1266 iptr[1].opc = ICMD_ELSE_ICONST;
1267 iptr[1].val.i = tbptr[2].iinstr[0].val.i;
1268 tbptr[1].iinstr[0].opc = ICMD_NOP;
1269 tbptr[1].iinstr[1].opc = ICMD_NOP;
1270 tbptr[2].iinstr[0].opc = ICMD_NOP;
1272 tbptr[1].flags = BBDELETED;
1273 tbptr[2].flags = BBDELETED;
1274 tbptr[1].icount = 0;
1275 tbptr[2].icount = 0;
1276 if (tbptr[3].pre_count == 2) {
1277 len += tbptr[3].icount + 3;
1278 bptr->icount += tbptr[3].icount + 3;
1279 tbptr[3].flags = BBDELETED;
1280 tbptr[3].icount = 0;
1290 #endif /* CONDITIONAL_LOADCONST */
1293 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1295 iptr[0].target = (void *) tbptr;
1297 MARKREACHED(tbptr, copy);
1300 /* pop 0 push 0 branch */
1303 COUNT(count_pcmd_bra);
1304 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1306 iptr[0].target = (void *) tbptr;
1308 MARKREACHED(tbptr, copy);
1310 superblockend = true;
1313 /* pop 1 push 0 table branch */
1315 case ICMD_TABLESWITCH:
1316 COUNT(count_pcmd_table);
1318 s4ptr = iptr->val.a;
1319 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1320 MARKREACHED(tbptr, copy);
1321 i = *s4ptr++; /* low */
1322 i = *s4ptr++ - i + 1; /* high */
1324 tptr = DMNEW(void*, i+1);
1325 iptr->target = (void *) tptr;
1327 tptr[0] = (void *) tbptr;
1331 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1333 tptr[0] = (void *) tbptr;
1336 MARKREACHED(tbptr, copy);
1339 superblockend = true;
1342 /* pop 1 push 0 table branch */
1344 case ICMD_LOOKUPSWITCH:
1345 COUNT(count_pcmd_table);
1347 s4ptr = iptr->val.a;
1348 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1349 MARKREACHED(tbptr, copy);
1350 i = *s4ptr++; /* count */
1352 tptr = DMNEW(void*, i+1);
1353 iptr->target = (void *) tptr;
1355 tptr[0] = (void *) tbptr;
1359 tbptr = m->basicblocks + m->basicblockindex[s4ptr[1]];
1361 tptr[0] = (void *) tbptr;
1364 MARKREACHED(tbptr, copy);
1368 superblockend = true;
1371 case ICMD_MONITORENTER:
1372 COUNT(count_check_null);
1373 case ICMD_MONITOREXIT:
1377 /* pop 2 push 0 branch */
1379 case ICMD_IF_ICMPEQ:
1380 case ICMD_IF_ICMPNE:
1381 case ICMD_IF_ICMPLT:
1382 case ICMD_IF_ICMPGE:
1383 case ICMD_IF_ICMPGT:
1384 case ICMD_IF_ICMPLE:
1385 COUNT(count_pcmd_bra);
1387 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1389 iptr[0].target = (void *) tbptr;
1391 MARKREACHED(tbptr, copy);
1394 case ICMD_IF_ACMPEQ:
1395 case ICMD_IF_ACMPNE:
1396 COUNT(count_pcmd_bra);
1398 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1400 iptr[0].target = (void *) tbptr;
1402 MARKREACHED(tbptr, copy);
1408 COUNT(count_check_null);
1409 COUNT(count_pcmd_mem);
1410 OPTT2_0(iptr->op1,TYPE_ADR);
1415 if (!IS_2_WORD_TYPE(curstack->type)) {
1417 #ifdef TYPECHECK_STACK_COMPCAT
1420 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1421 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1426 OP1_0ANY; /* second pop */
1429 iptr->opc = ICMD_POP;
1433 /* pop 0 push 1 dup */
1436 #ifdef TYPECHECK_STACK_COMPCAT
1439 if (IS_2_WORD_TYPE(curstack->type)) {
1440 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1445 COUNT(count_dup_instruction);
1451 if (IS_2_WORD_TYPE(curstack->type)) {
1453 iptr->opc = ICMD_DUP;
1458 /* ..., ????, cat1 */
1459 #ifdef TYPECHECK_STACK_COMPCAT
1461 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1462 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1468 NEWSTACK(copy->prev->type, copy->prev->varkind,
1469 copy->prev->varnum);
1470 NEWSTACK(copy->type, copy->varkind,
1477 /* pop 2 push 3 dup */
1480 #ifdef TYPECHECK_STACK_COMPCAT
1483 if (IS_2_WORD_TYPE(curstack->type) ||
1484 IS_2_WORD_TYPE(curstack->prev->type)) {
1485 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1495 if (IS_2_WORD_TYPE(curstack->type)) {
1496 /* ..., ????, cat2 */
1497 #ifdef TYPECHECK_STACK_COMPCAT
1499 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1500 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1505 iptr->opc = ICMD_DUP_X1;
1509 /* ..., ????, cat1 */
1510 #ifdef TYPECHECK_STACK_COMPCAT
1513 if (IS_2_WORD_TYPE(curstack->prev->type)
1514 || IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1515 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1524 /* pop 3 push 4 dup */
1528 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1529 /* ..., cat2, ???? */
1530 #ifdef TYPECHECK_STACK_COMPCAT
1532 if (IS_2_WORD_TYPE(curstack->type)) {
1533 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1538 iptr->opc = ICMD_DUP_X1;
1542 /* ..., cat1, ???? */
1543 #ifdef TYPECHECK_STACK_COMPCAT
1546 if (IS_2_WORD_TYPE(curstack->type)
1547 || IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1548 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1559 if (IS_2_WORD_TYPE(curstack->type)) {
1560 /* ..., ????, cat2 */
1561 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1562 /* ..., cat2, cat2 */
1563 iptr->opc = ICMD_DUP_X1;
1567 /* ..., cat1, cat2 */
1568 #ifdef TYPECHECK_STACK_COMPCAT
1571 if (IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1572 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1577 iptr->opc = ICMD_DUP_X2;
1583 /* ..., ????, ????, cat1 */
1584 if (IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1585 /* ..., cat2, ????, cat1 */
1586 #ifdef TYPECHECK_STACK_COMPCAT
1588 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1589 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1594 iptr->opc = ICMD_DUP2_X1;
1598 /* ..., cat1, ????, cat1 */
1599 #ifdef TYPECHECK_STACK_COMPCAT
1602 if (IS_2_WORD_TYPE(curstack->prev->type)
1603 || IS_2_WORD_TYPE(curstack->prev->prev->prev->type)) {
1604 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1614 /* pop 2 push 2 swap */
1617 #ifdef TYPECHECK_STACK_COMPCAT
1620 if (IS_2_WORD_TYPE(curstack->type)
1621 || IS_2_WORD_TYPE(curstack->prev->type)) {
1622 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1634 #if !SUPPORT_DIVISION
1635 bte = (builtintable_entry *) iptr->val.a;
1639 if (md->memuse > rd->memuse)
1640 rd->memuse = md->memuse;
1641 if (md->argintreguse > rd->argintreguse)
1642 rd->argintreguse = md->argintreguse;
1644 /* make all stack variables saved */
1648 copy->flags |= SAVEDVAR;
1651 #endif /* !SUPPORT_DIVISION */
1662 COUNT(count_pcmd_op);
1668 #if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
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 && SUPPORT_LONG && SUPPORT_LONG_DIV) */
1690 #if SUPPORT_LONG_LOGICAL
1694 #endif /* SUPPORT_LONG_LOGICAL */
1695 COUNT(count_pcmd_op);
1702 COUNT(count_pcmd_op);
1711 COUNT(count_pcmd_op);
1720 COUNT(count_pcmd_op);
1725 COUNT(count_pcmd_op);
1726 #if !defined(NOLONG_CONDITIONAL)
1727 if ((len > 0) && (iptr[1].val.i == 0)) {
1728 switch (iptr[1].opc) {
1730 iptr[0].opc = ICMD_IF_LCMPEQ;
1732 iptr[0].op1 = iptr[1].op1;
1735 /* iptr[1].opc = ICMD_NOP; */
1737 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1739 iptr[0].target = (void *) tbptr;
1741 MARKREACHED(tbptr, copy);
1742 COUNT(count_pcmd_bra);
1745 iptr[0].opc = ICMD_IF_LCMPNE;
1746 goto icmd_lcmp_if_tail;
1748 iptr[0].opc = ICMD_IF_LCMPLT;
1749 goto icmd_lcmp_if_tail;
1751 iptr[0].opc = ICMD_IF_LCMPGT;
1752 goto icmd_lcmp_if_tail;
1754 iptr[0].opc = ICMD_IF_LCMPLE;
1755 goto icmd_lcmp_if_tail;
1757 iptr[0].opc = ICMD_IF_LCMPGE;
1758 goto icmd_lcmp_if_tail;
1760 OPTT2_1(TYPE_LNG, TYPE_INT);
1765 OPTT2_1(TYPE_LNG, TYPE_INT);
1769 COUNT(count_pcmd_op);
1770 OPTT2_1(TYPE_FLT, TYPE_INT);
1774 COUNT(count_pcmd_op);
1775 OPTT2_1(TYPE_DBL, TYPE_INT);
1783 case ICMD_INT2SHORT:
1784 COUNT(count_pcmd_op);
1785 OP1_1(TYPE_INT, TYPE_INT);
1788 COUNT(count_pcmd_op);
1789 OP1_1(TYPE_LNG, TYPE_LNG);
1792 COUNT(count_pcmd_op);
1793 OP1_1(TYPE_FLT, TYPE_FLT);
1796 COUNT(count_pcmd_op);
1797 OP1_1(TYPE_DBL, TYPE_DBL);
1801 COUNT(count_pcmd_op);
1802 OP1_1(TYPE_INT, TYPE_LNG);
1805 COUNT(count_pcmd_op);
1806 OP1_1(TYPE_INT, TYPE_FLT);
1809 COUNT(count_pcmd_op);
1810 OP1_1(TYPE_INT, TYPE_DBL);
1813 COUNT(count_pcmd_op);
1814 OP1_1(TYPE_LNG, TYPE_INT);
1817 COUNT(count_pcmd_op);
1818 OP1_1(TYPE_LNG, TYPE_FLT);
1821 COUNT(count_pcmd_op);
1822 OP1_1(TYPE_LNG, TYPE_DBL);
1825 COUNT(count_pcmd_op);
1826 OP1_1(TYPE_FLT, TYPE_INT);
1829 COUNT(count_pcmd_op);
1830 OP1_1(TYPE_FLT, TYPE_LNG);
1833 COUNT(count_pcmd_op);
1834 OP1_1(TYPE_FLT, TYPE_DBL);
1837 COUNT(count_pcmd_op);
1838 OP1_1(TYPE_DBL, TYPE_INT);
1841 COUNT(count_pcmd_op);
1842 OP1_1(TYPE_DBL, TYPE_LNG);
1845 COUNT(count_pcmd_op);
1846 OP1_1(TYPE_DBL, TYPE_FLT);
1849 case ICMD_CHECKCAST:
1850 OP1_1(TYPE_ADR, TYPE_ADR);
1853 case ICMD_ARRAYCHECKCAST:
1854 bte = (builtintable_entry *) iptr->val.a;
1857 if (md->memuse > rd->memuse)
1858 rd->memuse = md->memuse;
1859 if (md->argintreguse > rd->argintreguse)
1860 rd->argintreguse = md->argintreguse;
1862 /* make all stack variables saved */
1866 copy->flags |= SAVEDVAR;
1870 OP1_1(TYPE_ADR, TYPE_ADR);
1873 case ICMD_INSTANCEOF:
1874 case ICMD_ARRAYLENGTH:
1875 OP1_1(TYPE_ADR, TYPE_INT);
1879 case ICMD_ANEWARRAY:
1880 OP1_1(TYPE_INT, TYPE_ADR);
1884 COUNT(count_check_null);
1885 COUNT(count_pcmd_mem);
1886 OP1_1(TYPE_ADR, iptr->op1);
1891 case ICMD_GETSTATIC:
1892 COUNT(count_pcmd_mem);
1902 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1904 iptr[0].target = (void *) tbptr;
1906 /* This is a dirty hack. The typechecker
1907 * needs it because the OP1_0ANY below
1908 * overwrites iptr->dst.
1910 iptr->val.a = (void *) iptr->dst;
1912 tbptr->type = BBTYPE_SBR;
1914 /* We need to check for overflow right here because
1915 * the pushed value is poped after MARKREACHED. */
1917 MARKREACHED(tbptr, copy);
1921 /* pop many push any */
1924 #if defined(USEBUILTINTABLE)
1927 bte = (builtintable_entry *) iptr->val.a;
1931 case ICMD_INVOKESTATIC:
1932 case ICMD_INVOKESPECIAL:
1933 case ICMD_INVOKEVIRTUAL:
1934 case ICMD_INVOKEINTERFACE:
1935 COUNT(count_pcmd_met);
1937 md = um->methodref->parseddesc.md;
1938 /* if (lm->flags & ACC_STATIC) */
1939 /* {COUNT(count_check_null);} */
1943 if (md->memuse > rd->memuse)
1944 rd->memuse = md->memuse;
1945 if (md->argintreguse > rd->argintreguse)
1946 rd->argintreguse = md->argintreguse;
1947 if (md->argfltreguse > rd->argfltreguse)
1948 rd->argfltreguse = md->argfltreguse;
1953 for (i-- ; i >= 0; i--) {
1954 #if defined(SUPPORT_NO_FLOAT_ARGUMENT_REGISTERS)
1955 if (!(copy->flags & SAVEDVAR) &&
1956 (!IS_FLT_DBL_TYPE(copy->type) || md->params[i].inmemory)) {
1958 if (!(copy->flags & SAVEDVAR)) {
1960 copy->varkind = ARGVAR;
1962 if (md->params[i].inmemory) {
1963 copy->flags = INMEMORY;
1964 copy->regoff = md->params[i].regoff;
1967 if (IS_FLT_DBL_TYPE(copy->type))
1968 #if defined(SUPPORT_NO_FLOAT_ARGUMENT_REGISTERS)
1972 rd->argfltregs[md->params[i].regoff];
1975 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
1976 if (IS_2_WORD_TYPE(copy->type))
1977 copy->regoff = PACK_REGS(
1978 rd->argintregs[GET_LOW_REG(md->params[i].regoff)],
1979 rd->argintregs[GET_HIGH_REG(md->params[i].regoff)]);
1983 rd->argintregs[md->params[i].regoff];
1991 copy->flags |= SAVEDVAR;
1997 if (md->returntype.type != TYPE_VOID)
1998 OP0_1(md->returntype.type);
2001 case ICMD_INLINE_START:
2002 case ICMD_INLINE_END:
2006 case ICMD_MULTIANEWARRAY:
2007 if (rd->argintreguse < 3)
2008 rd->argintreguse = 3;
2013 #if defined(SPECIALMEMUSE)
2014 # if defined(__DARWIN__)
2015 if (rd->memuse < (i + INT_ARG_CNT + LA_WORD_SIZE))
2016 rd->memuse = i + LA_WORD_SIZE + INT_ARG_CNT;
2018 if (rd->memuse < (i + LA_WORD_SIZE + 3))
2019 rd->memuse = i + LA_WORD_SIZE + 3;
2022 # if defined(__I386__)
2023 if (rd->memuse < i + 3)
2024 rd->memuse = i + 3; /* n integer args spilled on stack */
2027 rd->memuse = i; /* n integer args spilled on stack */
2028 # endif /* defined(__I386__) */
2032 /* check INT type here? Currently typecheck does this. */
2033 if (!(copy->flags & SAVEDVAR)) {
2034 copy->varkind = ARGVAR;
2035 copy->varnum = i + INT_ARG_CNT;
2036 copy->flags |= INMEMORY;
2037 #if defined(SPECIALMEMUSE)
2038 # if defined(__DARWIN__)
2039 copy->regoff = i + LA_WORD_SIZE + INT_ARG_CNT;
2041 copy->regoff = i + LA_WORD_SIZE + 3;
2044 # if defined(__I386__)
2045 copy->regoff = i + 3;
2048 # endif /* defined(__I386__) */
2049 #endif /* defined(SPECIALMEMUSE) */
2054 copy->flags |= SAVEDVAR;
2062 case ICMD_CLEAR_ARGREN:
2063 for (i = iptr->op1; i < cd->maxlocals; i++)
2065 iptr->opc = opcode = ICMD_NOP;
2069 case ICMD_READONLY_ARG:
2070 case ICMD_READONLY_ARG+1:
2071 case ICMD_READONLY_ARG+2:
2072 case ICMD_READONLY_ARG+3:
2073 case ICMD_READONLY_ARG+4:
2076 if (curstack->varkind == LOCALVAR) {
2077 i = curstack->varnum;
2078 argren[iptr->op1] = i;
2081 opcode = iptr->opc = opcode - ICMD_READONLY_ARG + ICMD_ISTORE;
2088 new_exception_message(string_java_lang_InternalError,
2095 } /* while instructions */
2097 bptr->outstack = curstack;
2098 bptr->outdepth = stackdepth;
2102 superblockend = true;
2104 } /* while blocks */
2105 } while (repeat && !deadcode);
2107 #if defined(STATISTICS)
2109 if (m->basicblockcount > count_max_basic_blocks)
2110 count_max_basic_blocks = m->basicblockcount;
2111 count_basic_blocks += m->basicblockcount;
2112 if (m->instructioncount > count_max_javainstr) count_max_javainstr = m->instructioncount;
2113 count_javainstr += m->instructioncount;
2114 if (m->stackcount > count_upper_bound_new_stack)
2115 count_upper_bound_new_stack = m->stackcount;
2116 if ((new - m->stack) > count_max_new_stack)
2117 count_max_new_stack = (new - m->stack);
2119 b_count = m->basicblockcount;
2120 bptr = m->basicblocks;
2121 while (--b_count >= 0) {
2122 if (bptr->flags > BBREACHED) {
2123 if (bptr->indepth >= 10)
2124 count_block_stack[10]++;
2126 count_block_stack[bptr->indepth]++;
2129 count_block_size_distribution[len]++;
2131 count_block_size_distribution[10]++;
2133 count_block_size_distribution[11]++;
2135 count_block_size_distribution[12]++;
2137 count_block_size_distribution[13]++;
2139 count_block_size_distribution[14]++;
2141 count_block_size_distribution[15]++;
2143 count_block_size_distribution[16]++;
2145 count_block_size_distribution[17]++;
2151 count_analyse_iterations[0]++;
2152 else if (loops == 2)
2153 count_analyse_iterations[1]++;
2154 else if (loops == 3)
2155 count_analyse_iterations[2]++;
2156 else if (loops == 4)
2157 count_analyse_iterations[3]++;
2159 count_analyse_iterations[4]++;
2161 if (m->basicblockcount <= 5)
2162 count_method_bb_distribution[0]++;
2163 else if (m->basicblockcount <= 10)
2164 count_method_bb_distribution[1]++;
2165 else if (m->basicblockcount <= 15)
2166 count_method_bb_distribution[2]++;
2167 else if (m->basicblockcount <= 20)
2168 count_method_bb_distribution[3]++;
2169 else if (m->basicblockcount <= 30)
2170 count_method_bb_distribution[4]++;
2171 else if (m->basicblockcount <= 40)
2172 count_method_bb_distribution[5]++;
2173 else if (m->basicblockcount <= 50)
2174 count_method_bb_distribution[6]++;
2175 else if (m->basicblockcount <= 75)
2176 count_method_bb_distribution[7]++;
2178 count_method_bb_distribution[8]++;
2182 /* just return methodinfo* to signal everything was ok */
2188 /**********************************************************************/
2189 /* DEBUGGING HELPERS */
2190 /**********************************************************************/
2192 void icmd_print_stack(codegendata *cd, stackptr s)
2204 j = cd->maxstack - i;
2209 /* DEBUG */ /*printf("(%d,%d,%d,%d)",s->varkind,s->flags,s->regoff,s->varnum); fflush(stdout);*/
2210 if (s->flags & SAVEDVAR)
2211 switch (s->varkind) {
2213 if (s->flags & INMEMORY)
2214 printf(" M%02d", s->regoff);
2215 #ifdef HAS_ADDRESS_REGISTER_FILE
2216 else if (s->type == TYPE_ADR)
2217 printf(" R%02d", s->regoff);
2219 else if (IS_FLT_DBL_TYPE(s->type))
2220 printf(" F%02d", s->regoff);
2222 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2223 if (IS_2_WORD_TYPE(s->type))
2224 printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
2225 regs[GET_HIGH_REG(s->regoff)]);
2228 printf(" %3s", regs[s->regoff]);
2232 printf(" I%02d", s->varnum);
2235 printf(" L%02d", s->varnum);
2238 if (s->varnum == -1) {
2240 /* varkind ARGVAR "misused for this special case */
2242 } else /* "normal" Argvar */
2243 printf(" A%02d", s->varnum);
2244 #ifdef INVOKE_NEW_DEBUG
2245 if (s->flags & INMEMORY)
2246 printf("(M%i)", s->regoff);
2248 printf("(R%i)", s->regoff);
2252 printf(" !%02d", j);
2255 switch (s->varkind) {
2257 if (s->flags & INMEMORY)
2258 printf(" m%02d", s->regoff);
2259 #ifdef HAS_ADDRESS_REGISTER_FILE
2260 else if (s->type == TYPE_ADR)
2261 printf(" r%02d", s->regoff);
2263 else if (IS_FLT_DBL_TYPE(s->type))
2264 printf(" f%02d", s->regoff);
2266 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2267 if (IS_2_WORD_TYPE(s->type))
2268 printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
2269 regs[GET_HIGH_REG(s->regoff)]);
2272 printf(" %3s", regs[s->regoff]);
2276 printf(" i%02d", s->varnum);
2279 printf(" l%02d", s->varnum);
2282 if (s->varnum == -1) {
2284 /* varkind ARGVAR "misused for this special case */
2286 } else /* "normal" Argvar */
2287 printf(" a%02d", s->varnum);
2288 #ifdef INVOKE_NEW_DEBUG
2289 if (s->flags & INMEMORY)
2290 printf("(M%i)", s->regoff);
2292 printf("(R%i)", s->regoff);
2296 printf(" ?%02d", j);
2304 static void print_reg(stackptr s) {
2306 if (s->flags & SAVEDVAR)
2307 switch (s->varkind) {
2309 if (s->flags & INMEMORY)
2310 printf(" tm%02d", s->regoff);
2312 printf(" tr%02d", s->regoff);
2315 printf(" s %02d", s->varnum);
2318 printf(" l %02d", s->varnum);
2321 printf(" a %02d", s->varnum);
2324 printf(" ! %02d", s->varnum);
2327 switch (s->varkind) {
2329 if (s->flags & INMEMORY)
2330 printf(" Tm%02d", s->regoff);
2332 printf(" Tr%02d", s->regoff);
2335 printf(" S %02d", s->varnum);
2338 printf(" L %02d", s->varnum);
2341 printf(" A %02d", s->varnum);
2344 printf(" ? %02d", s->varnum);
2354 static char *jit_type[] = {
2363 /* show_icmd_method ************************************************************
2367 *******************************************************************************/
2369 void show_icmd_method(methodinfo *m, codegendata *cd, registerdata *rd)
2375 #if defined(USE_THREADS)
2376 /* We need to enter a lock here, since the binutils disassembler is not */
2377 /* reentrant-able and we could not read functions printed at the same */
2380 builtin_monitorenter(&show_icmd_lock);
2384 utf_fprint_classname(stdout, m->class->name);
2386 utf_fprint(stdout, m->name);
2387 utf_fprint(stdout, m->descriptor);
2388 printf("\n\nMax locals: %d\n", (int) cd->maxlocals);
2389 printf("Max stack: %d\n", (int) cd->maxstack);
2391 printf("Line number table length: %d\n", m->linenumbercount);
2393 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
2394 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
2395 printf(" L%03d ... ", ex->start->debug_nr );
2396 printf("L%03d = ", ex->end->debug_nr);
2397 printf("L%03d", ex->handler->debug_nr);
2398 printf(" (catchtype: ");
2399 if (ex->catchtype.any)
2400 if (IS_CLASSREF(ex->catchtype))
2401 utf_display_classname(ex->catchtype.ref->name);
2403 utf_display_classname(ex->catchtype.cls->name);
2409 printf("Local Table:\n");
2410 for (i = 0; i < cd->maxlocals; i++) {
2411 printf(" %3d: ", i);
2412 for (j = TYPE_INT; j <= TYPE_ADR; j++)
2413 if (rd->locals[i][j].type >= 0) {
2414 printf(" (%s) ", jit_type[j]);
2415 if (rd->locals[i][j].flags & INMEMORY)
2416 printf("m%2d", rd->locals[i][j].regoff);
2417 #ifdef HAS_ADDRESS_REGISTER_FILE
2418 else if (j == TYPE_ADR)
2419 printf("r%02d", rd->locals[i][j].regoff);
2421 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2422 printf("f%02d", rd->locals[i][j].regoff);
2424 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2425 if (IS_2_WORD_TYPE(j))
2427 regs[GET_LOW_REG(rd->locals[i][j].regoff)],
2428 regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
2431 printf("%3s", regs[rd->locals[i][j].regoff]);
2441 printf("Interface Table:\n");
2442 for (i = 0; i < cd->maxstack; i++) {
2443 if ((rd->interfaces[i][0].type >= 0) ||
2444 (rd->interfaces[i][1].type >= 0) ||
2445 (rd->interfaces[i][2].type >= 0) ||
2446 (rd->interfaces[i][3].type >= 0) ||
2447 (rd->interfaces[i][4].type >= 0)) {
2448 printf(" %3d: ", i);
2449 for (j = TYPE_INT; j <= TYPE_ADR; j++)
2450 if (rd->interfaces[i][j].type >= 0) {
2451 printf(" (%s) ", jit_type[j]);
2452 if (rd->interfaces[i][j].flags & SAVEDVAR) {
2453 if (rd->interfaces[i][j].flags & INMEMORY)
2454 printf("M%2d", rd->interfaces[i][j].regoff);
2455 #ifdef HAS_ADDRESS_REGISTER_FILE
2456 else if (j == TYPE_ADR)
2457 printf("R%02d", rd->interfaces[i][j].regoff);
2459 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2460 printf("F%02d", rd->interfaces[i][j].regoff);
2462 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2463 if (IS_2_WORD_TYPE(j))
2465 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
2466 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
2469 printf("%3s",regs[rd->interfaces[i][j].regoff]);
2473 if (rd->interfaces[i][j].flags & INMEMORY)
2474 printf("m%2d", rd->interfaces[i][j].regoff);
2475 #ifdef HAS_ADDRESS_REGISTER_FILE
2476 else if (j == TYPE_ADR)
2477 printf("r%02d", rd->interfaces[i][j].regoff);
2479 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2480 printf("f%02d", rd->interfaces[i][j].regoff);
2482 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2483 if (IS_2_WORD_TYPE(j))
2485 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
2486 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
2489 printf("%3s",regs[rd->interfaces[i][j].regoff]);
2502 /* show code before first basic block */
2504 if (opt_showdisassemble) {
2505 #if defined(__I386__) || defined(__X86_64__)
2509 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen);
2510 for (i = 0; i < m->basicblocks[0].mpc;) {
2511 a = disassinstr(u1ptr);
2516 #elif defined(__XDSPCORE__)
2520 s4ptr = (s4 *) ((ptrint) m->mcode + cd->dseglen);
2521 for (i = 0; i < m->basicblocks[0].mpc;) {
2522 a = disassinstr(stdout, s4ptr);
2531 s4ptr = (s4 *) ((ptrint) m->mcode + cd->dseglen);
2532 for (i = 0; i < m->basicblocks[0].mpc; i += 4, s4ptr++) {
2539 /* show code off all basic blocks */
2541 for (bptr = m->basicblocks; bptr != NULL; bptr = bptr->next) {
2542 show_icmd_block(m, cd, bptr);
2545 /* show stubs code */
2547 if (opt_showdisassemble && opt_showexceptionstubs) {
2548 printf("\nException stubs code:\n");
2549 printf("Length: %d\n\n", (s4) (m->mcodelength -
2550 ((ptrint) cd->dseglen +
2551 m->basicblocks[m->basicblockcount].mpc)));
2553 #if defined(__I386__) || defined(__X86_64__)
2558 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen +
2559 m->basicblocks[m->basicblockcount].mpc);
2561 for (; (ptrint) u1ptr < ((ptrint) m->mcode + m->mcodelength);) {
2562 a = disassinstr(u1ptr);
2567 #elif defined(__XDSPCORE__)
2572 s4ptr = (s4 *) ((ptrint) m->mcode + cd->dseglen +
2573 m->basicblocks[m->basicblockcount].mpc);
2575 for (; (ptrint) s4ptr < ((ptrint) m->mcode + m->mcodelength);) {
2576 a = disassinstr(stdout, s4ptr);
2586 s4ptr = (s4 *) ((ptrint) m->mcode + cd->dseglen +
2587 m->basicblocks[m->basicblockcount].mpc);
2589 for (; (ptrint) s4ptr < ((ptrint) m->mcode + m->mcodelength); s4ptr++)
2597 #if defined(USE_THREADS)
2598 builtin_monitorexit(&show_icmd_lock);
2603 void show_icmd_block(methodinfo *m, codegendata *cd, basicblock *bptr)
2609 if (bptr->flags != BBDELETED) {
2610 deadcode = bptr->flags <= BBREACHED;
2613 for (j = cd->maxstack; j > 0; j--)
2616 icmd_print_stack(cd, bptr->instack);
2617 printf("] L%03d(%d - %d) flags=%d:\n", bptr->debug_nr, bptr->icount, bptr->pre_count,bptr->flags);
2618 iptr = bptr->iinstr;
2620 for (i = 0; i < bptr->icount; i++, iptr++) {
2623 for (j = cd->maxstack; j > 0; j--)
2627 icmd_print_stack(cd, iptr->dst);
2628 printf("] %5d (line: %5d) ", i, iptr->line);
2631 if (icmd_uses_tmp[iptr->opc][0])
2635 if (icmd_uses_tmp[iptr->opc][1])
2639 if (icmd_uses_tmp[iptr->opc][2])
2645 show_icmd(iptr, deadcode);
2649 if (opt_showdisassemble && (!deadcode)) {
2650 #if defined(__I386__) || defined(__X86_64__)
2656 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen + i);
2658 if (bptr->next != NULL) {
2659 for (; i < bptr->next->mpc; ) {
2660 a = disassinstr(u1ptr);
2667 for (; u1ptr < (u1 *) ((ptrint) m->mcode + m->mcodelength); ) {
2668 a = disassinstr(u1ptr);
2674 #elif defined(__XDSPCORE__)
2680 s4ptr = (s4 *) ((ptrint) m->mcode + cd->dseglen + i);
2682 if (bptr->next != NULL) {
2683 for (; i < bptr->next->mpc;) {
2684 a = disassinstr(stdout, s4ptr);
2692 for (; s4ptr < (s4 *) ((ptrint) m->mcode + m->mcodelength); ) {
2693 a = disassinstr(stdout, s4ptr);
2704 s4ptr = (s4 *) ((ptrint) m->mcode + cd->dseglen + i);
2706 if (bptr->next != NULL) {
2707 for (; i < bptr->next->mpc; i += 4, s4ptr++)
2712 for (; s4ptr < (s4 *) ((ptrint) m->mcode + m->mcodelength); i += 4, s4ptr++)
2722 void show_icmd(instruction *iptr, bool deadcode)
2728 printf("%s", icmd_names[iptr->opc]);
2730 switch (iptr->opc) {
2731 case ICMD_IADDCONST:
2732 case ICMD_ISUBCONST:
2733 case ICMD_IMULCONST:
2737 case ICMD_IANDCONST:
2739 case ICMD_IXORCONST:
2740 case ICMD_ISHLCONST:
2741 case ICMD_ISHRCONST:
2742 case ICMD_IUSHRCONST:
2743 case ICMD_LSHLCONST:
2744 case ICMD_LSHRCONST:
2745 case ICMD_LUSHRCONST:
2747 case ICMD_ELSE_ICONST:
2748 case ICMD_IASTORECONST:
2749 case ICMD_BASTORECONST:
2750 case ICMD_CASTORECONST:
2751 case ICMD_SASTORECONST:
2752 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
2755 case ICMD_IFEQ_ICONST:
2756 case ICMD_IFNE_ICONST:
2757 case ICMD_IFLT_ICONST:
2758 case ICMD_IFGE_ICONST:
2759 case ICMD_IFGT_ICONST:
2760 case ICMD_IFLE_ICONST:
2761 printf("(%d) %d", iptr[1].op1, iptr->val.i);
2764 case ICMD_LADDCONST:
2765 case ICMD_LSUBCONST:
2766 case ICMD_LMULCONST:
2770 case ICMD_LANDCONST:
2772 case ICMD_LXORCONST:
2774 case ICMD_LASTORECONST:
2775 #if SIZEOF_VOID_P == 4
2776 printf(" %lld (0x%016llx)", iptr->val.l, iptr->val.l);
2778 printf(" %ld (0x%016lx)", iptr->val.l, iptr->val.l);
2783 printf(" %f (0x%08x)", iptr->val.f, iptr->val.i);
2787 #if SIZEOF_VOID_P == 4
2788 printf(" %g (0x%016llx)", iptr->val.d, iptr->val.l);
2790 printf(" %g (0x%016lx)", iptr->val.d, iptr->val.l);
2795 case ICMD_AASTORECONST:
2796 printf(" %p", iptr->val.a);
2802 printf(" %d, ", ((fieldinfo *) iptr->val.a)->offset);
2804 printf(" (NOT RESOLVED), ");
2805 utf_display_classname(((unresolved_field *) iptr->target)->fieldref->classref->name);
2807 utf_display(((unresolved_field *) iptr->target)->fieldref->name);
2809 utf_display(((unresolved_field *) iptr->target)->fieldref->descriptor);
2813 case ICMD_PUTSTATIC:
2814 case ICMD_GETSTATIC:
2816 if (!((fieldinfo *) iptr->val.a)->class->initialized)
2817 printf(" (NOT INITIALIZED) ");
2821 printf(" (NOT RESOLVED) ");
2822 utf_display_classname(((unresolved_field *) iptr->target)->fieldref->classref->name);
2824 utf_display(((unresolved_field *) iptr->target)->fieldref->name);
2826 utf_display(((unresolved_field *) iptr->target)->fieldref->descriptor);
2830 case ICMD_PUTSTATICCONST:
2831 case ICMD_PUTFIELDCONST:
2832 switch (iptr[1].op1) {
2834 printf(" %d,", iptr->val.i);
2837 #if SIZEOF_VOID_P == 4
2838 printf(" %lld,", iptr->val.l);
2840 printf(" %ld,", iptr->val.l);
2844 printf(" %p,", iptr->val.a);
2847 printf(" %g,", iptr->val.f);
2850 printf(" %g,", iptr->val.d);
2853 if (iptr->opc == ICMD_PUTFIELDCONST)
2854 printf(" NOT RESOLVED,");
2856 utf_display_classname(((unresolved_field *) iptr[1].target)->fieldref->classref->name);
2858 utf_display(((unresolved_field *) iptr[1].target)->fieldref->name);
2860 utf_display(((unresolved_field *) iptr[1].target)->fieldref->descriptor);
2865 printf(" %d + %d", iptr->op1, iptr->val.i);
2900 printf(" %d", iptr->op1);
2905 utf_display_classname(((classinfo *) iptr->val.a)->name);
2909 switch (iptr->op1) {
2937 case ICMD_ANEWARRAY:
2940 utf_display_classname(((classinfo *) iptr->val.a)->name);
2944 case ICMD_MULTIANEWARRAY:
2946 printf(" (NOT RESOLVED) %d ",iptr->op1);
2947 utf_display(((constant_classref *) iptr->val.a)->name);
2949 printf(" %d ",iptr->op1);
2950 utf_display_classname(((vftbl_t *) iptr->val.a)->class->name);
2954 case ICMD_CHECKCAST:
2955 case ICMD_INSTANCEOF:
2957 classinfo *c = iptr->val.a;
2959 if (c->flags & ACC_INTERFACE)
2960 printf(" (INTERFACE) ");
2962 printf(" (CLASS,%3d) ", c->vftbl->diffval);
2964 printf(" (NOT RESOLVED) ");
2966 utf_display_classname(((constant_classref *) iptr->target)->name);
2970 case ICMD_ARRAYCHECKCAST:
2972 classinfo *c = ((vftbl_t *) iptr->target)->class;
2973 if (c->flags & ACC_INTERFACE)
2974 printf(" (INTERFACE) ");
2976 printf(" (CLASS,%3d) ", c->vftbl->diffval);
2977 utf_display_classname(c->name);
2979 printf(" (NOT RESOLVED) ");
2980 utf_display_classname(((constant_classref *) iptr->target)->name);
2984 case ICMD_INLINE_START:
2986 utf_display_classname(iptr->method->class->name);
2988 utf_display_classname(iptr->method->name);
2989 utf_display_classname(iptr->method->descriptor);
2990 printf(", depth=%i", iptr->op1);
2992 case ICMD_INLINE_END:
2996 printf(" %s", ((builtintable_entry *) iptr->val.a)->name);
2999 case ICMD_INVOKEVIRTUAL:
3000 case ICMD_INVOKESPECIAL:
3001 case ICMD_INVOKESTATIC:
3002 case ICMD_INVOKEINTERFACE:
3004 printf(" (NOT RESOLVED) ");
3007 utf_display_classname(((unresolved_method *) iptr->target)->methodref->classref->name);
3009 utf_display(((unresolved_method *) iptr->target)->methodref->name);
3010 utf_display(((unresolved_method *) iptr->target)->methodref->descriptor);
3019 if (deadcode || !iptr->target)
3020 printf("(%d) op1=%d", iptr->val.i, iptr->op1);
3022 printf("(%d) L%03d", iptr->val.i, ((basicblock *) iptr->target)->debug_nr);
3031 if (deadcode || !iptr->target)
3032 #if SIZEOF_VOID_P == 4
3033 printf("(%lld) op1=%d", iptr->val.l, iptr->op1);
3035 printf("(%ld) op1=%d", iptr->val.l, iptr->op1);
3038 #if SIZEOF_VOID_P == 4
3039 printf("(%lld) L%03d", iptr->val.l, ((basicblock *) iptr->target)->debug_nr);
3041 printf("(%ld) L%03d", iptr->val.l, ((basicblock *) iptr->target)->debug_nr);
3048 case ICMD_IFNONNULL:
3049 case ICMD_IF_ICMPEQ:
3050 case ICMD_IF_ICMPNE:
3051 case ICMD_IF_ICMPLT:
3052 case ICMD_IF_ICMPGE:
3053 case ICMD_IF_ICMPGT:
3054 case ICMD_IF_ICMPLE:
3055 case ICMD_IF_LCMPEQ:
3056 case ICMD_IF_LCMPNE:
3057 case ICMD_IF_LCMPLT:
3058 case ICMD_IF_LCMPGE:
3059 case ICMD_IF_LCMPGT:
3060 case ICMD_IF_LCMPLE:
3061 case ICMD_IF_ACMPEQ:
3062 case ICMD_IF_ACMPNE:
3063 if (deadcode || !iptr->target)
3064 printf(" op1=%d", iptr->op1);
3066 printf(" L%03d", ((basicblock *) iptr->target)->debug_nr);
3069 case ICMD_TABLESWITCH:
3070 s4ptr = (s4*)iptr->val.a;
3072 if (deadcode || !iptr->target) {
3073 printf(" %d;", *s4ptr);
3076 tptr = (void **) iptr->target;
3077 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
3081 s4ptr++; /* skip default */
3082 j = *s4ptr++; /* low */
3083 j = *s4ptr++ - j; /* high */
3085 if (deadcode || !*tptr)
3086 printf(" %d", *s4ptr++);
3088 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
3095 case ICMD_LOOKUPSWITCH:
3096 s4ptr = (s4*)iptr->val.a;
3098 if (deadcode || !iptr->target) {
3099 printf(" %d;", *s4ptr);
3102 tptr = (void **) iptr->target;
3103 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
3106 s4ptr++; /* default */
3107 j = *s4ptr++; /* count */
3110 if (deadcode || !*tptr) {
3111 s4ptr++; /* skip value */
3112 printf(" %d",*s4ptr++);
3115 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
3125 * These are local overrides for various environment variables in Emacs.
3126 * Please do not remove this and leave it at the end of the file, where
3127 * Emacs will automagically detect them.
3128 * ---------------------------------------------------------------------
3131 * indent-tabs-mode: t