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 3848 2005-12-03 12:31:30Z 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/jit/codegen.inc.h"
57 #include "vm/jit/disass.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 *lock_show_icmd;
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 lock_show_icmd = NEW(java_objectheader);
84 # if defined(NATIVE_THREADS)
85 initObjectLock(lock_show_icmd);
95 /**********************************************************************/
97 /**********************************************************************/
99 /* analyse_stack uses the intermediate code created by parse.c to
100 * build a model of the JVM operand stack for the current method.
102 * The following checks are performed:
103 * - check for operand stack underflow (before each instruction)
104 * - check for operand stack overflow (after[1] each instruction)
105 * - check for matching stack depth at merging points
106 * - check for matching basic types[2] at merging points
107 * - check basic types for instruction input (except for BUILTIN*
108 * opcodes, INVOKE* opcodes and MULTIANEWARRAY)
110 * [1]) Checking this after the instruction should be ok. parse.c
111 * counts the number of required stack slots in such a way that it is
112 * only vital that we don't exceed `maxstack` at basic block
115 * [2]) 'basic types' means the distinction between INT, LONG, FLOAT,
116 * DOUBLE and ADDRESS types. Subtypes of INT and different ADDRESS
117 * types are not discerned.
120 methodinfo *analyse_stack(methodinfo *m, codegendata *cd, registerdata *rd)
128 int opcode, i, len, loops;
129 int superblockend, repeat, deadcode;
137 builtintable_entry *bte;
138 unresolved_method *um;
145 argren = DMNEW(s4, cd->maxlocals); /* table for argument renaming */
146 for (i = 0; i < cd->maxlocals; i++)
151 m->basicblocks[0].flags = BBREACHED;
152 m->basicblocks[0].instack = 0;
153 m->basicblocks[0].indepth = 0;
155 for (i = 0; i < cd->exceptiontablelength; i++) {
156 bptr = &m->basicblocks[m->basicblockindex[cd->exceptiontable[i].handlerpc]];
157 bptr->flags = BBREACHED;
158 bptr->type = BBTYPE_EXH;
161 bptr->pre_count = 10000;
166 #if CONDITIONAL_LOADCONST
167 b_count = m->basicblockcount;
168 bptr = m->basicblocks;
169 while (--b_count >= 0) {
170 if (bptr->icount != 0) {
171 iptr = bptr->iinstr + bptr->icount - 1;
204 m->basicblocks[m->basicblockindex[iptr->op1]].pre_count++;
207 case ICMD_TABLESWITCH:
209 m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
210 i = *s4ptr++; /* low */
211 i = *s4ptr++ - i + 1; /* high */
213 m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
217 case ICMD_LOOKUPSWITCH:
219 m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
220 i = *s4ptr++; /* count */
222 m->basicblocks[m->basicblockindex[s4ptr[1]]].pre_count++;
233 #endif /* CONDITIONAL_LOADCONST */
238 b_count = m->basicblockcount;
239 bptr = m->basicblocks;
240 superblockend = true;
245 while (--b_count >= 0) {
246 if (bptr->flags == BBDELETED) {
249 } else if (superblockend && (bptr->flags < BBREACHED)) {
252 } else if (bptr->flags <= BBREACHED) {
254 stackdepth = bptr->indepth;
256 } else if (bptr->flags < BBREACHED) {
258 bptr->instack = copy;
259 bptr->indepth = stackdepth;
261 } else if (bptr->indepth != stackdepth) {
262 /*show_icmd_method(m, cd, rd);
263 printf("Block: %d, required depth: %d, current depth: %d\n",
264 bptr->debug_nr, bptr->indepth, stackdepth);*/
265 *exceptionptr = new_verifyerror(m,"Stack depth mismatch");
269 curstack = bptr->instack;
271 superblockend = false;
272 bptr->flags = BBFINISHED;
275 b_index = bptr - m->basicblocks;
280 #if defined(USEBUILTINTABLE)
281 # if defined(ENABLE_INTRP)
284 bte = builtintable_get_automatic(opcode);
286 if (bte && bte->opcode == opcode) {
287 iptr->opc = ICMD_BUILTIN;
288 iptr->op1 = false; /* don't check for exception */
290 m->isleafmethod = false;
293 # if defined(ENABLE_INTRP)
296 #endif /* defined(USEBUILTINTABLE) */
303 COUNT(count_check_null);
306 case ICMD_IFEQ_ICONST:
307 case ICMD_IFNE_ICONST:
308 case ICMD_IFLT_ICONST:
309 case ICMD_IFGE_ICONST:
310 case ICMD_IFGT_ICONST:
311 case ICMD_IFLE_ICONST:
312 case ICMD_ELSE_ICONST:
317 #if defined(ENABLE_INTRP)
320 rd->locals[iptr->op1][TYPE_ADR].type = TYPE_ADR;
322 COUNT(count_pcmd_return);
324 superblockend = true;
327 /* pop 0 push 1 const */
330 COUNT(count_pcmd_load);
332 switch (iptr[1].opc) {
334 iptr[0].opc = ICMD_IADDCONST;
336 iptr[1].opc = ICMD_NOP;
337 OP1_1(TYPE_INT, TYPE_INT);
338 COUNT(count_pcmd_op);
341 iptr[0].opc = ICMD_ISUBCONST;
342 goto icmd_iconst_tail;
343 #if SUPPORT_CONST_MUL
345 iptr[0].opc = ICMD_IMULCONST;
346 goto icmd_iconst_tail;
347 #else /* SUPPORT_CONST_MUL */
349 if (iptr[0].val.i == 0x00000002)
351 else if (iptr[0].val.i == 0x00000004)
353 else if (iptr[0].val.i == 0x00000008)
355 else if (iptr[0].val.i == 0x00000010)
357 else if (iptr[0].val.i == 0x00000020)
359 else if (iptr[0].val.i == 0x00000040)
361 else if (iptr[0].val.i == 0x00000080)
363 else if (iptr[0].val.i == 0x00000100)
365 else if (iptr[0].val.i == 0x00000200)
367 else if (iptr[0].val.i == 0x00000400)
369 else if (iptr[0].val.i == 0x00000800)
371 else if (iptr[0].val.i == 0x00001000)
373 else if (iptr[0].val.i == 0x00002000)
375 else if (iptr[0].val.i == 0x00004000)
377 else if (iptr[0].val.i == 0x00008000)
379 else if (iptr[0].val.i == 0x00010000)
381 else if (iptr[0].val.i == 0x00020000)
383 else if (iptr[0].val.i == 0x00040000)
385 else if (iptr[0].val.i == 0x00080000)
387 else if (iptr[0].val.i == 0x00100000)
389 else if (iptr[0].val.i == 0x00200000)
391 else if (iptr[0].val.i == 0x00400000)
393 else if (iptr[0].val.i == 0x00800000)
395 else if (iptr[0].val.i == 0x01000000)
397 else if (iptr[0].val.i == 0x02000000)
399 else if (iptr[0].val.i == 0x04000000)
401 else if (iptr[0].val.i == 0x08000000)
403 else if (iptr[0].val.i == 0x10000000)
405 else if (iptr[0].val.i == 0x20000000)
407 else if (iptr[0].val.i == 0x40000000)
409 else if (iptr[0].val.i == 0x80000000)
415 iptr[0].opc = ICMD_IMULPOW2;
416 goto icmd_iconst_tail;
417 #endif /* SUPPORT_CONST_MUL */
419 if (iptr[0].val.i == 0x00000002)
421 else if (iptr[0].val.i == 0x00000004)
423 else if (iptr[0].val.i == 0x00000008)
425 else if (iptr[0].val.i == 0x00000010)
427 else if (iptr[0].val.i == 0x00000020)
429 else if (iptr[0].val.i == 0x00000040)
431 else if (iptr[0].val.i == 0x00000080)
433 else if (iptr[0].val.i == 0x00000100)
435 else if (iptr[0].val.i == 0x00000200)
437 else if (iptr[0].val.i == 0x00000400)
439 else if (iptr[0].val.i == 0x00000800)
441 else if (iptr[0].val.i == 0x00001000)
443 else if (iptr[0].val.i == 0x00002000)
445 else if (iptr[0].val.i == 0x00004000)
447 else if (iptr[0].val.i == 0x00008000)
449 else if (iptr[0].val.i == 0x00010000)
451 else if (iptr[0].val.i == 0x00020000)
453 else if (iptr[0].val.i == 0x00040000)
455 else if (iptr[0].val.i == 0x00080000)
457 else if (iptr[0].val.i == 0x00100000)
459 else if (iptr[0].val.i == 0x00200000)
461 else if (iptr[0].val.i == 0x00400000)
463 else if (iptr[0].val.i == 0x00800000)
465 else if (iptr[0].val.i == 0x01000000)
467 else if (iptr[0].val.i == 0x02000000)
469 else if (iptr[0].val.i == 0x04000000)
471 else if (iptr[0].val.i == 0x08000000)
473 else if (iptr[0].val.i == 0x10000000)
475 else if (iptr[0].val.i == 0x20000000)
477 else if (iptr[0].val.i == 0x40000000)
479 else if (iptr[0].val.i == 0x80000000)
485 iptr[0].opc = ICMD_IDIVPOW2;
486 goto icmd_iconst_tail;
488 /*log_text("stack.c: ICMD_ICONST/ICMD_IREM");*/
489 if ((iptr[0].val.i == 0x00000002) ||
490 (iptr[0].val.i == 0x00000004) ||
491 (iptr[0].val.i == 0x00000008) ||
492 (iptr[0].val.i == 0x00000010) ||
493 (iptr[0].val.i == 0x00000020) ||
494 (iptr[0].val.i == 0x00000040) ||
495 (iptr[0].val.i == 0x00000080) ||
496 (iptr[0].val.i == 0x00000100) ||
497 (iptr[0].val.i == 0x00000200) ||
498 (iptr[0].val.i == 0x00000400) ||
499 (iptr[0].val.i == 0x00000800) ||
500 (iptr[0].val.i == 0x00001000) ||
501 (iptr[0].val.i == 0x00002000) ||
502 (iptr[0].val.i == 0x00004000) ||
503 (iptr[0].val.i == 0x00008000) ||
504 (iptr[0].val.i == 0x00010000) ||
505 (iptr[0].val.i == 0x00020000) ||
506 (iptr[0].val.i == 0x00040000) ||
507 (iptr[0].val.i == 0x00080000) ||
508 (iptr[0].val.i == 0x00100000) ||
509 (iptr[0].val.i == 0x00200000) ||
510 (iptr[0].val.i == 0x00400000) ||
511 (iptr[0].val.i == 0x00800000) ||
512 (iptr[0].val.i == 0x01000000) ||
513 (iptr[0].val.i == 0x02000000) ||
514 (iptr[0].val.i == 0x04000000) ||
515 (iptr[0].val.i == 0x08000000) ||
516 (iptr[0].val.i == 0x10000000) ||
517 (iptr[0].val.i == 0x20000000) ||
518 (iptr[0].val.i == 0x40000000) ||
519 (iptr[0].val.i == 0x80000000)) {
520 iptr[0].opc = ICMD_IREMPOW2;
522 goto icmd_iconst_tail;
526 #if SUPPORT_CONST_LOGICAL
528 iptr[0].opc = ICMD_IANDCONST;
529 goto icmd_iconst_tail;
531 iptr[0].opc = ICMD_IORCONST;
532 goto icmd_iconst_tail;
534 iptr[0].opc = ICMD_IXORCONST;
535 goto icmd_iconst_tail;
536 #endif /* SUPPORT_CONST_LOGICAL */
538 iptr[0].opc = ICMD_ISHLCONST;
539 goto icmd_iconst_tail;
541 iptr[0].opc = ICMD_ISHRCONST;
542 goto icmd_iconst_tail;
544 iptr[0].opc = ICMD_IUSHRCONST;
545 goto icmd_iconst_tail;
546 #if SUPPORT_LONG_SHIFT
548 iptr[0].opc = ICMD_LSHLCONST;
549 goto icmd_lconst_tail;
551 iptr[0].opc = ICMD_LSHRCONST;
552 goto icmd_lconst_tail;
554 iptr[0].opc = ICMD_LUSHRCONST;
555 goto icmd_lconst_tail;
556 #endif /* SUPPORT_LONG_SHIFT */
558 iptr[0].opc = ICMD_IFEQ;
560 iptr[0].op1 = iptr[1].op1;
561 /* IF_ICMPxx is the last instruction in the */
562 /* basic block, just remove it */
563 /* iptr[1].opc = ICMD_NOP; */
568 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
570 iptr[0].target = (void *) tbptr;
572 MARKREACHED(tbptr, copy);
573 COUNT(count_pcmd_bra);
576 iptr[0].opc = ICMD_IFLT;
577 goto icmd_if_icmp_tail;
579 iptr[0].opc = ICMD_IFLE;
580 goto icmd_if_icmp_tail;
582 iptr[0].opc = ICMD_IFNE;
583 goto icmd_if_icmp_tail;
585 iptr[0].opc = ICMD_IFGT;
586 goto icmd_if_icmp_tail;
588 iptr[0].opc = ICMD_IFGE;
589 goto icmd_if_icmp_tail;
591 #if SUPPORT_CONST_STORE
596 # if defined(ENABLE_INTRP)
599 #if SUPPORT_CONST_STORE_ZERO_ONLY
600 if (iptr[0].val.i == 0) {
601 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
602 switch (iptr[1].opc) {
604 iptr[0].opc = ICMD_IASTORECONST;
607 iptr[0].opc = ICMD_BASTORECONST;
610 iptr[0].opc = ICMD_CASTORECONST;
613 iptr[0].opc = ICMD_SASTORECONST;
617 iptr[1].opc = ICMD_NOP;
618 OPTT2_0(TYPE_INT, TYPE_ADR);
619 COUNT(count_pcmd_op);
620 #if SUPPORT_CONST_STORE_ZERO_ONLY
623 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
624 # if defined(ENABLE_INTRP)
632 #if SUPPORT_CONST_STORE_ZERO_ONLY
633 if (iptr[0].val.i == 0) {
634 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
635 switch (iptr[1].opc) {
637 iptr[0].opc = ICMD_PUTSTATICCONST;
641 iptr[0].opc = ICMD_PUTFIELDCONST;
646 iptr[1].opc = ICMD_NOP;
647 iptr[0].op1 = TYPE_INT;
648 COUNT(count_pcmd_op);
649 #if SUPPORT_CONST_STORE_ZERO_ONLY
652 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
654 #endif /* SUPPORT_CONST_STORE */
664 COUNT(count_pcmd_load);
666 switch (iptr[1].opc) {
669 iptr[0].opc = ICMD_LADDCONST;
671 iptr[1].opc = ICMD_NOP;
672 OP1_1(TYPE_LNG,TYPE_LNG);
673 COUNT(count_pcmd_op);
676 iptr[0].opc = ICMD_LSUBCONST;
677 goto icmd_lconst_tail;
678 #endif /* SUPPORT_LONG_ADD */
679 #if SUPPORT_LONG_MUL && SUPPORT_CONST_MUL
681 iptr[0].opc = ICMD_LMULCONST;
682 goto icmd_lconst_tail;
683 #else /* SUPPORT_LONG_MUL && SUPPORT_CONST_MUL */
684 # if SUPPORT_LONG_SHIFT
686 if (iptr[0].val.l == 0x00000002)
688 else if (iptr[0].val.l == 0x00000004)
690 else if (iptr[0].val.l == 0x00000008)
692 else if (iptr[0].val.l == 0x00000010)
694 else if (iptr[0].val.l == 0x00000020)
696 else if (iptr[0].val.l == 0x00000040)
698 else if (iptr[0].val.l == 0x00000080)
700 else if (iptr[0].val.l == 0x00000100)
702 else if (iptr[0].val.l == 0x00000200)
704 else if (iptr[0].val.l == 0x00000400)
706 else if (iptr[0].val.l == 0x00000800)
708 else if (iptr[0].val.l == 0x00001000)
710 else if (iptr[0].val.l == 0x00002000)
712 else if (iptr[0].val.l == 0x00004000)
714 else if (iptr[0].val.l == 0x00008000)
716 else if (iptr[0].val.l == 0x00010000)
718 else if (iptr[0].val.l == 0x00020000)
720 else if (iptr[0].val.l == 0x00040000)
722 else if (iptr[0].val.l == 0x00080000)
724 else if (iptr[0].val.l == 0x00100000)
726 else if (iptr[0].val.l == 0x00200000)
728 else if (iptr[0].val.l == 0x00400000)
730 else if (iptr[0].val.l == 0x00800000)
732 else if (iptr[0].val.l == 0x01000000)
734 else if (iptr[0].val.l == 0x02000000)
736 else if (iptr[0].val.l == 0x04000000)
738 else if (iptr[0].val.l == 0x08000000)
740 else if (iptr[0].val.l == 0x10000000)
742 else if (iptr[0].val.l == 0x20000000)
744 else if (iptr[0].val.l == 0x40000000)
746 else if (iptr[0].val.l == 0x80000000)
752 iptr[0].opc = ICMD_LMULPOW2;
753 goto icmd_lconst_tail;
754 # endif /* SUPPORT_LONG_SHIFT */
755 #endif /* SUPPORT_LONG_MUL && SUPPORT_CONST_MUL */
758 if (iptr[0].val.l == 0x00000002)
760 else if (iptr[0].val.l == 0x00000004)
762 else if (iptr[0].val.l == 0x00000008)
764 else if (iptr[0].val.l == 0x00000010)
766 else if (iptr[0].val.l == 0x00000020)
768 else if (iptr[0].val.l == 0x00000040)
770 else if (iptr[0].val.l == 0x00000080)
772 else if (iptr[0].val.l == 0x00000100)
774 else if (iptr[0].val.l == 0x00000200)
776 else if (iptr[0].val.l == 0x00000400)
778 else if (iptr[0].val.l == 0x00000800)
780 else if (iptr[0].val.l == 0x00001000)
782 else if (iptr[0].val.l == 0x00002000)
784 else if (iptr[0].val.l == 0x00004000)
786 else if (iptr[0].val.l == 0x00008000)
788 else if (iptr[0].val.l == 0x00010000)
790 else if (iptr[0].val.l == 0x00020000)
792 else if (iptr[0].val.l == 0x00040000)
794 else if (iptr[0].val.l == 0x00080000)
796 else if (iptr[0].val.l == 0x00100000)
798 else if (iptr[0].val.l == 0x00200000)
800 else if (iptr[0].val.l == 0x00400000)
802 else if (iptr[0].val.l == 0x00800000)
804 else if (iptr[0].val.l == 0x01000000)
806 else if (iptr[0].val.l == 0x02000000)
808 else if (iptr[0].val.l == 0x04000000)
810 else if (iptr[0].val.l == 0x08000000)
812 else if (iptr[0].val.l == 0x10000000)
814 else if (iptr[0].val.l == 0x20000000)
816 else if (iptr[0].val.l == 0x40000000)
818 else if (iptr[0].val.l == 0x80000000)
824 iptr[0].opc = ICMD_LDIVPOW2;
825 goto icmd_lconst_tail;
827 if ((iptr[0].val.l == 0x00000002) ||
828 (iptr[0].val.l == 0x00000004) ||
829 (iptr[0].val.l == 0x00000008) ||
830 (iptr[0].val.l == 0x00000010) ||
831 (iptr[0].val.l == 0x00000020) ||
832 (iptr[0].val.l == 0x00000040) ||
833 (iptr[0].val.l == 0x00000080) ||
834 (iptr[0].val.l == 0x00000100) ||
835 (iptr[0].val.l == 0x00000200) ||
836 (iptr[0].val.l == 0x00000400) ||
837 (iptr[0].val.l == 0x00000800) ||
838 (iptr[0].val.l == 0x00001000) ||
839 (iptr[0].val.l == 0x00002000) ||
840 (iptr[0].val.l == 0x00004000) ||
841 (iptr[0].val.l == 0x00008000) ||
842 (iptr[0].val.l == 0x00010000) ||
843 (iptr[0].val.l == 0x00020000) ||
844 (iptr[0].val.l == 0x00040000) ||
845 (iptr[0].val.l == 0x00080000) ||
846 (iptr[0].val.l == 0x00100000) ||
847 (iptr[0].val.l == 0x00200000) ||
848 (iptr[0].val.l == 0x00400000) ||
849 (iptr[0].val.l == 0x00800000) ||
850 (iptr[0].val.l == 0x01000000) ||
851 (iptr[0].val.l == 0x02000000) ||
852 (iptr[0].val.l == 0x04000000) ||
853 (iptr[0].val.l == 0x08000000) ||
854 (iptr[0].val.l == 0x10000000) ||
855 (iptr[0].val.l == 0x20000000) ||
856 (iptr[0].val.l == 0x40000000) ||
857 (iptr[0].val.l == 0x80000000)) {
858 iptr[0].opc = ICMD_LREMPOW2;
860 goto icmd_lconst_tail;
864 #endif /* SUPPORT_LONG_DIV */
865 #if SUPPORT_LONG_LOGICAL && SUPPORT_CONST_LOGICAL
868 iptr[0].opc = ICMD_LANDCONST;
869 goto icmd_lconst_tail;
871 iptr[0].opc = ICMD_LORCONST;
872 goto icmd_lconst_tail;
874 iptr[0].opc = ICMD_LXORCONST;
875 goto icmd_lconst_tail;
876 #endif /* SUPPORT_LONG_LOGICAL && SUPPORT_CONST_LOGICAL */
878 #if SUPPORT_LONG_CMP_CONST
880 if ((len > 1) && (iptr[2].val.i == 0)) {
881 switch (iptr[2].opc) {
883 iptr[0].opc = ICMD_IF_LEQ;
884 icmd_lconst_lcmp_tail:
885 iptr[0].op1 = iptr[2].op1;
888 /* iptr[1].opc = ICMD_NOP;
889 iptr[2].opc = ICMD_NOP; */
891 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
893 iptr[0].target = (void *) tbptr;
895 MARKREACHED(tbptr, copy);
896 COUNT(count_pcmd_bra);
897 COUNT(count_pcmd_op);
900 iptr[0].opc = ICMD_IF_LNE;
901 goto icmd_lconst_lcmp_tail;
903 iptr[0].opc = ICMD_IF_LLT;
904 goto icmd_lconst_lcmp_tail;
906 iptr[0].opc = ICMD_IF_LGT;
907 goto icmd_lconst_lcmp_tail;
909 iptr[0].opc = ICMD_IF_LLE;
910 goto icmd_lconst_lcmp_tail;
912 iptr[0].opc = ICMD_IF_LGE;
913 goto icmd_lconst_lcmp_tail;
916 } /* switch (iptr[2].opc) */
917 } /* if (iptr[2].val.i == 0) */
921 #endif /* SUPPORT_LONG_CMP_CONST */
923 #if SUPPORT_CONST_STORE
925 # if defined(ENABLE_INTRP)
928 #if SUPPORT_CONST_STORE_ZERO_ONLY
929 if (iptr[0].val.l == 0) {
930 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
931 iptr[0].opc = ICMD_LASTORECONST;
932 iptr[1].opc = ICMD_NOP;
933 OPTT2_0(TYPE_INT, TYPE_ADR);
934 COUNT(count_pcmd_op);
935 #if SUPPORT_CONST_STORE_ZERO_ONLY
938 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
939 # if defined(ENABLE_INTRP)
947 #if SUPPORT_CONST_STORE_ZERO_ONLY
948 if (iptr[0].val.l == 0) {
949 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
950 switch (iptr[1].opc) {
952 iptr[0].opc = ICMD_PUTSTATICCONST;
956 iptr[0].opc = ICMD_PUTFIELDCONST;
961 iptr[1].opc = ICMD_NOP;
962 iptr[0].op1 = TYPE_LNG;
963 COUNT(count_pcmd_op);
964 #if SUPPORT_CONST_STORE_ZERO_ONLY
967 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
969 #endif /* SUPPORT_CONST_STORE */
979 COUNT(count_pcmd_load);
984 COUNT(count_pcmd_load);
989 COUNT(count_pcmd_load);
990 #if SUPPORT_CONST_STORE
991 if (len > 0 && iptr->val.a == 0) {
992 switch (iptr[1].opc) {
993 #if !defined(__POWERPC__) && !defined(__X86_64__) && !defined(__I386__) && !defined(__ALPHA__) && !defined(__MIPS__)
995 if (iptr[1].val.fp != BUILTIN_aastore) {
1001 case ICMD_PUTSTATIC:
1003 switch (iptr[1].opc) {
1005 iptr[0].opc = ICMD_AASTORECONST;
1006 OPTT2_0(TYPE_INT, TYPE_ADR);
1008 case ICMD_PUTSTATIC:
1009 iptr[0].opc = ICMD_PUTSTATICCONST;
1010 iptr[0].op1 = TYPE_ADR;
1014 iptr[0].opc = ICMD_PUTFIELDCONST;
1015 iptr[0].op1 = TYPE_ADR;
1020 iptr[1].opc = ICMD_NOP;
1021 COUNT(count_pcmd_op);
1025 PUSHCONST(TYPE_ADR);
1028 #endif /* SUPPORT_CONST_STORE */
1029 PUSHCONST(TYPE_ADR);
1032 /* pop 0 push 1 load */
1039 COUNT(count_load_instruction);
1040 i = opcode - ICMD_ILOAD;
1041 iptr->op1 = argren[iptr->op1];
1042 #if defined(ENABLE_INTRP)
1045 rd->locals[iptr->op1][i].type = i;
1046 LOAD(i, LOCALVAR, iptr->op1);
1056 COUNT(count_check_null);
1057 COUNT(count_check_bound);
1058 COUNT(count_pcmd_mem);
1059 OP2IAT_1(opcode - ICMD_IALOAD);
1065 COUNT(count_check_null);
1066 COUNT(count_check_bound);
1067 COUNT(count_pcmd_mem);
1071 /* pop 0 push 0 iinc */
1074 #if defined(STATISTICS)
1078 count_store_depth[10]++;
1080 count_store_depth[i]++;
1086 if ((copy->varkind == LOCALVAR) &&
1087 (copy->varnum == iptr->op1)) {
1088 copy->varkind = TEMPVAR;
1095 /* allocate a dummy stack slot to keep ISTORE from */
1096 /* marking its input stack as a LOCALVAR, since we */
1097 /* change the value of the local variable here. */
1098 NEWSTACK0(TYPE_INT);
1104 /* pop 1 push 0 store */
1114 i = opcode - ICMD_ISTORE;
1115 #if defined(ENABLE_INTRP)
1118 rd->locals[iptr->op1][i].type = i;
1119 #if defined(STATISTICS)
1124 count_store_length[20]++;
1126 count_store_length[i]++;
1129 count_store_depth[10]++;
1131 count_store_depth[i]++;
1134 copy = curstack->prev;
1137 if ((copy->varkind == LOCALVAR) &&
1138 (copy->varnum == iptr->op1)) {
1139 copy->varkind = TEMPVAR;
1145 if ((new - curstack) == 1) {
1146 curstack->varkind = LOCALVAR;
1147 curstack->varnum = iptr->op1;
1149 STORE(opcode - ICMD_ISTORE);
1155 COUNT(count_check_null);
1156 COUNT(count_check_bound);
1157 COUNT(count_pcmd_mem);
1159 bte = builtintable_get_internal(BUILTIN_canstore);
1162 if (md->memuse > rd->memuse)
1163 rd->memuse = md->memuse;
1164 if (md->argintreguse > rd->argintreguse)
1165 rd->argintreguse = md->argintreguse;
1167 /* make all stack variables saved */
1171 copy->flags |= SAVEDVAR;
1182 COUNT(count_check_null);
1183 COUNT(count_check_bound);
1184 COUNT(count_pcmd_mem);
1185 OP3TIA_0(opcode - ICMD_IASTORE);
1191 COUNT(count_check_null);
1192 COUNT(count_check_bound);
1193 COUNT(count_pcmd_mem);
1200 #ifdef TYPECHECK_STACK_COMPCAT
1203 if (IS_2_WORD_TYPE(curstack->type)) {
1204 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1217 md_return_alloc(m, rd, opcode - ICMD_IRETURN, curstack);
1218 COUNT(count_pcmd_return);
1219 OP1_0(opcode - ICMD_IRETURN);
1220 superblockend = true;
1224 COUNT(count_check_null);
1228 superblockend = true;
1231 case ICMD_PUTSTATIC:
1232 COUNT(count_pcmd_mem);
1236 /* pop 1 push 0 branch */
1239 case ICMD_IFNONNULL:
1240 COUNT(count_pcmd_bra);
1242 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1244 iptr[0].target = (void *) tbptr;
1246 MARKREACHED(tbptr, copy);
1255 COUNT(count_pcmd_bra);
1256 #if CONDITIONAL_LOADCONST
1257 # if defined(ENABLE_INTRP)
1260 tbptr = m->basicblocks + b_index;
1261 if ((b_count >= 3) &&
1262 ((b_index + 2) == m->basicblockindex[iptr[0].op1]) &&
1263 (tbptr[1].pre_count == 1) &&
1264 (tbptr[1].iinstr[0].opc == ICMD_ICONST) &&
1265 (tbptr[1].iinstr[1].opc == ICMD_GOTO) &&
1266 ((b_index + 3) == m->basicblockindex[tbptr[1].iinstr[1].op1]) &&
1267 (tbptr[2].pre_count == 1) &&
1268 (tbptr[2].iinstr[0].opc == ICMD_ICONST) &&
1269 (tbptr[2].icount==1)) {
1270 /*printf("tbptr[2].icount=%d\n",tbptr[2].icount);*/
1271 OP1_1(TYPE_INT, TYPE_INT);
1272 switch (iptr[0].opc) {
1274 iptr[0].opc = ICMD_IFNE_ICONST;
1277 iptr[0].opc = ICMD_IFEQ_ICONST;
1280 iptr[0].opc = ICMD_IFGE_ICONST;
1283 iptr[0].opc = ICMD_IFLT_ICONST;
1286 iptr[0].opc = ICMD_IFLE_ICONST;
1289 iptr[0].opc = ICMD_IFGT_ICONST;
1293 iptr[0].val.i = iptr[1].val.i;
1294 iptr[1].opc = ICMD_ELSE_ICONST;
1295 iptr[1].val.i = iptr[3].val.i;
1296 iptr[2].opc = ICMD_NOP;
1297 iptr[3].opc = ICMD_NOP;
1299 /* HACK: save compare value in iptr[1].op1 */
1300 iptr[1].op1 = iptr[0].val.i;
1301 iptr[0].val.i = tbptr[1].iinstr[0].val.i;
1302 iptr[1].opc = ICMD_ELSE_ICONST;
1303 iptr[1].val.i = tbptr[2].iinstr[0].val.i;
1304 tbptr[1].iinstr[0].opc = ICMD_NOP;
1305 tbptr[1].iinstr[1].opc = ICMD_NOP;
1306 tbptr[2].iinstr[0].opc = ICMD_NOP;
1308 tbptr[1].flags = BBDELETED;
1309 tbptr[2].flags = BBDELETED;
1310 tbptr[1].icount = 0;
1311 tbptr[2].icount = 0;
1312 if (tbptr[3].pre_count == 2) {
1313 len += tbptr[3].icount + 3;
1314 bptr->icount += tbptr[3].icount + 3;
1315 tbptr[3].flags = BBDELETED;
1316 tbptr[3].icount = 0;
1326 # if defined(ENABLE_INTRP)
1330 #endif /* CONDITIONAL_LOADCONST */
1334 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1336 iptr[0].target = (void *) tbptr;
1338 MARKREACHED(tbptr, copy);
1341 /* pop 0 push 0 branch */
1344 COUNT(count_pcmd_bra);
1345 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1347 iptr[0].target = (void *) tbptr;
1349 MARKREACHED(tbptr, copy);
1351 superblockend = true;
1354 /* pop 1 push 0 table branch */
1356 case ICMD_TABLESWITCH:
1357 COUNT(count_pcmd_table);
1359 s4ptr = iptr->val.a;
1360 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1361 MARKREACHED(tbptr, copy);
1362 i = *s4ptr++; /* low */
1363 i = *s4ptr++ - i + 1; /* high */
1365 tptr = DMNEW(void*, i+1);
1366 iptr->target = (void *) tptr;
1368 tptr[0] = (void *) tbptr;
1372 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1374 tptr[0] = (void *) tbptr;
1377 MARKREACHED(tbptr, copy);
1380 superblockend = true;
1383 /* pop 1 push 0 table branch */
1385 case ICMD_LOOKUPSWITCH:
1386 COUNT(count_pcmd_table);
1388 s4ptr = iptr->val.a;
1389 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1390 MARKREACHED(tbptr, copy);
1391 i = *s4ptr++; /* count */
1393 tptr = DMNEW(void*, i+1);
1394 iptr->target = (void *) tptr;
1396 tptr[0] = (void *) tbptr;
1400 tbptr = m->basicblocks + m->basicblockindex[s4ptr[1]];
1402 tptr[0] = (void *) tbptr;
1405 MARKREACHED(tbptr, copy);
1409 superblockend = true;
1412 case ICMD_MONITORENTER:
1413 COUNT(count_check_null);
1414 case ICMD_MONITOREXIT:
1418 /* pop 2 push 0 branch */
1420 case ICMD_IF_ICMPEQ:
1421 case ICMD_IF_ICMPNE:
1422 case ICMD_IF_ICMPLT:
1423 case ICMD_IF_ICMPGE:
1424 case ICMD_IF_ICMPGT:
1425 case ICMD_IF_ICMPLE:
1426 COUNT(count_pcmd_bra);
1428 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1430 iptr[0].target = (void *) tbptr;
1432 MARKREACHED(tbptr, copy);
1435 case ICMD_IF_ACMPEQ:
1436 case ICMD_IF_ACMPNE:
1437 COUNT(count_pcmd_bra);
1439 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1441 iptr[0].target = (void *) tbptr;
1443 MARKREACHED(tbptr, copy);
1449 COUNT(count_check_null);
1450 COUNT(count_pcmd_mem);
1451 OPTT2_0(iptr->op1,TYPE_ADR);
1456 if (!IS_2_WORD_TYPE(curstack->type)) {
1458 #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");
1467 OP1_0ANY; /* second pop */
1470 iptr->opc = ICMD_POP;
1474 /* pop 0 push 1 dup */
1477 #ifdef TYPECHECK_STACK_COMPCAT
1480 if (IS_2_WORD_TYPE(curstack->type)) {
1481 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1486 COUNT(count_dup_instruction);
1492 if (IS_2_WORD_TYPE(curstack->type)) {
1494 iptr->opc = ICMD_DUP;
1499 /* ..., ????, cat1 */
1500 #ifdef TYPECHECK_STACK_COMPCAT
1502 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1503 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1509 NEWSTACK(copy->prev->type, copy->prev->varkind,
1510 copy->prev->varnum);
1511 NEWSTACK(copy->type, copy->varkind,
1518 /* pop 2 push 3 dup */
1521 #ifdef TYPECHECK_STACK_COMPCAT
1524 if (IS_2_WORD_TYPE(curstack->type) ||
1525 IS_2_WORD_TYPE(curstack->prev->type)) {
1526 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1536 if (IS_2_WORD_TYPE(curstack->type)) {
1537 /* ..., ????, cat2 */
1538 #ifdef TYPECHECK_STACK_COMPCAT
1540 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1541 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1546 iptr->opc = ICMD_DUP_X1;
1550 /* ..., ????, cat1 */
1551 #ifdef TYPECHECK_STACK_COMPCAT
1554 if (IS_2_WORD_TYPE(curstack->prev->type)
1555 || IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1556 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1565 /* pop 3 push 4 dup */
1569 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1570 /* ..., cat2, ???? */
1571 #ifdef TYPECHECK_STACK_COMPCAT
1573 if (IS_2_WORD_TYPE(curstack->type)) {
1574 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1579 iptr->opc = ICMD_DUP_X1;
1583 /* ..., cat1, ???? */
1584 #ifdef TYPECHECK_STACK_COMPCAT
1587 if (IS_2_WORD_TYPE(curstack->type)
1588 || IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1589 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1600 if (IS_2_WORD_TYPE(curstack->type)) {
1601 /* ..., ????, cat2 */
1602 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1603 /* ..., cat2, cat2 */
1604 iptr->opc = ICMD_DUP_X1;
1608 /* ..., cat1, cat2 */
1609 #ifdef TYPECHECK_STACK_COMPCAT
1612 if (IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1613 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1618 iptr->opc = ICMD_DUP_X2;
1624 /* ..., ????, ????, cat1 */
1625 if (IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1626 /* ..., cat2, ????, cat1 */
1627 #ifdef TYPECHECK_STACK_COMPCAT
1629 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1630 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1635 iptr->opc = ICMD_DUP2_X1;
1639 /* ..., cat1, ????, cat1 */
1640 #ifdef TYPECHECK_STACK_COMPCAT
1643 if (IS_2_WORD_TYPE(curstack->prev->type)
1644 || IS_2_WORD_TYPE(curstack->prev->prev->prev->type)) {
1645 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1655 /* pop 2 push 2 swap */
1658 #ifdef TYPECHECK_STACK_COMPCAT
1661 if (IS_2_WORD_TYPE(curstack->type)
1662 || IS_2_WORD_TYPE(curstack->prev->type)) {
1663 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1675 #if !SUPPORT_DIVISION
1676 bte = (builtintable_entry *) iptr->val.a;
1680 if (md->memuse > rd->memuse)
1681 rd->memuse = md->memuse;
1682 if (md->argintreguse > rd->argintreguse)
1683 rd->argintreguse = md->argintreguse;
1685 /* make all stack variables saved */
1689 copy->flags |= SAVEDVAR;
1694 #endif /* !SUPPORT_DIVISION */
1705 COUNT(count_pcmd_op);
1711 #if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
1712 bte = (builtintable_entry *) iptr->val.a;
1716 if (md->memuse > rd->memuse)
1717 rd->memuse = md->memuse;
1718 if (md->argintreguse > rd->argintreguse)
1719 rd->argintreguse = md->argintreguse;
1721 /* make all stack variables saved */
1725 copy->flags |= SAVEDVAR;
1730 #endif /* !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV) */
1735 #if SUPPORT_LONG_LOGICAL
1739 #endif /* SUPPORT_LONG_LOGICAL */
1740 COUNT(count_pcmd_op);
1747 COUNT(count_pcmd_op);
1756 COUNT(count_pcmd_op);
1765 COUNT(count_pcmd_op);
1770 COUNT(count_pcmd_op);
1771 #if SUPPORT_LONG_CMP_CONST
1772 if ((len > 0) && (iptr[1].val.i == 0)) {
1773 switch (iptr[1].opc) {
1775 iptr[0].opc = ICMD_IF_LCMPEQ;
1777 iptr[0].op1 = iptr[1].op1;
1780 /* iptr[1].opc = ICMD_NOP; */
1782 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1784 iptr[0].target = (void *) tbptr;
1786 MARKREACHED(tbptr, copy);
1787 COUNT(count_pcmd_bra);
1790 iptr[0].opc = ICMD_IF_LCMPNE;
1791 goto icmd_lcmp_if_tail;
1793 iptr[0].opc = ICMD_IF_LCMPLT;
1794 goto icmd_lcmp_if_tail;
1796 iptr[0].opc = ICMD_IF_LCMPGT;
1797 goto icmd_lcmp_if_tail;
1799 iptr[0].opc = ICMD_IF_LCMPLE;
1800 goto icmd_lcmp_if_tail;
1802 iptr[0].opc = ICMD_IF_LCMPGE;
1803 goto icmd_lcmp_if_tail;
1805 OPTT2_1(TYPE_LNG, TYPE_INT);
1809 #endif /* SUPPORT_LONG_CMP_CONST */
1810 OPTT2_1(TYPE_LNG, TYPE_INT);
1814 COUNT(count_pcmd_op);
1815 OPTT2_1(TYPE_FLT, TYPE_INT);
1819 COUNT(count_pcmd_op);
1820 OPTT2_1(TYPE_DBL, TYPE_INT);
1828 case ICMD_INT2SHORT:
1829 COUNT(count_pcmd_op);
1830 OP1_1(TYPE_INT, TYPE_INT);
1833 COUNT(count_pcmd_op);
1834 OP1_1(TYPE_LNG, TYPE_LNG);
1837 COUNT(count_pcmd_op);
1838 OP1_1(TYPE_FLT, TYPE_FLT);
1841 COUNT(count_pcmd_op);
1842 OP1_1(TYPE_DBL, TYPE_DBL);
1846 COUNT(count_pcmd_op);
1847 OP1_1(TYPE_INT, TYPE_LNG);
1850 COUNT(count_pcmd_op);
1851 OP1_1(TYPE_INT, TYPE_FLT);
1854 COUNT(count_pcmd_op);
1855 OP1_1(TYPE_INT, TYPE_DBL);
1858 COUNT(count_pcmd_op);
1859 OP1_1(TYPE_LNG, TYPE_INT);
1862 COUNT(count_pcmd_op);
1863 OP1_1(TYPE_LNG, TYPE_FLT);
1866 COUNT(count_pcmd_op);
1867 OP1_1(TYPE_LNG, TYPE_DBL);
1870 COUNT(count_pcmd_op);
1871 OP1_1(TYPE_FLT, TYPE_INT);
1874 COUNT(count_pcmd_op);
1875 OP1_1(TYPE_FLT, TYPE_LNG);
1878 COUNT(count_pcmd_op);
1879 OP1_1(TYPE_FLT, TYPE_DBL);
1882 COUNT(count_pcmd_op);
1883 OP1_1(TYPE_DBL, TYPE_INT);
1886 COUNT(count_pcmd_op);
1887 OP1_1(TYPE_DBL, TYPE_LNG);
1890 COUNT(count_pcmd_op);
1891 OP1_1(TYPE_DBL, TYPE_FLT);
1894 case ICMD_CHECKCAST:
1895 if (iptr->op1 == 0) {
1896 /* array type cast-check */
1898 bte = builtintable_get_internal(BUILTIN_arraycheckcast);
1901 if (md->memuse > rd->memuse)
1902 rd->memuse = md->memuse;
1903 if (md->argintreguse > rd->argintreguse)
1904 rd->argintreguse = md->argintreguse;
1906 /* make all stack variables saved */
1910 copy->flags |= SAVEDVAR;
1914 OP1_1(TYPE_ADR, TYPE_ADR);
1917 case ICMD_INSTANCEOF:
1918 case ICMD_ARRAYLENGTH:
1919 OP1_1(TYPE_ADR, TYPE_INT);
1923 case ICMD_ANEWARRAY:
1924 OP1_1(TYPE_INT, TYPE_ADR);
1928 COUNT(count_check_null);
1929 COUNT(count_pcmd_mem);
1930 OP1_1(TYPE_ADR, iptr->op1);
1935 case ICMD_GETSTATIC:
1936 COUNT(count_pcmd_mem);
1946 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1948 iptr[0].target = (void *) tbptr;
1950 /* This is a dirty hack. The typechecker
1951 * needs it because the OP1_0ANY below
1952 * overwrites iptr->dst.
1954 iptr->val.a = (void *) iptr->dst;
1956 tbptr->type = BBTYPE_SBR;
1958 /* We need to check for overflow right here because
1959 * the pushed value is poped after MARKREACHED. */
1961 MARKREACHED(tbptr, copy);
1965 /* pop many push any */
1968 #if defined(USEBUILTINTABLE)
1971 bte = (builtintable_entry *) iptr->val.a;
1975 case ICMD_INVOKESTATIC:
1976 case ICMD_INVOKESPECIAL:
1977 case ICMD_INVOKEVIRTUAL:
1978 case ICMD_INVOKEINTERFACE:
1979 COUNT(count_pcmd_met);
1981 md = um->methodref->parseddesc.md;
1982 /* if (lm->flags & ACC_STATIC) */
1983 /* {COUNT(count_check_null);} */
1988 if (md->memuse > rd->memuse)
1989 rd->memuse = md->memuse;
1990 if (md->argintreguse > rd->argintreguse)
1991 rd->argintreguse = md->argintreguse;
1992 if (md->argfltreguse > rd->argfltreguse)
1993 rd->argfltreguse = md->argfltreguse;
1998 for (i-- ; i >= 0; i--) {
1999 #if defined(SUPPORT_PASS_FLOATARGS_IN_INTREGS)
2000 /* If we pass float arguments in integer argument registers, we
2001 * are not allowed to precolor them here. Floats have to be moved
2002 * to this regs explicitly in codegen().
2003 * Only arguments that are passed by stack anyway can be precolored
2004 * (michi 2005/07/24) */
2005 if (!(copy->flags & SAVEDVAR) &&
2006 (!IS_FLT_DBL_TYPE(copy->type) || md->params[i].inmemory)) {
2008 if (!(copy->flags & SAVEDVAR)) {
2010 copy->varkind = ARGVAR;
2013 #if defined(ENABLE_INTRP)
2016 if (md->params[i].inmemory) {
2017 copy->flags = INMEMORY;
2018 copy->regoff = md->params[i].regoff;
2021 if (IS_FLT_DBL_TYPE(copy->type))
2022 #if defined(SUPPORT_PASS_FLOATARGS_IN_INTREGS)
2023 assert(0); /* XXX is this assert ok? */
2026 rd->argfltregs[md->params[i].regoff];
2029 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2030 if (IS_2_WORD_TYPE(copy->type))
2031 copy->regoff = PACK_REGS(
2032 rd->argintregs[GET_LOW_REG(md->params[i].regoff)],
2033 rd->argintregs[GET_HIGH_REG(md->params[i].regoff)]);
2037 rd->argintregs[md->params[i].regoff];
2040 #if defined(ENABLE_INTRP)
2048 copy->flags |= SAVEDVAR;
2054 if (md->returntype.type != TYPE_VOID)
2055 OP0_1(md->returntype.type);
2058 case ICMD_INLINE_START:
2059 case ICMD_INLINE_END:
2063 case ICMD_MULTIANEWARRAY:
2064 if (rd->argintreguse < 3)
2065 rd->argintreguse = 3;
2070 #if defined(SPECIALMEMUSE)
2071 # if defined(__DARWIN__)
2072 if (rd->memuse < (i + INT_ARG_CNT + LA_WORD_SIZE))
2073 rd->memuse = i + LA_WORD_SIZE + INT_ARG_CNT;
2075 if (rd->memuse < (i + LA_WORD_SIZE + 3))
2076 rd->memuse = i + LA_WORD_SIZE + 3;
2079 # if defined(__I386__)
2080 if (rd->memuse < i + 3)
2081 rd->memuse = i + 3; /* n integer args spilled on stack */
2082 # elif defined(__MIPS__) && SIZEOF_VOID_P == 4
2083 if (rd->memuse < i + 2)
2084 rd->memuse = i + 2; /* 4*4 bytes callee save space */
2087 rd->memuse = i; /* n integer args spilled on stack */
2088 # endif /* defined(__I386__) */
2092 /* check INT type here? Currently typecheck does this. */
2093 if (!(copy->flags & SAVEDVAR)) {
2094 copy->varkind = ARGVAR;
2095 copy->varnum = i + INT_ARG_CNT;
2096 copy->flags |= INMEMORY;
2097 #if defined(SPECIALMEMUSE)
2098 # if defined(__DARWIN__)
2099 copy->regoff = i + LA_WORD_SIZE + INT_ARG_CNT;
2101 copy->regoff = i + LA_WORD_SIZE + 3;
2104 # if defined(__I386__)
2105 copy->regoff = i + 3;
2106 # elif defined(__MIPS__) && SIZEOF_VOID_P == 4
2107 copy->regoff = i + 2;
2110 # endif /* defined(__I386__) */
2111 #endif /* defined(SPECIALMEMUSE) */
2116 copy->flags |= SAVEDVAR;
2124 case ICMD_CLEAR_ARGREN:
2125 for (i = iptr->op1; i < cd->maxlocals; i++)
2127 iptr->opc = opcode = ICMD_NOP;
2131 case ICMD_READONLY_ARG:
2132 case ICMD_READONLY_ARG+1:
2133 case ICMD_READONLY_ARG+2:
2134 case ICMD_READONLY_ARG+3:
2135 case ICMD_READONLY_ARG+4:
2138 if (curstack->varkind == LOCALVAR) {
2139 i = curstack->varnum;
2140 argren[iptr->op1] = i;
2143 opcode = iptr->opc = opcode - ICMD_READONLY_ARG + ICMD_ISTORE;
2150 new_internalerror("Unknown ICMD %d", opcode);
2156 } /* while instructions */
2158 bptr->outstack = curstack;
2159 bptr->outdepth = stackdepth;
2163 superblockend = true;
2165 } /* while blocks */
2166 } while (repeat && !deadcode);
2168 #if defined(STATISTICS)
2170 if (m->basicblockcount > count_max_basic_blocks)
2171 count_max_basic_blocks = m->basicblockcount;
2172 count_basic_blocks += m->basicblockcount;
2173 if (m->instructioncount > count_max_javainstr) count_max_javainstr = m->instructioncount;
2174 count_javainstr += m->instructioncount;
2175 if (m->stackcount > count_upper_bound_new_stack)
2176 count_upper_bound_new_stack = m->stackcount;
2177 if ((new - m->stack) > count_max_new_stack)
2178 count_max_new_stack = (new - m->stack);
2180 b_count = m->basicblockcount;
2181 bptr = m->basicblocks;
2182 while (--b_count >= 0) {
2183 if (bptr->flags > BBREACHED) {
2184 if (bptr->indepth >= 10)
2185 count_block_stack[10]++;
2187 count_block_stack[bptr->indepth]++;
2190 count_block_size_distribution[len]++;
2192 count_block_size_distribution[10]++;
2194 count_block_size_distribution[11]++;
2196 count_block_size_distribution[12]++;
2198 count_block_size_distribution[13]++;
2200 count_block_size_distribution[14]++;
2202 count_block_size_distribution[15]++;
2204 count_block_size_distribution[16]++;
2206 count_block_size_distribution[17]++;
2212 count_analyse_iterations[0]++;
2213 else if (loops == 2)
2214 count_analyse_iterations[1]++;
2215 else if (loops == 3)
2216 count_analyse_iterations[2]++;
2217 else if (loops == 4)
2218 count_analyse_iterations[3]++;
2220 count_analyse_iterations[4]++;
2222 if (m->basicblockcount <= 5)
2223 count_method_bb_distribution[0]++;
2224 else if (m->basicblockcount <= 10)
2225 count_method_bb_distribution[1]++;
2226 else if (m->basicblockcount <= 15)
2227 count_method_bb_distribution[2]++;
2228 else if (m->basicblockcount <= 20)
2229 count_method_bb_distribution[3]++;
2230 else if (m->basicblockcount <= 30)
2231 count_method_bb_distribution[4]++;
2232 else if (m->basicblockcount <= 40)
2233 count_method_bb_distribution[5]++;
2234 else if (m->basicblockcount <= 50)
2235 count_method_bb_distribution[6]++;
2236 else if (m->basicblockcount <= 75)
2237 count_method_bb_distribution[7]++;
2239 count_method_bb_distribution[8]++;
2243 /* just return methodinfo* to signal everything was ok */
2249 /**********************************************************************/
2250 /* DEBUGGING HELPERS */
2251 /**********************************************************************/
2253 void icmd_print_stack(codegendata *cd, stackptr s)
2265 j = cd->maxstack - i;
2271 if (s->flags & SAVEDVAR)
2272 switch (s->varkind) {
2274 if (s->flags & INMEMORY)
2275 printf(" M%02d", s->regoff);
2276 #ifdef HAS_ADDRESS_REGISTER_FILE
2277 else if (s->type == TYPE_ADR)
2278 printf(" R%02d", s->regoff);
2280 else if (IS_FLT_DBL_TYPE(s->type))
2281 printf(" F%02d", s->regoff);
2283 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2284 if (IS_2_WORD_TYPE(s->type))
2285 printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
2286 regs[GET_HIGH_REG(s->regoff)]);
2289 #if defined(ENABLE_INTRP)
2290 printf(" %3d", s->regoff);
2292 printf(" %3s", regs[s->regoff]);
2297 printf(" I%02d", s->varnum);
2300 printf(" L%02d", s->varnum);
2303 if (s->varnum == -1) {
2305 /* varkind ARGVAR "misused for this special case */
2307 } else /* "normal" Argvar */
2308 printf(" A%02d", s->varnum);
2309 #ifdef INVOKE_NEW_DEBUG
2310 if (s->flags & INMEMORY)
2311 printf("(M%i)", s->regoff);
2313 printf("(R%i)", s->regoff);
2317 printf(" !%02d", j);
2320 switch (s->varkind) {
2322 if (s->flags & INMEMORY)
2323 printf(" m%02d", s->regoff);
2324 #ifdef HAS_ADDRESS_REGISTER_FILE
2325 else if (s->type == TYPE_ADR)
2326 printf(" r%02d", s->regoff);
2328 else if (IS_FLT_DBL_TYPE(s->type))
2329 printf(" f%02d", s->regoff);
2331 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2332 if (IS_2_WORD_TYPE(s->type))
2333 printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
2334 regs[GET_HIGH_REG(s->regoff)]);
2337 #if defined(ENABLE_INTRP)
2338 printf(" %3d", s->regoff);
2340 printf(" %3s", regs[s->regoff]);
2345 printf(" i%02d", s->varnum);
2348 printf(" l%02d", s->varnum);
2351 if (s->varnum == -1) {
2353 /* varkind ARGVAR "misused for this special case */
2355 } else /* "normal" Argvar */
2356 printf(" a%02d", s->varnum);
2357 #ifdef INVOKE_NEW_DEBUG
2358 if (s->flags & INMEMORY)
2359 printf("(M%i)", s->regoff);
2361 printf("(R%i)", s->regoff);
2365 printf(" ?%02d", j);
2373 static void print_reg(stackptr s) {
2375 if (s->flags & SAVEDVAR)
2376 switch (s->varkind) {
2378 if (s->flags & INMEMORY)
2379 printf(" tm%02d", s->regoff);
2381 printf(" tr%02d", s->regoff);
2384 printf(" s %02d", s->varnum);
2387 printf(" l %02d", s->varnum);
2390 printf(" a %02d", s->varnum);
2393 printf(" ! %02d", s->varnum);
2396 switch (s->varkind) {
2398 if (s->flags & INMEMORY)
2399 printf(" Tm%02d", s->regoff);
2401 printf(" Tr%02d", s->regoff);
2404 printf(" S %02d", s->varnum);
2407 printf(" L %02d", s->varnum);
2410 printf(" A %02d", s->varnum);
2413 printf(" ? %02d", s->varnum);
2423 static char *jit_type[] = {
2432 /* show_icmd_method ************************************************************
2436 *******************************************************************************/
2438 void show_icmd_method(methodinfo *m, codegendata *cd, registerdata *rd)
2445 #if defined(USE_THREADS)
2446 /* We need to enter a lock here, since the binutils disassembler
2447 is not reentrant-able and we could not read functions printed
2448 at the same time. */
2450 builtin_monitorenter(lock_show_icmd);
2454 utf_fprint_classname(stdout, m->class->name);
2456 utf_fprint(stdout, m->name);
2457 utf_fprint(stdout, m->descriptor);
2458 printf("\n\nMax locals: %d\n", (int) cd->maxlocals);
2459 printf("Max stack: %d\n", (int) cd->maxstack);
2460 printf("Line number table length: %d\n", m->linenumbercount);
2462 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
2463 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
2464 printf(" L%03d ... ", ex->start->debug_nr );
2465 printf("L%03d = ", ex->end->debug_nr);
2466 printf("L%03d", ex->handler->debug_nr);
2467 printf(" (catchtype: ");
2468 if (ex->catchtype.any)
2469 if (IS_CLASSREF(ex->catchtype))
2470 utf_display_classname(ex->catchtype.ref->name);
2472 utf_display_classname(ex->catchtype.cls->name);
2478 printf("Local Table:\n");
2479 for (i = 0; i < cd->maxlocals; i++) {
2480 printf(" %3d: ", i);
2481 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
2482 #if defined(ENABLE_INTRP)
2485 if (rd->locals[i][j].type >= 0) {
2486 printf(" (%s) ", jit_type[j]);
2487 if (rd->locals[i][j].flags & INMEMORY)
2488 printf("m%2d", rd->locals[i][j].regoff);
2489 #ifdef HAS_ADDRESS_REGISTER_FILE
2490 else if (j == TYPE_ADR)
2491 printf("r%02d", rd->locals[i][j].regoff);
2493 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2494 printf("f%02d", rd->locals[i][j].regoff);
2496 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2497 if (IS_2_WORD_TYPE(j))
2499 regs[GET_LOW_REG(rd->locals[i][j].regoff)],
2500 regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
2503 printf("%3s", regs[rd->locals[i][j].regoff]);
2506 #if defined(ENABLE_INTRP)
2517 #if defined(ENABLE_INTRP)
2520 printf("Interface Table:\n");
2521 for (i = 0; i < cd->maxstack; i++) {
2522 if ((rd->interfaces[i][0].type >= 0) ||
2523 (rd->interfaces[i][1].type >= 0) ||
2524 (rd->interfaces[i][2].type >= 0) ||
2525 (rd->interfaces[i][3].type >= 0) ||
2526 (rd->interfaces[i][4].type >= 0)) {
2527 printf(" %3d: ", i);
2528 for (j = TYPE_INT; j <= TYPE_ADR; j++)
2529 if (rd->interfaces[i][j].type >= 0) {
2530 printf(" (%s) ", jit_type[j]);
2531 if (rd->interfaces[i][j].flags & SAVEDVAR) {
2532 if (rd->interfaces[i][j].flags & INMEMORY)
2533 printf("M%2d", rd->interfaces[i][j].regoff);
2534 #ifdef HAS_ADDRESS_REGISTER_FILE
2535 else if (j == TYPE_ADR)
2536 printf("R%02d", rd->interfaces[i][j].regoff);
2538 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2539 printf("F%02d", rd->interfaces[i][j].regoff);
2541 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2542 if (IS_2_WORD_TYPE(j))
2544 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
2545 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
2548 printf("%3s",regs[rd->interfaces[i][j].regoff]);
2552 if (rd->interfaces[i][j].flags & INMEMORY)
2553 printf("m%2d", rd->interfaces[i][j].regoff);
2554 #ifdef HAS_ADDRESS_REGISTER_FILE
2555 else if (j == TYPE_ADR)
2556 printf("r%02d", rd->interfaces[i][j].regoff);
2558 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2559 printf("f%02d", rd->interfaces[i][j].regoff);
2561 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2562 if (IS_2_WORD_TYPE(j))
2564 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
2565 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
2568 printf("%3s",regs[rd->interfaces[i][j].regoff]);
2577 #if defined(ENABLE_INTRP)
2584 /* show code before first basic block */
2586 if (opt_showdisassemble) {
2587 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen);
2589 for (; u1ptr < (u1 *) ((ptrint) m->mcode + cd->dseglen + m->basicblocks[0].mpc);)
2590 u1ptr = disassinstr(u1ptr);
2595 /* show code of all basic blocks */
2597 for (bptr = m->basicblocks; bptr != NULL; bptr = bptr->next) {
2598 show_icmd_block(m, cd, bptr);
2601 /* show stubs code */
2603 if (opt_showdisassemble && opt_showexceptionstubs) {
2604 printf("\nException stubs code:\n");
2605 printf("Length: %d\n\n", (s4) (m->mcodelength -
2606 ((ptrint) cd->dseglen +
2607 m->basicblocks[m->basicblockcount].mpc)));
2609 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen +
2610 m->basicblocks[m->basicblockcount].mpc);
2612 for (; (ptrint) u1ptr < ((ptrint) m->mcode + m->mcodelength);)
2613 u1ptr = disassinstr(u1ptr);
2618 #if defined(USE_THREADS)
2619 builtin_monitorexit(lock_show_icmd);
2624 void show_icmd_block(methodinfo *m, codegendata *cd, basicblock *bptr)
2631 if (bptr->flags != BBDELETED) {
2632 deadcode = bptr->flags <= BBREACHED;
2635 for (j = cd->maxstack; j > 0; j--)
2638 icmd_print_stack(cd, bptr->instack);
2639 printf("] L%03d(%d - %d) flags=%d:\n", bptr->debug_nr, bptr->icount, bptr->pre_count,bptr->flags);
2640 iptr = bptr->iinstr;
2642 for (i = 0; i < bptr->icount; i++, iptr++) {
2645 for (j = cd->maxstack; j > 0; j--)
2649 icmd_print_stack(cd, iptr->dst);
2650 printf("] %5d (line: %5d) ", i, iptr->line);
2652 show_icmd(iptr, deadcode);
2656 if (opt_showdisassemble && (!deadcode)) {
2658 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen + bptr->mpc);
2660 if (bptr->next != NULL) {
2661 for (; u1ptr < (u1 *) ((ptrint) m->mcode + cd->dseglen + bptr->next->mpc);)
2662 u1ptr = disassinstr(u1ptr);
2665 for (; u1ptr < (u1 *) ((ptrint) m->mcode + m->mcodelength);)
2666 u1ptr = disassinstr(u1ptr);
2674 void show_icmd(instruction *iptr, bool deadcode)
2680 printf("%s", icmd_names[iptr->opc]);
2682 switch (iptr->opc) {
2683 case ICMD_IADDCONST:
2684 case ICMD_ISUBCONST:
2685 case ICMD_IMULCONST:
2689 case ICMD_IANDCONST:
2691 case ICMD_IXORCONST:
2692 case ICMD_ISHLCONST:
2693 case ICMD_ISHRCONST:
2694 case ICMD_IUSHRCONST:
2695 case ICMD_LSHLCONST:
2696 case ICMD_LSHRCONST:
2697 case ICMD_LUSHRCONST:
2699 case ICMD_ELSE_ICONST:
2700 case ICMD_IASTORECONST:
2701 case ICMD_BASTORECONST:
2702 case ICMD_CASTORECONST:
2703 case ICMD_SASTORECONST:
2704 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
2707 case ICMD_IFEQ_ICONST:
2708 case ICMD_IFNE_ICONST:
2709 case ICMD_IFLT_ICONST:
2710 case ICMD_IFGE_ICONST:
2711 case ICMD_IFGT_ICONST:
2712 case ICMD_IFLE_ICONST:
2713 printf("(%d) %d", iptr[1].op1, iptr->val.i);
2716 case ICMD_LADDCONST:
2717 case ICMD_LSUBCONST:
2718 case ICMD_LMULCONST:
2722 case ICMD_LANDCONST:
2724 case ICMD_LXORCONST:
2726 case ICMD_LASTORECONST:
2727 #if SIZEOF_VOID_P == 4
2728 printf(" %lld (0x%016llx)", iptr->val.l, iptr->val.l);
2730 printf(" %ld (0x%016lx)", iptr->val.l, iptr->val.l);
2735 printf(" %f (0x%08x)", iptr->val.f, iptr->val.i);
2739 #if SIZEOF_VOID_P == 4
2740 printf(" %g (0x%016llx)", iptr->val.d, iptr->val.l);
2742 printf(" %g (0x%016lx)", iptr->val.d, iptr->val.l);
2747 case ICMD_AASTORECONST:
2748 /* check if this is a constant string or a class reference */
2752 printf(" %p", iptr->val.a);
2754 printf(" (NOT RESOLVED)");
2756 printf(", Class = \"");
2757 utf_display(((constant_classref *) iptr->target)->name);
2761 printf(" %p", iptr->val.a);
2763 printf(", String = \"");
2764 utf_display(javastring_toutf(iptr->val.a, false));
2773 printf(" %d, ", ((fieldinfo *) iptr->val.a)->offset);
2775 printf(" (NOT RESOLVED), ");
2776 utf_display_classname(((unresolved_field *) iptr->target)->fieldref->classref->name);
2778 utf_display(((unresolved_field *) iptr->target)->fieldref->name);
2780 utf_display(((unresolved_field *) iptr->target)->fieldref->descriptor);
2784 case ICMD_PUTSTATIC:
2785 case ICMD_GETSTATIC:
2787 if (!(((fieldinfo *) iptr->val.a)->class->state & CLASS_INITIALIZED))
2788 printf(" (NOT INITIALIZED) ");
2792 printf(" (NOT RESOLVED) ");
2793 utf_display_classname(((unresolved_field *) iptr->target)->fieldref->classref->name);
2795 utf_display(((unresolved_field *) iptr->target)->fieldref->name);
2797 utf_display(((unresolved_field *) iptr->target)->fieldref->descriptor);
2801 case ICMD_PUTSTATICCONST:
2802 case ICMD_PUTFIELDCONST:
2803 switch (iptr[1].op1) {
2805 printf(" %d (0x%08x),", iptr->val.i, iptr->val.i);
2808 #if SIZEOF_VOID_P == 4
2809 printf(" %lld (0x%016llx),", iptr->val.l, iptr->val.l);
2811 printf(" %ld (0x%016lx),", iptr->val.l, iptr->val.l);
2815 printf(" %p,", iptr->val.a);
2818 printf(" %g (0x%08x),", iptr->val.f, iptr->val.i);
2821 #if SIZEOF_VOID_P == 4
2822 printf(" %g (0x%016llx),", iptr->val.d, iptr->val.l);
2824 printf(" %g (0x%016lx),", iptr->val.d, iptr->val.l);
2828 if (iptr->opc == ICMD_PUTFIELDCONST) {
2830 printf(" %d,", ((fieldinfo *) iptr[1].val.a)->offset);
2832 printf(" (NOT RESOLVED),");
2835 utf_display_classname(((unresolved_field *) iptr[1].target)->fieldref->classref->name);
2837 utf_display(((unresolved_field *) iptr[1].target)->fieldref->name);
2839 utf_display(((unresolved_field *) iptr[1].target)->fieldref->descriptor);
2844 printf(" %d + %d", iptr->op1, iptr->val.i);
2879 printf(" %d", iptr->op1);
2884 utf_display_classname(((classinfo *) iptr->val.a)->name);
2888 switch (iptr->op1) {
2916 case ICMD_ANEWARRAY:
2919 utf_display_classname(((classinfo *) iptr->val.a)->name);
2923 case ICMD_MULTIANEWARRAY:
2925 printf(" (NOT RESOLVED) %d ",iptr->op1);
2926 utf_display(((constant_classref *) iptr->val.a)->name);
2928 printf(" %d ",iptr->op1);
2929 utf_display_classname(((vftbl_t *) iptr->val.a)->class->name);
2933 case ICMD_CHECKCAST:
2934 case ICMD_INSTANCEOF:
2936 classinfo *c = iptr->val.a;
2938 if (c->flags & ACC_INTERFACE)
2939 printf(" (INTERFACE) ");
2941 printf(" (CLASS,%3d) ", c->vftbl->diffval);
2943 printf(" (NOT RESOLVED) ");
2945 utf_display_classname(((constant_classref *) iptr->target)->name);
2949 case ICMD_INLINE_START:
2951 utf_display_classname(iptr->method->class->name);
2953 utf_display_classname(iptr->method->name);
2954 utf_display_classname(iptr->method->descriptor);
2955 printf(", depth=%i", iptr->op1);
2958 case ICMD_INLINE_END:
2962 printf(" %s", ((builtintable_entry *) iptr->val.a)->name);
2965 case ICMD_INVOKEVIRTUAL:
2966 case ICMD_INVOKESPECIAL:
2967 case ICMD_INVOKESTATIC:
2968 case ICMD_INVOKEINTERFACE:
2970 printf(" (NOT RESOLVED) ");
2973 utf_display_classname(((unresolved_method *) iptr->target)->methodref->classref->name);
2975 utf_display(((unresolved_method *) iptr->target)->methodref->name);
2976 utf_display(((unresolved_method *) iptr->target)->methodref->descriptor);
2985 if (deadcode || !iptr->target)
2986 printf(" %d (0x%08x) op1=%d", iptr->val.i, iptr->val.i, iptr->op1);
2988 printf(" %d (0x%08x) L%03d", iptr->val.i, iptr->val.i, ((basicblock *) iptr->target)->debug_nr);
2997 if (deadcode || !iptr->target)
2998 #if SIZEOF_VOID_P == 4
2999 printf("(%lld) op1=%d", iptr->val.l, iptr->op1);
3001 printf("(%ld) op1=%d", iptr->val.l, iptr->op1);
3004 #if SIZEOF_VOID_P == 4
3005 printf("(%lld) L%03d", iptr->val.l, ((basicblock *) iptr->target)->debug_nr);
3007 printf("(%ld) L%03d", iptr->val.l, ((basicblock *) iptr->target)->debug_nr);
3014 case ICMD_IFNONNULL:
3015 case ICMD_IF_ICMPEQ:
3016 case ICMD_IF_ICMPNE:
3017 case ICMD_IF_ICMPLT:
3018 case ICMD_IF_ICMPGE:
3019 case ICMD_IF_ICMPGT:
3020 case ICMD_IF_ICMPLE:
3021 case ICMD_IF_LCMPEQ:
3022 case ICMD_IF_LCMPNE:
3023 case ICMD_IF_LCMPLT:
3024 case ICMD_IF_LCMPGE:
3025 case ICMD_IF_LCMPGT:
3026 case ICMD_IF_LCMPLE:
3027 case ICMD_IF_ACMPEQ:
3028 case ICMD_IF_ACMPNE:
3029 if (deadcode || !iptr->target)
3030 printf(" op1=%d", iptr->op1);
3032 printf(" L%03d", ((basicblock *) iptr->target)->debug_nr);
3035 case ICMD_TABLESWITCH:
3036 s4ptr = (s4*)iptr->val.a;
3038 if (deadcode || !iptr->target) {
3039 printf(" %d;", *s4ptr);
3042 tptr = (void **) iptr->target;
3043 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
3047 s4ptr++; /* skip default */
3048 j = *s4ptr++; /* low */
3049 j = *s4ptr++ - j; /* high */
3051 if (deadcode || !*tptr)
3052 printf(" %d", *s4ptr++);
3054 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
3061 case ICMD_LOOKUPSWITCH:
3062 s4ptr = (s4*)iptr->val.a;
3064 if (deadcode || !iptr->target) {
3065 printf(" %d;", *s4ptr);
3068 tptr = (void **) iptr->target;
3069 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
3072 s4ptr++; /* default */
3073 j = *s4ptr++; /* count */
3076 if (deadcode || !*tptr) {
3077 s4ptr++; /* skip value */
3078 printf(" %d",*s4ptr++);
3081 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
3089 printf(" (NOT RESOLVED), Class = \"");
3090 utf_display(((unresolved_class *) iptr->val.a)->classref->name);
3098 * These are local overrides for various environment variables in Emacs.
3099 * Please do not remove this and leave it at the end of the file, where
3100 * Emacs will automagically detect them.
3101 * ---------------------------------------------------------------------
3104 * indent-tabs-mode: t