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 4366 2006-01-23 16:03:50Z twisti $
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;
282 #if defined(USEBUILTINTABLE)
283 # if defined(ENABLE_INTRP)
286 bte = builtintable_get_automatic(opcode);
288 if (bte && bte->opcode == opcode) {
289 iptr->opc = ICMD_BUILTIN;
290 iptr->op1 = false; /* don't check for exception */
292 m->isleafmethod = false;
295 # if defined(ENABLE_INTRP)
298 #endif /* defined(USEBUILTINTABLE) */
305 COUNT(count_check_null);
308 case ICMD_IFEQ_ICONST:
309 case ICMD_IFNE_ICONST:
310 case ICMD_IFLT_ICONST:
311 case ICMD_IFGE_ICONST:
312 case ICMD_IFGT_ICONST:
313 case ICMD_IFLE_ICONST:
314 case ICMD_ELSE_ICONST:
319 #if defined(ENABLE_INTRP)
322 rd->locals[iptr->op1][TYPE_ADR].type = TYPE_ADR;
324 COUNT(count_pcmd_return);
326 superblockend = true;
329 /* pop 0 push 1 const */
332 COUNT(count_pcmd_load);
334 switch (iptr[1].opc) {
336 iptr[0].opc = ICMD_IADDCONST;
338 iptr[1].opc = ICMD_NOP;
339 OP1_1(TYPE_INT, TYPE_INT);
340 COUNT(count_pcmd_op);
343 iptr[0].opc = ICMD_ISUBCONST;
344 goto icmd_iconst_tail;
345 #if SUPPORT_CONST_MUL
347 iptr[0].opc = ICMD_IMULCONST;
348 goto icmd_iconst_tail;
349 #else /* SUPPORT_CONST_MUL */
351 if (iptr[0].val.i == 0x00000002)
353 else if (iptr[0].val.i == 0x00000004)
355 else if (iptr[0].val.i == 0x00000008)
357 else if (iptr[0].val.i == 0x00000010)
359 else if (iptr[0].val.i == 0x00000020)
361 else if (iptr[0].val.i == 0x00000040)
363 else if (iptr[0].val.i == 0x00000080)
365 else if (iptr[0].val.i == 0x00000100)
367 else if (iptr[0].val.i == 0x00000200)
369 else if (iptr[0].val.i == 0x00000400)
371 else if (iptr[0].val.i == 0x00000800)
373 else if (iptr[0].val.i == 0x00001000)
375 else if (iptr[0].val.i == 0x00002000)
377 else if (iptr[0].val.i == 0x00004000)
379 else if (iptr[0].val.i == 0x00008000)
381 else if (iptr[0].val.i == 0x00010000)
383 else if (iptr[0].val.i == 0x00020000)
385 else if (iptr[0].val.i == 0x00040000)
387 else if (iptr[0].val.i == 0x00080000)
389 else if (iptr[0].val.i == 0x00100000)
391 else if (iptr[0].val.i == 0x00200000)
393 else if (iptr[0].val.i == 0x00400000)
395 else if (iptr[0].val.i == 0x00800000)
397 else if (iptr[0].val.i == 0x01000000)
399 else if (iptr[0].val.i == 0x02000000)
401 else if (iptr[0].val.i == 0x04000000)
403 else if (iptr[0].val.i == 0x08000000)
405 else if (iptr[0].val.i == 0x10000000)
407 else if (iptr[0].val.i == 0x20000000)
409 else if (iptr[0].val.i == 0x40000000)
411 else if (iptr[0].val.i == 0x80000000)
417 iptr[0].opc = ICMD_IMULPOW2;
418 goto icmd_iconst_tail;
419 #endif /* SUPPORT_CONST_MUL */
421 if (iptr[0].val.i == 0x00000002)
423 else if (iptr[0].val.i == 0x00000004)
425 else if (iptr[0].val.i == 0x00000008)
427 else if (iptr[0].val.i == 0x00000010)
429 else if (iptr[0].val.i == 0x00000020)
431 else if (iptr[0].val.i == 0x00000040)
433 else if (iptr[0].val.i == 0x00000080)
435 else if (iptr[0].val.i == 0x00000100)
437 else if (iptr[0].val.i == 0x00000200)
439 else if (iptr[0].val.i == 0x00000400)
441 else if (iptr[0].val.i == 0x00000800)
443 else if (iptr[0].val.i == 0x00001000)
445 else if (iptr[0].val.i == 0x00002000)
447 else if (iptr[0].val.i == 0x00004000)
449 else if (iptr[0].val.i == 0x00008000)
451 else if (iptr[0].val.i == 0x00010000)
453 else if (iptr[0].val.i == 0x00020000)
455 else if (iptr[0].val.i == 0x00040000)
457 else if (iptr[0].val.i == 0x00080000)
459 else if (iptr[0].val.i == 0x00100000)
461 else if (iptr[0].val.i == 0x00200000)
463 else if (iptr[0].val.i == 0x00400000)
465 else if (iptr[0].val.i == 0x00800000)
467 else if (iptr[0].val.i == 0x01000000)
469 else if (iptr[0].val.i == 0x02000000)
471 else if (iptr[0].val.i == 0x04000000)
473 else if (iptr[0].val.i == 0x08000000)
475 else if (iptr[0].val.i == 0x10000000)
477 else if (iptr[0].val.i == 0x20000000)
479 else if (iptr[0].val.i == 0x40000000)
481 else if (iptr[0].val.i == 0x80000000)
487 iptr[0].opc = ICMD_IDIVPOW2;
488 goto icmd_iconst_tail;
490 /*log_text("stack.c: ICMD_ICONST/ICMD_IREM");*/
491 if ((iptr[0].val.i == 0x00000002) ||
492 (iptr[0].val.i == 0x00000004) ||
493 (iptr[0].val.i == 0x00000008) ||
494 (iptr[0].val.i == 0x00000010) ||
495 (iptr[0].val.i == 0x00000020) ||
496 (iptr[0].val.i == 0x00000040) ||
497 (iptr[0].val.i == 0x00000080) ||
498 (iptr[0].val.i == 0x00000100) ||
499 (iptr[0].val.i == 0x00000200) ||
500 (iptr[0].val.i == 0x00000400) ||
501 (iptr[0].val.i == 0x00000800) ||
502 (iptr[0].val.i == 0x00001000) ||
503 (iptr[0].val.i == 0x00002000) ||
504 (iptr[0].val.i == 0x00004000) ||
505 (iptr[0].val.i == 0x00008000) ||
506 (iptr[0].val.i == 0x00010000) ||
507 (iptr[0].val.i == 0x00020000) ||
508 (iptr[0].val.i == 0x00040000) ||
509 (iptr[0].val.i == 0x00080000) ||
510 (iptr[0].val.i == 0x00100000) ||
511 (iptr[0].val.i == 0x00200000) ||
512 (iptr[0].val.i == 0x00400000) ||
513 (iptr[0].val.i == 0x00800000) ||
514 (iptr[0].val.i == 0x01000000) ||
515 (iptr[0].val.i == 0x02000000) ||
516 (iptr[0].val.i == 0x04000000) ||
517 (iptr[0].val.i == 0x08000000) ||
518 (iptr[0].val.i == 0x10000000) ||
519 (iptr[0].val.i == 0x20000000) ||
520 (iptr[0].val.i == 0x40000000) ||
521 (iptr[0].val.i == 0x80000000)) {
522 iptr[0].opc = ICMD_IREMPOW2;
524 goto icmd_iconst_tail;
528 #if SUPPORT_CONST_LOGICAL
530 iptr[0].opc = ICMD_IANDCONST;
531 goto icmd_iconst_tail;
533 iptr[0].opc = ICMD_IORCONST;
534 goto icmd_iconst_tail;
536 iptr[0].opc = ICMD_IXORCONST;
537 goto icmd_iconst_tail;
538 #endif /* SUPPORT_CONST_LOGICAL */
540 iptr[0].opc = ICMD_ISHLCONST;
541 goto icmd_iconst_tail;
543 iptr[0].opc = ICMD_ISHRCONST;
544 goto icmd_iconst_tail;
546 iptr[0].opc = ICMD_IUSHRCONST;
547 goto icmd_iconst_tail;
548 #if SUPPORT_LONG_SHIFT
550 iptr[0].opc = ICMD_LSHLCONST;
551 goto icmd_lconst_tail;
553 iptr[0].opc = ICMD_LSHRCONST;
554 goto icmd_lconst_tail;
556 iptr[0].opc = ICMD_LUSHRCONST;
557 goto icmd_lconst_tail;
558 #endif /* SUPPORT_LONG_SHIFT */
560 iptr[0].opc = ICMD_IFEQ;
562 iptr[0].op1 = iptr[1].op1;
563 /* IF_ICMPxx is the last instruction in the */
564 /* basic block, just remove it */
565 /* iptr[1].opc = ICMD_NOP; */
570 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
572 iptr[0].target = (void *) tbptr;
574 MARKREACHED(tbptr, copy);
575 COUNT(count_pcmd_bra);
578 iptr[0].opc = ICMD_IFLT;
579 goto icmd_if_icmp_tail;
581 iptr[0].opc = ICMD_IFLE;
582 goto icmd_if_icmp_tail;
584 iptr[0].opc = ICMD_IFNE;
585 goto icmd_if_icmp_tail;
587 iptr[0].opc = ICMD_IFGT;
588 goto icmd_if_icmp_tail;
590 iptr[0].opc = ICMD_IFGE;
591 goto icmd_if_icmp_tail;
593 #if SUPPORT_CONST_STORE
598 # if defined(ENABLE_INTRP)
601 # if SUPPORT_CONST_STORE_ZERO_ONLY
602 if (iptr[0].val.i == 0) {
603 # endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
604 switch (iptr[1].opc) {
606 iptr[0].opc = ICMD_IASTORECONST;
609 iptr[0].opc = ICMD_BASTORECONST;
612 iptr[0].opc = ICMD_CASTORECONST;
615 iptr[0].opc = ICMD_SASTORECONST;
619 iptr[1].opc = ICMD_NOP;
620 OPTT2_0(TYPE_INT, TYPE_ADR);
621 COUNT(count_pcmd_op);
622 # if SUPPORT_CONST_STORE_ZERO_ONLY
625 # endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
626 # if defined(ENABLE_INTRP)
634 # if defined(ENABLE_INTRP)
637 # if SUPPORT_CONST_STORE_ZERO_ONLY
638 if (iptr[0].val.i == 0) {
639 # endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
640 switch (iptr[1].opc) {
642 iptr[0].opc = ICMD_PUTSTATICCONST;
646 iptr[0].opc = ICMD_PUTFIELDCONST;
651 iptr[1].opc = ICMD_NOP;
652 iptr[0].op1 = TYPE_INT;
653 COUNT(count_pcmd_op);
654 # if SUPPORT_CONST_STORE_ZERO_ONLY
657 # endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
658 # if defined(ENABLE_INTRP)
663 #endif /* SUPPORT_CONST_STORE */
673 COUNT(count_pcmd_load);
675 switch (iptr[1].opc) {
678 iptr[0].opc = ICMD_LADDCONST;
680 iptr[1].opc = ICMD_NOP;
681 OP1_1(TYPE_LNG,TYPE_LNG);
682 COUNT(count_pcmd_op);
685 iptr[0].opc = ICMD_LSUBCONST;
686 goto icmd_lconst_tail;
687 #endif /* SUPPORT_LONG_ADD */
688 #if SUPPORT_LONG_MUL && SUPPORT_CONST_MUL
690 iptr[0].opc = ICMD_LMULCONST;
691 goto icmd_lconst_tail;
692 #else /* SUPPORT_LONG_MUL && SUPPORT_CONST_MUL */
693 # if SUPPORT_LONG_SHIFT
695 if (iptr[0].val.l == 0x00000002)
697 else if (iptr[0].val.l == 0x00000004)
699 else if (iptr[0].val.l == 0x00000008)
701 else if (iptr[0].val.l == 0x00000010)
703 else if (iptr[0].val.l == 0x00000020)
705 else if (iptr[0].val.l == 0x00000040)
707 else if (iptr[0].val.l == 0x00000080)
709 else if (iptr[0].val.l == 0x00000100)
711 else if (iptr[0].val.l == 0x00000200)
713 else if (iptr[0].val.l == 0x00000400)
715 else if (iptr[0].val.l == 0x00000800)
717 else if (iptr[0].val.l == 0x00001000)
719 else if (iptr[0].val.l == 0x00002000)
721 else if (iptr[0].val.l == 0x00004000)
723 else if (iptr[0].val.l == 0x00008000)
725 else if (iptr[0].val.l == 0x00010000)
727 else if (iptr[0].val.l == 0x00020000)
729 else if (iptr[0].val.l == 0x00040000)
731 else if (iptr[0].val.l == 0x00080000)
733 else if (iptr[0].val.l == 0x00100000)
735 else if (iptr[0].val.l == 0x00200000)
737 else if (iptr[0].val.l == 0x00400000)
739 else if (iptr[0].val.l == 0x00800000)
741 else if (iptr[0].val.l == 0x01000000)
743 else if (iptr[0].val.l == 0x02000000)
745 else if (iptr[0].val.l == 0x04000000)
747 else if (iptr[0].val.l == 0x08000000)
749 else if (iptr[0].val.l == 0x10000000)
751 else if (iptr[0].val.l == 0x20000000)
753 else if (iptr[0].val.l == 0x40000000)
755 else if (iptr[0].val.l == 0x80000000)
761 iptr[0].opc = ICMD_LMULPOW2;
762 goto icmd_lconst_tail;
763 # endif /* SUPPORT_LONG_SHIFT */
764 #endif /* SUPPORT_LONG_MUL && SUPPORT_CONST_MUL */
767 if (iptr[0].val.l == 0x00000002)
769 else if (iptr[0].val.l == 0x00000004)
771 else if (iptr[0].val.l == 0x00000008)
773 else if (iptr[0].val.l == 0x00000010)
775 else if (iptr[0].val.l == 0x00000020)
777 else if (iptr[0].val.l == 0x00000040)
779 else if (iptr[0].val.l == 0x00000080)
781 else if (iptr[0].val.l == 0x00000100)
783 else if (iptr[0].val.l == 0x00000200)
785 else if (iptr[0].val.l == 0x00000400)
787 else if (iptr[0].val.l == 0x00000800)
789 else if (iptr[0].val.l == 0x00001000)
791 else if (iptr[0].val.l == 0x00002000)
793 else if (iptr[0].val.l == 0x00004000)
795 else if (iptr[0].val.l == 0x00008000)
797 else if (iptr[0].val.l == 0x00010000)
799 else if (iptr[0].val.l == 0x00020000)
801 else if (iptr[0].val.l == 0x00040000)
803 else if (iptr[0].val.l == 0x00080000)
805 else if (iptr[0].val.l == 0x00100000)
807 else if (iptr[0].val.l == 0x00200000)
809 else if (iptr[0].val.l == 0x00400000)
811 else if (iptr[0].val.l == 0x00800000)
813 else if (iptr[0].val.l == 0x01000000)
815 else if (iptr[0].val.l == 0x02000000)
817 else if (iptr[0].val.l == 0x04000000)
819 else if (iptr[0].val.l == 0x08000000)
821 else if (iptr[0].val.l == 0x10000000)
823 else if (iptr[0].val.l == 0x20000000)
825 else if (iptr[0].val.l == 0x40000000)
827 else if (iptr[0].val.l == 0x80000000)
833 iptr[0].opc = ICMD_LDIVPOW2;
834 goto icmd_lconst_tail;
836 if ((iptr[0].val.l == 0x00000002) ||
837 (iptr[0].val.l == 0x00000004) ||
838 (iptr[0].val.l == 0x00000008) ||
839 (iptr[0].val.l == 0x00000010) ||
840 (iptr[0].val.l == 0x00000020) ||
841 (iptr[0].val.l == 0x00000040) ||
842 (iptr[0].val.l == 0x00000080) ||
843 (iptr[0].val.l == 0x00000100) ||
844 (iptr[0].val.l == 0x00000200) ||
845 (iptr[0].val.l == 0x00000400) ||
846 (iptr[0].val.l == 0x00000800) ||
847 (iptr[0].val.l == 0x00001000) ||
848 (iptr[0].val.l == 0x00002000) ||
849 (iptr[0].val.l == 0x00004000) ||
850 (iptr[0].val.l == 0x00008000) ||
851 (iptr[0].val.l == 0x00010000) ||
852 (iptr[0].val.l == 0x00020000) ||
853 (iptr[0].val.l == 0x00040000) ||
854 (iptr[0].val.l == 0x00080000) ||
855 (iptr[0].val.l == 0x00100000) ||
856 (iptr[0].val.l == 0x00200000) ||
857 (iptr[0].val.l == 0x00400000) ||
858 (iptr[0].val.l == 0x00800000) ||
859 (iptr[0].val.l == 0x01000000) ||
860 (iptr[0].val.l == 0x02000000) ||
861 (iptr[0].val.l == 0x04000000) ||
862 (iptr[0].val.l == 0x08000000) ||
863 (iptr[0].val.l == 0x10000000) ||
864 (iptr[0].val.l == 0x20000000) ||
865 (iptr[0].val.l == 0x40000000) ||
866 (iptr[0].val.l == 0x80000000)) {
867 iptr[0].opc = ICMD_LREMPOW2;
869 goto icmd_lconst_tail;
873 #endif /* SUPPORT_LONG_DIV */
874 #if SUPPORT_LONG_LOGICAL && SUPPORT_CONST_LOGICAL
877 iptr[0].opc = ICMD_LANDCONST;
878 goto icmd_lconst_tail;
880 iptr[0].opc = ICMD_LORCONST;
881 goto icmd_lconst_tail;
883 iptr[0].opc = ICMD_LXORCONST;
884 goto icmd_lconst_tail;
885 #endif /* SUPPORT_LONG_LOGICAL && SUPPORT_CONST_LOGICAL */
887 #if SUPPORT_LONG_CMP_CONST
889 if ((len > 1) && (iptr[2].val.i == 0)) {
890 switch (iptr[2].opc) {
892 iptr[0].opc = ICMD_IF_LEQ;
893 icmd_lconst_lcmp_tail:
894 iptr[0].op1 = iptr[2].op1;
897 /* iptr[1].opc = ICMD_NOP;
898 iptr[2].opc = ICMD_NOP; */
900 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
902 iptr[0].target = (void *) tbptr;
904 MARKREACHED(tbptr, copy);
905 COUNT(count_pcmd_bra);
906 COUNT(count_pcmd_op);
909 iptr[0].opc = ICMD_IF_LNE;
910 goto icmd_lconst_lcmp_tail;
912 iptr[0].opc = ICMD_IF_LLT;
913 goto icmd_lconst_lcmp_tail;
915 iptr[0].opc = ICMD_IF_LGT;
916 goto icmd_lconst_lcmp_tail;
918 iptr[0].opc = ICMD_IF_LLE;
919 goto icmd_lconst_lcmp_tail;
921 iptr[0].opc = ICMD_IF_LGE;
922 goto icmd_lconst_lcmp_tail;
925 } /* switch (iptr[2].opc) */
926 } /* if (iptr[2].val.i == 0) */
930 #endif /* SUPPORT_LONG_CMP_CONST */
932 #if SUPPORT_CONST_STORE
934 # if defined(ENABLE_INTRP)
937 # if SUPPORT_CONST_STORE_ZERO_ONLY
938 if (iptr[0].val.l == 0) {
939 # endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
940 iptr[0].opc = ICMD_LASTORECONST;
941 iptr[1].opc = ICMD_NOP;
942 OPTT2_0(TYPE_INT, TYPE_ADR);
943 COUNT(count_pcmd_op);
944 # if SUPPORT_CONST_STORE_ZERO_ONLY
947 # endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
948 # if defined(ENABLE_INTRP)
956 # if defined(ENABLE_INTRP)
959 # if SUPPORT_CONST_STORE_ZERO_ONLY
960 if (iptr[0].val.l == 0) {
961 # endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
962 switch (iptr[1].opc) {
964 iptr[0].opc = ICMD_PUTSTATICCONST;
968 iptr[0].opc = ICMD_PUTFIELDCONST;
973 iptr[1].opc = ICMD_NOP;
974 iptr[0].op1 = TYPE_LNG;
975 COUNT(count_pcmd_op);
976 # if SUPPORT_CONST_STORE_ZERO_ONLY
979 # endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
980 # if defined(ENABLE_INTRP)
985 #endif /* SUPPORT_CONST_STORE */
995 COUNT(count_pcmd_load);
1000 COUNT(count_pcmd_load);
1001 PUSHCONST(TYPE_DBL);
1005 COUNT(count_pcmd_load);
1006 #if SUPPORT_CONST_STORE
1007 # if defined(ENABLE_INTRP)
1010 if ((len > 0) && (iptr->val.a == 0)) {
1011 switch (iptr[1].opc) {
1013 case ICMD_PUTSTATIC:
1015 switch (iptr[1].opc) {
1017 iptr[0].opc = ICMD_AASTORECONST;
1018 OPTT2_0(TYPE_INT, TYPE_ADR);
1020 case ICMD_PUTSTATIC:
1021 iptr[0].opc = ICMD_PUTSTATICCONST;
1022 iptr[0].op1 = TYPE_ADR;
1026 iptr[0].opc = ICMD_PUTFIELDCONST;
1027 iptr[0].op1 = TYPE_ADR;
1032 iptr[1].opc = ICMD_NOP;
1033 COUNT(count_pcmd_op);
1037 PUSHCONST(TYPE_ADR);
1041 PUSHCONST(TYPE_ADR);
1042 # if defined(ENABLE_INTRP)
1044 PUSHCONST(TYPE_ADR);
1046 #else /* SUPPORT_CONST_STORE */
1047 PUSHCONST(TYPE_ADR);
1048 #endif /* SUPPORT_CONST_STORE */
1051 /* pop 0 push 1 load */
1058 COUNT(count_load_instruction);
1059 i = opcode - ICMD_ILOAD;
1060 iptr->op1 = argren[iptr->op1];
1061 #if defined(ENABLE_INTRP)
1064 rd->locals[iptr->op1][i].type = i;
1065 LOAD(i, LOCALVAR, iptr->op1);
1075 COUNT(count_check_null);
1076 COUNT(count_check_bound);
1077 COUNT(count_pcmd_mem);
1078 OP2IAT_1(opcode - ICMD_IALOAD);
1084 COUNT(count_check_null);
1085 COUNT(count_check_bound);
1086 COUNT(count_pcmd_mem);
1090 /* pop 0 push 0 iinc */
1093 #if defined(ENABLE_STATISTICS)
1097 count_store_depth[10]++;
1099 count_store_depth[i]++;
1105 if ((copy->varkind == LOCALVAR) &&
1106 (copy->varnum == iptr->op1)) {
1107 copy->varkind = TEMPVAR;
1114 /* allocate a dummy stack slot to keep ISTORE from */
1115 /* marking its input stack as a LOCALVAR, since we */
1116 /* change the value of the local variable here. */
1117 NEWSTACK0(TYPE_INT);
1123 /* pop 1 push 0 store */
1133 i = opcode - ICMD_ISTORE;
1134 #if defined(ENABLE_INTRP)
1137 rd->locals[iptr->op1][i].type = i;
1138 #if defined(ENABLE_STATISTICS)
1143 count_store_length[20]++;
1145 count_store_length[i]++;
1148 count_store_depth[10]++;
1150 count_store_depth[i]++;
1153 copy = curstack->prev;
1156 if ((copy->varkind == LOCALVAR) &&
1157 (copy->varnum == iptr->op1)) {
1158 copy->varkind = TEMPVAR;
1164 if ((new - curstack) == 1) {
1165 curstack->varkind = LOCALVAR;
1166 curstack->varnum = iptr->op1;
1168 STORE(opcode - ICMD_ISTORE);
1174 COUNT(count_check_null);
1175 COUNT(count_check_bound);
1176 COUNT(count_pcmd_mem);
1178 bte = builtintable_get_internal(BUILTIN_canstore);
1181 if (md->memuse > rd->memuse)
1182 rd->memuse = md->memuse;
1183 if (md->argintreguse > rd->argintreguse)
1184 rd->argintreguse = md->argintreguse;
1186 /* make all stack variables saved */
1190 copy->flags |= SAVEDVAR;
1201 COUNT(count_check_null);
1202 COUNT(count_check_bound);
1203 COUNT(count_pcmd_mem);
1204 OP3TIA_0(opcode - ICMD_IASTORE);
1210 COUNT(count_check_null);
1211 COUNT(count_check_bound);
1212 COUNT(count_pcmd_mem);
1219 #ifdef TYPECHECK_STACK_COMPCAT
1222 if (IS_2_WORD_TYPE(curstack->type)) {
1223 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1236 #if defined(ENABLE_JIT)
1237 # if defined(ENABLE_INTRP)
1240 md_return_alloc(m, rd, opcode - ICMD_IRETURN,
1243 COUNT(count_pcmd_return);
1244 OP1_0(opcode - ICMD_IRETURN);
1245 superblockend = true;
1249 COUNT(count_check_null);
1253 superblockend = true;
1256 case ICMD_PUTSTATIC:
1257 COUNT(count_pcmd_mem);
1261 /* pop 1 push 0 branch */
1264 case ICMD_IFNONNULL:
1265 COUNT(count_pcmd_bra);
1267 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1269 iptr[0].target = (void *) tbptr;
1271 MARKREACHED(tbptr, copy);
1280 COUNT(count_pcmd_bra);
1281 #if CONDITIONAL_LOADCONST
1282 # if defined(ENABLE_INTRP)
1285 tbptr = m->basicblocks + b_index;
1286 if ((b_count >= 3) &&
1287 ((b_index + 2) == m->basicblockindex[iptr[0].op1]) &&
1288 (tbptr[1].pre_count == 1) &&
1289 (tbptr[1].iinstr[0].opc == ICMD_ICONST) &&
1290 (tbptr[1].iinstr[1].opc == ICMD_GOTO) &&
1291 ((b_index + 3) == m->basicblockindex[tbptr[1].iinstr[1].op1]) &&
1292 (tbptr[2].pre_count == 1) &&
1293 (tbptr[2].iinstr[0].opc == ICMD_ICONST) &&
1294 (tbptr[2].icount==1)) {
1295 /*printf("tbptr[2].icount=%d\n",tbptr[2].icount);*/
1296 OP1_1(TYPE_INT, TYPE_INT);
1297 switch (iptr[0].opc) {
1299 iptr[0].opc = ICMD_IFNE_ICONST;
1302 iptr[0].opc = ICMD_IFEQ_ICONST;
1305 iptr[0].opc = ICMD_IFGE_ICONST;
1308 iptr[0].opc = ICMD_IFLT_ICONST;
1311 iptr[0].opc = ICMD_IFLE_ICONST;
1314 iptr[0].opc = ICMD_IFGT_ICONST;
1318 iptr[0].val.i = iptr[1].val.i;
1319 iptr[1].opc = ICMD_ELSE_ICONST;
1320 iptr[1].val.i = iptr[3].val.i;
1321 iptr[2].opc = ICMD_NOP;
1322 iptr[3].opc = ICMD_NOP;
1324 /* HACK: save compare value in iptr[1].op1 */
1325 iptr[1].op1 = iptr[0].val.i;
1326 iptr[0].val.i = tbptr[1].iinstr[0].val.i;
1327 iptr[1].opc = ICMD_ELSE_ICONST;
1328 iptr[1].val.i = tbptr[2].iinstr[0].val.i;
1329 tbptr[1].iinstr[0].opc = ICMD_NOP;
1330 tbptr[1].iinstr[1].opc = ICMD_NOP;
1331 tbptr[2].iinstr[0].opc = ICMD_NOP;
1333 tbptr[1].flags = BBDELETED;
1334 tbptr[2].flags = BBDELETED;
1335 tbptr[1].icount = 0;
1336 tbptr[2].icount = 0;
1337 if (tbptr[3].pre_count == 2) {
1338 len += tbptr[3].icount + 3;
1339 bptr->icount += tbptr[3].icount + 3;
1340 tbptr[3].flags = BBDELETED;
1341 tbptr[3].icount = 0;
1351 # if defined(ENABLE_INTRP)
1355 #endif /* CONDITIONAL_LOADCONST */
1359 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1361 iptr[0].target = (void *) tbptr;
1363 MARKREACHED(tbptr, copy);
1366 /* pop 0 push 0 branch */
1369 COUNT(count_pcmd_bra);
1370 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1372 iptr[0].target = (void *) tbptr;
1374 MARKREACHED(tbptr, copy);
1376 superblockend = true;
1379 /* pop 1 push 0 table branch */
1381 case ICMD_TABLESWITCH:
1382 COUNT(count_pcmd_table);
1384 s4ptr = iptr->val.a;
1385 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1386 MARKREACHED(tbptr, copy);
1387 i = *s4ptr++; /* low */
1388 i = *s4ptr++ - i + 1; /* high */
1390 tptr = DMNEW(void*, i+1);
1391 iptr->target = (void *) tptr;
1393 tptr[0] = (void *) tbptr;
1397 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1399 tptr[0] = (void *) tbptr;
1402 MARKREACHED(tbptr, copy);
1405 superblockend = true;
1408 /* pop 1 push 0 table branch */
1410 case ICMD_LOOKUPSWITCH:
1411 COUNT(count_pcmd_table);
1413 s4ptr = iptr->val.a;
1414 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1415 MARKREACHED(tbptr, copy);
1416 i = *s4ptr++; /* count */
1418 tptr = DMNEW(void*, i+1);
1419 iptr->target = (void *) tptr;
1421 tptr[0] = (void *) tbptr;
1425 tbptr = m->basicblocks + m->basicblockindex[s4ptr[1]];
1427 tptr[0] = (void *) tbptr;
1430 MARKREACHED(tbptr, copy);
1434 superblockend = true;
1437 case ICMD_MONITORENTER:
1438 COUNT(count_check_null);
1439 case ICMD_MONITOREXIT:
1443 /* pop 2 push 0 branch */
1445 case ICMD_IF_ICMPEQ:
1446 case ICMD_IF_ICMPNE:
1447 case ICMD_IF_ICMPLT:
1448 case ICMD_IF_ICMPGE:
1449 case ICMD_IF_ICMPGT:
1450 case ICMD_IF_ICMPLE:
1451 COUNT(count_pcmd_bra);
1453 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1455 iptr[0].target = (void *) tbptr;
1457 MARKREACHED(tbptr, copy);
1460 case ICMD_IF_ACMPEQ:
1461 case ICMD_IF_ACMPNE:
1462 COUNT(count_pcmd_bra);
1464 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1466 iptr[0].target = (void *) tbptr;
1468 MARKREACHED(tbptr, copy);
1474 COUNT(count_check_null);
1475 COUNT(count_pcmd_mem);
1476 OPTT2_0(iptr->op1,TYPE_ADR);
1481 if (!IS_2_WORD_TYPE(curstack->type)) {
1483 #ifdef TYPECHECK_STACK_COMPCAT
1486 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1487 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1492 OP1_0ANY; /* second pop */
1495 iptr->opc = ICMD_POP;
1499 /* pop 0 push 1 dup */
1502 #ifdef TYPECHECK_STACK_COMPCAT
1505 if (IS_2_WORD_TYPE(curstack->type)) {
1506 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1511 COUNT(count_dup_instruction);
1517 if (IS_2_WORD_TYPE(curstack->type)) {
1519 iptr->opc = ICMD_DUP;
1524 /* ..., ????, cat1 */
1525 #ifdef TYPECHECK_STACK_COMPCAT
1527 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1528 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1534 NEWSTACK(copy->prev->type, copy->prev->varkind,
1535 copy->prev->varnum);
1536 NEWSTACK(copy->type, copy->varkind,
1543 /* pop 2 push 3 dup */
1546 #ifdef TYPECHECK_STACK_COMPCAT
1549 if (IS_2_WORD_TYPE(curstack->type) ||
1550 IS_2_WORD_TYPE(curstack->prev->type)) {
1551 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1561 if (IS_2_WORD_TYPE(curstack->type)) {
1562 /* ..., ????, cat2 */
1563 #ifdef TYPECHECK_STACK_COMPCAT
1565 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1566 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1571 iptr->opc = ICMD_DUP_X1;
1575 /* ..., ????, cat1 */
1576 #ifdef TYPECHECK_STACK_COMPCAT
1579 if (IS_2_WORD_TYPE(curstack->prev->type)
1580 || IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1581 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1590 /* pop 3 push 4 dup */
1594 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1595 /* ..., cat2, ???? */
1596 #ifdef TYPECHECK_STACK_COMPCAT
1598 if (IS_2_WORD_TYPE(curstack->type)) {
1599 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1604 iptr->opc = ICMD_DUP_X1;
1608 /* ..., cat1, ???? */
1609 #ifdef TYPECHECK_STACK_COMPCAT
1612 if (IS_2_WORD_TYPE(curstack->type)
1613 || IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1614 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1625 if (IS_2_WORD_TYPE(curstack->type)) {
1626 /* ..., ????, cat2 */
1627 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1628 /* ..., cat2, cat2 */
1629 iptr->opc = ICMD_DUP_X1;
1633 /* ..., cat1, cat2 */
1634 #ifdef TYPECHECK_STACK_COMPCAT
1637 if (IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1638 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1643 iptr->opc = ICMD_DUP_X2;
1649 /* ..., ????, ????, cat1 */
1650 if (IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1651 /* ..., cat2, ????, cat1 */
1652 #ifdef TYPECHECK_STACK_COMPCAT
1654 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1655 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1660 iptr->opc = ICMD_DUP2_X1;
1664 /* ..., cat1, ????, cat1 */
1665 #ifdef TYPECHECK_STACK_COMPCAT
1668 if (IS_2_WORD_TYPE(curstack->prev->type)
1669 || IS_2_WORD_TYPE(curstack->prev->prev->prev->type)) {
1670 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1680 /* pop 2 push 2 swap */
1683 #ifdef TYPECHECK_STACK_COMPCAT
1686 if (IS_2_WORD_TYPE(curstack->type)
1687 || IS_2_WORD_TYPE(curstack->prev->type)) {
1688 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1700 #if !SUPPORT_DIVISION
1701 bte = (builtintable_entry *) iptr->val.a;
1705 if (md->memuse > rd->memuse)
1706 rd->memuse = md->memuse;
1707 if (md->argintreguse > rd->argintreguse)
1708 rd->argintreguse = md->argintreguse;
1710 /* make all stack variables saved */
1714 copy->flags |= SAVEDVAR;
1719 #endif /* !SUPPORT_DIVISION */
1730 COUNT(count_pcmd_op);
1736 #if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
1737 bte = (builtintable_entry *) iptr->val.a;
1741 if (md->memuse > rd->memuse)
1742 rd->memuse = md->memuse;
1743 if (md->argintreguse > rd->argintreguse)
1744 rd->argintreguse = md->argintreguse;
1746 /* make all stack variables saved */
1750 copy->flags |= SAVEDVAR;
1755 #endif /* !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV) */
1760 #if SUPPORT_LONG_LOGICAL
1764 #endif /* SUPPORT_LONG_LOGICAL */
1765 COUNT(count_pcmd_op);
1772 COUNT(count_pcmd_op);
1781 COUNT(count_pcmd_op);
1790 COUNT(count_pcmd_op);
1795 COUNT(count_pcmd_op);
1796 #if SUPPORT_LONG_CMP_CONST
1797 if ((len > 0) && (iptr[1].val.i == 0)) {
1798 switch (iptr[1].opc) {
1800 iptr[0].opc = ICMD_IF_LCMPEQ;
1802 iptr[0].op1 = iptr[1].op1;
1805 /* iptr[1].opc = ICMD_NOP; */
1807 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1809 iptr[0].target = (void *) tbptr;
1811 MARKREACHED(tbptr, copy);
1812 COUNT(count_pcmd_bra);
1815 iptr[0].opc = ICMD_IF_LCMPNE;
1816 goto icmd_lcmp_if_tail;
1818 iptr[0].opc = ICMD_IF_LCMPLT;
1819 goto icmd_lcmp_if_tail;
1821 iptr[0].opc = ICMD_IF_LCMPGT;
1822 goto icmd_lcmp_if_tail;
1824 iptr[0].opc = ICMD_IF_LCMPLE;
1825 goto icmd_lcmp_if_tail;
1827 iptr[0].opc = ICMD_IF_LCMPGE;
1828 goto icmd_lcmp_if_tail;
1830 OPTT2_1(TYPE_LNG, TYPE_INT);
1834 #endif /* SUPPORT_LONG_CMP_CONST */
1835 OPTT2_1(TYPE_LNG, TYPE_INT);
1839 COUNT(count_pcmd_op);
1840 OPTT2_1(TYPE_FLT, TYPE_INT);
1844 COUNT(count_pcmd_op);
1845 OPTT2_1(TYPE_DBL, TYPE_INT);
1853 case ICMD_INT2SHORT:
1854 COUNT(count_pcmd_op);
1855 OP1_1(TYPE_INT, TYPE_INT);
1858 COUNT(count_pcmd_op);
1859 OP1_1(TYPE_LNG, TYPE_LNG);
1862 COUNT(count_pcmd_op);
1863 OP1_1(TYPE_FLT, TYPE_FLT);
1866 COUNT(count_pcmd_op);
1867 OP1_1(TYPE_DBL, TYPE_DBL);
1871 COUNT(count_pcmd_op);
1872 OP1_1(TYPE_INT, TYPE_LNG);
1875 COUNT(count_pcmd_op);
1876 OP1_1(TYPE_INT, TYPE_FLT);
1879 COUNT(count_pcmd_op);
1880 OP1_1(TYPE_INT, TYPE_DBL);
1883 COUNT(count_pcmd_op);
1884 OP1_1(TYPE_LNG, TYPE_INT);
1887 COUNT(count_pcmd_op);
1888 OP1_1(TYPE_LNG, TYPE_FLT);
1891 COUNT(count_pcmd_op);
1892 OP1_1(TYPE_LNG, TYPE_DBL);
1895 COUNT(count_pcmd_op);
1896 OP1_1(TYPE_FLT, TYPE_INT);
1899 COUNT(count_pcmd_op);
1900 OP1_1(TYPE_FLT, TYPE_LNG);
1903 COUNT(count_pcmd_op);
1904 OP1_1(TYPE_FLT, TYPE_DBL);
1907 COUNT(count_pcmd_op);
1908 OP1_1(TYPE_DBL, TYPE_INT);
1911 COUNT(count_pcmd_op);
1912 OP1_1(TYPE_DBL, TYPE_LNG);
1915 COUNT(count_pcmd_op);
1916 OP1_1(TYPE_DBL, TYPE_FLT);
1919 case ICMD_CHECKCAST:
1920 if (iptr->op1 == 0) {
1921 /* array type cast-check */
1923 bte = builtintable_get_internal(BUILTIN_arraycheckcast);
1926 if (md->memuse > rd->memuse)
1927 rd->memuse = md->memuse;
1928 if (md->argintreguse > rd->argintreguse)
1929 rd->argintreguse = md->argintreguse;
1931 /* make all stack variables saved */
1935 copy->flags |= SAVEDVAR;
1939 OP1_1(TYPE_ADR, TYPE_ADR);
1942 case ICMD_INSTANCEOF:
1943 case ICMD_ARRAYLENGTH:
1944 OP1_1(TYPE_ADR, TYPE_INT);
1948 case ICMD_ANEWARRAY:
1949 OP1_1(TYPE_INT, TYPE_ADR);
1953 COUNT(count_check_null);
1954 COUNT(count_pcmd_mem);
1955 OP1_1(TYPE_ADR, iptr->op1);
1960 case ICMD_GETSTATIC:
1961 COUNT(count_pcmd_mem);
1971 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1973 iptr[0].target = (void *) tbptr;
1975 /* This is a dirty hack. The typechecker
1976 * needs it because the OP1_0ANY below
1977 * overwrites iptr->dst.
1979 iptr->val.a = (void *) iptr->dst;
1981 tbptr->type = BBTYPE_SBR;
1983 /* We need to check for overflow right here because
1984 * the pushed value is poped after MARKREACHED. */
1986 MARKREACHED(tbptr, copy);
1990 /* pop many push any */
1993 #if defined(USEBUILTINTABLE)
1996 bte = (builtintable_entry *) iptr->val.a;
2000 case ICMD_INVOKESTATIC:
2001 case ICMD_INVOKESPECIAL:
2002 case ICMD_INVOKEVIRTUAL:
2003 case ICMD_INVOKEINTERFACE:
2004 COUNT(count_pcmd_met);
2006 md = um->methodref->parseddesc.md;
2007 /* if (lm->flags & ACC_STATIC) */
2008 /* {COUNT(count_check_null);} */
2013 if (md->memuse > rd->memuse)
2014 rd->memuse = md->memuse;
2015 if (md->argintreguse > rd->argintreguse)
2016 rd->argintreguse = md->argintreguse;
2017 if (md->argfltreguse > rd->argfltreguse)
2018 rd->argfltreguse = md->argfltreguse;
2023 for (i-- ; i >= 0; i--) {
2024 #if defined(SUPPORT_PASS_FLOATARGS_IN_INTREGS)
2025 /* If we pass float arguments in integer argument registers, we
2026 * are not allowed to precolor them here. Floats have to be moved
2027 * to this regs explicitly in codegen().
2028 * Only arguments that are passed by stack anyway can be precolored
2029 * (michi 2005/07/24) */
2030 if (!(copy->flags & SAVEDVAR) &&
2031 (!IS_FLT_DBL_TYPE(copy->type) || md->params[i].inmemory)) {
2033 if (!(copy->flags & SAVEDVAR)) {
2035 copy->varkind = ARGVAR;
2038 #if defined(ENABLE_INTRP)
2041 if (md->params[i].inmemory) {
2042 copy->flags = INMEMORY;
2043 copy->regoff = md->params[i].regoff;
2046 if (IS_FLT_DBL_TYPE(copy->type))
2047 #if defined(SUPPORT_PASS_FLOATARGS_IN_INTREGS)
2048 assert(0); /* XXX is this assert ok? */
2051 rd->argfltregs[md->params[i].regoff];
2054 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2055 if (IS_2_WORD_TYPE(copy->type))
2056 copy->regoff = PACK_REGS(
2057 rd->argintregs[GET_LOW_REG(md->params[i].regoff)],
2058 rd->argintregs[GET_HIGH_REG(md->params[i].regoff)]);
2062 rd->argintregs[md->params[i].regoff];
2065 #if defined(ENABLE_INTRP)
2073 copy->flags |= SAVEDVAR;
2079 if (md->returntype.type != TYPE_VOID)
2080 OP0_1(md->returntype.type);
2083 case ICMD_INLINE_START:
2084 case ICMD_INLINE_END:
2088 case ICMD_MULTIANEWARRAY:
2089 if (rd->argintreguse < 3)
2090 rd->argintreguse = 3;
2095 #if defined(SPECIALMEMUSE)
2096 # if defined(__DARWIN__)
2097 if (rd->memuse < (i + INT_ARG_CNT + LA_WORD_SIZE))
2098 rd->memuse = i + LA_WORD_SIZE + INT_ARG_CNT;
2100 if (rd->memuse < (i + LA_WORD_SIZE + 3))
2101 rd->memuse = i + LA_WORD_SIZE + 3;
2104 # if defined(__I386__)
2105 if (rd->memuse < i + 3)
2106 rd->memuse = i + 3; /* n integer args spilled on stack */
2107 # elif defined(__MIPS__) && SIZEOF_VOID_P == 4
2108 if (rd->memuse < i + 2)
2109 rd->memuse = i + 2; /* 4*4 bytes callee save space */
2112 rd->memuse = i; /* n integer args spilled on stack */
2113 # endif /* defined(__I386__) */
2117 /* check INT type here? Currently typecheck does this. */
2118 if (!(copy->flags & SAVEDVAR)) {
2119 copy->varkind = ARGVAR;
2120 copy->varnum = i + INT_ARG_CNT;
2121 copy->flags |= INMEMORY;
2122 #if defined(SPECIALMEMUSE)
2123 # if defined(__DARWIN__)
2124 copy->regoff = i + LA_WORD_SIZE + INT_ARG_CNT;
2126 copy->regoff = i + LA_WORD_SIZE + 3;
2129 # if defined(__I386__)
2130 copy->regoff = i + 3;
2131 # elif defined(__MIPS__) && SIZEOF_VOID_P == 4
2132 copy->regoff = i + 2;
2135 # endif /* defined(__I386__) */
2136 #endif /* defined(SPECIALMEMUSE) */
2141 copy->flags |= SAVEDVAR;
2149 case ICMD_CLEAR_ARGREN:
2150 for (i = iptr->op1; i < cd->maxlocals; i++)
2152 iptr->opc = opcode = ICMD_NOP;
2156 case ICMD_READONLY_ARG:
2157 case ICMD_READONLY_ARG+1:
2158 case ICMD_READONLY_ARG+2:
2159 case ICMD_READONLY_ARG+3:
2160 case ICMD_READONLY_ARG+4:
2163 if (curstack->varkind == LOCALVAR) {
2164 i = curstack->varnum;
2165 argren[iptr->op1] = i;
2168 opcode = iptr->opc = opcode - ICMD_READONLY_ARG + ICMD_ISTORE;
2175 new_internalerror("Unknown ICMD %d", opcode);
2181 } /* while instructions */
2183 bptr->outstack = curstack;
2184 bptr->outdepth = stackdepth;
2188 superblockend = true;
2190 } /* while blocks */
2191 } while (repeat && !deadcode);
2193 #if defined(ENABLE_STATISTICS)
2195 if (m->basicblockcount > count_max_basic_blocks)
2196 count_max_basic_blocks = m->basicblockcount;
2197 count_basic_blocks += m->basicblockcount;
2198 if (m->instructioncount > count_max_javainstr) count_max_javainstr = m->instructioncount;
2199 count_javainstr += m->instructioncount;
2200 if (m->stackcount > count_upper_bound_new_stack)
2201 count_upper_bound_new_stack = m->stackcount;
2202 if ((new - m->stack) > count_max_new_stack)
2203 count_max_new_stack = (new - m->stack);
2205 b_count = m->basicblockcount;
2206 bptr = m->basicblocks;
2207 while (--b_count >= 0) {
2208 if (bptr->flags > BBREACHED) {
2209 if (bptr->indepth >= 10)
2210 count_block_stack[10]++;
2212 count_block_stack[bptr->indepth]++;
2215 count_block_size_distribution[len]++;
2217 count_block_size_distribution[10]++;
2219 count_block_size_distribution[11]++;
2221 count_block_size_distribution[12]++;
2223 count_block_size_distribution[13]++;
2225 count_block_size_distribution[14]++;
2227 count_block_size_distribution[15]++;
2229 count_block_size_distribution[16]++;
2231 count_block_size_distribution[17]++;
2237 count_analyse_iterations[0]++;
2238 else if (loops == 2)
2239 count_analyse_iterations[1]++;
2240 else if (loops == 3)
2241 count_analyse_iterations[2]++;
2242 else if (loops == 4)
2243 count_analyse_iterations[3]++;
2245 count_analyse_iterations[4]++;
2247 if (m->basicblockcount <= 5)
2248 count_method_bb_distribution[0]++;
2249 else if (m->basicblockcount <= 10)
2250 count_method_bb_distribution[1]++;
2251 else if (m->basicblockcount <= 15)
2252 count_method_bb_distribution[2]++;
2253 else if (m->basicblockcount <= 20)
2254 count_method_bb_distribution[3]++;
2255 else if (m->basicblockcount <= 30)
2256 count_method_bb_distribution[4]++;
2257 else if (m->basicblockcount <= 40)
2258 count_method_bb_distribution[5]++;
2259 else if (m->basicblockcount <= 50)
2260 count_method_bb_distribution[6]++;
2261 else if (m->basicblockcount <= 75)
2262 count_method_bb_distribution[7]++;
2264 count_method_bb_distribution[8]++;
2266 #endif /* defined(ENABLE_STATISTICS) */
2268 /* just return methodinfo* to signal everything was ok */
2274 /* debugging helpers **********************************************************/
2276 void icmd_print_stack(codegendata *cd, stackptr s)
2288 j = cd->maxstack - i;
2294 if (s->flags & SAVEDVAR)
2295 switch (s->varkind) {
2297 if (s->flags & INMEMORY)
2298 printf(" M%02d", s->regoff);
2299 #ifdef HAS_ADDRESS_REGISTER_FILE
2300 else if (s->type == TYPE_ADR)
2301 printf(" R%02d", s->regoff);
2303 else if (IS_FLT_DBL_TYPE(s->type))
2304 printf(" F%02d", s->regoff);
2306 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2307 if (IS_2_WORD_TYPE(s->type))
2308 printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
2309 regs[GET_HIGH_REG(s->regoff)]);
2313 #if defined(ENABLE_JIT)
2314 # if defined(ENABLE_INTRP)
2316 printf(" %3d", s->regoff);
2319 printf(" %3s", regs[s->regoff]);
2321 printf(" %3d", s->regoff);
2327 printf(" I%02d", s->varnum);
2330 printf(" L%02d", s->varnum);
2333 if (s->varnum == -1) {
2335 /* varkind ARGVAR "misused for this special case */
2337 } else /* "normal" Argvar */
2338 printf(" A%02d", s->varnum);
2341 printf(" !%02d", j);
2344 switch (s->varkind) {
2346 if (s->flags & INMEMORY)
2347 printf(" m%02d", s->regoff);
2348 #ifdef HAS_ADDRESS_REGISTER_FILE
2349 else if (s->type == TYPE_ADR)
2350 printf(" r%02d", s->regoff);
2352 else if (IS_FLT_DBL_TYPE(s->type))
2353 printf(" f%02d", s->regoff);
2355 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2356 if (IS_2_WORD_TYPE(s->type))
2357 printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
2358 regs[GET_HIGH_REG(s->regoff)]);
2362 #if defined(ENABLE_JIT)
2363 # if defined(ENABLE_INTRP)
2365 printf(" %3d", s->regoff);
2368 printf(" %3s", regs[s->regoff]);
2370 printf(" %3d", s->regoff);
2376 printf(" i%02d", s->varnum);
2379 printf(" l%02d", s->varnum);
2382 if (s->varnum == -1) {
2384 /* varkind ARGVAR "misused for this special case */
2386 } else /* "normal" Argvar */
2387 printf(" a%02d", s->varnum);
2390 printf(" ?%02d", j);
2398 static void print_reg(stackptr s) {
2400 if (s->flags & SAVEDVAR)
2401 switch (s->varkind) {
2403 if (s->flags & INMEMORY)
2404 printf(" tm%02d", s->regoff);
2406 printf(" tr%02d", s->regoff);
2409 printf(" s %02d", s->varnum);
2412 printf(" l %02d", s->varnum);
2415 printf(" a %02d", s->varnum);
2418 printf(" ! %02d", s->varnum);
2421 switch (s->varkind) {
2423 if (s->flags & INMEMORY)
2424 printf(" Tm%02d", s->regoff);
2426 printf(" Tr%02d", s->regoff);
2429 printf(" S %02d", s->varnum);
2432 printf(" L %02d", s->varnum);
2435 printf(" A %02d", s->varnum);
2438 printf(" ? %02d", s->varnum);
2448 static char *jit_type[] = {
2457 /* show_icmd_method ************************************************************
2461 *******************************************************************************/
2463 #if !defined(NDEBUG)
2464 void show_icmd_method(methodinfo *m, codegendata *cd, registerdata *rd)
2471 #if defined(USE_THREADS)
2472 /* We need to enter a lock here, since the binutils disassembler
2473 is not reentrant-able and we could not read functions printed
2474 at the same time. */
2476 builtin_monitorenter(lock_show_icmd);
2483 printf("\nBasic blocks: %d\n", m->basicblockcount);
2484 printf("Max locals: %d\n", cd->maxlocals);
2485 printf("Max stack: %d\n", cd->maxstack);
2486 printf("Line number table length: %d\n", m->linenumbercount);
2488 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
2489 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
2490 printf(" L%03d ... ", ex->start->debug_nr );
2491 printf("L%03d = ", ex->end->debug_nr);
2492 printf("L%03d", ex->handler->debug_nr);
2493 printf(" (catchtype: ");
2494 if (ex->catchtype.any)
2495 if (IS_CLASSREF(ex->catchtype))
2496 utf_display_classname(ex->catchtype.ref->name);
2498 utf_display_classname(ex->catchtype.cls->name);
2504 printf("Local Table:\n");
2505 for (i = 0; i < cd->maxlocals; i++) {
2506 printf(" %3d: ", i);
2508 #if defined(ENABLE_JIT)
2509 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
2510 # if defined(ENABLE_INTRP)
2513 if (rd->locals[i][j].type >= 0) {
2514 printf(" (%s) ", jit_type[j]);
2515 if (rd->locals[i][j].flags & INMEMORY)
2516 printf("m%2d", rd->locals[i][j].regoff);
2517 # ifdef HAS_ADDRESS_REGISTER_FILE
2518 else if (j == TYPE_ADR)
2519 printf("r%02d", rd->locals[i][j].regoff);
2521 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2522 printf("f%02d", rd->locals[i][j].regoff);
2524 # if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2525 if (IS_2_WORD_TYPE(j))
2527 regs[GET_LOW_REG(rd->locals[i][j].regoff)],
2528 regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
2531 printf("%3s", regs[rd->locals[i][j].regoff]);
2534 # if defined(ENABLE_INTRP)
2538 #endif /* defined(ENABLE_JIT) */
2544 #if defined(ENABLE_LSRA)
2547 #if defined(ENABLE_INTRP)
2550 printf("Interface Table:\n");
2551 for (i = 0; i < cd->maxstack; i++) {
2552 if ((rd->interfaces[i][0].type >= 0) ||
2553 (rd->interfaces[i][1].type >= 0) ||
2554 (rd->interfaces[i][2].type >= 0) ||
2555 (rd->interfaces[i][3].type >= 0) ||
2556 (rd->interfaces[i][4].type >= 0)) {
2557 printf(" %3d: ", i);
2559 #if defined(ENABLE_JIT)
2560 # if defined(ENABLE_INTRP)
2563 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
2564 if (rd->interfaces[i][j].type >= 0) {
2565 printf(" (%s) ", jit_type[j]);
2566 if (rd->interfaces[i][j].flags & SAVEDVAR) {
2567 if (rd->interfaces[i][j].flags & INMEMORY)
2568 printf("M%2d", rd->interfaces[i][j].regoff);
2569 #ifdef HAS_ADDRESS_REGISTER_FILE
2570 else if (j == TYPE_ADR)
2571 printf("R%02d", rd->interfaces[i][j].regoff);
2573 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2574 printf("F%02d", rd->interfaces[i][j].regoff);
2576 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2577 if (IS_2_WORD_TYPE(j))
2579 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
2580 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
2583 printf("%3s",regs[rd->interfaces[i][j].regoff]);
2587 if (rd->interfaces[i][j].flags & INMEMORY)
2588 printf("m%2d", rd->interfaces[i][j].regoff);
2589 #ifdef HAS_ADDRESS_REGISTER_FILE
2590 else if (j == TYPE_ADR)
2591 printf("r%02d", rd->interfaces[i][j].regoff);
2593 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2594 printf("f%02d", rd->interfaces[i][j].regoff);
2596 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2597 if (IS_2_WORD_TYPE(j))
2599 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
2600 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
2603 printf("%3s",regs[rd->interfaces[i][j].regoff]);
2609 # if defined(ENABLE_INTRP)
2612 #endif /* defined(ENABLE_JIT) */
2618 #if defined(ENABLE_INTRP)
2621 #if defined(ENABLE_LSRA)
2625 /* show code before first basic block */
2627 if (opt_showdisassemble) {
2628 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen);
2630 for (; u1ptr < (u1 *) ((ptrint) m->mcode + cd->dseglen + m->basicblocks[0].mpc);)
2636 /* show code of all basic blocks */
2638 for (bptr = m->basicblocks; bptr != NULL; bptr = bptr->next) {
2639 show_icmd_block(m, cd, bptr);
2642 /* show stubs code */
2644 if (opt_showdisassemble && opt_showexceptionstubs) {
2645 printf("\nException stubs code:\n");
2646 printf("Length: %d\n\n", (s4) (m->mcodelength -
2647 ((ptrint) cd->dseglen +
2648 m->basicblocks[m->basicblockcount].mpc)));
2650 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen +
2651 m->basicblocks[m->basicblockcount].mpc);
2653 for (; (ptrint) u1ptr < ((ptrint) m->mcode + m->mcodelength);)
2659 #if defined(USE_THREADS)
2660 builtin_monitorexit(lock_show_icmd);
2663 #endif /* !defined(NDEBUG) */
2666 /* show_icmd_block *************************************************************
2670 *******************************************************************************/
2672 #if !defined(NDEBUG)
2673 void show_icmd_block(methodinfo *m, codegendata *cd, basicblock *bptr)
2680 if (bptr->flags != BBDELETED) {
2681 deadcode = bptr->flags <= BBREACHED;
2686 for (j = cd->maxstack; j > 0; j--)
2689 icmd_print_stack(cd, bptr->instack);
2691 printf("] L%03d(instruction count: %d, predecessors: %d):\n",
2692 bptr->debug_nr, bptr->icount, bptr->pre_count);
2694 iptr = bptr->iinstr;
2696 for (i = 0; i < bptr->icount; i++, iptr++) {
2700 for (j = cd->maxstack; j > 0; j--)
2703 icmd_print_stack(cd, iptr->dst);
2705 printf("] %5d (line: %5d) ", i, iptr->line);
2707 show_icmd(iptr, deadcode);
2711 if (opt_showdisassemble && (!deadcode)) {
2713 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen + bptr->mpc);
2715 if (bptr->next != NULL) {
2716 for (; u1ptr < (u1 *) ((ptrint) m->mcode + cd->dseglen + bptr->next->mpc);)
2720 for (; u1ptr < (u1 *) ((ptrint) m->mcode + m->mcodelength);)
2727 #endif /* !defined(NDEBUG) */
2730 /* show_icmd *******************************************************************
2734 *******************************************************************************/
2736 #if !defined(NDEBUG)
2737 void show_icmd(instruction *iptr, bool deadcode)
2743 printf("%s", icmd_names[iptr->opc]);
2745 switch (iptr->opc) {
2746 case ICMD_IADDCONST:
2747 case ICMD_ISUBCONST:
2748 case ICMD_IMULCONST:
2752 case ICMD_IANDCONST:
2754 case ICMD_IXORCONST:
2755 case ICMD_ISHLCONST:
2756 case ICMD_ISHRCONST:
2757 case ICMD_IUSHRCONST:
2758 case ICMD_LSHLCONST:
2759 case ICMD_LSHRCONST:
2760 case ICMD_LUSHRCONST:
2762 case ICMD_IASTORECONST:
2763 case ICMD_BASTORECONST:
2764 case ICMD_CASTORECONST:
2765 case ICMD_SASTORECONST:
2766 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
2769 case ICMD_IFEQ_ICONST:
2770 case ICMD_IFNE_ICONST:
2771 case ICMD_IFLT_ICONST:
2772 case ICMD_IFGE_ICONST:
2773 case ICMD_IFGT_ICONST:
2774 case ICMD_IFLE_ICONST:
2775 printf(" %d, %d (0x%08x)", iptr[1].op1, iptr->val.i, iptr->val.i);
2778 case ICMD_ELSE_ICONST:
2779 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
2782 case ICMD_LADDCONST:
2783 case ICMD_LSUBCONST:
2784 case ICMD_LMULCONST:
2788 case ICMD_LANDCONST:
2790 case ICMD_LXORCONST:
2792 case ICMD_LASTORECONST:
2793 #if SIZEOF_VOID_P == 4
2794 printf(" %lld (0x%016llx)", iptr->val.l, iptr->val.l);
2796 printf(" %ld (0x%016lx)", iptr->val.l, iptr->val.l);
2801 printf(" %f (0x%08x)", iptr->val.f, iptr->val.i);
2805 #if SIZEOF_VOID_P == 4
2806 printf(" %g (0x%016llx)", iptr->val.d, iptr->val.l);
2808 printf(" %g (0x%016lx)", iptr->val.d, iptr->val.l);
2813 case ICMD_AASTORECONST:
2814 /* check if this is a constant string or a class reference */
2818 printf(" %p", iptr->val.a);
2820 printf(" (NOT RESOLVED)");
2822 printf(", Class = \"");
2823 utf_display(((constant_classref *) iptr->target)->name);
2827 printf(" %p", iptr->val.a);
2829 printf(", String = \"");
2830 utf_display(javastring_toutf(iptr->val.a, false));
2839 printf(" %d, ", ((fieldinfo *) iptr->val.a)->offset);
2841 printf(" (NOT RESOLVED), ");
2842 utf_display_classname(((unresolved_field *) iptr->target)->fieldref->classref->name);
2844 utf_display(((unresolved_field *) iptr->target)->fieldref->name);
2846 utf_display(((unresolved_field *) iptr->target)->fieldref->descriptor);
2850 case ICMD_PUTSTATIC:
2851 case ICMD_GETSTATIC:
2853 if (!CLASS_IS_OR_ALMOST_INITIALIZED(((fieldinfo *) iptr->val.a)->class))
2854 printf(" (NOT INITIALIZED) ");
2858 printf(" (NOT RESOLVED) ");
2859 utf_display_classname(((unresolved_field *) iptr->target)->fieldref->classref->name);
2861 utf_display(((unresolved_field *) iptr->target)->fieldref->name);
2863 utf_display(((unresolved_field *) iptr->target)->fieldref->descriptor);
2867 case ICMD_PUTSTATICCONST:
2868 case ICMD_PUTFIELDCONST:
2869 switch (iptr[1].op1) {
2871 printf(" %d (0x%08x),", iptr->val.i, iptr->val.i);
2874 #if SIZEOF_VOID_P == 4
2875 printf(" %lld (0x%016llx),", iptr->val.l, iptr->val.l);
2877 printf(" %ld (0x%016lx),", iptr->val.l, iptr->val.l);
2881 printf(" %p,", iptr->val.a);
2884 printf(" %g (0x%08x),", iptr->val.f, iptr->val.i);
2887 #if SIZEOF_VOID_P == 4
2888 printf(" %g (0x%016llx),", iptr->val.d, iptr->val.l);
2890 printf(" %g (0x%016lx),", iptr->val.d, iptr->val.l);
2894 if (iptr->opc == ICMD_PUTFIELDCONST) {
2896 printf(" %d,", ((fieldinfo *) iptr[1].val.a)->offset);
2898 printf(" (NOT RESOLVED),");
2901 utf_display_classname(((unresolved_field *) iptr[1].target)->fieldref->classref->name);
2903 utf_display(((unresolved_field *) iptr[1].target)->fieldref->name);
2905 utf_display(((unresolved_field *) iptr[1].target)->fieldref->descriptor);
2910 printf(" %d + %d", iptr->op1, iptr->val.i);
2945 printf(" %d", iptr->op1);
2950 utf_display_classname(((classinfo *) iptr->val.a)->name);
2954 switch (iptr->op1) {
2982 case ICMD_ANEWARRAY:
2985 utf_display_classname(((classinfo *) iptr->val.a)->name);
2989 case ICMD_MULTIANEWARRAY:
2990 if (iptr->val.a == NULL) {
2991 printf(" (NOT RESOLVED) %d ", iptr->op1);
2992 utf_display(((constant_classref *) iptr->target)->name);
2994 printf(" %d ",iptr->op1);
2995 utf_display_classname(((classinfo *) iptr->val.a)->name);
2999 case ICMD_CHECKCAST:
3000 case ICMD_INSTANCEOF:
3002 classinfo *c = iptr->val.a;
3004 if (c->flags & ACC_INTERFACE)
3005 printf(" (INTERFACE) ");
3007 printf(" (CLASS,%3d) ", c->vftbl->diffval);
3009 printf(" (NOT RESOLVED) ");
3011 utf_display_classname(((constant_classref *) iptr->target)->name);
3015 case ICMD_INLINE_START:
3017 utf_display_classname(iptr->method->class->name);
3019 utf_display_classname(iptr->method->name);
3020 utf_display_classname(iptr->method->descriptor);
3021 printf(", depth=%i", iptr->op1);
3024 case ICMD_INLINE_END:
3028 printf(" %s", ((builtintable_entry *) iptr->val.a)->name);
3031 case ICMD_INVOKEVIRTUAL:
3032 case ICMD_INVOKESPECIAL:
3033 case ICMD_INVOKESTATIC:
3034 case ICMD_INVOKEINTERFACE:
3036 printf(" (NOT RESOLVED) ");
3039 utf_display_classname(((unresolved_method *) iptr->target)->methodref->classref->name);
3041 utf_display(((unresolved_method *) iptr->target)->methodref->name);
3042 utf_display(((unresolved_method *) iptr->target)->methodref->descriptor);
3051 if (deadcode || !iptr->target)
3052 printf(" %d (0x%08x) op1=%d", iptr->val.i, iptr->val.i, iptr->op1);
3054 printf(" %d (0x%08x) L%03d", iptr->val.i, iptr->val.i, ((basicblock *) iptr->target)->debug_nr);
3063 if (deadcode || !iptr->target)
3064 #if SIZEOF_VOID_P == 4
3065 printf("(%lld) op1=%d", iptr->val.l, iptr->op1);
3067 printf("(%ld) op1=%d", iptr->val.l, iptr->op1);
3070 #if SIZEOF_VOID_P == 4
3071 printf("(%lld) L%03d", iptr->val.l, ((basicblock *) iptr->target)->debug_nr);
3073 printf("(%ld) L%03d", iptr->val.l, ((basicblock *) iptr->target)->debug_nr);
3080 case ICMD_IFNONNULL:
3081 case ICMD_IF_ICMPEQ:
3082 case ICMD_IF_ICMPNE:
3083 case ICMD_IF_ICMPLT:
3084 case ICMD_IF_ICMPGE:
3085 case ICMD_IF_ICMPGT:
3086 case ICMD_IF_ICMPLE:
3087 case ICMD_IF_LCMPEQ:
3088 case ICMD_IF_LCMPNE:
3089 case ICMD_IF_LCMPLT:
3090 case ICMD_IF_LCMPGE:
3091 case ICMD_IF_LCMPGT:
3092 case ICMD_IF_LCMPLE:
3093 case ICMD_IF_ACMPEQ:
3094 case ICMD_IF_ACMPNE:
3095 if (deadcode || !iptr->target)
3096 printf(" op1=%d", iptr->op1);
3098 printf(" L%03d", ((basicblock *) iptr->target)->debug_nr);
3101 case ICMD_TABLESWITCH:
3102 s4ptr = (s4*)iptr->val.a;
3104 if (deadcode || !iptr->target) {
3105 printf(" %d;", *s4ptr);
3108 tptr = (void **) iptr->target;
3109 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
3113 s4ptr++; /* skip default */
3114 j = *s4ptr++; /* low */
3115 j = *s4ptr++ - j; /* high */
3117 if (deadcode || !*tptr)
3118 printf(" %d", *s4ptr++);
3120 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
3127 case ICMD_LOOKUPSWITCH:
3128 s4ptr = (s4*)iptr->val.a;
3130 if (deadcode || !iptr->target) {
3131 printf(" %d;", *s4ptr);
3134 tptr = (void **) iptr->target;
3135 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
3138 s4ptr++; /* default */
3139 j = *s4ptr++; /* count */
3142 if (deadcode || !*tptr) {
3143 s4ptr++; /* skip value */
3144 printf(" %d",*s4ptr++);
3147 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
3155 printf(" (NOT RESOLVED), Class = \"");
3156 utf_display(((unresolved_class *) iptr->val.a)->classref->name);
3161 #endif /* !defined(NDEBUG) */
3165 * These are local overrides for various environment variables in Emacs.
3166 * Please do not remove this and leave it at the end of the file, where
3167 * Emacs will automagically detect them.
3168 * ---------------------------------------------------------------------
3171 * indent-tabs-mode: t
3175 * vim:noexpandtab:sw=4:ts=4: