1 /* src/vm/jit/stack.c - stack analysis
3 Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
4 C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5 E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6 J. Wenninger, 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., 51 Franklin Street, Fifth Floor, Boston, MA
25 Contact: cacao@cacaojvm.org
27 Authors: Andreas Krall
29 Changes: Edwin Steiner
33 $Id: stack.c 4455 2006-02-06 01:02:59Z edwin $
49 #include "mm/memory.h"
50 #include "native/native.h"
51 #include "toolbox/logging.h"
52 #include "vm/global.h"
53 #include "vm/builtin.h"
54 #include "vm/options.h"
55 #include "vm/resolve.h"
56 #include "vm/statistics.h"
57 #include "vm/stringlocal.h"
58 #include "vm/jit/codegen-common.h"
59 #include "vm/jit/disass.h"
60 #include "vm/jit/jit.h"
61 #include "vm/jit/reg.h"
62 #include "vm/jit/stack.h"
63 #include "vm/jit/allocator/lsra.h"
66 /* global variables ***********************************************************/
68 #if defined(USE_THREADS)
69 static java_objectheader *lock_show_icmd;
73 /* stack_init ******************************************************************
75 Initialized the stack analysis subsystem (called by jit_init).
77 *******************************************************************************/
81 #if defined(USE_THREADS)
82 /* initialize the show lock */
84 lock_show_icmd = NEW(java_objectheader);
86 # if defined(NATIVE_THREADS)
87 initObjectLock(lock_show_icmd);
97 /**********************************************************************/
99 /**********************************************************************/
101 /* analyse_stack uses the intermediate code created by parse.c to
102 * build a model of the JVM operand stack for the current method.
104 * The following checks are performed:
105 * - check for operand stack underflow (before each instruction)
106 * - check for operand stack overflow (after[1] each instruction)
107 * - check for matching stack depth at merging points
108 * - check for matching basic types[2] at merging points
109 * - check basic types for instruction input (except for BUILTIN*
110 * opcodes, INVOKE* opcodes and MULTIANEWARRAY)
112 * [1]) Checking this after the instruction should be ok. parse.c
113 * counts the number of required stack slots in such a way that it is
114 * only vital that we don't exceed `maxstack` at basic block
117 * [2]) 'basic types' means the distinction between INT, LONG, FLOAT,
118 * DOUBLE and ADDRESS types. Subtypes of INT and different ADDRESS
119 * types are not discerned.
122 methodinfo *analyse_stack(methodinfo *m, codegendata *cd, registerdata *rd)
130 int opcode, i, len, loops;
131 int superblockend, repeat, deadcode;
139 builtintable_entry *bte;
140 unresolved_method *um;
143 #if defined(ENABLE_LSRA)
147 argren = DMNEW(s4, cd->maxlocals); /* table for argument renaming */
148 for (i = 0; i < cd->maxlocals; i++)
153 m->basicblocks[0].flags = BBREACHED;
154 m->basicblocks[0].instack = 0;
155 m->basicblocks[0].indepth = 0;
157 for (i = 0; i < cd->exceptiontablelength; i++) {
158 bptr = &m->basicblocks[m->basicblockindex[cd->exceptiontable[i].handlerpc]];
159 bptr->flags = BBREACHED;
160 bptr->type = BBTYPE_EXH;
163 bptr->pre_count = 10000;
168 #if CONDITIONAL_LOADCONST
169 b_count = m->basicblockcount;
170 bptr = m->basicblocks;
171 while (--b_count >= 0) {
172 if (bptr->icount != 0) {
173 iptr = bptr->iinstr + bptr->icount - 1;
206 m->basicblocks[m->basicblockindex[iptr->op1]].pre_count++;
209 case ICMD_TABLESWITCH:
211 m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
212 i = *s4ptr++; /* low */
213 i = *s4ptr++ - i + 1; /* high */
215 m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
219 case ICMD_LOOKUPSWITCH:
221 m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
222 i = *s4ptr++; /* count */
224 m->basicblocks[m->basicblockindex[s4ptr[1]]].pre_count++;
235 #endif /* CONDITIONAL_LOADCONST */
240 b_count = m->basicblockcount;
241 bptr = m->basicblocks;
242 superblockend = true;
247 while (--b_count >= 0) {
248 if (bptr->flags == BBDELETED) {
251 } else if (superblockend && (bptr->flags < BBREACHED)) {
254 } else if (bptr->flags <= BBREACHED) {
256 stackdepth = bptr->indepth;
258 } else if (bptr->flags < BBREACHED) {
260 bptr->instack = copy;
261 bptr->indepth = stackdepth;
263 } else if (bptr->indepth != stackdepth) {
264 /*show_icmd_method(m, cd, rd);
265 printf("Block: %d, required depth: %d, current depth: %d\n",
266 bptr->debug_nr, bptr->indepth, stackdepth);*/
267 *exceptionptr = new_verifyerror(m,"Stack depth mismatch");
271 curstack = bptr->instack;
273 superblockend = false;
274 bptr->flags = BBFINISHED;
277 b_index = bptr - m->basicblocks;
284 #if defined(USEBUILTINTABLE)
285 # if defined(ENABLE_INTRP)
288 bte = builtintable_get_automatic(opcode);
290 if (bte && bte->opcode == opcode) {
291 iptr->opc = ICMD_BUILTIN;
292 iptr->op1 = false; /* don't check for exception */
294 m->isleafmethod = false;
297 # if defined(ENABLE_INTRP)
300 #endif /* defined(USEBUILTINTABLE) */
307 COUNT(count_check_null);
310 case ICMD_IFEQ_ICONST:
311 case ICMD_IFNE_ICONST:
312 case ICMD_IFLT_ICONST:
313 case ICMD_IFGE_ICONST:
314 case ICMD_IFGT_ICONST:
315 case ICMD_IFLE_ICONST:
316 case ICMD_ELSE_ICONST:
321 #if defined(ENABLE_INTRP)
324 rd->locals[iptr->op1][TYPE_ADR].type = TYPE_ADR;
326 COUNT(count_pcmd_return);
328 superblockend = true;
331 /* pop 0 push 1 const */
334 COUNT(count_pcmd_load);
336 switch (iptr[1].opc) {
338 iptr[0].opc = ICMD_IADDCONST;
340 iptr[1].opc = ICMD_NOP;
341 OP1_1(TYPE_INT, TYPE_INT);
342 COUNT(count_pcmd_op);
345 iptr[0].opc = ICMD_ISUBCONST;
346 goto icmd_iconst_tail;
347 #if SUPPORT_CONST_MUL
349 iptr[0].opc = ICMD_IMULCONST;
350 goto icmd_iconst_tail;
351 #else /* SUPPORT_CONST_MUL */
353 if (iptr[0].val.i == 0x00000002)
355 else if (iptr[0].val.i == 0x00000004)
357 else if (iptr[0].val.i == 0x00000008)
359 else if (iptr[0].val.i == 0x00000010)
361 else if (iptr[0].val.i == 0x00000020)
363 else if (iptr[0].val.i == 0x00000040)
365 else if (iptr[0].val.i == 0x00000080)
367 else if (iptr[0].val.i == 0x00000100)
369 else if (iptr[0].val.i == 0x00000200)
371 else if (iptr[0].val.i == 0x00000400)
373 else if (iptr[0].val.i == 0x00000800)
375 else if (iptr[0].val.i == 0x00001000)
377 else if (iptr[0].val.i == 0x00002000)
379 else if (iptr[0].val.i == 0x00004000)
381 else if (iptr[0].val.i == 0x00008000)
383 else if (iptr[0].val.i == 0x00010000)
385 else if (iptr[0].val.i == 0x00020000)
387 else if (iptr[0].val.i == 0x00040000)
389 else if (iptr[0].val.i == 0x00080000)
391 else if (iptr[0].val.i == 0x00100000)
393 else if (iptr[0].val.i == 0x00200000)
395 else if (iptr[0].val.i == 0x00400000)
397 else if (iptr[0].val.i == 0x00800000)
399 else if (iptr[0].val.i == 0x01000000)
401 else if (iptr[0].val.i == 0x02000000)
403 else if (iptr[0].val.i == 0x04000000)
405 else if (iptr[0].val.i == 0x08000000)
407 else if (iptr[0].val.i == 0x10000000)
409 else if (iptr[0].val.i == 0x20000000)
411 else if (iptr[0].val.i == 0x40000000)
413 else if (iptr[0].val.i == 0x80000000)
419 iptr[0].opc = ICMD_IMULPOW2;
420 goto icmd_iconst_tail;
421 #endif /* SUPPORT_CONST_MUL */
423 if (iptr[0].val.i == 0x00000002)
425 else if (iptr[0].val.i == 0x00000004)
427 else if (iptr[0].val.i == 0x00000008)
429 else if (iptr[0].val.i == 0x00000010)
431 else if (iptr[0].val.i == 0x00000020)
433 else if (iptr[0].val.i == 0x00000040)
435 else if (iptr[0].val.i == 0x00000080)
437 else if (iptr[0].val.i == 0x00000100)
439 else if (iptr[0].val.i == 0x00000200)
441 else if (iptr[0].val.i == 0x00000400)
443 else if (iptr[0].val.i == 0x00000800)
445 else if (iptr[0].val.i == 0x00001000)
447 else if (iptr[0].val.i == 0x00002000)
449 else if (iptr[0].val.i == 0x00004000)
451 else if (iptr[0].val.i == 0x00008000)
453 else if (iptr[0].val.i == 0x00010000)
455 else if (iptr[0].val.i == 0x00020000)
457 else if (iptr[0].val.i == 0x00040000)
459 else if (iptr[0].val.i == 0x00080000)
461 else if (iptr[0].val.i == 0x00100000)
463 else if (iptr[0].val.i == 0x00200000)
465 else if (iptr[0].val.i == 0x00400000)
467 else if (iptr[0].val.i == 0x00800000)
469 else if (iptr[0].val.i == 0x01000000)
471 else if (iptr[0].val.i == 0x02000000)
473 else if (iptr[0].val.i == 0x04000000)
475 else if (iptr[0].val.i == 0x08000000)
477 else if (iptr[0].val.i == 0x10000000)
479 else if (iptr[0].val.i == 0x20000000)
481 else if (iptr[0].val.i == 0x40000000)
483 else if (iptr[0].val.i == 0x80000000)
489 iptr[0].opc = ICMD_IDIVPOW2;
490 goto icmd_iconst_tail;
492 /*log_text("stack.c: ICMD_ICONST/ICMD_IREM");*/
493 if ((iptr[0].val.i == 0x00000002) ||
494 (iptr[0].val.i == 0x00000004) ||
495 (iptr[0].val.i == 0x00000008) ||
496 (iptr[0].val.i == 0x00000010) ||
497 (iptr[0].val.i == 0x00000020) ||
498 (iptr[0].val.i == 0x00000040) ||
499 (iptr[0].val.i == 0x00000080) ||
500 (iptr[0].val.i == 0x00000100) ||
501 (iptr[0].val.i == 0x00000200) ||
502 (iptr[0].val.i == 0x00000400) ||
503 (iptr[0].val.i == 0x00000800) ||
504 (iptr[0].val.i == 0x00001000) ||
505 (iptr[0].val.i == 0x00002000) ||
506 (iptr[0].val.i == 0x00004000) ||
507 (iptr[0].val.i == 0x00008000) ||
508 (iptr[0].val.i == 0x00010000) ||
509 (iptr[0].val.i == 0x00020000) ||
510 (iptr[0].val.i == 0x00040000) ||
511 (iptr[0].val.i == 0x00080000) ||
512 (iptr[0].val.i == 0x00100000) ||
513 (iptr[0].val.i == 0x00200000) ||
514 (iptr[0].val.i == 0x00400000) ||
515 (iptr[0].val.i == 0x00800000) ||
516 (iptr[0].val.i == 0x01000000) ||
517 (iptr[0].val.i == 0x02000000) ||
518 (iptr[0].val.i == 0x04000000) ||
519 (iptr[0].val.i == 0x08000000) ||
520 (iptr[0].val.i == 0x10000000) ||
521 (iptr[0].val.i == 0x20000000) ||
522 (iptr[0].val.i == 0x40000000) ||
523 (iptr[0].val.i == 0x80000000)) {
524 iptr[0].opc = ICMD_IREMPOW2;
526 goto icmd_iconst_tail;
530 #if SUPPORT_CONST_LOGICAL
532 iptr[0].opc = ICMD_IANDCONST;
533 goto icmd_iconst_tail;
535 iptr[0].opc = ICMD_IORCONST;
536 goto icmd_iconst_tail;
538 iptr[0].opc = ICMD_IXORCONST;
539 goto icmd_iconst_tail;
540 #endif /* SUPPORT_CONST_LOGICAL */
542 iptr[0].opc = ICMD_ISHLCONST;
543 goto icmd_iconst_tail;
545 iptr[0].opc = ICMD_ISHRCONST;
546 goto icmd_iconst_tail;
548 iptr[0].opc = ICMD_IUSHRCONST;
549 goto icmd_iconst_tail;
550 #if SUPPORT_LONG_SHIFT
552 iptr[0].opc = ICMD_LSHLCONST;
553 goto icmd_lconst_tail;
555 iptr[0].opc = ICMD_LSHRCONST;
556 goto icmd_lconst_tail;
558 iptr[0].opc = ICMD_LUSHRCONST;
559 goto icmd_lconst_tail;
560 #endif /* SUPPORT_LONG_SHIFT */
562 iptr[0].opc = ICMD_IFEQ;
564 iptr[0].op1 = iptr[1].op1;
565 /* IF_ICMPxx is the last instruction in the */
566 /* basic block, just remove it */
567 /* iptr[1].opc = ICMD_NOP; */
572 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
574 iptr[0].target = (void *) tbptr;
576 MARKREACHED(tbptr, copy);
577 COUNT(count_pcmd_bra);
580 iptr[0].opc = ICMD_IFLT;
581 goto icmd_if_icmp_tail;
583 iptr[0].opc = ICMD_IFLE;
584 goto icmd_if_icmp_tail;
586 iptr[0].opc = ICMD_IFNE;
587 goto icmd_if_icmp_tail;
589 iptr[0].opc = ICMD_IFGT;
590 goto icmd_if_icmp_tail;
592 iptr[0].opc = ICMD_IFGE;
593 goto icmd_if_icmp_tail;
595 #if SUPPORT_CONST_STORE
600 # if defined(ENABLE_INTRP)
603 # if SUPPORT_CONST_STORE_ZERO_ONLY
604 if (iptr[0].val.i == 0) {
605 # endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
606 switch (iptr[1].opc) {
608 iptr[0].opc = ICMD_IASTORECONST;
611 iptr[0].opc = ICMD_BASTORECONST;
614 iptr[0].opc = ICMD_CASTORECONST;
617 iptr[0].opc = ICMD_SASTORECONST;
621 iptr[1].opc = ICMD_NOP;
622 OPTT2_0(TYPE_INT, TYPE_ADR);
623 COUNT(count_pcmd_op);
624 # if SUPPORT_CONST_STORE_ZERO_ONLY
627 # endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
628 # if defined(ENABLE_INTRP)
636 # if defined(ENABLE_INTRP)
639 # if SUPPORT_CONST_STORE_ZERO_ONLY
640 if (iptr[0].val.i == 0) {
641 # endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
642 switch (iptr[1].opc) {
644 iptr[0].opc = ICMD_PUTSTATICCONST;
648 iptr[0].opc = ICMD_PUTFIELDCONST;
653 iptr[1].opc = ICMD_NOP;
654 iptr[0].op1 = TYPE_INT;
655 COUNT(count_pcmd_op);
656 # if SUPPORT_CONST_STORE_ZERO_ONLY
659 # endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
660 # if defined(ENABLE_INTRP)
665 #endif /* SUPPORT_CONST_STORE */
675 COUNT(count_pcmd_load);
677 switch (iptr[1].opc) {
680 iptr[0].opc = ICMD_LADDCONST;
682 iptr[1].opc = ICMD_NOP;
683 OP1_1(TYPE_LNG,TYPE_LNG);
684 COUNT(count_pcmd_op);
687 iptr[0].opc = ICMD_LSUBCONST;
688 goto icmd_lconst_tail;
689 #endif /* SUPPORT_LONG_ADD */
690 #if SUPPORT_LONG_MUL && SUPPORT_CONST_MUL
692 iptr[0].opc = ICMD_LMULCONST;
693 goto icmd_lconst_tail;
694 #else /* SUPPORT_LONG_MUL && SUPPORT_CONST_MUL */
695 # if SUPPORT_LONG_SHIFT
697 if (iptr[0].val.l == 0x00000002)
699 else if (iptr[0].val.l == 0x00000004)
701 else if (iptr[0].val.l == 0x00000008)
703 else if (iptr[0].val.l == 0x00000010)
705 else if (iptr[0].val.l == 0x00000020)
707 else if (iptr[0].val.l == 0x00000040)
709 else if (iptr[0].val.l == 0x00000080)
711 else if (iptr[0].val.l == 0x00000100)
713 else if (iptr[0].val.l == 0x00000200)
715 else if (iptr[0].val.l == 0x00000400)
717 else if (iptr[0].val.l == 0x00000800)
719 else if (iptr[0].val.l == 0x00001000)
721 else if (iptr[0].val.l == 0x00002000)
723 else if (iptr[0].val.l == 0x00004000)
725 else if (iptr[0].val.l == 0x00008000)
727 else if (iptr[0].val.l == 0x00010000)
729 else if (iptr[0].val.l == 0x00020000)
731 else if (iptr[0].val.l == 0x00040000)
733 else if (iptr[0].val.l == 0x00080000)
735 else if (iptr[0].val.l == 0x00100000)
737 else if (iptr[0].val.l == 0x00200000)
739 else if (iptr[0].val.l == 0x00400000)
741 else if (iptr[0].val.l == 0x00800000)
743 else if (iptr[0].val.l == 0x01000000)
745 else if (iptr[0].val.l == 0x02000000)
747 else if (iptr[0].val.l == 0x04000000)
749 else if (iptr[0].val.l == 0x08000000)
751 else if (iptr[0].val.l == 0x10000000)
753 else if (iptr[0].val.l == 0x20000000)
755 else if (iptr[0].val.l == 0x40000000)
757 else if (iptr[0].val.l == 0x80000000)
763 iptr[0].opc = ICMD_LMULPOW2;
764 goto icmd_lconst_tail;
765 # endif /* SUPPORT_LONG_SHIFT */
766 #endif /* SUPPORT_LONG_MUL && SUPPORT_CONST_MUL */
769 if (iptr[0].val.l == 0x00000002)
771 else if (iptr[0].val.l == 0x00000004)
773 else if (iptr[0].val.l == 0x00000008)
775 else if (iptr[0].val.l == 0x00000010)
777 else if (iptr[0].val.l == 0x00000020)
779 else if (iptr[0].val.l == 0x00000040)
781 else if (iptr[0].val.l == 0x00000080)
783 else if (iptr[0].val.l == 0x00000100)
785 else if (iptr[0].val.l == 0x00000200)
787 else if (iptr[0].val.l == 0x00000400)
789 else if (iptr[0].val.l == 0x00000800)
791 else if (iptr[0].val.l == 0x00001000)
793 else if (iptr[0].val.l == 0x00002000)
795 else if (iptr[0].val.l == 0x00004000)
797 else if (iptr[0].val.l == 0x00008000)
799 else if (iptr[0].val.l == 0x00010000)
801 else if (iptr[0].val.l == 0x00020000)
803 else if (iptr[0].val.l == 0x00040000)
805 else if (iptr[0].val.l == 0x00080000)
807 else if (iptr[0].val.l == 0x00100000)
809 else if (iptr[0].val.l == 0x00200000)
811 else if (iptr[0].val.l == 0x00400000)
813 else if (iptr[0].val.l == 0x00800000)
815 else if (iptr[0].val.l == 0x01000000)
817 else if (iptr[0].val.l == 0x02000000)
819 else if (iptr[0].val.l == 0x04000000)
821 else if (iptr[0].val.l == 0x08000000)
823 else if (iptr[0].val.l == 0x10000000)
825 else if (iptr[0].val.l == 0x20000000)
827 else if (iptr[0].val.l == 0x40000000)
829 else if (iptr[0].val.l == 0x80000000)
835 iptr[0].opc = ICMD_LDIVPOW2;
836 goto icmd_lconst_tail;
838 if ((iptr[0].val.l == 0x00000002) ||
839 (iptr[0].val.l == 0x00000004) ||
840 (iptr[0].val.l == 0x00000008) ||
841 (iptr[0].val.l == 0x00000010) ||
842 (iptr[0].val.l == 0x00000020) ||
843 (iptr[0].val.l == 0x00000040) ||
844 (iptr[0].val.l == 0x00000080) ||
845 (iptr[0].val.l == 0x00000100) ||
846 (iptr[0].val.l == 0x00000200) ||
847 (iptr[0].val.l == 0x00000400) ||
848 (iptr[0].val.l == 0x00000800) ||
849 (iptr[0].val.l == 0x00001000) ||
850 (iptr[0].val.l == 0x00002000) ||
851 (iptr[0].val.l == 0x00004000) ||
852 (iptr[0].val.l == 0x00008000) ||
853 (iptr[0].val.l == 0x00010000) ||
854 (iptr[0].val.l == 0x00020000) ||
855 (iptr[0].val.l == 0x00040000) ||
856 (iptr[0].val.l == 0x00080000) ||
857 (iptr[0].val.l == 0x00100000) ||
858 (iptr[0].val.l == 0x00200000) ||
859 (iptr[0].val.l == 0x00400000) ||
860 (iptr[0].val.l == 0x00800000) ||
861 (iptr[0].val.l == 0x01000000) ||
862 (iptr[0].val.l == 0x02000000) ||
863 (iptr[0].val.l == 0x04000000) ||
864 (iptr[0].val.l == 0x08000000) ||
865 (iptr[0].val.l == 0x10000000) ||
866 (iptr[0].val.l == 0x20000000) ||
867 (iptr[0].val.l == 0x40000000) ||
868 (iptr[0].val.l == 0x80000000)) {
869 iptr[0].opc = ICMD_LREMPOW2;
871 goto icmd_lconst_tail;
875 #endif /* SUPPORT_LONG_DIV */
876 #if SUPPORT_LONG_LOGICAL && SUPPORT_CONST_LOGICAL
879 iptr[0].opc = ICMD_LANDCONST;
880 goto icmd_lconst_tail;
882 iptr[0].opc = ICMD_LORCONST;
883 goto icmd_lconst_tail;
885 iptr[0].opc = ICMD_LXORCONST;
886 goto icmd_lconst_tail;
887 #endif /* SUPPORT_LONG_LOGICAL && SUPPORT_CONST_LOGICAL */
889 #if SUPPORT_LONG_CMP_CONST
891 if ((len > 1) && (iptr[2].val.i == 0)) {
892 switch (iptr[2].opc) {
894 iptr[0].opc = ICMD_IF_LEQ;
895 icmd_lconst_lcmp_tail:
896 iptr[0].op1 = iptr[2].op1;
899 /* iptr[1].opc = ICMD_NOP;
900 iptr[2].opc = ICMD_NOP; */
902 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
904 iptr[0].target = (void *) tbptr;
906 MARKREACHED(tbptr, copy);
907 COUNT(count_pcmd_bra);
908 COUNT(count_pcmd_op);
911 iptr[0].opc = ICMD_IF_LNE;
912 goto icmd_lconst_lcmp_tail;
914 iptr[0].opc = ICMD_IF_LLT;
915 goto icmd_lconst_lcmp_tail;
917 iptr[0].opc = ICMD_IF_LGT;
918 goto icmd_lconst_lcmp_tail;
920 iptr[0].opc = ICMD_IF_LLE;
921 goto icmd_lconst_lcmp_tail;
923 iptr[0].opc = ICMD_IF_LGE;
924 goto icmd_lconst_lcmp_tail;
927 } /* switch (iptr[2].opc) */
928 } /* if (iptr[2].val.i == 0) */
932 #endif /* SUPPORT_LONG_CMP_CONST */
934 #if SUPPORT_CONST_STORE
936 # if defined(ENABLE_INTRP)
939 # if SUPPORT_CONST_STORE_ZERO_ONLY
940 if (iptr[0].val.l == 0) {
941 # endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
942 iptr[0].opc = ICMD_LASTORECONST;
943 iptr[1].opc = ICMD_NOP;
944 OPTT2_0(TYPE_INT, TYPE_ADR);
945 COUNT(count_pcmd_op);
946 # if SUPPORT_CONST_STORE_ZERO_ONLY
949 # endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
950 # if defined(ENABLE_INTRP)
958 # if defined(ENABLE_INTRP)
961 # if SUPPORT_CONST_STORE_ZERO_ONLY
962 if (iptr[0].val.l == 0) {
963 # endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
964 switch (iptr[1].opc) {
966 iptr[0].opc = ICMD_PUTSTATICCONST;
970 iptr[0].opc = ICMD_PUTFIELDCONST;
975 iptr[1].opc = ICMD_NOP;
976 iptr[0].op1 = TYPE_LNG;
977 COUNT(count_pcmd_op);
978 # if SUPPORT_CONST_STORE_ZERO_ONLY
981 # endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
982 # if defined(ENABLE_INTRP)
987 #endif /* SUPPORT_CONST_STORE */
997 COUNT(count_pcmd_load);
1002 COUNT(count_pcmd_load);
1003 PUSHCONST(TYPE_DBL);
1007 COUNT(count_pcmd_load);
1008 #if SUPPORT_CONST_STORE
1009 # if defined(ENABLE_INTRP)
1012 if ((len > 0) && (iptr->val.a == 0)) {
1013 switch (iptr[1].opc) {
1015 case ICMD_PUTSTATIC:
1017 switch (iptr[1].opc) {
1019 iptr[0].opc = ICMD_AASTORECONST;
1020 OPTT2_0(TYPE_INT, TYPE_ADR);
1022 case ICMD_PUTSTATIC:
1023 iptr[0].opc = ICMD_PUTSTATICCONST;
1024 iptr[0].op1 = TYPE_ADR;
1028 iptr[0].opc = ICMD_PUTFIELDCONST;
1029 iptr[0].op1 = TYPE_ADR;
1034 iptr[1].opc = ICMD_NOP;
1035 COUNT(count_pcmd_op);
1039 PUSHCONST(TYPE_ADR);
1043 PUSHCONST(TYPE_ADR);
1044 # if defined(ENABLE_INTRP)
1046 PUSHCONST(TYPE_ADR);
1048 #else /* SUPPORT_CONST_STORE */
1049 PUSHCONST(TYPE_ADR);
1050 #endif /* SUPPORT_CONST_STORE */
1053 /* pop 0 push 1 load */
1060 COUNT(count_load_instruction);
1061 i = opcode - ICMD_ILOAD;
1062 iptr->op1 = argren[iptr->op1];
1063 #if defined(ENABLE_INTRP)
1066 rd->locals[iptr->op1][i].type = i;
1067 LOAD(i, LOCALVAR, iptr->op1);
1077 COUNT(count_check_null);
1078 COUNT(count_check_bound);
1079 COUNT(count_pcmd_mem);
1080 OP2IAT_1(opcode - ICMD_IALOAD);
1086 COUNT(count_check_null);
1087 COUNT(count_check_bound);
1088 COUNT(count_pcmd_mem);
1092 /* pop 0 push 0 iinc */
1095 #if defined(ENABLE_STATISTICS)
1099 count_store_depth[10]++;
1101 count_store_depth[i]++;
1107 if ((copy->varkind == LOCALVAR) &&
1108 (copy->varnum == iptr->op1)) {
1109 copy->varkind = TEMPVAR;
1116 /* allocate a dummy stack slot to keep ISTORE from */
1117 /* marking its input stack as a LOCALVAR, since we */
1118 /* change the value of the local variable here. */
1119 NEWSTACK0(TYPE_INT);
1125 /* pop 1 push 0 store */
1135 i = opcode - ICMD_ISTORE;
1136 #if defined(ENABLE_INTRP)
1139 rd->locals[iptr->op1][i].type = i;
1140 #if defined(ENABLE_STATISTICS)
1145 count_store_length[20]++;
1147 count_store_length[i]++;
1150 count_store_depth[10]++;
1152 count_store_depth[i]++;
1155 copy = curstack->prev;
1158 if ((copy->varkind == LOCALVAR) &&
1159 (copy->varnum == iptr->op1)) {
1160 copy->varkind = TEMPVAR;
1166 if ((new - curstack) == 1) {
1167 curstack->varkind = LOCALVAR;
1168 curstack->varnum = iptr->op1;
1170 STORE(opcode - ICMD_ISTORE);
1176 COUNT(count_check_null);
1177 COUNT(count_check_bound);
1178 COUNT(count_pcmd_mem);
1180 bte = builtintable_get_internal(BUILTIN_canstore);
1183 if (md->memuse > rd->memuse)
1184 rd->memuse = md->memuse;
1185 if (md->argintreguse > rd->argintreguse)
1186 rd->argintreguse = md->argintreguse;
1188 /* make all stack variables saved */
1192 copy->flags |= SAVEDVAR;
1203 COUNT(count_check_null);
1204 COUNT(count_check_bound);
1205 COUNT(count_pcmd_mem);
1206 OP3TIA_0(opcode - ICMD_IASTORE);
1212 COUNT(count_check_null);
1213 COUNT(count_check_bound);
1214 COUNT(count_pcmd_mem);
1221 #ifdef TYPECHECK_STACK_COMPCAT
1224 if (IS_2_WORD_TYPE(curstack->type)) {
1225 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1238 #if defined(ENABLE_JIT)
1239 # if defined(ENABLE_INTRP)
1242 md_return_alloc(m, rd, opcode - ICMD_IRETURN,
1245 COUNT(count_pcmd_return);
1246 OP1_0(opcode - ICMD_IRETURN);
1247 superblockend = true;
1251 COUNT(count_check_null);
1255 superblockend = true;
1258 case ICMD_PUTSTATIC:
1259 COUNT(count_pcmd_mem);
1263 /* pop 1 push 0 branch */
1266 case ICMD_IFNONNULL:
1267 COUNT(count_pcmd_bra);
1269 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1271 iptr[0].target = (void *) tbptr;
1273 MARKREACHED(tbptr, copy);
1282 COUNT(count_pcmd_bra);
1283 #if CONDITIONAL_LOADCONST
1284 # if defined(ENABLE_INTRP)
1287 tbptr = m->basicblocks + b_index;
1288 if ((b_count >= 3) &&
1289 ((b_index + 2) == m->basicblockindex[iptr[0].op1]) &&
1290 (tbptr[1].pre_count == 1) &&
1291 (tbptr[1].iinstr[0].opc == ICMD_ICONST) &&
1292 (tbptr[1].iinstr[1].opc == ICMD_GOTO) &&
1293 ((b_index + 3) == m->basicblockindex[tbptr[1].iinstr[1].op1]) &&
1294 (tbptr[2].pre_count == 1) &&
1295 (tbptr[2].iinstr[0].opc == ICMD_ICONST) &&
1296 (tbptr[2].icount==1)) {
1297 /*printf("tbptr[2].icount=%d\n",tbptr[2].icount);*/
1298 OP1_1(TYPE_INT, TYPE_INT);
1299 switch (iptr[0].opc) {
1301 iptr[0].opc = ICMD_IFNE_ICONST;
1304 iptr[0].opc = ICMD_IFEQ_ICONST;
1307 iptr[0].opc = ICMD_IFGE_ICONST;
1310 iptr[0].opc = ICMD_IFLT_ICONST;
1313 iptr[0].opc = ICMD_IFLE_ICONST;
1316 iptr[0].opc = ICMD_IFGT_ICONST;
1320 iptr[0].val.i = iptr[1].val.i;
1321 iptr[1].opc = ICMD_ELSE_ICONST;
1322 iptr[1].val.i = iptr[3].val.i;
1323 iptr[2].opc = ICMD_NOP;
1324 iptr[3].opc = ICMD_NOP;
1326 /* HACK: save compare value in iptr[1].op1 */
1327 iptr[1].op1 = iptr[0].val.i;
1328 iptr[0].val.i = tbptr[1].iinstr[0].val.i;
1329 iptr[1].opc = ICMD_ELSE_ICONST;
1330 iptr[1].val.i = tbptr[2].iinstr[0].val.i;
1331 tbptr[1].iinstr[0].opc = ICMD_NOP;
1332 tbptr[1].iinstr[1].opc = ICMD_NOP;
1333 tbptr[2].iinstr[0].opc = ICMD_NOP;
1335 tbptr[1].flags = BBDELETED;
1336 tbptr[2].flags = BBDELETED;
1337 tbptr[1].icount = 0;
1338 tbptr[2].icount = 0;
1339 if (tbptr[3].pre_count == 2) {
1340 len += tbptr[3].icount + 3;
1341 bptr->icount += tbptr[3].icount + 3;
1342 tbptr[3].flags = BBDELETED;
1343 tbptr[3].icount = 0;
1353 # if defined(ENABLE_INTRP)
1357 #endif /* CONDITIONAL_LOADCONST */
1361 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1363 iptr[0].target = (void *) tbptr;
1365 MARKREACHED(tbptr, copy);
1368 /* pop 0 push 0 branch */
1371 COUNT(count_pcmd_bra);
1372 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1374 iptr[0].target = (void *) tbptr;
1376 MARKREACHED(tbptr, copy);
1378 superblockend = true;
1381 /* pop 1 push 0 table branch */
1383 case ICMD_TABLESWITCH:
1384 COUNT(count_pcmd_table);
1386 s4ptr = iptr->val.a;
1387 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1388 MARKREACHED(tbptr, copy);
1389 i = *s4ptr++; /* low */
1390 i = *s4ptr++ - i + 1; /* high */
1392 tptr = DMNEW(void*, i+1);
1393 iptr->target = (void *) tptr;
1395 tptr[0] = (void *) tbptr;
1399 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1401 tptr[0] = (void *) tbptr;
1404 MARKREACHED(tbptr, copy);
1407 superblockend = true;
1410 /* pop 1 push 0 table branch */
1412 case ICMD_LOOKUPSWITCH:
1413 COUNT(count_pcmd_table);
1415 s4ptr = iptr->val.a;
1416 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1417 MARKREACHED(tbptr, copy);
1418 i = *s4ptr++; /* count */
1420 tptr = DMNEW(void*, i+1);
1421 iptr->target = (void *) tptr;
1423 tptr[0] = (void *) tbptr;
1427 tbptr = m->basicblocks + m->basicblockindex[s4ptr[1]];
1429 tptr[0] = (void *) tbptr;
1432 MARKREACHED(tbptr, copy);
1436 superblockend = true;
1439 case ICMD_MONITORENTER:
1440 COUNT(count_check_null);
1441 case ICMD_MONITOREXIT:
1445 /* pop 2 push 0 branch */
1447 case ICMD_IF_ICMPEQ:
1448 case ICMD_IF_ICMPNE:
1449 case ICMD_IF_ICMPLT:
1450 case ICMD_IF_ICMPGE:
1451 case ICMD_IF_ICMPGT:
1452 case ICMD_IF_ICMPLE:
1453 COUNT(count_pcmd_bra);
1455 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1457 iptr[0].target = (void *) tbptr;
1459 MARKREACHED(tbptr, copy);
1462 case ICMD_IF_ACMPEQ:
1463 case ICMD_IF_ACMPNE:
1464 COUNT(count_pcmd_bra);
1466 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1468 iptr[0].target = (void *) tbptr;
1470 MARKREACHED(tbptr, copy);
1476 COUNT(count_check_null);
1477 COUNT(count_pcmd_mem);
1478 OPTT2_0(iptr->op1,TYPE_ADR);
1483 if (!IS_2_WORD_TYPE(curstack->type)) {
1485 #ifdef TYPECHECK_STACK_COMPCAT
1488 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1489 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1494 OP1_0ANY; /* second pop */
1497 iptr->opc = ICMD_POP;
1501 /* pop 0 push 1 dup */
1504 #ifdef TYPECHECK_STACK_COMPCAT
1507 if (IS_2_WORD_TYPE(curstack->type)) {
1508 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1513 COUNT(count_dup_instruction);
1519 if (IS_2_WORD_TYPE(curstack->type)) {
1521 iptr->opc = ICMD_DUP;
1526 /* ..., ????, cat1 */
1527 #ifdef TYPECHECK_STACK_COMPCAT
1529 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1530 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1536 NEWSTACK(copy->prev->type, copy->prev->varkind,
1537 copy->prev->varnum);
1538 NEWSTACK(copy->type, copy->varkind,
1545 /* pop 2 push 3 dup */
1548 #ifdef TYPECHECK_STACK_COMPCAT
1551 if (IS_2_WORD_TYPE(curstack->type) ||
1552 IS_2_WORD_TYPE(curstack->prev->type)) {
1553 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1563 if (IS_2_WORD_TYPE(curstack->type)) {
1564 /* ..., ????, cat2 */
1565 #ifdef TYPECHECK_STACK_COMPCAT
1567 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1568 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1573 iptr->opc = ICMD_DUP_X1;
1577 /* ..., ????, cat1 */
1578 #ifdef TYPECHECK_STACK_COMPCAT
1581 if (IS_2_WORD_TYPE(curstack->prev->type)
1582 || IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1583 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1592 /* pop 3 push 4 dup */
1596 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1597 /* ..., cat2, ???? */
1598 #ifdef TYPECHECK_STACK_COMPCAT
1600 if (IS_2_WORD_TYPE(curstack->type)) {
1601 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1606 iptr->opc = ICMD_DUP_X1;
1610 /* ..., cat1, ???? */
1611 #ifdef TYPECHECK_STACK_COMPCAT
1614 if (IS_2_WORD_TYPE(curstack->type)
1615 || IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1616 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1627 if (IS_2_WORD_TYPE(curstack->type)) {
1628 /* ..., ????, cat2 */
1629 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1630 /* ..., cat2, cat2 */
1631 iptr->opc = ICMD_DUP_X1;
1635 /* ..., cat1, cat2 */
1636 #ifdef TYPECHECK_STACK_COMPCAT
1639 if (IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1640 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1645 iptr->opc = ICMD_DUP_X2;
1651 /* ..., ????, ????, cat1 */
1652 if (IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1653 /* ..., cat2, ????, cat1 */
1654 #ifdef TYPECHECK_STACK_COMPCAT
1656 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1657 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1662 iptr->opc = ICMD_DUP2_X1;
1666 /* ..., cat1, ????, cat1 */
1667 #ifdef TYPECHECK_STACK_COMPCAT
1670 if (IS_2_WORD_TYPE(curstack->prev->type)
1671 || IS_2_WORD_TYPE(curstack->prev->prev->prev->type)) {
1672 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1682 /* pop 2 push 2 swap */
1685 #ifdef TYPECHECK_STACK_COMPCAT
1688 if (IS_2_WORD_TYPE(curstack->type)
1689 || IS_2_WORD_TYPE(curstack->prev->type)) {
1690 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1702 #if !SUPPORT_DIVISION
1703 bte = (builtintable_entry *) iptr->val.a;
1707 if (md->memuse > rd->memuse)
1708 rd->memuse = md->memuse;
1709 if (md->argintreguse > rd->argintreguse)
1710 rd->argintreguse = md->argintreguse;
1712 /* make all stack variables saved */
1716 copy->flags |= SAVEDVAR;
1721 #endif /* !SUPPORT_DIVISION */
1732 COUNT(count_pcmd_op);
1738 #if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
1739 bte = (builtintable_entry *) iptr->val.a;
1743 if (md->memuse > rd->memuse)
1744 rd->memuse = md->memuse;
1745 if (md->argintreguse > rd->argintreguse)
1746 rd->argintreguse = md->argintreguse;
1748 /* make all stack variables saved */
1752 copy->flags |= SAVEDVAR;
1757 #endif /* !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV) */
1762 #if SUPPORT_LONG_LOGICAL
1766 #endif /* SUPPORT_LONG_LOGICAL */
1767 COUNT(count_pcmd_op);
1774 COUNT(count_pcmd_op);
1783 COUNT(count_pcmd_op);
1792 COUNT(count_pcmd_op);
1797 COUNT(count_pcmd_op);
1798 #if SUPPORT_LONG_CMP_CONST
1799 if ((len > 0) && (iptr[1].val.i == 0)) {
1800 switch (iptr[1].opc) {
1802 iptr[0].opc = ICMD_IF_LCMPEQ;
1804 iptr[0].op1 = iptr[1].op1;
1807 /* iptr[1].opc = ICMD_NOP; */
1809 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1811 iptr[0].target = (void *) tbptr;
1813 MARKREACHED(tbptr, copy);
1814 COUNT(count_pcmd_bra);
1817 iptr[0].opc = ICMD_IF_LCMPNE;
1818 goto icmd_lcmp_if_tail;
1820 iptr[0].opc = ICMD_IF_LCMPLT;
1821 goto icmd_lcmp_if_tail;
1823 iptr[0].opc = ICMD_IF_LCMPGT;
1824 goto icmd_lcmp_if_tail;
1826 iptr[0].opc = ICMD_IF_LCMPLE;
1827 goto icmd_lcmp_if_tail;
1829 iptr[0].opc = ICMD_IF_LCMPGE;
1830 goto icmd_lcmp_if_tail;
1832 OPTT2_1(TYPE_LNG, TYPE_INT);
1836 #endif /* SUPPORT_LONG_CMP_CONST */
1837 OPTT2_1(TYPE_LNG, TYPE_INT);
1841 COUNT(count_pcmd_op);
1842 OPTT2_1(TYPE_FLT, TYPE_INT);
1846 COUNT(count_pcmd_op);
1847 OPTT2_1(TYPE_DBL, TYPE_INT);
1855 case ICMD_INT2SHORT:
1856 COUNT(count_pcmd_op);
1857 OP1_1(TYPE_INT, TYPE_INT);
1860 COUNT(count_pcmd_op);
1861 OP1_1(TYPE_LNG, TYPE_LNG);
1864 COUNT(count_pcmd_op);
1865 OP1_1(TYPE_FLT, TYPE_FLT);
1868 COUNT(count_pcmd_op);
1869 OP1_1(TYPE_DBL, TYPE_DBL);
1873 COUNT(count_pcmd_op);
1874 OP1_1(TYPE_INT, TYPE_LNG);
1877 COUNT(count_pcmd_op);
1878 OP1_1(TYPE_INT, TYPE_FLT);
1881 COUNT(count_pcmd_op);
1882 OP1_1(TYPE_INT, TYPE_DBL);
1885 COUNT(count_pcmd_op);
1886 OP1_1(TYPE_LNG, TYPE_INT);
1889 COUNT(count_pcmd_op);
1890 OP1_1(TYPE_LNG, TYPE_FLT);
1893 COUNT(count_pcmd_op);
1894 OP1_1(TYPE_LNG, TYPE_DBL);
1897 COUNT(count_pcmd_op);
1898 OP1_1(TYPE_FLT, TYPE_INT);
1901 COUNT(count_pcmd_op);
1902 OP1_1(TYPE_FLT, TYPE_LNG);
1905 COUNT(count_pcmd_op);
1906 OP1_1(TYPE_FLT, TYPE_DBL);
1909 COUNT(count_pcmd_op);
1910 OP1_1(TYPE_DBL, TYPE_INT);
1913 COUNT(count_pcmd_op);
1914 OP1_1(TYPE_DBL, TYPE_LNG);
1917 COUNT(count_pcmd_op);
1918 OP1_1(TYPE_DBL, TYPE_FLT);
1921 case ICMD_CHECKCAST:
1922 if (iptr->op1 == 0) {
1923 /* array type cast-check */
1925 bte = builtintable_get_internal(BUILTIN_arraycheckcast);
1928 if (md->memuse > rd->memuse)
1929 rd->memuse = md->memuse;
1930 if (md->argintreguse > rd->argintreguse)
1931 rd->argintreguse = md->argintreguse;
1933 /* make all stack variables saved */
1937 copy->flags |= SAVEDVAR;
1941 OP1_1(TYPE_ADR, TYPE_ADR);
1944 case ICMD_INSTANCEOF:
1945 case ICMD_ARRAYLENGTH:
1946 OP1_1(TYPE_ADR, TYPE_INT);
1950 case ICMD_ANEWARRAY:
1951 OP1_1(TYPE_INT, TYPE_ADR);
1955 COUNT(count_check_null);
1956 COUNT(count_pcmd_mem);
1957 OP1_1(TYPE_ADR, iptr->op1);
1962 case ICMD_GETSTATIC:
1963 COUNT(count_pcmd_mem);
1973 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1975 iptr[0].target = (void *) tbptr;
1977 /* This is a dirty hack. The typechecker
1978 * needs it because the OP1_0ANY below
1979 * overwrites iptr->dst.
1981 iptr->val.a = (void *) iptr->dst;
1983 tbptr->type = BBTYPE_SBR;
1985 /* We need to check for overflow right here because
1986 * the pushed value is poped after MARKREACHED. */
1988 MARKREACHED(tbptr, copy);
1992 /* pop many push any */
1995 #if defined(USEBUILTINTABLE)
1998 bte = (builtintable_entry *) iptr->val.a;
2002 case ICMD_INVOKESTATIC:
2003 case ICMD_INVOKESPECIAL:
2004 case ICMD_INVOKEVIRTUAL:
2005 case ICMD_INVOKEINTERFACE:
2006 COUNT(count_pcmd_met);
2008 md = um->methodref->parseddesc.md;
2009 /* if (lm->flags & ACC_STATIC) */
2010 /* {COUNT(count_check_null);} */
2015 if (md->memuse > rd->memuse)
2016 rd->memuse = md->memuse;
2017 if (md->argintreguse > rd->argintreguse)
2018 rd->argintreguse = md->argintreguse;
2019 if (md->argfltreguse > rd->argfltreguse)
2020 rd->argfltreguse = md->argfltreguse;
2025 for (i-- ; i >= 0; i--) {
2026 #if defined(SUPPORT_PASS_FLOATARGS_IN_INTREGS)
2027 /* If we pass float arguments in integer argument registers, we
2028 * are not allowed to precolor them here. Floats have to be moved
2029 * to this regs explicitly in codegen().
2030 * Only arguments that are passed by stack anyway can be precolored
2031 * (michi 2005/07/24) */
2032 if (!(copy->flags & SAVEDVAR) &&
2033 (!IS_FLT_DBL_TYPE(copy->type) || md->params[i].inmemory)) {
2035 if (!(copy->flags & SAVEDVAR)) {
2037 copy->varkind = ARGVAR;
2040 #if defined(ENABLE_INTRP)
2043 if (md->params[i].inmemory) {
2044 copy->flags = INMEMORY;
2045 copy->regoff = md->params[i].regoff;
2048 if (IS_FLT_DBL_TYPE(copy->type))
2049 #if defined(SUPPORT_PASS_FLOATARGS_IN_INTREGS)
2050 assert(0); /* XXX is this assert ok? */
2053 rd->argfltregs[md->params[i].regoff];
2056 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2057 if (IS_2_WORD_TYPE(copy->type))
2058 copy->regoff = PACK_REGS(
2059 rd->argintregs[GET_LOW_REG(md->params[i].regoff)],
2060 rd->argintregs[GET_HIGH_REG(md->params[i].regoff)]);
2064 rd->argintregs[md->params[i].regoff];
2067 #if defined(ENABLE_INTRP)
2075 copy->flags |= SAVEDVAR;
2081 if (md->returntype.type != TYPE_VOID)
2082 OP0_1(md->returntype.type);
2085 case ICMD_INLINE_START:
2086 case ICMD_INLINE_END:
2090 case ICMD_MULTIANEWARRAY:
2091 if (rd->argintreguse < 3)
2092 rd->argintreguse = 3;
2097 #if defined(SPECIALMEMUSE)
2098 # if defined(__DARWIN__)
2099 if (rd->memuse < (i + INT_ARG_CNT + LA_WORD_SIZE))
2100 rd->memuse = i + LA_WORD_SIZE + INT_ARG_CNT;
2102 if (rd->memuse < (i + LA_WORD_SIZE + 3))
2103 rd->memuse = i + LA_WORD_SIZE + 3;
2106 # if defined(__I386__)
2107 if (rd->memuse < i + 3)
2108 rd->memuse = i + 3; /* n integer args spilled on stack */
2109 # elif defined(__MIPS__) && SIZEOF_VOID_P == 4
2110 if (rd->memuse < i + 2)
2111 rd->memuse = i + 2; /* 4*4 bytes callee save space */
2114 rd->memuse = i; /* n integer args spilled on stack */
2115 # endif /* defined(__I386__) */
2119 /* check INT type here? Currently typecheck does this. */
2120 if (!(copy->flags & SAVEDVAR)) {
2121 copy->varkind = ARGVAR;
2122 copy->varnum = i + INT_ARG_CNT;
2123 copy->flags |= INMEMORY;
2124 #if defined(SPECIALMEMUSE)
2125 # if defined(__DARWIN__)
2126 copy->regoff = i + LA_WORD_SIZE + INT_ARG_CNT;
2128 copy->regoff = i + LA_WORD_SIZE + 3;
2131 # if defined(__I386__)
2132 copy->regoff = i + 3;
2133 # elif defined(__MIPS__) && SIZEOF_VOID_P == 4
2134 copy->regoff = i + 2;
2137 # endif /* defined(__I386__) */
2138 #endif /* defined(SPECIALMEMUSE) */
2143 copy->flags |= SAVEDVAR;
2151 case ICMD_CLEAR_ARGREN:
2152 for (i = iptr->op1; i < cd->maxlocals; i++)
2154 iptr->opc = opcode = ICMD_NOP;
2158 case ICMD_READONLY_ARG:
2159 case ICMD_READONLY_ARG+1:
2160 case ICMD_READONLY_ARG+2:
2161 case ICMD_READONLY_ARG+3:
2162 case ICMD_READONLY_ARG+4:
2165 if (curstack->varkind == LOCALVAR) {
2166 i = curstack->varnum;
2167 argren[iptr->op1] = i;
2170 opcode = iptr->opc = opcode - ICMD_READONLY_ARG + ICMD_ISTORE;
2177 new_internalerror("Unknown ICMD %d", opcode);
2183 } /* while instructions */
2185 bptr->outstack = curstack;
2186 bptr->outdepth = stackdepth;
2190 superblockend = true;
2192 } /* while blocks */
2193 } while (repeat && !deadcode);
2195 #if defined(ENABLE_STATISTICS)
2197 if (m->basicblockcount > count_max_basic_blocks)
2198 count_max_basic_blocks = m->basicblockcount;
2199 count_basic_blocks += m->basicblockcount;
2200 if (m->instructioncount > count_max_javainstr) count_max_javainstr = m->instructioncount;
2201 count_javainstr += m->instructioncount;
2202 if (m->stackcount > count_upper_bound_new_stack)
2203 count_upper_bound_new_stack = m->stackcount;
2204 if ((new - m->stack) > count_max_new_stack)
2205 count_max_new_stack = (new - m->stack);
2207 b_count = m->basicblockcount;
2208 bptr = m->basicblocks;
2209 while (--b_count >= 0) {
2210 if (bptr->flags > BBREACHED) {
2211 if (bptr->indepth >= 10)
2212 count_block_stack[10]++;
2214 count_block_stack[bptr->indepth]++;
2217 count_block_size_distribution[len]++;
2219 count_block_size_distribution[10]++;
2221 count_block_size_distribution[11]++;
2223 count_block_size_distribution[12]++;
2225 count_block_size_distribution[13]++;
2227 count_block_size_distribution[14]++;
2229 count_block_size_distribution[15]++;
2231 count_block_size_distribution[16]++;
2233 count_block_size_distribution[17]++;
2239 count_analyse_iterations[0]++;
2240 else if (loops == 2)
2241 count_analyse_iterations[1]++;
2242 else if (loops == 3)
2243 count_analyse_iterations[2]++;
2244 else if (loops == 4)
2245 count_analyse_iterations[3]++;
2247 count_analyse_iterations[4]++;
2249 if (m->basicblockcount <= 5)
2250 count_method_bb_distribution[0]++;
2251 else if (m->basicblockcount <= 10)
2252 count_method_bb_distribution[1]++;
2253 else if (m->basicblockcount <= 15)
2254 count_method_bb_distribution[2]++;
2255 else if (m->basicblockcount <= 20)
2256 count_method_bb_distribution[3]++;
2257 else if (m->basicblockcount <= 30)
2258 count_method_bb_distribution[4]++;
2259 else if (m->basicblockcount <= 40)
2260 count_method_bb_distribution[5]++;
2261 else if (m->basicblockcount <= 50)
2262 count_method_bb_distribution[6]++;
2263 else if (m->basicblockcount <= 75)
2264 count_method_bb_distribution[7]++;
2266 count_method_bb_distribution[8]++;
2268 #endif /* defined(ENABLE_STATISTICS) */
2270 /* just return methodinfo* to signal everything was ok */
2276 /* debugging helpers **********************************************************/
2278 void icmd_print_stack(codegendata *cd, stackptr s)
2290 j = cd->maxstack - i;
2296 if (s->flags & SAVEDVAR)
2297 switch (s->varkind) {
2299 if (s->flags & INMEMORY)
2300 printf(" M%02d", s->regoff);
2301 #ifdef HAS_ADDRESS_REGISTER_FILE
2302 else if (s->type == TYPE_ADR)
2303 printf(" R%02d", s->regoff);
2305 else if (IS_FLT_DBL_TYPE(s->type))
2306 printf(" F%02d", s->regoff);
2308 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2309 if (IS_2_WORD_TYPE(s->type)) {
2310 # if defined(ENABLE_JIT)
2311 # if defined(ENABLE_INTRP)
2313 printf(" %3d/%3d", GET_LOW_REG(s->regoff),
2314 GET_HIGH_REG(s->regoff));
2317 printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
2318 regs[GET_HIGH_REG(s->regoff)]);
2320 printf(" %3d/%3d", GET_LOW_REG(s->regoff),
2321 GET_HIGH_REG(s->regoff));
2324 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
2326 #if defined(ENABLE_JIT)
2327 # if defined(ENABLE_INTRP)
2329 printf(" %3d", s->regoff);
2332 printf(" %3s", regs[s->regoff]);
2334 printf(" %3d", s->regoff);
2340 printf(" I%02d", s->varnum);
2343 printf(" L%02d", s->varnum);
2346 if (s->varnum == -1) {
2348 /* varkind ARGVAR "misused for this special case */
2350 } else /* "normal" Argvar */
2351 printf(" A%02d", s->varnum);
2354 printf(" !%02d", j);
2357 switch (s->varkind) {
2359 if (s->flags & INMEMORY)
2360 printf(" m%02d", s->regoff);
2361 #ifdef HAS_ADDRESS_REGISTER_FILE
2362 else if (s->type == TYPE_ADR)
2363 printf(" r%02d", s->regoff);
2365 else if (IS_FLT_DBL_TYPE(s->type))
2366 printf(" f%02d", s->regoff);
2368 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2369 if (IS_2_WORD_TYPE(s->type)) {
2370 # if defined(ENABLE_JIT)
2371 # if defined(ENABLE_INTRP)
2373 printf(" %3d/%3d", GET_LOW_REG(s->regoff),
2374 GET_HIGH_REG(s->regoff));
2377 printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
2378 regs[GET_HIGH_REG(s->regoff)]);
2380 printf(" %3d/%3d", GET_LOW_REG(s->regoff),
2381 GET_HIGH_REG(s->regoff));
2384 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
2386 #if defined(ENABLE_JIT)
2387 # if defined(ENABLE_INTRP)
2389 printf(" %3d", s->regoff);
2392 printf(" %3s", regs[s->regoff]);
2394 printf(" %3d", s->regoff);
2400 printf(" i%02d", s->varnum);
2403 printf(" l%02d", s->varnum);
2406 if (s->varnum == -1) {
2408 /* varkind ARGVAR "misused for this special case */
2410 } else /* "normal" Argvar */
2411 printf(" a%02d", s->varnum);
2414 printf(" ?%02d", j);
2422 static void print_reg(stackptr s) {
2424 if (s->flags & SAVEDVAR)
2425 switch (s->varkind) {
2427 if (s->flags & INMEMORY)
2428 printf(" tm%02d", s->regoff);
2430 printf(" tr%02d", s->regoff);
2433 printf(" s %02d", s->varnum);
2436 printf(" l %02d", s->varnum);
2439 printf(" a %02d", s->varnum);
2442 printf(" ! %02d", s->varnum);
2445 switch (s->varkind) {
2447 if (s->flags & INMEMORY)
2448 printf(" Tm%02d", s->regoff);
2450 printf(" Tr%02d", s->regoff);
2453 printf(" S %02d", s->varnum);
2456 printf(" L %02d", s->varnum);
2459 printf(" A %02d", s->varnum);
2462 printf(" ? %02d", s->varnum);
2472 static char *jit_type[] = {
2481 /* show_icmd_method ************************************************************
2485 *******************************************************************************/
2487 #if !defined(NDEBUG)
2488 void show_icmd_method(methodinfo *m, codegendata *cd, registerdata *rd)
2495 #if defined(USE_THREADS)
2496 /* We need to enter a lock here, since the binutils disassembler
2497 is not reentrant-able and we could not read functions printed
2498 at the same time. */
2500 builtin_monitorenter(lock_show_icmd);
2507 printf("\nBasic blocks: %d\n", m->basicblockcount);
2508 printf("Max locals: %d\n", cd->maxlocals);
2509 printf("Max stack: %d\n", cd->maxstack);
2510 printf("Line number table length: %d\n", m->linenumbercount);
2512 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
2513 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
2514 printf(" L%03d ... ", ex->start->debug_nr );
2515 printf("L%03d = ", ex->end->debug_nr);
2516 printf("L%03d", ex->handler->debug_nr);
2517 printf(" (catchtype: ");
2518 if (ex->catchtype.any)
2519 if (IS_CLASSREF(ex->catchtype))
2520 utf_display_classname(ex->catchtype.ref->name);
2522 utf_display_classname(ex->catchtype.cls->name);
2528 printf("Local Table:\n");
2529 for (i = 0; i < cd->maxlocals; i++) {
2530 printf(" %3d: ", i);
2532 #if defined(ENABLE_JIT)
2533 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
2534 # if defined(ENABLE_INTRP)
2537 if (rd->locals[i][j].type >= 0) {
2538 printf(" (%s) ", jit_type[j]);
2539 if (rd->locals[i][j].flags & INMEMORY)
2540 printf("m%2d", rd->locals[i][j].regoff);
2541 # ifdef HAS_ADDRESS_REGISTER_FILE
2542 else if (j == TYPE_ADR)
2543 printf("r%02d", rd->locals[i][j].regoff);
2545 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2546 printf("f%02d", rd->locals[i][j].regoff);
2548 # if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2549 if (IS_2_WORD_TYPE(j))
2551 regs[GET_LOW_REG(rd->locals[i][j].regoff)],
2552 regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
2555 printf("%3s", regs[rd->locals[i][j].regoff]);
2558 # if defined(ENABLE_INTRP)
2562 #endif /* defined(ENABLE_JIT) */
2568 #if defined(ENABLE_LSRA)
2571 #if defined(ENABLE_INTRP)
2574 printf("Interface Table:\n");
2575 for (i = 0; i < cd->maxstack; i++) {
2576 if ((rd->interfaces[i][0].type >= 0) ||
2577 (rd->interfaces[i][1].type >= 0) ||
2578 (rd->interfaces[i][2].type >= 0) ||
2579 (rd->interfaces[i][3].type >= 0) ||
2580 (rd->interfaces[i][4].type >= 0)) {
2581 printf(" %3d: ", i);
2583 #if defined(ENABLE_JIT)
2584 # if defined(ENABLE_INTRP)
2587 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
2588 if (rd->interfaces[i][j].type >= 0) {
2589 printf(" (%s) ", jit_type[j]);
2590 if (rd->interfaces[i][j].flags & SAVEDVAR) {
2591 if (rd->interfaces[i][j].flags & INMEMORY)
2592 printf("M%2d", rd->interfaces[i][j].regoff);
2593 #ifdef HAS_ADDRESS_REGISTER_FILE
2594 else if (j == TYPE_ADR)
2595 printf("R%02d", rd->interfaces[i][j].regoff);
2597 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2598 printf("F%02d", rd->interfaces[i][j].regoff);
2600 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2601 if (IS_2_WORD_TYPE(j))
2603 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
2604 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
2607 printf("%3s",regs[rd->interfaces[i][j].regoff]);
2611 if (rd->interfaces[i][j].flags & INMEMORY)
2612 printf("m%2d", rd->interfaces[i][j].regoff);
2613 #ifdef HAS_ADDRESS_REGISTER_FILE
2614 else if (j == TYPE_ADR)
2615 printf("r%02d", rd->interfaces[i][j].regoff);
2617 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2618 printf("f%02d", rd->interfaces[i][j].regoff);
2620 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2621 if (IS_2_WORD_TYPE(j))
2623 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
2624 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
2627 printf("%3s",regs[rd->interfaces[i][j].regoff]);
2633 # if defined(ENABLE_INTRP)
2636 #endif /* defined(ENABLE_JIT) */
2642 #if defined(ENABLE_INTRP)
2645 #if defined(ENABLE_LSRA)
2649 /* show code before first basic block */
2651 if (opt_showdisassemble) {
2652 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen);
2654 for (; u1ptr < (u1 *) ((ptrint) m->mcode + cd->dseglen + m->basicblocks[0].mpc);)
2660 /* show code of all basic blocks */
2662 for (bptr = m->basicblocks; bptr != NULL; bptr = bptr->next) {
2663 show_icmd_block(m, cd, bptr);
2666 /* show stubs code */
2668 if (opt_showdisassemble && opt_showexceptionstubs) {
2669 printf("\nException stubs code:\n");
2670 printf("Length: %d\n\n", (s4) (m->mcodelength -
2671 ((ptrint) cd->dseglen +
2672 m->basicblocks[m->basicblockcount].mpc)));
2674 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen +
2675 m->basicblocks[m->basicblockcount].mpc);
2677 for (; (ptrint) u1ptr < ((ptrint) m->mcode + m->mcodelength);)
2683 #if defined(USE_THREADS)
2684 builtin_monitorexit(lock_show_icmd);
2687 #endif /* !defined(NDEBUG) */
2690 /* show_icmd_block *************************************************************
2694 *******************************************************************************/
2696 #if !defined(NDEBUG)
2697 void show_icmd_block(methodinfo *m, codegendata *cd, basicblock *bptr)
2704 if (bptr->flags != BBDELETED) {
2705 deadcode = bptr->flags <= BBREACHED;
2710 for (j = cd->maxstack; j > 0; j--)
2713 icmd_print_stack(cd, bptr->instack);
2715 printf("] L%03d(flags: %d, next: %d, type: ",
2716 bptr->debug_nr, bptr->flags, (bptr->next) ? (bptr->next->debug_nr) : -1);
2718 switch (bptr->type) {
2730 printf(", instruction count: %d, predecessors: %d):\n",
2731 bptr->icount, bptr->pre_count);
2733 iptr = bptr->iinstr;
2735 for (i = 0; i < bptr->icount; i++, iptr++) {
2739 for (j = cd->maxstack; j > 0; j--)
2742 icmd_print_stack(cd, iptr->dst);
2744 printf("] %5d (line: %5d) ", i, iptr->line);
2746 show_icmd(iptr, deadcode);
2750 if (opt_showdisassemble && (!deadcode)) {
2752 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen + bptr->mpc);
2754 if (bptr->next != NULL) {
2755 for (; u1ptr < (u1 *) ((ptrint) m->mcode + cd->dseglen + bptr->next->mpc);)
2759 for (; u1ptr < (u1 *) ((ptrint) m->mcode + m->mcodelength);)
2766 #endif /* !defined(NDEBUG) */
2769 /* show_icmd *******************************************************************
2773 *******************************************************************************/
2775 #if !defined(NDEBUG)
2776 void show_icmd(instruction *iptr, bool deadcode)
2782 printf("%s", icmd_names[iptr->opc]);
2784 switch (iptr->opc) {
2785 case ICMD_IADDCONST:
2786 case ICMD_ISUBCONST:
2787 case ICMD_IMULCONST:
2791 case ICMD_IANDCONST:
2793 case ICMD_IXORCONST:
2794 case ICMD_ISHLCONST:
2795 case ICMD_ISHRCONST:
2796 case ICMD_IUSHRCONST:
2797 case ICMD_LSHLCONST:
2798 case ICMD_LSHRCONST:
2799 case ICMD_LUSHRCONST:
2801 case ICMD_IASTORECONST:
2802 case ICMD_BASTORECONST:
2803 case ICMD_CASTORECONST:
2804 case ICMD_SASTORECONST:
2805 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
2808 case ICMD_IFEQ_ICONST:
2809 case ICMD_IFNE_ICONST:
2810 case ICMD_IFLT_ICONST:
2811 case ICMD_IFGE_ICONST:
2812 case ICMD_IFGT_ICONST:
2813 case ICMD_IFLE_ICONST:
2814 printf(" %d, %d (0x%08x)", iptr[1].op1, iptr->val.i, iptr->val.i);
2817 case ICMD_ELSE_ICONST:
2818 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
2821 case ICMD_LADDCONST:
2822 case ICMD_LSUBCONST:
2823 case ICMD_LMULCONST:
2827 case ICMD_LANDCONST:
2829 case ICMD_LXORCONST:
2831 case ICMD_LASTORECONST:
2832 #if SIZEOF_VOID_P == 4
2833 printf(" %lld (0x%016llx)", iptr->val.l, iptr->val.l);
2835 printf(" %ld (0x%016lx)", iptr->val.l, iptr->val.l);
2840 printf(" %f (0x%08x)", iptr->val.f, iptr->val.i);
2844 #if SIZEOF_VOID_P == 4
2845 printf(" %g (0x%016llx)", iptr->val.d, iptr->val.l);
2847 printf(" %g (0x%016lx)", iptr->val.d, iptr->val.l);
2852 case ICMD_AASTORECONST:
2853 /* check if this is a constant string or a class reference */
2857 printf(" %p", iptr->val.a);
2859 printf(" (NOT RESOLVED)");
2861 printf(", Class = \"");
2862 utf_display(((constant_classref *) iptr->target)->name);
2866 printf(" %p", iptr->val.a);
2868 printf(", String = \"");
2869 utf_display(javastring_toutf(iptr->val.a, false));
2878 printf(" %d, ", ((fieldinfo *) iptr->val.a)->offset);
2880 printf(" (NOT RESOLVED), ");
2881 utf_display_classname(((unresolved_field *) iptr->target)->fieldref->classref->name);
2883 utf_display(((unresolved_field *) iptr->target)->fieldref->name);
2885 utf_display(((unresolved_field *) iptr->target)->fieldref->descriptor);
2889 case ICMD_PUTSTATIC:
2890 case ICMD_GETSTATIC:
2892 if (!CLASS_IS_OR_ALMOST_INITIALIZED(((fieldinfo *) iptr->val.a)->class))
2893 printf(" (NOT INITIALIZED) ");
2897 printf(" (NOT RESOLVED) ");
2898 utf_display_classname(((unresolved_field *) iptr->target)->fieldref->classref->name);
2900 utf_display(((unresolved_field *) iptr->target)->fieldref->name);
2902 utf_display(((unresolved_field *) iptr->target)->fieldref->descriptor);
2906 case ICMD_PUTSTATICCONST:
2907 case ICMD_PUTFIELDCONST:
2908 switch (iptr[1].op1) {
2910 printf(" %d (0x%08x),", iptr->val.i, iptr->val.i);
2913 #if SIZEOF_VOID_P == 4
2914 printf(" %lld (0x%016llx),", iptr->val.l, iptr->val.l);
2916 printf(" %ld (0x%016lx),", iptr->val.l, iptr->val.l);
2920 printf(" %p,", iptr->val.a);
2923 printf(" %g (0x%08x),", iptr->val.f, iptr->val.i);
2926 #if SIZEOF_VOID_P == 4
2927 printf(" %g (0x%016llx),", iptr->val.d, iptr->val.l);
2929 printf(" %g (0x%016lx),", iptr->val.d, iptr->val.l);
2933 if (iptr->opc == ICMD_PUTFIELDCONST) {
2935 printf(" %d,", ((fieldinfo *) iptr[1].val.a)->offset);
2937 printf(" (NOT RESOLVED),");
2940 utf_display_classname(((unresolved_field *) iptr[1].target)->fieldref->classref->name);
2942 utf_display(((unresolved_field *) iptr[1].target)->fieldref->name);
2944 utf_display(((unresolved_field *) iptr[1].target)->fieldref->descriptor);
2949 printf(" %d + %d", iptr->op1, iptr->val.i);
2984 printf(" %d", iptr->op1);
2989 utf_display_classname(((classinfo *) iptr->val.a)->name);
2993 switch (iptr->op1) {
3021 case ICMD_ANEWARRAY:
3024 utf_display_classname(((classinfo *) iptr->val.a)->name);
3028 case ICMD_MULTIANEWARRAY:
3029 if (iptr->val.a == NULL) {
3030 printf(" (NOT RESOLVED) %d ", iptr->op1);
3031 utf_display(((constant_classref *) iptr->target)->name);
3033 printf(" %d ",iptr->op1);
3034 utf_display_classname(((classinfo *) iptr->val.a)->name);
3038 case ICMD_CHECKCAST:
3039 case ICMD_INSTANCEOF:
3041 classinfo *c = iptr->val.a;
3043 if (c->flags & ACC_INTERFACE)
3044 printf(" (INTERFACE) ");
3046 printf(" (CLASS,%3d) ", c->vftbl->diffval);
3048 printf(" (NOT RESOLVED) ");
3050 utf_display_classname(((constant_classref *) iptr->target)->name);
3054 case ICMD_INLINE_START:
3055 case ICMD_INLINE_END:
3057 utf_display_classname(iptr->method->class->name);
3059 utf_display_classname(iptr->method->name);
3060 utf_display_classname(iptr->method->descriptor);
3064 printf(" %s", ((builtintable_entry *) iptr->val.a)->name);
3067 case ICMD_INVOKEVIRTUAL:
3068 case ICMD_INVOKESPECIAL:
3069 case ICMD_INVOKESTATIC:
3070 case ICMD_INVOKEINTERFACE:
3072 printf(" (NOT RESOLVED) ");
3075 utf_display_classname(((unresolved_method *) iptr->target)->methodref->classref->name);
3077 utf_display(((unresolved_method *) iptr->target)->methodref->name);
3078 utf_display(((unresolved_method *) iptr->target)->methodref->descriptor);
3087 if (deadcode || !iptr->target)
3088 printf(" %d (0x%08x) op1=%d", iptr->val.i, iptr->val.i, iptr->op1);
3090 printf(" %d (0x%08x) L%03d (%p)", iptr->val.i, iptr->val.i, ((basicblock *) iptr->target)->debug_nr,iptr->target);
3099 if (deadcode || !iptr->target)
3100 #if SIZEOF_VOID_P == 4
3101 printf("(%lld) op1=%d", iptr->val.l, iptr->op1);
3103 printf("(%ld) op1=%d", iptr->val.l, iptr->op1);
3106 #if SIZEOF_VOID_P == 4
3107 printf("(%lld) L%03d", iptr->val.l, ((basicblock *) iptr->target)->debug_nr);
3109 printf("(%ld) L%03d", iptr->val.l, ((basicblock *) iptr->target)->debug_nr);
3116 case ICMD_IFNONNULL:
3117 case ICMD_IF_ICMPEQ:
3118 case ICMD_IF_ICMPNE:
3119 case ICMD_IF_ICMPLT:
3120 case ICMD_IF_ICMPGE:
3121 case ICMD_IF_ICMPGT:
3122 case ICMD_IF_ICMPLE:
3123 case ICMD_IF_LCMPEQ:
3124 case ICMD_IF_LCMPNE:
3125 case ICMD_IF_LCMPLT:
3126 case ICMD_IF_LCMPGE:
3127 case ICMD_IF_LCMPGT:
3128 case ICMD_IF_LCMPLE:
3129 case ICMD_IF_ACMPEQ:
3130 case ICMD_IF_ACMPNE:
3131 case ICMD_INLINE_GOTO:
3132 if (deadcode || !iptr->target)
3133 printf(" op1=%d", iptr->op1);
3135 printf(" L%03d (%p)", ((basicblock *) iptr->target)->debug_nr,iptr->target);
3138 case ICMD_TABLESWITCH:
3139 s4ptr = (s4*)iptr->val.a;
3141 if (deadcode || !iptr->target) {
3142 printf(" %d;", *s4ptr);
3145 tptr = (void **) iptr->target;
3146 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
3150 s4ptr++; /* skip default */
3151 j = *s4ptr++; /* low */
3152 j = *s4ptr++ - j; /* high */
3154 if (deadcode || !*tptr)
3155 printf(" %d", *s4ptr++);
3157 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
3164 case ICMD_LOOKUPSWITCH:
3165 s4ptr = (s4*)iptr->val.a;
3167 if (deadcode || !iptr->target) {
3168 printf(" %d;", *s4ptr);
3171 tptr = (void **) iptr->target;
3172 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
3175 s4ptr++; /* default */
3176 j = *s4ptr++; /* count */
3179 if (deadcode || !*tptr) {
3180 s4ptr++; /* skip value */
3181 printf(" %d",*s4ptr++);
3184 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
3192 printf(" (NOT RESOLVED), Class = \"");
3193 utf_display(((unresolved_class *) iptr->val.a)->classref->name);
3198 #endif /* !defined(NDEBUG) */
3202 * These are local overrides for various environment variables in Emacs.
3203 * Please do not remove this and leave it at the end of the file, where
3204 * Emacs will automagically detect them.
3205 * ---------------------------------------------------------------------
3208 * indent-tabs-mode: t
3212 * vim:noexpandtab:sw=4:ts=4: