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 3580 2005-11-05 17:57:09Z twisti $
47 #include "mm/memory.h"
48 #include "native/native.h"
49 #include "toolbox/logging.h"
50 #include "vm/global.h"
51 #include "vm/builtin.h"
52 #include "vm/options.h"
53 #include "vm/resolve.h"
54 #include "vm/statistics.h"
55 #include "vm/stringlocal.h"
56 #include "vm/tables.h"
57 #include "vm/jit/codegen.inc.h"
58 #include "vm/jit/disass.h"
59 #include "vm/jit/jit.h"
60 #include "vm/jit/reg.h"
61 #include "vm/jit/stack.h"
62 #include "vm/jit/lsra.h"
65 /* global variables ***********************************************************/
67 #if defined(USE_THREADS)
68 static java_objectheader show_icmd_lock;
72 /* stack_init ******************************************************************
74 Initialized the stack analysis subsystem (called by jit_init).
76 *******************************************************************************/
80 #if defined(USE_THREADS)
81 /* initialize the show lock */
83 show_icmd_lock.monitorPtr = get_dummyLR();
92 /**********************************************************************/
94 /**********************************************************************/
96 /* analyse_stack uses the intermediate code created by parse.c to
97 * build a model of the JVM operand stack for the current method.
99 * The following checks are performed:
100 * - check for operand stack underflow (before each instruction)
101 * - check for operand stack overflow (after[1] each instruction)
102 * - check for matching stack depth at merging points
103 * - check for matching basic types[2] at merging points
104 * - check basic types for instruction input (except for BUILTIN*
105 * opcodes, INVOKE* opcodes and MULTIANEWARRAY)
107 * [1]) Checking this after the instruction should be ok. parse.c
108 * counts the number of required stack slots in such a way that it is
109 * only vital that we don't exceed `maxstack` at basic block
112 * [2]) 'basic types' means the distinction between INT, LONG, FLOAT,
113 * DOUBLE and ADDRESS types. Subtypes of INT and different ADDRESS
114 * types are not discerned.
117 methodinfo *analyse_stack(methodinfo *m, codegendata *cd, registerdata *rd)
125 int opcode, i, len, loops;
126 int superblockend, repeat, deadcode;
134 builtintable_entry *bte;
135 unresolved_method *um;
142 argren = DMNEW(s4, cd->maxlocals); /* table for argument renaming */
143 for (i = 0; i < cd->maxlocals; i++)
148 m->basicblocks[0].flags = BBREACHED;
149 m->basicblocks[0].instack = 0;
150 m->basicblocks[0].indepth = 0;
152 for (i = 0; i < cd->exceptiontablelength; i++) {
153 bptr = &m->basicblocks[m->basicblockindex[cd->exceptiontable[i].handlerpc]];
154 bptr->flags = BBREACHED;
155 bptr->type = BBTYPE_EXH;
158 bptr->pre_count = 10000;
163 #if CONDITIONAL_LOADCONST
164 b_count = m->basicblockcount;
165 bptr = m->basicblocks;
166 while (--b_count >= 0) {
167 if (bptr->icount != 0) {
168 iptr = bptr->iinstr + bptr->icount - 1;
201 m->basicblocks[m->basicblockindex[iptr->op1]].pre_count++;
204 case ICMD_TABLESWITCH:
206 m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
207 i = *s4ptr++; /* low */
208 i = *s4ptr++ - i + 1; /* high */
210 m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
214 case ICMD_LOOKUPSWITCH:
216 m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
217 i = *s4ptr++; /* count */
219 m->basicblocks[m->basicblockindex[s4ptr[1]]].pre_count++;
230 #endif /* CONDITIONAL_LOADCONST */
235 b_count = m->basicblockcount;
236 bptr = m->basicblocks;
237 superblockend = true;
242 while (--b_count >= 0) {
243 if (bptr->flags == BBDELETED) {
246 } else if (superblockend && (bptr->flags < BBREACHED)) {
249 } else if (bptr->flags <= BBREACHED) {
251 stackdepth = bptr->indepth;
253 } else if (bptr->flags < BBREACHED) {
255 bptr->instack = copy;
256 bptr->indepth = stackdepth;
258 } else if (bptr->indepth != stackdepth) {
259 /*show_icmd_method(m, cd, rd);
260 printf("Block: %d, required depth: %d, current depth: %d\n",
261 bptr->debug_nr, bptr->indepth, stackdepth);*/
262 *exceptionptr = new_verifyerror(m,"Stack depth mismatch");
266 curstack = bptr->instack;
268 superblockend = false;
269 bptr->flags = BBFINISHED;
272 b_index = bptr - m->basicblocks;
277 #if defined(USEBUILTINTABLE)
278 # if defined(ENABLE_INTRP)
281 bte = builtintable_get_automatic(opcode);
283 if (bte && bte->opcode == opcode) {
284 iptr->opc = ICMD_BUILTIN;
285 iptr->op1 = false; /* don't check for exception */
287 m->isleafmethod = false;
290 # if defined(ENABLE_INTRP)
293 #endif /* defined(USEBUILTINTABLE) */
300 COUNT(count_check_null);
303 case ICMD_IFEQ_ICONST:
304 case ICMD_IFNE_ICONST:
305 case ICMD_IFLT_ICONST:
306 case ICMD_IFGE_ICONST:
307 case ICMD_IFGT_ICONST:
308 case ICMD_IFLE_ICONST:
309 case ICMD_ELSE_ICONST:
314 #if defined(ENABLE_INTRP)
317 rd->locals[iptr->op1][TYPE_ADR].type = TYPE_ADR;
319 COUNT(count_pcmd_return);
321 superblockend = true;
324 /* pop 0 push 1 const */
327 COUNT(count_pcmd_load);
329 switch (iptr[1].opc) {
331 iptr[0].opc = ICMD_IADDCONST;
333 iptr[1].opc = ICMD_NOP;
334 OP1_1(TYPE_INT, TYPE_INT);
335 COUNT(count_pcmd_op);
338 iptr[0].opc = ICMD_ISUBCONST;
339 goto icmd_iconst_tail;
340 #if SUPPORT_CONST_MUL
342 iptr[0].opc = ICMD_IMULCONST;
343 goto icmd_iconst_tail;
344 #else /* SUPPORT_CONST_MUL */
346 if (iptr[0].val.i == 0x00000002)
348 else if (iptr[0].val.i == 0x00000004)
350 else if (iptr[0].val.i == 0x00000008)
352 else if (iptr[0].val.i == 0x00000010)
354 else if (iptr[0].val.i == 0x00000020)
356 else if (iptr[0].val.i == 0x00000040)
358 else if (iptr[0].val.i == 0x00000080)
360 else if (iptr[0].val.i == 0x00000100)
362 else if (iptr[0].val.i == 0x00000200)
364 else if (iptr[0].val.i == 0x00000400)
366 else if (iptr[0].val.i == 0x00000800)
368 else if (iptr[0].val.i == 0x00001000)
370 else if (iptr[0].val.i == 0x00002000)
372 else if (iptr[0].val.i == 0x00004000)
374 else if (iptr[0].val.i == 0x00008000)
376 else if (iptr[0].val.i == 0x00010000)
378 else if (iptr[0].val.i == 0x00020000)
380 else if (iptr[0].val.i == 0x00040000)
382 else if (iptr[0].val.i == 0x00080000)
384 else if (iptr[0].val.i == 0x00100000)
386 else if (iptr[0].val.i == 0x00200000)
388 else if (iptr[0].val.i == 0x00400000)
390 else if (iptr[0].val.i == 0x00800000)
392 else if (iptr[0].val.i == 0x01000000)
394 else if (iptr[0].val.i == 0x02000000)
396 else if (iptr[0].val.i == 0x04000000)
398 else if (iptr[0].val.i == 0x08000000)
400 else if (iptr[0].val.i == 0x10000000)
402 else if (iptr[0].val.i == 0x20000000)
404 else if (iptr[0].val.i == 0x40000000)
406 else if (iptr[0].val.i == 0x80000000)
412 iptr[0].opc = ICMD_IMULPOW2;
413 goto icmd_iconst_tail;
414 #endif /* SUPPORT_CONST_MUL */
416 if (iptr[0].val.i == 0x00000002)
418 else if (iptr[0].val.i == 0x00000004)
420 else if (iptr[0].val.i == 0x00000008)
422 else if (iptr[0].val.i == 0x00000010)
424 else if (iptr[0].val.i == 0x00000020)
426 else if (iptr[0].val.i == 0x00000040)
428 else if (iptr[0].val.i == 0x00000080)
430 else if (iptr[0].val.i == 0x00000100)
432 else if (iptr[0].val.i == 0x00000200)
434 else if (iptr[0].val.i == 0x00000400)
436 else if (iptr[0].val.i == 0x00000800)
438 else if (iptr[0].val.i == 0x00001000)
440 else if (iptr[0].val.i == 0x00002000)
442 else if (iptr[0].val.i == 0x00004000)
444 else if (iptr[0].val.i == 0x00008000)
446 else if (iptr[0].val.i == 0x00010000)
448 else if (iptr[0].val.i == 0x00020000)
450 else if (iptr[0].val.i == 0x00040000)
452 else if (iptr[0].val.i == 0x00080000)
454 else if (iptr[0].val.i == 0x00100000)
456 else if (iptr[0].val.i == 0x00200000)
458 else if (iptr[0].val.i == 0x00400000)
460 else if (iptr[0].val.i == 0x00800000)
462 else if (iptr[0].val.i == 0x01000000)
464 else if (iptr[0].val.i == 0x02000000)
466 else if (iptr[0].val.i == 0x04000000)
468 else if (iptr[0].val.i == 0x08000000)
470 else if (iptr[0].val.i == 0x10000000)
472 else if (iptr[0].val.i == 0x20000000)
474 else if (iptr[0].val.i == 0x40000000)
476 else if (iptr[0].val.i == 0x80000000)
482 iptr[0].opc = ICMD_IDIVPOW2;
483 goto icmd_iconst_tail;
485 /*log_text("stack.c: ICMD_ICONST/ICMD_IREM");*/
486 if ((iptr[0].val.i == 0x00000002) ||
487 (iptr[0].val.i == 0x00000004) ||
488 (iptr[0].val.i == 0x00000008) ||
489 (iptr[0].val.i == 0x00000010) ||
490 (iptr[0].val.i == 0x00000020) ||
491 (iptr[0].val.i == 0x00000040) ||
492 (iptr[0].val.i == 0x00000080) ||
493 (iptr[0].val.i == 0x00000100) ||
494 (iptr[0].val.i == 0x00000200) ||
495 (iptr[0].val.i == 0x00000400) ||
496 (iptr[0].val.i == 0x00000800) ||
497 (iptr[0].val.i == 0x00001000) ||
498 (iptr[0].val.i == 0x00002000) ||
499 (iptr[0].val.i == 0x00004000) ||
500 (iptr[0].val.i == 0x00008000) ||
501 (iptr[0].val.i == 0x00010000) ||
502 (iptr[0].val.i == 0x00020000) ||
503 (iptr[0].val.i == 0x00040000) ||
504 (iptr[0].val.i == 0x00080000) ||
505 (iptr[0].val.i == 0x00100000) ||
506 (iptr[0].val.i == 0x00200000) ||
507 (iptr[0].val.i == 0x00400000) ||
508 (iptr[0].val.i == 0x00800000) ||
509 (iptr[0].val.i == 0x01000000) ||
510 (iptr[0].val.i == 0x02000000) ||
511 (iptr[0].val.i == 0x04000000) ||
512 (iptr[0].val.i == 0x08000000) ||
513 (iptr[0].val.i == 0x10000000) ||
514 (iptr[0].val.i == 0x20000000) ||
515 (iptr[0].val.i == 0x40000000) ||
516 (iptr[0].val.i == 0x80000000)) {
517 iptr[0].opc = ICMD_IREMPOW2;
519 goto icmd_iconst_tail;
523 #if SUPPORT_CONST_LOGICAL
525 iptr[0].opc = ICMD_IANDCONST;
526 goto icmd_iconst_tail;
528 iptr[0].opc = ICMD_IORCONST;
529 goto icmd_iconst_tail;
531 iptr[0].opc = ICMD_IXORCONST;
532 goto icmd_iconst_tail;
533 #endif /* SUPPORT_CONST_LOGICAL */
535 iptr[0].opc = ICMD_ISHLCONST;
536 goto icmd_iconst_tail;
538 iptr[0].opc = ICMD_ISHRCONST;
539 goto icmd_iconst_tail;
541 iptr[0].opc = ICMD_IUSHRCONST;
542 goto icmd_iconst_tail;
543 #if SUPPORT_LONG_SHIFT
545 iptr[0].opc = ICMD_LSHLCONST;
546 goto icmd_lconst_tail;
548 iptr[0].opc = ICMD_LSHRCONST;
549 goto icmd_lconst_tail;
551 iptr[0].opc = ICMD_LUSHRCONST;
552 goto icmd_lconst_tail;
553 #endif /* SUPPORT_LONG_SHIFT */
555 iptr[0].opc = ICMD_IFEQ;
557 iptr[0].op1 = iptr[1].op1;
558 /* IF_ICMPxx is the last instruction in the */
559 /* basic block, just remove it */
560 /* iptr[1].opc = ICMD_NOP; */
565 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
567 iptr[0].target = (void *) tbptr;
569 MARKREACHED(tbptr, copy);
570 COUNT(count_pcmd_bra);
573 iptr[0].opc = ICMD_IFLT;
574 goto icmd_if_icmp_tail;
576 iptr[0].opc = ICMD_IFLE;
577 goto icmd_if_icmp_tail;
579 iptr[0].opc = ICMD_IFNE;
580 goto icmd_if_icmp_tail;
582 iptr[0].opc = ICMD_IFGT;
583 goto icmd_if_icmp_tail;
585 iptr[0].opc = ICMD_IFGE;
586 goto icmd_if_icmp_tail;
588 #if SUPPORT_CONST_STORE
593 # if defined(ENABLE_INTRP)
596 #if SUPPORT_CONST_STORE_ZERO_ONLY
597 if (iptr[0].val.i == 0) {
598 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
599 switch (iptr[1].opc) {
601 iptr[0].opc = ICMD_IASTORECONST;
604 iptr[0].opc = ICMD_BASTORECONST;
607 iptr[0].opc = ICMD_CASTORECONST;
610 iptr[0].opc = ICMD_SASTORECONST;
614 iptr[1].opc = ICMD_NOP;
615 OPTT2_0(TYPE_INT, TYPE_ADR);
616 COUNT(count_pcmd_op);
617 #if SUPPORT_CONST_STORE_ZERO_ONLY
620 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
621 # if defined(ENABLE_INTRP)
629 #if SUPPORT_CONST_STORE_ZERO_ONLY
630 if (iptr[0].val.i == 0) {
631 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
632 switch (iptr[1].opc) {
634 iptr[0].opc = ICMD_PUTSTATICCONST;
638 iptr[0].opc = ICMD_PUTFIELDCONST;
643 iptr[1].opc = ICMD_NOP;
644 iptr[0].op1 = TYPE_INT;
645 COUNT(count_pcmd_op);
646 #if SUPPORT_CONST_STORE_ZERO_ONLY
649 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
651 #endif /* SUPPORT_CONST_STORE */
661 COUNT(count_pcmd_load);
663 switch (iptr[1].opc) {
666 iptr[0].opc = ICMD_LADDCONST;
668 iptr[1].opc = ICMD_NOP;
669 OP1_1(TYPE_LNG,TYPE_LNG);
670 COUNT(count_pcmd_op);
673 iptr[0].opc = ICMD_LSUBCONST;
674 goto icmd_lconst_tail;
675 #endif /* SUPPORT_LONG_ADD */
676 #if SUPPORT_LONG_MUL && SUPPORT_CONST_MUL
678 iptr[0].opc = ICMD_LMULCONST;
679 goto icmd_lconst_tail;
680 #else /* SUPPORT_LONG_MUL && SUPPORT_CONST_MUL */
681 # if SUPPORT_LONG_SHIFT
683 if (iptr[0].val.l == 0x00000002)
685 else if (iptr[0].val.l == 0x00000004)
687 else if (iptr[0].val.l == 0x00000008)
689 else if (iptr[0].val.l == 0x00000010)
691 else if (iptr[0].val.l == 0x00000020)
693 else if (iptr[0].val.l == 0x00000040)
695 else if (iptr[0].val.l == 0x00000080)
697 else if (iptr[0].val.l == 0x00000100)
699 else if (iptr[0].val.l == 0x00000200)
701 else if (iptr[0].val.l == 0x00000400)
703 else if (iptr[0].val.l == 0x00000800)
705 else if (iptr[0].val.l == 0x00001000)
707 else if (iptr[0].val.l == 0x00002000)
709 else if (iptr[0].val.l == 0x00004000)
711 else if (iptr[0].val.l == 0x00008000)
713 else if (iptr[0].val.l == 0x00010000)
715 else if (iptr[0].val.l == 0x00020000)
717 else if (iptr[0].val.l == 0x00040000)
719 else if (iptr[0].val.l == 0x00080000)
721 else if (iptr[0].val.l == 0x00100000)
723 else if (iptr[0].val.l == 0x00200000)
725 else if (iptr[0].val.l == 0x00400000)
727 else if (iptr[0].val.l == 0x00800000)
729 else if (iptr[0].val.l == 0x01000000)
731 else if (iptr[0].val.l == 0x02000000)
733 else if (iptr[0].val.l == 0x04000000)
735 else if (iptr[0].val.l == 0x08000000)
737 else if (iptr[0].val.l == 0x10000000)
739 else if (iptr[0].val.l == 0x20000000)
741 else if (iptr[0].val.l == 0x40000000)
743 else if (iptr[0].val.l == 0x80000000)
749 iptr[0].opc = ICMD_LMULPOW2;
750 goto icmd_lconst_tail;
751 # endif /* SUPPORT_LONG_SHIFT */
752 #endif /* SUPPORT_LONG_MUL && SUPPORT_CONST_MUL */
755 if (iptr[0].val.l == 0x00000002)
757 else if (iptr[0].val.l == 0x00000004)
759 else if (iptr[0].val.l == 0x00000008)
761 else if (iptr[0].val.l == 0x00000010)
763 else if (iptr[0].val.l == 0x00000020)
765 else if (iptr[0].val.l == 0x00000040)
767 else if (iptr[0].val.l == 0x00000080)
769 else if (iptr[0].val.l == 0x00000100)
771 else if (iptr[0].val.l == 0x00000200)
773 else if (iptr[0].val.l == 0x00000400)
775 else if (iptr[0].val.l == 0x00000800)
777 else if (iptr[0].val.l == 0x00001000)
779 else if (iptr[0].val.l == 0x00002000)
781 else if (iptr[0].val.l == 0x00004000)
783 else if (iptr[0].val.l == 0x00008000)
785 else if (iptr[0].val.l == 0x00010000)
787 else if (iptr[0].val.l == 0x00020000)
789 else if (iptr[0].val.l == 0x00040000)
791 else if (iptr[0].val.l == 0x00080000)
793 else if (iptr[0].val.l == 0x00100000)
795 else if (iptr[0].val.l == 0x00200000)
797 else if (iptr[0].val.l == 0x00400000)
799 else if (iptr[0].val.l == 0x00800000)
801 else if (iptr[0].val.l == 0x01000000)
803 else if (iptr[0].val.l == 0x02000000)
805 else if (iptr[0].val.l == 0x04000000)
807 else if (iptr[0].val.l == 0x08000000)
809 else if (iptr[0].val.l == 0x10000000)
811 else if (iptr[0].val.l == 0x20000000)
813 else if (iptr[0].val.l == 0x40000000)
815 else if (iptr[0].val.l == 0x80000000)
821 iptr[0].opc = ICMD_LDIVPOW2;
822 goto icmd_lconst_tail;
824 if ((iptr[0].val.l == 0x00000002) ||
825 (iptr[0].val.l == 0x00000004) ||
826 (iptr[0].val.l == 0x00000008) ||
827 (iptr[0].val.l == 0x00000010) ||
828 (iptr[0].val.l == 0x00000020) ||
829 (iptr[0].val.l == 0x00000040) ||
830 (iptr[0].val.l == 0x00000080) ||
831 (iptr[0].val.l == 0x00000100) ||
832 (iptr[0].val.l == 0x00000200) ||
833 (iptr[0].val.l == 0x00000400) ||
834 (iptr[0].val.l == 0x00000800) ||
835 (iptr[0].val.l == 0x00001000) ||
836 (iptr[0].val.l == 0x00002000) ||
837 (iptr[0].val.l == 0x00004000) ||
838 (iptr[0].val.l == 0x00008000) ||
839 (iptr[0].val.l == 0x00010000) ||
840 (iptr[0].val.l == 0x00020000) ||
841 (iptr[0].val.l == 0x00040000) ||
842 (iptr[0].val.l == 0x00080000) ||
843 (iptr[0].val.l == 0x00100000) ||
844 (iptr[0].val.l == 0x00200000) ||
845 (iptr[0].val.l == 0x00400000) ||
846 (iptr[0].val.l == 0x00800000) ||
847 (iptr[0].val.l == 0x01000000) ||
848 (iptr[0].val.l == 0x02000000) ||
849 (iptr[0].val.l == 0x04000000) ||
850 (iptr[0].val.l == 0x08000000) ||
851 (iptr[0].val.l == 0x10000000) ||
852 (iptr[0].val.l == 0x20000000) ||
853 (iptr[0].val.l == 0x40000000) ||
854 (iptr[0].val.l == 0x80000000)) {
855 iptr[0].opc = ICMD_LREMPOW2;
857 goto icmd_lconst_tail;
861 #endif /* SUPPORT_LONG_DIV */
862 #if SUPPORT_LONG_LOGICAL && SUPPORT_CONST_LOGICAL
865 iptr[0].opc = ICMD_LANDCONST;
866 goto icmd_lconst_tail;
868 iptr[0].opc = ICMD_LORCONST;
869 goto icmd_lconst_tail;
871 iptr[0].opc = ICMD_LXORCONST;
872 goto icmd_lconst_tail;
873 #endif /* SUPPORT_LONG_LOGICAL && SUPPORT_CONST_LOGICAL */
874 #if !defined(NOLONG_CONDITIONAL)
876 if ((len > 1) && (iptr[2].val.i == 0)) {
877 switch (iptr[2].opc) {
879 iptr[0].opc = ICMD_IF_LEQ;
880 icmd_lconst_lcmp_tail:
881 iptr[0].op1 = iptr[2].op1;
884 /* iptr[1].opc = ICMD_NOP;
885 iptr[2].opc = ICMD_NOP; */
887 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
889 iptr[0].target = (void *) tbptr;
891 MARKREACHED(tbptr, copy);
892 COUNT(count_pcmd_bra);
893 COUNT(count_pcmd_op);
896 iptr[0].opc = ICMD_IF_LNE;
897 goto icmd_lconst_lcmp_tail;
899 iptr[0].opc = ICMD_IF_LLT;
900 goto icmd_lconst_lcmp_tail;
902 iptr[0].opc = ICMD_IF_LGT;
903 goto icmd_lconst_lcmp_tail;
905 iptr[0].opc = ICMD_IF_LLE;
906 goto icmd_lconst_lcmp_tail;
908 iptr[0].opc = ICMD_IF_LGE;
909 goto icmd_lconst_lcmp_tail;
912 } /* switch (iptr[2].opc) */
913 } /* if (iptr[2].val.i == 0) */
917 #endif /* !defined(NOLONG_CONDITIONAL) */
919 #if SUPPORT_CONST_STORE
921 # if defined(ENABLE_INTRP)
924 #if SUPPORT_CONST_STORE_ZERO_ONLY
925 if (iptr[0].val.l == 0) {
926 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
927 iptr[0].opc = ICMD_LASTORECONST;
928 iptr[1].opc = ICMD_NOP;
929 OPTT2_0(TYPE_INT, TYPE_ADR);
930 COUNT(count_pcmd_op);
931 #if SUPPORT_CONST_STORE_ZERO_ONLY
934 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
935 # if defined(ENABLE_INTRP)
943 #if SUPPORT_CONST_STORE_ZERO_ONLY
944 if (iptr[0].val.l == 0) {
945 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
946 switch (iptr[1].opc) {
948 iptr[0].opc = ICMD_PUTSTATICCONST;
952 iptr[0].opc = ICMD_PUTFIELDCONST;
957 iptr[1].opc = ICMD_NOP;
958 iptr[0].op1 = TYPE_LNG;
959 COUNT(count_pcmd_op);
960 #if SUPPORT_CONST_STORE_ZERO_ONLY
963 #endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
965 #endif /* SUPPORT_CONST_STORE */
975 COUNT(count_pcmd_load);
980 COUNT(count_pcmd_load);
985 COUNT(count_pcmd_load);
986 #if SUPPORT_CONST_STORE
987 if (len > 0 && iptr->val.a == 0) {
988 switch (iptr[1].opc) {
989 #if !defined(__POWERPC__) && !defined(__X86_64__) && !defined(__I386__) && !defined(__ALPHA__) && !defined(__MIPS__)
991 if (iptr[1].val.fp != BUILTIN_aastore) {
999 switch (iptr[1].opc) {
1001 iptr[0].opc = ICMD_AASTORECONST;
1002 OPTT2_0(TYPE_INT, TYPE_ADR);
1004 case ICMD_PUTSTATIC:
1005 iptr[0].opc = ICMD_PUTSTATICCONST;
1006 iptr[0].op1 = TYPE_ADR;
1010 iptr[0].opc = ICMD_PUTFIELDCONST;
1011 iptr[0].op1 = TYPE_ADR;
1016 iptr[1].opc = ICMD_NOP;
1017 COUNT(count_pcmd_op);
1021 PUSHCONST(TYPE_ADR);
1024 #endif /* SUPPORT_CONST_STORE */
1025 PUSHCONST(TYPE_ADR);
1028 /* pop 0 push 1 load */
1035 COUNT(count_load_instruction);
1036 i = opcode - ICMD_ILOAD;
1037 iptr->op1 = argren[iptr->op1];
1038 #if defined(ENABLE_INTRP)
1041 rd->locals[iptr->op1][i].type = i;
1042 LOAD(i, LOCALVAR, iptr->op1);
1052 COUNT(count_check_null);
1053 COUNT(count_check_bound);
1054 COUNT(count_pcmd_mem);
1055 OP2IAT_1(opcode - ICMD_IALOAD);
1061 COUNT(count_check_null);
1062 COUNT(count_check_bound);
1063 COUNT(count_pcmd_mem);
1067 /* pop 0 push 0 iinc */
1070 #if defined(STATISTICS)
1074 count_store_depth[10]++;
1076 count_store_depth[i]++;
1082 if ((copy->varkind == LOCALVAR) &&
1083 (copy->varnum == iptr->op1)) {
1084 copy->varkind = TEMPVAR;
1093 /* pop 1 push 0 store */
1103 i = opcode - ICMD_ISTORE;
1104 #if defined(ENABLE_INTRP)
1107 rd->locals[iptr->op1][i].type = i;
1108 #if defined(STATISTICS)
1113 count_store_length[20]++;
1115 count_store_length[i]++;
1118 count_store_depth[10]++;
1120 count_store_depth[i]++;
1123 copy = curstack->prev;
1126 if ((copy->varkind == LOCALVAR) &&
1127 (copy->varnum == iptr->op1)) {
1128 copy->varkind = TEMPVAR;
1134 if ((new - curstack) == 1) {
1135 curstack->varkind = LOCALVAR;
1136 curstack->varnum = iptr->op1;
1138 STORE(opcode - ICMD_ISTORE);
1144 COUNT(count_check_null);
1145 COUNT(count_check_bound);
1146 COUNT(count_pcmd_mem);
1148 bte = (builtintable_entry *) iptr->val.a;
1152 if (md->memuse > rd->memuse)
1153 rd->memuse = md->memuse;
1154 if (md->argintreguse > rd->argintreguse)
1155 rd->argintreguse = md->argintreguse;
1157 /* make all stack variables saved */
1161 copy->flags |= SAVEDVAR;
1172 COUNT(count_check_null);
1173 COUNT(count_check_bound);
1174 COUNT(count_pcmd_mem);
1175 OP3TIA_0(opcode - ICMD_IASTORE);
1181 COUNT(count_check_null);
1182 COUNT(count_check_bound);
1183 COUNT(count_pcmd_mem);
1190 #ifdef TYPECHECK_STACK_COMPCAT
1193 if (IS_2_WORD_TYPE(curstack->type)) {
1194 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1207 md_return_alloc(m, rd, opcode - ICMD_IRETURN, curstack);
1208 COUNT(count_pcmd_return);
1209 OP1_0(opcode - ICMD_IRETURN);
1210 superblockend = true;
1214 COUNT(count_check_null);
1218 superblockend = true;
1221 case ICMD_PUTSTATIC:
1222 COUNT(count_pcmd_mem);
1226 /* pop 1 push 0 branch */
1229 case ICMD_IFNONNULL:
1230 COUNT(count_pcmd_bra);
1232 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1234 iptr[0].target = (void *) tbptr;
1236 MARKREACHED(tbptr, copy);
1245 COUNT(count_pcmd_bra);
1246 #if CONDITIONAL_LOADCONST
1247 # if defined(ENABLE_INTRP)
1250 tbptr = m->basicblocks + b_index;
1251 if ((b_count >= 3) &&
1252 ((b_index + 2) == m->basicblockindex[iptr[0].op1]) &&
1253 (tbptr[1].pre_count == 1) &&
1254 (tbptr[1].iinstr[0].opc == ICMD_ICONST) &&
1255 (tbptr[1].iinstr[1].opc == ICMD_GOTO) &&
1256 ((b_index + 3) == m->basicblockindex[tbptr[1].iinstr[1].op1]) &&
1257 (tbptr[2].pre_count == 1) &&
1258 (tbptr[2].iinstr[0].opc == ICMD_ICONST) &&
1259 (tbptr[2].icount==1)) {
1260 /*printf("tbptr[2].icount=%d\n",tbptr[2].icount);*/
1261 OP1_1(TYPE_INT, TYPE_INT);
1262 switch (iptr[0].opc) {
1264 iptr[0].opc = ICMD_IFNE_ICONST;
1267 iptr[0].opc = ICMD_IFEQ_ICONST;
1270 iptr[0].opc = ICMD_IFGE_ICONST;
1273 iptr[0].opc = ICMD_IFLT_ICONST;
1276 iptr[0].opc = ICMD_IFLE_ICONST;
1279 iptr[0].opc = ICMD_IFGT_ICONST;
1283 iptr[0].val.i = iptr[1].val.i;
1284 iptr[1].opc = ICMD_ELSE_ICONST;
1285 iptr[1].val.i = iptr[3].val.i;
1286 iptr[2].opc = ICMD_NOP;
1287 iptr[3].opc = ICMD_NOP;
1289 /* HACK: save compare value in iptr[1].op1 */
1290 iptr[1].op1 = iptr[0].val.i;
1291 iptr[0].val.i = tbptr[1].iinstr[0].val.i;
1292 iptr[1].opc = ICMD_ELSE_ICONST;
1293 iptr[1].val.i = tbptr[2].iinstr[0].val.i;
1294 tbptr[1].iinstr[0].opc = ICMD_NOP;
1295 tbptr[1].iinstr[1].opc = ICMD_NOP;
1296 tbptr[2].iinstr[0].opc = ICMD_NOP;
1298 tbptr[1].flags = BBDELETED;
1299 tbptr[2].flags = BBDELETED;
1300 tbptr[1].icount = 0;
1301 tbptr[2].icount = 0;
1302 if (tbptr[3].pre_count == 2) {
1303 len += tbptr[3].icount + 3;
1304 bptr->icount += tbptr[3].icount + 3;
1305 tbptr[3].flags = BBDELETED;
1306 tbptr[3].icount = 0;
1316 # if defined(ENABLE_INTRP)
1320 #endif /* CONDITIONAL_LOADCONST */
1324 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1326 iptr[0].target = (void *) tbptr;
1328 MARKREACHED(tbptr, copy);
1331 /* pop 0 push 0 branch */
1334 COUNT(count_pcmd_bra);
1335 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1337 iptr[0].target = (void *) tbptr;
1339 MARKREACHED(tbptr, copy);
1341 superblockend = true;
1344 /* pop 1 push 0 table branch */
1346 case ICMD_TABLESWITCH:
1347 COUNT(count_pcmd_table);
1349 s4ptr = iptr->val.a;
1350 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1351 MARKREACHED(tbptr, copy);
1352 i = *s4ptr++; /* low */
1353 i = *s4ptr++ - i + 1; /* high */
1355 tptr = DMNEW(void*, i+1);
1356 iptr->target = (void *) tptr;
1358 tptr[0] = (void *) tbptr;
1362 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1364 tptr[0] = (void *) tbptr;
1367 MARKREACHED(tbptr, copy);
1370 superblockend = true;
1373 /* pop 1 push 0 table branch */
1375 case ICMD_LOOKUPSWITCH:
1376 COUNT(count_pcmd_table);
1378 s4ptr = iptr->val.a;
1379 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1380 MARKREACHED(tbptr, copy);
1381 i = *s4ptr++; /* count */
1383 tptr = DMNEW(void*, i+1);
1384 iptr->target = (void *) tptr;
1386 tptr[0] = (void *) tbptr;
1390 tbptr = m->basicblocks + m->basicblockindex[s4ptr[1]];
1392 tptr[0] = (void *) tbptr;
1395 MARKREACHED(tbptr, copy);
1399 superblockend = true;
1402 case ICMD_MONITORENTER:
1403 COUNT(count_check_null);
1404 case ICMD_MONITOREXIT:
1408 /* pop 2 push 0 branch */
1410 case ICMD_IF_ICMPEQ:
1411 case ICMD_IF_ICMPNE:
1412 case ICMD_IF_ICMPLT:
1413 case ICMD_IF_ICMPGE:
1414 case ICMD_IF_ICMPGT:
1415 case ICMD_IF_ICMPLE:
1416 COUNT(count_pcmd_bra);
1418 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1420 iptr[0].target = (void *) tbptr;
1422 MARKREACHED(tbptr, copy);
1425 case ICMD_IF_ACMPEQ:
1426 case ICMD_IF_ACMPNE:
1427 COUNT(count_pcmd_bra);
1429 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1431 iptr[0].target = (void *) tbptr;
1433 MARKREACHED(tbptr, copy);
1439 COUNT(count_check_null);
1440 COUNT(count_pcmd_mem);
1441 OPTT2_0(iptr->op1,TYPE_ADR);
1446 if (!IS_2_WORD_TYPE(curstack->type)) {
1448 #ifdef TYPECHECK_STACK_COMPCAT
1451 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1452 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1457 OP1_0ANY; /* second pop */
1460 iptr->opc = ICMD_POP;
1464 /* pop 0 push 1 dup */
1467 #ifdef TYPECHECK_STACK_COMPCAT
1470 if (IS_2_WORD_TYPE(curstack->type)) {
1471 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1476 COUNT(count_dup_instruction);
1482 if (IS_2_WORD_TYPE(curstack->type)) {
1484 iptr->opc = ICMD_DUP;
1489 /* ..., ????, cat1 */
1490 #ifdef TYPECHECK_STACK_COMPCAT
1492 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1493 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1499 NEWSTACK(copy->prev->type, copy->prev->varkind,
1500 copy->prev->varnum);
1501 NEWSTACK(copy->type, copy->varkind,
1508 /* pop 2 push 3 dup */
1511 #ifdef TYPECHECK_STACK_COMPCAT
1514 if (IS_2_WORD_TYPE(curstack->type) ||
1515 IS_2_WORD_TYPE(curstack->prev->type)) {
1516 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1526 if (IS_2_WORD_TYPE(curstack->type)) {
1527 /* ..., ????, cat2 */
1528 #ifdef TYPECHECK_STACK_COMPCAT
1530 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1531 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1536 iptr->opc = ICMD_DUP_X1;
1540 /* ..., ????, cat1 */
1541 #ifdef TYPECHECK_STACK_COMPCAT
1544 if (IS_2_WORD_TYPE(curstack->prev->type)
1545 || IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1546 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1555 /* pop 3 push 4 dup */
1559 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1560 /* ..., cat2, ???? */
1561 #ifdef TYPECHECK_STACK_COMPCAT
1563 if (IS_2_WORD_TYPE(curstack->type)) {
1564 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1569 iptr->opc = ICMD_DUP_X1;
1573 /* ..., cat1, ???? */
1574 #ifdef TYPECHECK_STACK_COMPCAT
1577 if (IS_2_WORD_TYPE(curstack->type)
1578 || IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1579 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1590 if (IS_2_WORD_TYPE(curstack->type)) {
1591 /* ..., ????, cat2 */
1592 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1593 /* ..., cat2, cat2 */
1594 iptr->opc = ICMD_DUP_X1;
1598 /* ..., cat1, cat2 */
1599 #ifdef TYPECHECK_STACK_COMPCAT
1602 if (IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1603 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1608 iptr->opc = ICMD_DUP_X2;
1614 /* ..., ????, ????, cat1 */
1615 if (IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1616 /* ..., cat2, ????, cat1 */
1617 #ifdef TYPECHECK_STACK_COMPCAT
1619 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1620 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1625 iptr->opc = ICMD_DUP2_X1;
1629 /* ..., cat1, ????, cat1 */
1630 #ifdef TYPECHECK_STACK_COMPCAT
1633 if (IS_2_WORD_TYPE(curstack->prev->type)
1634 || IS_2_WORD_TYPE(curstack->prev->prev->prev->type)) {
1635 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1645 /* pop 2 push 2 swap */
1648 #ifdef TYPECHECK_STACK_COMPCAT
1651 if (IS_2_WORD_TYPE(curstack->type)
1652 || IS_2_WORD_TYPE(curstack->prev->type)) {
1653 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1665 #if !SUPPORT_DIVISION
1666 bte = (builtintable_entry *) iptr->val.a;
1670 if (md->memuse > rd->memuse)
1671 rd->memuse = md->memuse;
1672 if (md->argintreguse > rd->argintreguse)
1673 rd->argintreguse = md->argintreguse;
1675 /* make all stack variables saved */
1679 copy->flags |= SAVEDVAR;
1684 #endif /* !SUPPORT_DIVISION */
1695 COUNT(count_pcmd_op);
1701 #if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
1702 bte = (builtintable_entry *) iptr->val.a;
1706 if (md->memuse > rd->memuse)
1707 rd->memuse = md->memuse;
1708 if (md->argintreguse > rd->argintreguse)
1709 rd->argintreguse = md->argintreguse;
1711 /* make all stack variables saved */
1715 copy->flags |= SAVEDVAR;
1720 #endif /* !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV) */
1725 #if SUPPORT_LONG_LOGICAL
1729 #endif /* SUPPORT_LONG_LOGICAL */
1730 COUNT(count_pcmd_op);
1737 COUNT(count_pcmd_op);
1746 COUNT(count_pcmd_op);
1755 COUNT(count_pcmd_op);
1760 COUNT(count_pcmd_op);
1761 #if !defined(NOLONG_CONDITIONAL)
1762 if ((len > 0) && (iptr[1].val.i == 0)) {
1763 switch (iptr[1].opc) {
1765 iptr[0].opc = ICMD_IF_LCMPEQ;
1767 iptr[0].op1 = iptr[1].op1;
1770 /* iptr[1].opc = ICMD_NOP; */
1772 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1774 iptr[0].target = (void *) tbptr;
1776 MARKREACHED(tbptr, copy);
1777 COUNT(count_pcmd_bra);
1780 iptr[0].opc = ICMD_IF_LCMPNE;
1781 goto icmd_lcmp_if_tail;
1783 iptr[0].opc = ICMD_IF_LCMPLT;
1784 goto icmd_lcmp_if_tail;
1786 iptr[0].opc = ICMD_IF_LCMPGT;
1787 goto icmd_lcmp_if_tail;
1789 iptr[0].opc = ICMD_IF_LCMPLE;
1790 goto icmd_lcmp_if_tail;
1792 iptr[0].opc = ICMD_IF_LCMPGE;
1793 goto icmd_lcmp_if_tail;
1795 OPTT2_1(TYPE_LNG, TYPE_INT);
1800 OPTT2_1(TYPE_LNG, TYPE_INT);
1804 COUNT(count_pcmd_op);
1805 OPTT2_1(TYPE_FLT, TYPE_INT);
1809 COUNT(count_pcmd_op);
1810 OPTT2_1(TYPE_DBL, TYPE_INT);
1818 case ICMD_INT2SHORT:
1819 COUNT(count_pcmd_op);
1820 OP1_1(TYPE_INT, TYPE_INT);
1823 COUNT(count_pcmd_op);
1824 OP1_1(TYPE_LNG, TYPE_LNG);
1827 COUNT(count_pcmd_op);
1828 OP1_1(TYPE_FLT, TYPE_FLT);
1831 COUNT(count_pcmd_op);
1832 OP1_1(TYPE_DBL, TYPE_DBL);
1836 COUNT(count_pcmd_op);
1837 OP1_1(TYPE_INT, TYPE_LNG);
1840 COUNT(count_pcmd_op);
1841 OP1_1(TYPE_INT, TYPE_FLT);
1844 COUNT(count_pcmd_op);
1845 OP1_1(TYPE_INT, TYPE_DBL);
1848 COUNT(count_pcmd_op);
1849 OP1_1(TYPE_LNG, TYPE_INT);
1852 COUNT(count_pcmd_op);
1853 OP1_1(TYPE_LNG, TYPE_FLT);
1856 COUNT(count_pcmd_op);
1857 OP1_1(TYPE_LNG, TYPE_DBL);
1860 COUNT(count_pcmd_op);
1861 OP1_1(TYPE_FLT, TYPE_INT);
1864 COUNT(count_pcmd_op);
1865 OP1_1(TYPE_FLT, TYPE_LNG);
1868 COUNT(count_pcmd_op);
1869 OP1_1(TYPE_FLT, TYPE_DBL);
1872 COUNT(count_pcmd_op);
1873 OP1_1(TYPE_DBL, TYPE_INT);
1876 COUNT(count_pcmd_op);
1877 OP1_1(TYPE_DBL, TYPE_LNG);
1880 COUNT(count_pcmd_op);
1881 OP1_1(TYPE_DBL, TYPE_FLT);
1884 case ICMD_CHECKCAST:
1885 OP1_1(TYPE_ADR, TYPE_ADR);
1888 case ICMD_ARRAYCHECKCAST:
1889 bte = (builtintable_entry *) iptr->val.a;
1892 if (md->memuse > rd->memuse)
1893 rd->memuse = md->memuse;
1894 if (md->argintreguse > rd->argintreguse)
1895 rd->argintreguse = md->argintreguse;
1897 /* make all stack variables saved */
1901 copy->flags |= SAVEDVAR;
1905 OP1_1(TYPE_ADR, TYPE_ADR);
1908 case ICMD_INSTANCEOF:
1909 case ICMD_ARRAYLENGTH:
1910 OP1_1(TYPE_ADR, TYPE_INT);
1914 case ICMD_ANEWARRAY:
1915 OP1_1(TYPE_INT, TYPE_ADR);
1919 COUNT(count_check_null);
1920 COUNT(count_pcmd_mem);
1921 OP1_1(TYPE_ADR, iptr->op1);
1926 case ICMD_GETSTATIC:
1927 COUNT(count_pcmd_mem);
1937 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1939 iptr[0].target = (void *) tbptr;
1941 /* This is a dirty hack. The typechecker
1942 * needs it because the OP1_0ANY below
1943 * overwrites iptr->dst.
1945 iptr->val.a = (void *) iptr->dst;
1947 tbptr->type = BBTYPE_SBR;
1949 /* We need to check for overflow right here because
1950 * the pushed value is poped after MARKREACHED. */
1952 MARKREACHED(tbptr, copy);
1956 /* pop many push any */
1959 #if defined(USEBUILTINTABLE)
1962 bte = (builtintable_entry *) iptr->val.a;
1966 case ICMD_INVOKESTATIC:
1967 case ICMD_INVOKESPECIAL:
1968 case ICMD_INVOKEVIRTUAL:
1969 case ICMD_INVOKEINTERFACE:
1970 COUNT(count_pcmd_met);
1972 md = um->methodref->parseddesc.md;
1973 /* if (lm->flags & ACC_STATIC) */
1974 /* {COUNT(count_check_null);} */
1979 if (md->memuse > rd->memuse)
1980 rd->memuse = md->memuse;
1981 if (md->argintreguse > rd->argintreguse)
1982 rd->argintreguse = md->argintreguse;
1983 if (md->argfltreguse > rd->argfltreguse)
1984 rd->argfltreguse = md->argfltreguse;
1989 for (i-- ; i >= 0; i--) {
1990 #if defined(SUPPORT_PASS_FLOATARGS_IN_INTREGS)
1991 /* If we pass float arguments in integer argument registers, we
1992 * are not allowed to precolor them here. Floats have to be moved
1993 * to this regs explicitly in codegen().
1994 * Only arguments that are passed by stack anyway can be precolored
1995 * (michi 2005/07/24) */
1996 if (!(copy->flags & SAVEDVAR) &&
1997 (!IS_FLT_DBL_TYPE(copy->type) || md->params[i].inmemory)) {
1999 if (!(copy->flags & SAVEDVAR)) {
2001 copy->varkind = ARGVAR;
2004 #if defined(ENABLE_INTRP)
2007 if (md->params[i].inmemory) {
2008 copy->flags = INMEMORY;
2009 copy->regoff = md->params[i].regoff;
2012 if (IS_FLT_DBL_TYPE(copy->type))
2013 #if defined(SUPPORT_PASS_FLOATARGS_IN_INTREGS)
2014 assert(0); /* XXX is this assert ok? */
2017 rd->argfltregs[md->params[i].regoff];
2020 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2021 if (IS_2_WORD_TYPE(copy->type))
2022 copy->regoff = PACK_REGS(
2023 rd->argintregs[GET_LOW_REG(md->params[i].regoff)],
2024 rd->argintregs[GET_HIGH_REG(md->params[i].regoff)]);
2028 rd->argintregs[md->params[i].regoff];
2031 #if defined(ENABLE_INTRP)
2039 copy->flags |= SAVEDVAR;
2045 if (md->returntype.type != TYPE_VOID)
2046 OP0_1(md->returntype.type);
2049 case ICMD_INLINE_START:
2050 case ICMD_INLINE_END:
2054 case ICMD_MULTIANEWARRAY:
2055 if (rd->argintreguse < 3)
2056 rd->argintreguse = 3;
2061 #if defined(SPECIALMEMUSE)
2062 # if defined(__DARWIN__)
2063 if (rd->memuse < (i + INT_ARG_CNT + LA_WORD_SIZE))
2064 rd->memuse = i + LA_WORD_SIZE + INT_ARG_CNT;
2066 if (rd->memuse < (i + LA_WORD_SIZE + 3))
2067 rd->memuse = i + LA_WORD_SIZE + 3;
2070 # if defined(__I386__)
2071 if (rd->memuse < i + 3)
2072 rd->memuse = i + 3; /* n integer args spilled on stack */
2073 # elif defined(__MIPS__) && SIZEOF_VOID_P == 4
2074 if (rd->memuse < i + 2)
2075 rd->memuse = i + 2; /* 4*4 bytes callee save space */
2078 rd->memuse = i; /* n integer args spilled on stack */
2079 # endif /* defined(__I386__) */
2083 /* check INT type here? Currently typecheck does this. */
2084 if (!(copy->flags & SAVEDVAR)) {
2085 copy->varkind = ARGVAR;
2086 copy->varnum = i + INT_ARG_CNT;
2087 copy->flags |= INMEMORY;
2088 #if defined(SPECIALMEMUSE)
2089 # if defined(__DARWIN__)
2090 copy->regoff = i + LA_WORD_SIZE + INT_ARG_CNT;
2092 copy->regoff = i + LA_WORD_SIZE + 3;
2095 # if defined(__I386__)
2096 copy->regoff = i + 3;
2097 # elif defined(__MIPS__) && SIZEOF_VOID_P == 4
2098 copy->regoff = i + 2;
2101 # endif /* defined(__I386__) */
2102 #endif /* defined(SPECIALMEMUSE) */
2107 copy->flags |= SAVEDVAR;
2115 case ICMD_CLEAR_ARGREN:
2116 for (i = iptr->op1; i < cd->maxlocals; i++)
2118 iptr->opc = opcode = ICMD_NOP;
2122 case ICMD_READONLY_ARG:
2123 case ICMD_READONLY_ARG+1:
2124 case ICMD_READONLY_ARG+2:
2125 case ICMD_READONLY_ARG+3:
2126 case ICMD_READONLY_ARG+4:
2129 if (curstack->varkind == LOCALVAR) {
2130 i = curstack->varnum;
2131 argren[iptr->op1] = i;
2134 opcode = iptr->opc = opcode - ICMD_READONLY_ARG + ICMD_ISTORE;
2140 *exceptionptr = new_internalerror("Unknown ICMD");
2146 } /* while instructions */
2148 bptr->outstack = curstack;
2149 bptr->outdepth = stackdepth;
2153 superblockend = true;
2155 } /* while blocks */
2156 } while (repeat && !deadcode);
2158 #if defined(STATISTICS)
2160 if (m->basicblockcount > count_max_basic_blocks)
2161 count_max_basic_blocks = m->basicblockcount;
2162 count_basic_blocks += m->basicblockcount;
2163 if (m->instructioncount > count_max_javainstr) count_max_javainstr = m->instructioncount;
2164 count_javainstr += m->instructioncount;
2165 if (m->stackcount > count_upper_bound_new_stack)
2166 count_upper_bound_new_stack = m->stackcount;
2167 if ((new - m->stack) > count_max_new_stack)
2168 count_max_new_stack = (new - m->stack);
2170 b_count = m->basicblockcount;
2171 bptr = m->basicblocks;
2172 while (--b_count >= 0) {
2173 if (bptr->flags > BBREACHED) {
2174 if (bptr->indepth >= 10)
2175 count_block_stack[10]++;
2177 count_block_stack[bptr->indepth]++;
2180 count_block_size_distribution[len]++;
2182 count_block_size_distribution[10]++;
2184 count_block_size_distribution[11]++;
2186 count_block_size_distribution[12]++;
2188 count_block_size_distribution[13]++;
2190 count_block_size_distribution[14]++;
2192 count_block_size_distribution[15]++;
2194 count_block_size_distribution[16]++;
2196 count_block_size_distribution[17]++;
2202 count_analyse_iterations[0]++;
2203 else if (loops == 2)
2204 count_analyse_iterations[1]++;
2205 else if (loops == 3)
2206 count_analyse_iterations[2]++;
2207 else if (loops == 4)
2208 count_analyse_iterations[3]++;
2210 count_analyse_iterations[4]++;
2212 if (m->basicblockcount <= 5)
2213 count_method_bb_distribution[0]++;
2214 else if (m->basicblockcount <= 10)
2215 count_method_bb_distribution[1]++;
2216 else if (m->basicblockcount <= 15)
2217 count_method_bb_distribution[2]++;
2218 else if (m->basicblockcount <= 20)
2219 count_method_bb_distribution[3]++;
2220 else if (m->basicblockcount <= 30)
2221 count_method_bb_distribution[4]++;
2222 else if (m->basicblockcount <= 40)
2223 count_method_bb_distribution[5]++;
2224 else if (m->basicblockcount <= 50)
2225 count_method_bb_distribution[6]++;
2226 else if (m->basicblockcount <= 75)
2227 count_method_bb_distribution[7]++;
2229 count_method_bb_distribution[8]++;
2233 /* just return methodinfo* to signal everything was ok */
2239 /**********************************************************************/
2240 /* DEBUGGING HELPERS */
2241 /**********************************************************************/
2243 void icmd_print_stack(codegendata *cd, stackptr s)
2255 j = cd->maxstack - i;
2261 if (s->flags & SAVEDVAR)
2262 switch (s->varkind) {
2264 if (s->flags & INMEMORY)
2265 printf(" M%02d", s->regoff);
2266 #ifdef HAS_ADDRESS_REGISTER_FILE
2267 else if (s->type == TYPE_ADR)
2268 printf(" R%02d", s->regoff);
2270 else if (IS_FLT_DBL_TYPE(s->type))
2271 printf(" F%02d", s->regoff);
2273 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2274 if (IS_2_WORD_TYPE(s->type))
2275 printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
2276 regs[GET_HIGH_REG(s->regoff)]);
2279 #if defined(ENABLE_INTRP)
2280 printf(" %3d", s->regoff);
2282 printf(" %3s", regs[s->regoff]);
2287 printf(" I%02d", s->varnum);
2290 printf(" L%02d", s->varnum);
2293 if (s->varnum == -1) {
2295 /* varkind ARGVAR "misused for this special case */
2297 } else /* "normal" Argvar */
2298 printf(" A%02d", s->varnum);
2299 #ifdef INVOKE_NEW_DEBUG
2300 if (s->flags & INMEMORY)
2301 printf("(M%i)", s->regoff);
2303 printf("(R%i)", s->regoff);
2307 printf(" !%02d", j);
2310 switch (s->varkind) {
2312 if (s->flags & INMEMORY)
2313 printf(" m%02d", s->regoff);
2314 #ifdef HAS_ADDRESS_REGISTER_FILE
2315 else if (s->type == TYPE_ADR)
2316 printf(" r%02d", s->regoff);
2318 else if (IS_FLT_DBL_TYPE(s->type))
2319 printf(" f%02d", s->regoff);
2321 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2322 if (IS_2_WORD_TYPE(s->type))
2323 printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
2324 regs[GET_HIGH_REG(s->regoff)]);
2327 #if defined(ENABLE_INTRP)
2328 printf(" %3d", s->regoff);
2330 printf(" %3s", regs[s->regoff]);
2335 printf(" i%02d", s->varnum);
2338 printf(" l%02d", s->varnum);
2341 if (s->varnum == -1) {
2343 /* varkind ARGVAR "misused for this special case */
2345 } else /* "normal" Argvar */
2346 printf(" a%02d", s->varnum);
2347 #ifdef INVOKE_NEW_DEBUG
2348 if (s->flags & INMEMORY)
2349 printf("(M%i)", s->regoff);
2351 printf("(R%i)", s->regoff);
2355 printf(" ?%02d", j);
2363 static void print_reg(stackptr s) {
2365 if (s->flags & SAVEDVAR)
2366 switch (s->varkind) {
2368 if (s->flags & INMEMORY)
2369 printf(" tm%02d", s->regoff);
2371 printf(" tr%02d", s->regoff);
2374 printf(" s %02d", s->varnum);
2377 printf(" l %02d", s->varnum);
2380 printf(" a %02d", s->varnum);
2383 printf(" ! %02d", s->varnum);
2386 switch (s->varkind) {
2388 if (s->flags & INMEMORY)
2389 printf(" Tm%02d", s->regoff);
2391 printf(" Tr%02d", s->regoff);
2394 printf(" S %02d", s->varnum);
2397 printf(" L %02d", s->varnum);
2400 printf(" A %02d", s->varnum);
2403 printf(" ? %02d", s->varnum);
2413 static char *jit_type[] = {
2422 /* show_icmd_method ************************************************************
2426 *******************************************************************************/
2428 void show_icmd_method(methodinfo *m, codegendata *cd, registerdata *rd)
2435 #if defined(USE_THREADS)
2436 /* We need to enter a lock here, since the binutils disassembler is not */
2437 /* reentrant-able and we could not read functions printed at the same */
2440 builtin_monitorenter(&show_icmd_lock);
2444 utf_fprint_classname(stdout, m->class->name);
2446 utf_fprint(stdout, m->name);
2447 utf_fprint(stdout, m->descriptor);
2448 printf("\n\nMax locals: %d\n", (int) cd->maxlocals);
2449 printf("Max stack: %d\n", (int) cd->maxstack);
2450 printf("Line number table length: %d\n", m->linenumbercount);
2452 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
2453 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
2454 printf(" L%03d ... ", ex->start->debug_nr );
2455 printf("L%03d = ", ex->end->debug_nr);
2456 printf("L%03d", ex->handler->debug_nr);
2457 printf(" (catchtype: ");
2458 if (ex->catchtype.any)
2459 if (IS_CLASSREF(ex->catchtype))
2460 utf_display_classname(ex->catchtype.ref->name);
2462 utf_display_classname(ex->catchtype.cls->name);
2468 printf("Local Table:\n");
2469 for (i = 0; i < cd->maxlocals; i++) {
2470 printf(" %3d: ", i);
2471 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
2472 #if defined(ENABLE_INTRP)
2475 if (rd->locals[i][j].type >= 0) {
2476 printf(" (%s) ", jit_type[j]);
2477 if (rd->locals[i][j].flags & INMEMORY)
2478 printf("m%2d", rd->locals[i][j].regoff);
2479 #ifdef HAS_ADDRESS_REGISTER_FILE
2480 else if (j == TYPE_ADR)
2481 printf("r%02d", rd->locals[i][j].regoff);
2483 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2484 printf("f%02d", rd->locals[i][j].regoff);
2486 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2487 if (IS_2_WORD_TYPE(j))
2489 regs[GET_LOW_REG(rd->locals[i][j].regoff)],
2490 regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
2493 printf("%3s", regs[rd->locals[i][j].regoff]);
2496 #if defined(ENABLE_INTRP)
2507 #if defined(ENABLE_INTRP)
2510 printf("Interface Table:\n");
2511 for (i = 0; i < cd->maxstack; i++) {
2512 if ((rd->interfaces[i][0].type >= 0) ||
2513 (rd->interfaces[i][1].type >= 0) ||
2514 (rd->interfaces[i][2].type >= 0) ||
2515 (rd->interfaces[i][3].type >= 0) ||
2516 (rd->interfaces[i][4].type >= 0)) {
2517 printf(" %3d: ", i);
2518 for (j = TYPE_INT; j <= TYPE_ADR; j++)
2519 if (rd->interfaces[i][j].type >= 0) {
2520 printf(" (%s) ", jit_type[j]);
2521 if (rd->interfaces[i][j].flags & SAVEDVAR) {
2522 if (rd->interfaces[i][j].flags & INMEMORY)
2523 printf("M%2d", rd->interfaces[i][j].regoff);
2524 #ifdef HAS_ADDRESS_REGISTER_FILE
2525 else if (j == TYPE_ADR)
2526 printf("R%02d", rd->interfaces[i][j].regoff);
2528 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2529 printf("F%02d", rd->interfaces[i][j].regoff);
2531 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2532 if (IS_2_WORD_TYPE(j))
2534 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
2535 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
2538 printf("%3s",regs[rd->interfaces[i][j].regoff]);
2542 if (rd->interfaces[i][j].flags & INMEMORY)
2543 printf("m%2d", rd->interfaces[i][j].regoff);
2544 #ifdef HAS_ADDRESS_REGISTER_FILE
2545 else if (j == TYPE_ADR)
2546 printf("r%02d", rd->interfaces[i][j].regoff);
2548 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2549 printf("f%02d", rd->interfaces[i][j].regoff);
2551 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2552 if (IS_2_WORD_TYPE(j))
2554 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
2555 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
2558 printf("%3s",regs[rd->interfaces[i][j].regoff]);
2567 #if defined(ENABLE_INTRP)
2574 /* show code before first basic block */
2576 if (opt_showdisassemble) {
2577 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen);
2579 for (; u1ptr < (u1 *) ((ptrint) m->mcode + cd->dseglen + m->basicblocks[0].mpc);)
2580 u1ptr = disassinstr(u1ptr);
2585 /* show code of all basic blocks */
2587 for (bptr = m->basicblocks; bptr != NULL; bptr = bptr->next) {
2588 show_icmd_block(m, cd, bptr);
2591 /* show stubs code */
2593 if (opt_showdisassemble && opt_showexceptionstubs) {
2594 printf("\nException stubs code:\n");
2595 printf("Length: %d\n\n", (s4) (m->mcodelength -
2596 ((ptrint) cd->dseglen +
2597 m->basicblocks[m->basicblockcount].mpc)));
2599 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen +
2600 m->basicblocks[m->basicblockcount].mpc);
2602 for (; (ptrint) u1ptr < ((ptrint) m->mcode + m->mcodelength);)
2603 u1ptr = disassinstr(u1ptr);
2608 #if defined(USE_THREADS)
2609 builtin_monitorexit(&show_icmd_lock);
2614 void show_icmd_block(methodinfo *m, codegendata *cd, basicblock *bptr)
2621 if (bptr->flags != BBDELETED) {
2622 deadcode = bptr->flags <= BBREACHED;
2625 for (j = cd->maxstack; j > 0; j--)
2628 icmd_print_stack(cd, bptr->instack);
2629 printf("] L%03d(%d - %d) flags=%d:\n", bptr->debug_nr, bptr->icount, bptr->pre_count,bptr->flags);
2630 iptr = bptr->iinstr;
2632 for (i = 0; i < bptr->icount; i++, iptr++) {
2635 for (j = cd->maxstack; j > 0; j--)
2639 icmd_print_stack(cd, iptr->dst);
2640 printf("] %5d (line: %5d) ", i, iptr->line);
2643 if (icmd_uses_tmp[iptr->opc][0])
2647 if (icmd_uses_tmp[iptr->opc][1])
2651 if (icmd_uses_tmp[iptr->opc][2])
2657 show_icmd(iptr, deadcode);
2661 if (opt_showdisassemble && (!deadcode)) {
2663 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen + bptr->mpc);
2665 if (bptr->next != NULL) {
2666 for (; u1ptr < (u1 *) ((ptrint) m->mcode + cd->dseglen + bptr->next->mpc);)
2667 u1ptr = disassinstr(u1ptr);
2670 for (; u1ptr < (u1 *) ((ptrint) m->mcode + m->mcodelength);)
2671 u1ptr = disassinstr(u1ptr);
2679 void show_icmd(instruction *iptr, bool deadcode)
2685 printf("%s", icmd_names[iptr->opc]);
2687 switch (iptr->opc) {
2688 case ICMD_IADDCONST:
2689 case ICMD_ISUBCONST:
2690 case ICMD_IMULCONST:
2694 case ICMD_IANDCONST:
2696 case ICMD_IXORCONST:
2697 case ICMD_ISHLCONST:
2698 case ICMD_ISHRCONST:
2699 case ICMD_IUSHRCONST:
2700 case ICMD_LSHLCONST:
2701 case ICMD_LSHRCONST:
2702 case ICMD_LUSHRCONST:
2704 case ICMD_ELSE_ICONST:
2705 case ICMD_IASTORECONST:
2706 case ICMD_BASTORECONST:
2707 case ICMD_CASTORECONST:
2708 case ICMD_SASTORECONST:
2709 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
2712 case ICMD_IFEQ_ICONST:
2713 case ICMD_IFNE_ICONST:
2714 case ICMD_IFLT_ICONST:
2715 case ICMD_IFGE_ICONST:
2716 case ICMD_IFGT_ICONST:
2717 case ICMD_IFLE_ICONST:
2718 printf("(%d) %d", iptr[1].op1, iptr->val.i);
2721 case ICMD_LADDCONST:
2722 case ICMD_LSUBCONST:
2723 case ICMD_LMULCONST:
2727 case ICMD_LANDCONST:
2729 case ICMD_LXORCONST:
2731 case ICMD_LASTORECONST:
2732 #if SIZEOF_VOID_P == 4
2733 printf(" %lld (0x%016llx)", iptr->val.l, iptr->val.l);
2735 printf(" %ld (0x%016lx)", iptr->val.l, iptr->val.l);
2740 printf(" %f (0x%08x)", iptr->val.f, iptr->val.i);
2744 #if SIZEOF_VOID_P == 4
2745 printf(" %g (0x%016llx)", iptr->val.d, iptr->val.l);
2747 printf(" %g (0x%016lx)", iptr->val.d, iptr->val.l);
2752 case ICMD_AASTORECONST:
2753 printf(" %p", iptr->val.a);
2756 /* check if this is a constant string */
2758 if (iptr->op1 == 0) {
2759 printf(", String = \"");
2760 utf_display(javastring_toutf(iptr->val.a, false));
2764 /* it is a BUILTIN argument */
2766 printf(", Class = \"");
2768 /* is it resolved? */
2770 if (iptr[1].target == NULL) {
2771 builtintable_entry *bte = iptr[1].val.a;
2773 /* NEW gets a classinfo* as argument */
2775 if (bte->fp == BUILTIN_new) {
2776 utf_display(((classinfo *) iptr->val.a)->name);
2779 utf_display(((vftbl_t *) iptr->val.a)->class->name);
2783 /* iptr->target is a constant_classref */
2785 utf_display(((constant_classref *) iptr->val.a)->name);
2795 printf(" %d, ", ((fieldinfo *) iptr->val.a)->offset);
2797 printf(" (NOT RESOLVED), ");
2798 utf_display_classname(((unresolved_field *) iptr->target)->fieldref->classref->name);
2800 utf_display(((unresolved_field *) iptr->target)->fieldref->name);
2802 utf_display(((unresolved_field *) iptr->target)->fieldref->descriptor);
2806 case ICMD_PUTSTATIC:
2807 case ICMD_GETSTATIC:
2809 if (!((fieldinfo *) iptr->val.a)->class->initialized)
2810 printf(" (NOT INITIALIZED) ");
2814 printf(" (NOT RESOLVED) ");
2815 utf_display_classname(((unresolved_field *) iptr->target)->fieldref->classref->name);
2817 utf_display(((unresolved_field *) iptr->target)->fieldref->name);
2819 utf_display(((unresolved_field *) iptr->target)->fieldref->descriptor);
2823 case ICMD_PUTSTATICCONST:
2824 case ICMD_PUTFIELDCONST:
2825 switch (iptr[1].op1) {
2827 printf(" %d (0x%08x),", iptr->val.i, iptr->val.i);
2830 #if SIZEOF_VOID_P == 4
2831 printf(" %lld (0x%016llx),", iptr->val.l, iptr->val.l);
2833 printf(" %ld (0x%016lx),", iptr->val.l, iptr->val.l);
2837 printf(" %p,", iptr->val.a);
2840 printf(" %g (0x%08x),", iptr->val.f, iptr->val.i);
2843 #if SIZEOF_VOID_P == 4
2844 printf(" %g (0x%016llx),", iptr->val.d, iptr->val.l);
2846 printf(" %g (0x%016lx),", iptr->val.d, iptr->val.l);
2850 if (iptr->opc == ICMD_PUTFIELDCONST) {
2852 printf(" %d,", ((fieldinfo *) iptr[1].val.a)->offset);
2854 printf(" (NOT RESOLVED),");
2857 utf_display_classname(((unresolved_field *) iptr[1].target)->fieldref->classref->name);
2859 utf_display(((unresolved_field *) iptr[1].target)->fieldref->name);
2861 utf_display(((unresolved_field *) iptr[1].target)->fieldref->descriptor);
2866 printf(" %d + %d", iptr->op1, iptr->val.i);
2901 printf(" %d", iptr->op1);
2906 utf_display_classname(((classinfo *) iptr->val.a)->name);
2910 switch (iptr->op1) {
2938 case ICMD_ANEWARRAY:
2941 utf_display_classname(((classinfo *) iptr->val.a)->name);
2945 case ICMD_MULTIANEWARRAY:
2947 printf(" (NOT RESOLVED) %d ",iptr->op1);
2948 utf_display(((constant_classref *) iptr->val.a)->name);
2950 printf(" %d ",iptr->op1);
2951 utf_display_classname(((vftbl_t *) iptr->val.a)->class->name);
2955 case ICMD_CHECKCAST:
2956 case ICMD_INSTANCEOF:
2958 classinfo *c = iptr->val.a;
2960 if (c->flags & ACC_INTERFACE)
2961 printf(" (INTERFACE) ");
2963 printf(" (CLASS,%3d) ", c->vftbl->diffval);
2965 printf(" (NOT RESOLVED) ");
2967 utf_display_classname(((constant_classref *) iptr->target)->name);
2971 case ICMD_ARRAYCHECKCAST:
2973 classinfo *c = iptr->target;
2974 if (c->flags & ACC_INTERFACE)
2975 printf(" (INTERFACE) ");
2977 printf(" (CLASS,%3d) ", c->vftbl->diffval);
2978 utf_display_classname(c->name);
2980 printf(" (NOT RESOLVED) ");
2981 utf_display_classname(((constant_classref *) iptr->target)->name);
2985 case ICMD_INLINE_START:
2987 utf_display_classname(iptr->method->class->name);
2989 utf_display_classname(iptr->method->name);
2990 utf_display_classname(iptr->method->descriptor);
2991 printf(", depth=%i", iptr->op1);
2993 case ICMD_INLINE_END:
2997 printf(" %s", ((builtintable_entry *) iptr->val.a)->name);
3000 case ICMD_INVOKEVIRTUAL:
3001 case ICMD_INVOKESPECIAL:
3002 case ICMD_INVOKESTATIC:
3003 case ICMD_INVOKEINTERFACE:
3005 printf(" (NOT RESOLVED) ");
3008 utf_display_classname(((unresolved_method *) iptr->target)->methodref->classref->name);
3010 utf_display(((unresolved_method *) iptr->target)->methodref->name);
3011 utf_display(((unresolved_method *) iptr->target)->methodref->descriptor);
3020 if (deadcode || !iptr->target)
3021 printf(" %d (0x%08x) op1=%d", iptr->val.i, iptr->val.i, iptr->op1);
3023 printf(" %d (0x%08x) L%03d", iptr->val.i, iptr->val.i, ((basicblock *) iptr->target)->debug_nr);
3032 if (deadcode || !iptr->target)
3033 #if SIZEOF_VOID_P == 4
3034 printf("(%lld) op1=%d", iptr->val.l, iptr->op1);
3036 printf("(%ld) op1=%d", iptr->val.l, iptr->op1);
3039 #if SIZEOF_VOID_P == 4
3040 printf("(%lld) L%03d", iptr->val.l, ((basicblock *) iptr->target)->debug_nr);
3042 printf("(%ld) L%03d", iptr->val.l, ((basicblock *) iptr->target)->debug_nr);
3049 case ICMD_IFNONNULL:
3050 case ICMD_IF_ICMPEQ:
3051 case ICMD_IF_ICMPNE:
3052 case ICMD_IF_ICMPLT:
3053 case ICMD_IF_ICMPGE:
3054 case ICMD_IF_ICMPGT:
3055 case ICMD_IF_ICMPLE:
3056 case ICMD_IF_LCMPEQ:
3057 case ICMD_IF_LCMPNE:
3058 case ICMD_IF_LCMPLT:
3059 case ICMD_IF_LCMPGE:
3060 case ICMD_IF_LCMPGT:
3061 case ICMD_IF_LCMPLE:
3062 case ICMD_IF_ACMPEQ:
3063 case ICMD_IF_ACMPNE:
3064 if (deadcode || !iptr->target)
3065 printf(" op1=%d", iptr->op1);
3067 printf(" L%03d", ((basicblock *) iptr->target)->debug_nr);
3070 case ICMD_TABLESWITCH:
3071 s4ptr = (s4*)iptr->val.a;
3073 if (deadcode || !iptr->target) {
3074 printf(" %d;", *s4ptr);
3077 tptr = (void **) iptr->target;
3078 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
3082 s4ptr++; /* skip default */
3083 j = *s4ptr++; /* low */
3084 j = *s4ptr++ - j; /* high */
3086 if (deadcode || !*tptr)
3087 printf(" %d", *s4ptr++);
3089 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
3096 case ICMD_LOOKUPSWITCH:
3097 s4ptr = (s4*)iptr->val.a;
3099 if (deadcode || !iptr->target) {
3100 printf(" %d;", *s4ptr);
3103 tptr = (void **) iptr->target;
3104 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
3107 s4ptr++; /* default */
3108 j = *s4ptr++; /* count */
3111 if (deadcode || !*tptr) {
3112 s4ptr++; /* skip value */
3113 printf(" %d",*s4ptr++);
3116 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
3124 printf(" (NOT RESOLVED), Class = \"");
3125 utf_display(((unresolved_class *) iptr->val.a)->classref->name);
3133 * These are local overrides for various environment variables in Emacs.
3134 * Please do not remove this and leave it at the end of the file, where
3135 * Emacs will automagically detect them.
3136 * ---------------------------------------------------------------------
3139 * indent-tabs-mode: t