1 /* src/vm/jit/stack.c - stack analysis
3 Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
4 R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
5 C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
6 Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25 Contact: cacao@complang.tuwien.ac.at
27 Authors: Andreas Krall
29 Changes: Edwin Steiner
33 $Id: stack.c 3969 2005-12-21 00:07:23Z twisti $
47 #include "mm/memory.h"
48 #include "native/native.h"
49 #include "toolbox/logging.h"
50 #include "vm/global.h"
51 #include "vm/builtin.h"
52 #include "vm/options.h"
53 #include "vm/resolve.h"
54 #include "vm/statistics.h"
55 #include "vm/stringlocal.h"
56 #include "vm/jit/codegen.inc.h"
57 #include "vm/jit/disass.h"
58 #include "vm/jit/jit.h"
59 #include "vm/jit/reg.h"
60 #include "vm/jit/stack.h"
61 #include "vm/jit/lsra.h"
64 /* global variables ***********************************************************/
66 #if defined(USE_THREADS)
67 static java_objectheader *lock_show_icmd;
71 /* stack_init ******************************************************************
73 Initialized the stack analysis subsystem (called by jit_init).
75 *******************************************************************************/
79 #if defined(USE_THREADS)
80 /* initialize the show lock */
82 lock_show_icmd = NEW(java_objectheader);
84 # if defined(NATIVE_THREADS)
85 initObjectLock(lock_show_icmd);
95 /**********************************************************************/
97 /**********************************************************************/
99 /* analyse_stack uses the intermediate code created by parse.c to
100 * build a model of the JVM operand stack for the current method.
102 * The following checks are performed:
103 * - check for operand stack underflow (before each instruction)
104 * - check for operand stack overflow (after[1] each instruction)
105 * - check for matching stack depth at merging points
106 * - check for matching basic types[2] at merging points
107 * - check basic types for instruction input (except for BUILTIN*
108 * opcodes, INVOKE* opcodes and MULTIANEWARRAY)
110 * [1]) Checking this after the instruction should be ok. parse.c
111 * counts the number of required stack slots in such a way that it is
112 * only vital that we don't exceed `maxstack` at basic block
115 * [2]) 'basic types' means the distinction between INT, LONG, FLOAT,
116 * DOUBLE and ADDRESS types. Subtypes of INT and different ADDRESS
117 * types are not discerned.
120 methodinfo *analyse_stack(methodinfo *m, codegendata *cd, registerdata *rd)
128 int opcode, i, len, loops;
129 int superblockend, repeat, deadcode;
137 builtintable_entry *bte;
138 unresolved_method *um;
141 #if defined(ENABLE_LSRA)
145 argren = DMNEW(s4, cd->maxlocals); /* table for argument renaming */
146 for (i = 0; i < cd->maxlocals; i++)
151 m->basicblocks[0].flags = BBREACHED;
152 m->basicblocks[0].instack = 0;
153 m->basicblocks[0].indepth = 0;
155 for (i = 0; i < cd->exceptiontablelength; i++) {
156 bptr = &m->basicblocks[m->basicblockindex[cd->exceptiontable[i].handlerpc]];
157 bptr->flags = BBREACHED;
158 bptr->type = BBTYPE_EXH;
161 bptr->pre_count = 10000;
166 #if CONDITIONAL_LOADCONST
167 b_count = m->basicblockcount;
168 bptr = m->basicblocks;
169 while (--b_count >= 0) {
170 if (bptr->icount != 0) {
171 iptr = bptr->iinstr + bptr->icount - 1;
204 m->basicblocks[m->basicblockindex[iptr->op1]].pre_count++;
207 case ICMD_TABLESWITCH:
209 m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
210 i = *s4ptr++; /* low */
211 i = *s4ptr++ - i + 1; /* high */
213 m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
217 case ICMD_LOOKUPSWITCH:
219 m->basicblocks[m->basicblockindex[*s4ptr++]].pre_count++;
220 i = *s4ptr++; /* count */
222 m->basicblocks[m->basicblockindex[s4ptr[1]]].pre_count++;
233 #endif /* CONDITIONAL_LOADCONST */
238 b_count = m->basicblockcount;
239 bptr = m->basicblocks;
240 superblockend = true;
245 while (--b_count >= 0) {
246 if (bptr->flags == BBDELETED) {
249 } else if (superblockend && (bptr->flags < BBREACHED)) {
252 } else if (bptr->flags <= BBREACHED) {
254 stackdepth = bptr->indepth;
256 } else if (bptr->flags < BBREACHED) {
258 bptr->instack = copy;
259 bptr->indepth = stackdepth;
261 } else if (bptr->indepth != stackdepth) {
262 /*show_icmd_method(m, cd, rd);
263 printf("Block: %d, required depth: %d, current depth: %d\n",
264 bptr->debug_nr, bptr->indepth, stackdepth);*/
265 *exceptionptr = new_verifyerror(m,"Stack depth mismatch");
269 curstack = bptr->instack;
271 superblockend = false;
272 bptr->flags = BBFINISHED;
275 b_index = bptr - m->basicblocks;
280 #if defined(USEBUILTINTABLE)
281 # if defined(ENABLE_INTRP)
284 bte = builtintable_get_automatic(opcode);
286 if (bte && bte->opcode == opcode) {
287 iptr->opc = ICMD_BUILTIN;
288 iptr->op1 = false; /* don't check for exception */
290 m->isleafmethod = false;
293 # if defined(ENABLE_INTRP)
296 #endif /* defined(USEBUILTINTABLE) */
303 COUNT(count_check_null);
306 case ICMD_IFEQ_ICONST:
307 case ICMD_IFNE_ICONST:
308 case ICMD_IFLT_ICONST:
309 case ICMD_IFGE_ICONST:
310 case ICMD_IFGT_ICONST:
311 case ICMD_IFLE_ICONST:
312 case ICMD_ELSE_ICONST:
317 #if defined(ENABLE_INTRP)
320 rd->locals[iptr->op1][TYPE_ADR].type = TYPE_ADR;
322 COUNT(count_pcmd_return);
324 superblockend = true;
327 /* pop 0 push 1 const */
330 COUNT(count_pcmd_load);
332 switch (iptr[1].opc) {
334 iptr[0].opc = ICMD_IADDCONST;
336 iptr[1].opc = ICMD_NOP;
337 OP1_1(TYPE_INT, TYPE_INT);
338 COUNT(count_pcmd_op);
341 iptr[0].opc = ICMD_ISUBCONST;
342 goto icmd_iconst_tail;
343 #if SUPPORT_CONST_MUL
345 iptr[0].opc = ICMD_IMULCONST;
346 goto icmd_iconst_tail;
347 #else /* SUPPORT_CONST_MUL */
349 if (iptr[0].val.i == 0x00000002)
351 else if (iptr[0].val.i == 0x00000004)
353 else if (iptr[0].val.i == 0x00000008)
355 else if (iptr[0].val.i == 0x00000010)
357 else if (iptr[0].val.i == 0x00000020)
359 else if (iptr[0].val.i == 0x00000040)
361 else if (iptr[0].val.i == 0x00000080)
363 else if (iptr[0].val.i == 0x00000100)
365 else if (iptr[0].val.i == 0x00000200)
367 else if (iptr[0].val.i == 0x00000400)
369 else if (iptr[0].val.i == 0x00000800)
371 else if (iptr[0].val.i == 0x00001000)
373 else if (iptr[0].val.i == 0x00002000)
375 else if (iptr[0].val.i == 0x00004000)
377 else if (iptr[0].val.i == 0x00008000)
379 else if (iptr[0].val.i == 0x00010000)
381 else if (iptr[0].val.i == 0x00020000)
383 else if (iptr[0].val.i == 0x00040000)
385 else if (iptr[0].val.i == 0x00080000)
387 else if (iptr[0].val.i == 0x00100000)
389 else if (iptr[0].val.i == 0x00200000)
391 else if (iptr[0].val.i == 0x00400000)
393 else if (iptr[0].val.i == 0x00800000)
395 else if (iptr[0].val.i == 0x01000000)
397 else if (iptr[0].val.i == 0x02000000)
399 else if (iptr[0].val.i == 0x04000000)
401 else if (iptr[0].val.i == 0x08000000)
403 else if (iptr[0].val.i == 0x10000000)
405 else if (iptr[0].val.i == 0x20000000)
407 else if (iptr[0].val.i == 0x40000000)
409 else if (iptr[0].val.i == 0x80000000)
415 iptr[0].opc = ICMD_IMULPOW2;
416 goto icmd_iconst_tail;
417 #endif /* SUPPORT_CONST_MUL */
419 if (iptr[0].val.i == 0x00000002)
421 else if (iptr[0].val.i == 0x00000004)
423 else if (iptr[0].val.i == 0x00000008)
425 else if (iptr[0].val.i == 0x00000010)
427 else if (iptr[0].val.i == 0x00000020)
429 else if (iptr[0].val.i == 0x00000040)
431 else if (iptr[0].val.i == 0x00000080)
433 else if (iptr[0].val.i == 0x00000100)
435 else if (iptr[0].val.i == 0x00000200)
437 else if (iptr[0].val.i == 0x00000400)
439 else if (iptr[0].val.i == 0x00000800)
441 else if (iptr[0].val.i == 0x00001000)
443 else if (iptr[0].val.i == 0x00002000)
445 else if (iptr[0].val.i == 0x00004000)
447 else if (iptr[0].val.i == 0x00008000)
449 else if (iptr[0].val.i == 0x00010000)
451 else if (iptr[0].val.i == 0x00020000)
453 else if (iptr[0].val.i == 0x00040000)
455 else if (iptr[0].val.i == 0x00080000)
457 else if (iptr[0].val.i == 0x00100000)
459 else if (iptr[0].val.i == 0x00200000)
461 else if (iptr[0].val.i == 0x00400000)
463 else if (iptr[0].val.i == 0x00800000)
465 else if (iptr[0].val.i == 0x01000000)
467 else if (iptr[0].val.i == 0x02000000)
469 else if (iptr[0].val.i == 0x04000000)
471 else if (iptr[0].val.i == 0x08000000)
473 else if (iptr[0].val.i == 0x10000000)
475 else if (iptr[0].val.i == 0x20000000)
477 else if (iptr[0].val.i == 0x40000000)
479 else if (iptr[0].val.i == 0x80000000)
485 iptr[0].opc = ICMD_IDIVPOW2;
486 goto icmd_iconst_tail;
488 /*log_text("stack.c: ICMD_ICONST/ICMD_IREM");*/
489 if ((iptr[0].val.i == 0x00000002) ||
490 (iptr[0].val.i == 0x00000004) ||
491 (iptr[0].val.i == 0x00000008) ||
492 (iptr[0].val.i == 0x00000010) ||
493 (iptr[0].val.i == 0x00000020) ||
494 (iptr[0].val.i == 0x00000040) ||
495 (iptr[0].val.i == 0x00000080) ||
496 (iptr[0].val.i == 0x00000100) ||
497 (iptr[0].val.i == 0x00000200) ||
498 (iptr[0].val.i == 0x00000400) ||
499 (iptr[0].val.i == 0x00000800) ||
500 (iptr[0].val.i == 0x00001000) ||
501 (iptr[0].val.i == 0x00002000) ||
502 (iptr[0].val.i == 0x00004000) ||
503 (iptr[0].val.i == 0x00008000) ||
504 (iptr[0].val.i == 0x00010000) ||
505 (iptr[0].val.i == 0x00020000) ||
506 (iptr[0].val.i == 0x00040000) ||
507 (iptr[0].val.i == 0x00080000) ||
508 (iptr[0].val.i == 0x00100000) ||
509 (iptr[0].val.i == 0x00200000) ||
510 (iptr[0].val.i == 0x00400000) ||
511 (iptr[0].val.i == 0x00800000) ||
512 (iptr[0].val.i == 0x01000000) ||
513 (iptr[0].val.i == 0x02000000) ||
514 (iptr[0].val.i == 0x04000000) ||
515 (iptr[0].val.i == 0x08000000) ||
516 (iptr[0].val.i == 0x10000000) ||
517 (iptr[0].val.i == 0x20000000) ||
518 (iptr[0].val.i == 0x40000000) ||
519 (iptr[0].val.i == 0x80000000)) {
520 iptr[0].opc = ICMD_IREMPOW2;
522 goto icmd_iconst_tail;
526 #if SUPPORT_CONST_LOGICAL
528 iptr[0].opc = ICMD_IANDCONST;
529 goto icmd_iconst_tail;
531 iptr[0].opc = ICMD_IORCONST;
532 goto icmd_iconst_tail;
534 iptr[0].opc = ICMD_IXORCONST;
535 goto icmd_iconst_tail;
536 #endif /* SUPPORT_CONST_LOGICAL */
538 iptr[0].opc = ICMD_ISHLCONST;
539 goto icmd_iconst_tail;
541 iptr[0].opc = ICMD_ISHRCONST;
542 goto icmd_iconst_tail;
544 iptr[0].opc = ICMD_IUSHRCONST;
545 goto icmd_iconst_tail;
546 #if SUPPORT_LONG_SHIFT
548 iptr[0].opc = ICMD_LSHLCONST;
549 goto icmd_lconst_tail;
551 iptr[0].opc = ICMD_LSHRCONST;
552 goto icmd_lconst_tail;
554 iptr[0].opc = ICMD_LUSHRCONST;
555 goto icmd_lconst_tail;
556 #endif /* SUPPORT_LONG_SHIFT */
558 iptr[0].opc = ICMD_IFEQ;
560 iptr[0].op1 = iptr[1].op1;
561 /* IF_ICMPxx is the last instruction in the */
562 /* basic block, just remove it */
563 /* iptr[1].opc = ICMD_NOP; */
568 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
570 iptr[0].target = (void *) tbptr;
572 MARKREACHED(tbptr, copy);
573 COUNT(count_pcmd_bra);
576 iptr[0].opc = ICMD_IFLT;
577 goto icmd_if_icmp_tail;
579 iptr[0].opc = ICMD_IFLE;
580 goto icmd_if_icmp_tail;
582 iptr[0].opc = ICMD_IFNE;
583 goto icmd_if_icmp_tail;
585 iptr[0].opc = ICMD_IFGT;
586 goto icmd_if_icmp_tail;
588 iptr[0].opc = ICMD_IFGE;
589 goto icmd_if_icmp_tail;
591 #if SUPPORT_CONST_STORE
596 # if defined(ENABLE_INTRP)
599 # if SUPPORT_CONST_STORE_ZERO_ONLY
600 if (iptr[0].val.i == 0) {
601 # endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
602 switch (iptr[1].opc) {
604 iptr[0].opc = ICMD_IASTORECONST;
607 iptr[0].opc = ICMD_BASTORECONST;
610 iptr[0].opc = ICMD_CASTORECONST;
613 iptr[0].opc = ICMD_SASTORECONST;
617 iptr[1].opc = ICMD_NOP;
618 OPTT2_0(TYPE_INT, TYPE_ADR);
619 COUNT(count_pcmd_op);
620 # if SUPPORT_CONST_STORE_ZERO_ONLY
623 # endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
624 # if defined(ENABLE_INTRP)
632 # if defined(ENABLE_INTRP)
635 # if SUPPORT_CONST_STORE_ZERO_ONLY
636 if (iptr[0].val.i == 0) {
637 # endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
638 switch (iptr[1].opc) {
640 iptr[0].opc = ICMD_PUTSTATICCONST;
644 iptr[0].opc = ICMD_PUTFIELDCONST;
649 iptr[1].opc = ICMD_NOP;
650 iptr[0].op1 = TYPE_INT;
651 COUNT(count_pcmd_op);
652 # if SUPPORT_CONST_STORE_ZERO_ONLY
655 # endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
656 # if defined(ENABLE_INTRP)
661 #endif /* SUPPORT_CONST_STORE */
671 COUNT(count_pcmd_load);
673 switch (iptr[1].opc) {
676 iptr[0].opc = ICMD_LADDCONST;
678 iptr[1].opc = ICMD_NOP;
679 OP1_1(TYPE_LNG,TYPE_LNG);
680 COUNT(count_pcmd_op);
683 iptr[0].opc = ICMD_LSUBCONST;
684 goto icmd_lconst_tail;
685 #endif /* SUPPORT_LONG_ADD */
686 #if SUPPORT_LONG_MUL && SUPPORT_CONST_MUL
688 iptr[0].opc = ICMD_LMULCONST;
689 goto icmd_lconst_tail;
690 #else /* SUPPORT_LONG_MUL && SUPPORT_CONST_MUL */
691 # if SUPPORT_LONG_SHIFT
693 if (iptr[0].val.l == 0x00000002)
695 else if (iptr[0].val.l == 0x00000004)
697 else if (iptr[0].val.l == 0x00000008)
699 else if (iptr[0].val.l == 0x00000010)
701 else if (iptr[0].val.l == 0x00000020)
703 else if (iptr[0].val.l == 0x00000040)
705 else if (iptr[0].val.l == 0x00000080)
707 else if (iptr[0].val.l == 0x00000100)
709 else if (iptr[0].val.l == 0x00000200)
711 else if (iptr[0].val.l == 0x00000400)
713 else if (iptr[0].val.l == 0x00000800)
715 else if (iptr[0].val.l == 0x00001000)
717 else if (iptr[0].val.l == 0x00002000)
719 else if (iptr[0].val.l == 0x00004000)
721 else if (iptr[0].val.l == 0x00008000)
723 else if (iptr[0].val.l == 0x00010000)
725 else if (iptr[0].val.l == 0x00020000)
727 else if (iptr[0].val.l == 0x00040000)
729 else if (iptr[0].val.l == 0x00080000)
731 else if (iptr[0].val.l == 0x00100000)
733 else if (iptr[0].val.l == 0x00200000)
735 else if (iptr[0].val.l == 0x00400000)
737 else if (iptr[0].val.l == 0x00800000)
739 else if (iptr[0].val.l == 0x01000000)
741 else if (iptr[0].val.l == 0x02000000)
743 else if (iptr[0].val.l == 0x04000000)
745 else if (iptr[0].val.l == 0x08000000)
747 else if (iptr[0].val.l == 0x10000000)
749 else if (iptr[0].val.l == 0x20000000)
751 else if (iptr[0].val.l == 0x40000000)
753 else if (iptr[0].val.l == 0x80000000)
759 iptr[0].opc = ICMD_LMULPOW2;
760 goto icmd_lconst_tail;
761 # endif /* SUPPORT_LONG_SHIFT */
762 #endif /* SUPPORT_LONG_MUL && SUPPORT_CONST_MUL */
765 if (iptr[0].val.l == 0x00000002)
767 else if (iptr[0].val.l == 0x00000004)
769 else if (iptr[0].val.l == 0x00000008)
771 else if (iptr[0].val.l == 0x00000010)
773 else if (iptr[0].val.l == 0x00000020)
775 else if (iptr[0].val.l == 0x00000040)
777 else if (iptr[0].val.l == 0x00000080)
779 else if (iptr[0].val.l == 0x00000100)
781 else if (iptr[0].val.l == 0x00000200)
783 else if (iptr[0].val.l == 0x00000400)
785 else if (iptr[0].val.l == 0x00000800)
787 else if (iptr[0].val.l == 0x00001000)
789 else if (iptr[0].val.l == 0x00002000)
791 else if (iptr[0].val.l == 0x00004000)
793 else if (iptr[0].val.l == 0x00008000)
795 else if (iptr[0].val.l == 0x00010000)
797 else if (iptr[0].val.l == 0x00020000)
799 else if (iptr[0].val.l == 0x00040000)
801 else if (iptr[0].val.l == 0x00080000)
803 else if (iptr[0].val.l == 0x00100000)
805 else if (iptr[0].val.l == 0x00200000)
807 else if (iptr[0].val.l == 0x00400000)
809 else if (iptr[0].val.l == 0x00800000)
811 else if (iptr[0].val.l == 0x01000000)
813 else if (iptr[0].val.l == 0x02000000)
815 else if (iptr[0].val.l == 0x04000000)
817 else if (iptr[0].val.l == 0x08000000)
819 else if (iptr[0].val.l == 0x10000000)
821 else if (iptr[0].val.l == 0x20000000)
823 else if (iptr[0].val.l == 0x40000000)
825 else if (iptr[0].val.l == 0x80000000)
831 iptr[0].opc = ICMD_LDIVPOW2;
832 goto icmd_lconst_tail;
834 if ((iptr[0].val.l == 0x00000002) ||
835 (iptr[0].val.l == 0x00000004) ||
836 (iptr[0].val.l == 0x00000008) ||
837 (iptr[0].val.l == 0x00000010) ||
838 (iptr[0].val.l == 0x00000020) ||
839 (iptr[0].val.l == 0x00000040) ||
840 (iptr[0].val.l == 0x00000080) ||
841 (iptr[0].val.l == 0x00000100) ||
842 (iptr[0].val.l == 0x00000200) ||
843 (iptr[0].val.l == 0x00000400) ||
844 (iptr[0].val.l == 0x00000800) ||
845 (iptr[0].val.l == 0x00001000) ||
846 (iptr[0].val.l == 0x00002000) ||
847 (iptr[0].val.l == 0x00004000) ||
848 (iptr[0].val.l == 0x00008000) ||
849 (iptr[0].val.l == 0x00010000) ||
850 (iptr[0].val.l == 0x00020000) ||
851 (iptr[0].val.l == 0x00040000) ||
852 (iptr[0].val.l == 0x00080000) ||
853 (iptr[0].val.l == 0x00100000) ||
854 (iptr[0].val.l == 0x00200000) ||
855 (iptr[0].val.l == 0x00400000) ||
856 (iptr[0].val.l == 0x00800000) ||
857 (iptr[0].val.l == 0x01000000) ||
858 (iptr[0].val.l == 0x02000000) ||
859 (iptr[0].val.l == 0x04000000) ||
860 (iptr[0].val.l == 0x08000000) ||
861 (iptr[0].val.l == 0x10000000) ||
862 (iptr[0].val.l == 0x20000000) ||
863 (iptr[0].val.l == 0x40000000) ||
864 (iptr[0].val.l == 0x80000000)) {
865 iptr[0].opc = ICMD_LREMPOW2;
867 goto icmd_lconst_tail;
871 #endif /* SUPPORT_LONG_DIV */
872 #if SUPPORT_LONG_LOGICAL && SUPPORT_CONST_LOGICAL
875 iptr[0].opc = ICMD_LANDCONST;
876 goto icmd_lconst_tail;
878 iptr[0].opc = ICMD_LORCONST;
879 goto icmd_lconst_tail;
881 iptr[0].opc = ICMD_LXORCONST;
882 goto icmd_lconst_tail;
883 #endif /* SUPPORT_LONG_LOGICAL && SUPPORT_CONST_LOGICAL */
885 #if SUPPORT_LONG_CMP_CONST
887 if ((len > 1) && (iptr[2].val.i == 0)) {
888 switch (iptr[2].opc) {
890 iptr[0].opc = ICMD_IF_LEQ;
891 icmd_lconst_lcmp_tail:
892 iptr[0].op1 = iptr[2].op1;
895 /* iptr[1].opc = ICMD_NOP;
896 iptr[2].opc = ICMD_NOP; */
898 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
900 iptr[0].target = (void *) tbptr;
902 MARKREACHED(tbptr, copy);
903 COUNT(count_pcmd_bra);
904 COUNT(count_pcmd_op);
907 iptr[0].opc = ICMD_IF_LNE;
908 goto icmd_lconst_lcmp_tail;
910 iptr[0].opc = ICMD_IF_LLT;
911 goto icmd_lconst_lcmp_tail;
913 iptr[0].opc = ICMD_IF_LGT;
914 goto icmd_lconst_lcmp_tail;
916 iptr[0].opc = ICMD_IF_LLE;
917 goto icmd_lconst_lcmp_tail;
919 iptr[0].opc = ICMD_IF_LGE;
920 goto icmd_lconst_lcmp_tail;
923 } /* switch (iptr[2].opc) */
924 } /* if (iptr[2].val.i == 0) */
928 #endif /* SUPPORT_LONG_CMP_CONST */
930 #if SUPPORT_CONST_STORE
932 # if defined(ENABLE_INTRP)
935 # if SUPPORT_CONST_STORE_ZERO_ONLY
936 if (iptr[0].val.l == 0) {
937 # endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
938 iptr[0].opc = ICMD_LASTORECONST;
939 iptr[1].opc = ICMD_NOP;
940 OPTT2_0(TYPE_INT, TYPE_ADR);
941 COUNT(count_pcmd_op);
942 # if SUPPORT_CONST_STORE_ZERO_ONLY
945 # endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
946 # if defined(ENABLE_INTRP)
954 # if defined(ENABLE_INTRP)
957 # if SUPPORT_CONST_STORE_ZERO_ONLY
958 if (iptr[0].val.l == 0) {
959 # endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
960 switch (iptr[1].opc) {
962 iptr[0].opc = ICMD_PUTSTATICCONST;
966 iptr[0].opc = ICMD_PUTFIELDCONST;
971 iptr[1].opc = ICMD_NOP;
972 iptr[0].op1 = TYPE_LNG;
973 COUNT(count_pcmd_op);
974 # if SUPPORT_CONST_STORE_ZERO_ONLY
977 # endif /* SUPPORT_CONST_STORE_ZERO_ONLY */
978 # if defined(ENABLE_INTRP)
983 #endif /* SUPPORT_CONST_STORE */
993 COUNT(count_pcmd_load);
998 COUNT(count_pcmd_load);
1003 COUNT(count_pcmd_load);
1004 #if SUPPORT_CONST_STORE
1005 # if defined(ENABLE_INTRP)
1008 if ((len > 0) && (iptr->val.a == 0)) {
1009 switch (iptr[1].opc) {
1011 case ICMD_PUTSTATIC:
1013 switch (iptr[1].opc) {
1015 iptr[0].opc = ICMD_AASTORECONST;
1016 OPTT2_0(TYPE_INT, TYPE_ADR);
1018 case ICMD_PUTSTATIC:
1019 iptr[0].opc = ICMD_PUTSTATICCONST;
1020 iptr[0].op1 = TYPE_ADR;
1024 iptr[0].opc = ICMD_PUTFIELDCONST;
1025 iptr[0].op1 = TYPE_ADR;
1030 iptr[1].opc = ICMD_NOP;
1031 COUNT(count_pcmd_op);
1035 PUSHCONST(TYPE_ADR);
1039 PUSHCONST(TYPE_ADR);
1040 # if defined(ENABLE_INTRP)
1042 PUSHCONST(TYPE_ADR);
1044 #else /* SUPPORT_CONST_STORE */
1045 PUSHCONST(TYPE_ADR);
1046 #endif /* SUPPORT_CONST_STORE */
1049 /* pop 0 push 1 load */
1056 COUNT(count_load_instruction);
1057 i = opcode - ICMD_ILOAD;
1058 iptr->op1 = argren[iptr->op1];
1059 #if defined(ENABLE_INTRP)
1062 rd->locals[iptr->op1][i].type = i;
1063 LOAD(i, LOCALVAR, iptr->op1);
1073 COUNT(count_check_null);
1074 COUNT(count_check_bound);
1075 COUNT(count_pcmd_mem);
1076 OP2IAT_1(opcode - ICMD_IALOAD);
1082 COUNT(count_check_null);
1083 COUNT(count_check_bound);
1084 COUNT(count_pcmd_mem);
1088 /* pop 0 push 0 iinc */
1091 #if defined(STATISTICS)
1095 count_store_depth[10]++;
1097 count_store_depth[i]++;
1103 if ((copy->varkind == LOCALVAR) &&
1104 (copy->varnum == iptr->op1)) {
1105 copy->varkind = TEMPVAR;
1112 /* allocate a dummy stack slot to keep ISTORE from */
1113 /* marking its input stack as a LOCALVAR, since we */
1114 /* change the value of the local variable here. */
1115 NEWSTACK0(TYPE_INT);
1121 /* pop 1 push 0 store */
1131 i = opcode - ICMD_ISTORE;
1132 #if defined(ENABLE_INTRP)
1135 rd->locals[iptr->op1][i].type = i;
1136 #if defined(STATISTICS)
1141 count_store_length[20]++;
1143 count_store_length[i]++;
1146 count_store_depth[10]++;
1148 count_store_depth[i]++;
1151 copy = curstack->prev;
1154 if ((copy->varkind == LOCALVAR) &&
1155 (copy->varnum == iptr->op1)) {
1156 copy->varkind = TEMPVAR;
1162 if ((new - curstack) == 1) {
1163 curstack->varkind = LOCALVAR;
1164 curstack->varnum = iptr->op1;
1166 STORE(opcode - ICMD_ISTORE);
1172 COUNT(count_check_null);
1173 COUNT(count_check_bound);
1174 COUNT(count_pcmd_mem);
1176 bte = builtintable_get_internal(BUILTIN_canstore);
1179 if (md->memuse > rd->memuse)
1180 rd->memuse = md->memuse;
1181 if (md->argintreguse > rd->argintreguse)
1182 rd->argintreguse = md->argintreguse;
1184 /* make all stack variables saved */
1188 copy->flags |= SAVEDVAR;
1199 COUNT(count_check_null);
1200 COUNT(count_check_bound);
1201 COUNT(count_pcmd_mem);
1202 OP3TIA_0(opcode - ICMD_IASTORE);
1208 COUNT(count_check_null);
1209 COUNT(count_check_bound);
1210 COUNT(count_pcmd_mem);
1217 #ifdef TYPECHECK_STACK_COMPCAT
1220 if (IS_2_WORD_TYPE(curstack->type)) {
1221 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1234 md_return_alloc(m, rd, opcode - ICMD_IRETURN, curstack);
1235 COUNT(count_pcmd_return);
1236 OP1_0(opcode - ICMD_IRETURN);
1237 superblockend = true;
1241 COUNT(count_check_null);
1245 superblockend = true;
1248 case ICMD_PUTSTATIC:
1249 COUNT(count_pcmd_mem);
1253 /* pop 1 push 0 branch */
1256 case ICMD_IFNONNULL:
1257 COUNT(count_pcmd_bra);
1259 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1261 iptr[0].target = (void *) tbptr;
1263 MARKREACHED(tbptr, copy);
1272 COUNT(count_pcmd_bra);
1273 #if CONDITIONAL_LOADCONST
1274 # if defined(ENABLE_INTRP)
1277 tbptr = m->basicblocks + b_index;
1278 if ((b_count >= 3) &&
1279 ((b_index + 2) == m->basicblockindex[iptr[0].op1]) &&
1280 (tbptr[1].pre_count == 1) &&
1281 (tbptr[1].iinstr[0].opc == ICMD_ICONST) &&
1282 (tbptr[1].iinstr[1].opc == ICMD_GOTO) &&
1283 ((b_index + 3) == m->basicblockindex[tbptr[1].iinstr[1].op1]) &&
1284 (tbptr[2].pre_count == 1) &&
1285 (tbptr[2].iinstr[0].opc == ICMD_ICONST) &&
1286 (tbptr[2].icount==1)) {
1287 /*printf("tbptr[2].icount=%d\n",tbptr[2].icount);*/
1288 OP1_1(TYPE_INT, TYPE_INT);
1289 switch (iptr[0].opc) {
1291 iptr[0].opc = ICMD_IFNE_ICONST;
1294 iptr[0].opc = ICMD_IFEQ_ICONST;
1297 iptr[0].opc = ICMD_IFGE_ICONST;
1300 iptr[0].opc = ICMD_IFLT_ICONST;
1303 iptr[0].opc = ICMD_IFLE_ICONST;
1306 iptr[0].opc = ICMD_IFGT_ICONST;
1310 iptr[0].val.i = iptr[1].val.i;
1311 iptr[1].opc = ICMD_ELSE_ICONST;
1312 iptr[1].val.i = iptr[3].val.i;
1313 iptr[2].opc = ICMD_NOP;
1314 iptr[3].opc = ICMD_NOP;
1316 /* HACK: save compare value in iptr[1].op1 */
1317 iptr[1].op1 = iptr[0].val.i;
1318 iptr[0].val.i = tbptr[1].iinstr[0].val.i;
1319 iptr[1].opc = ICMD_ELSE_ICONST;
1320 iptr[1].val.i = tbptr[2].iinstr[0].val.i;
1321 tbptr[1].iinstr[0].opc = ICMD_NOP;
1322 tbptr[1].iinstr[1].opc = ICMD_NOP;
1323 tbptr[2].iinstr[0].opc = ICMD_NOP;
1325 tbptr[1].flags = BBDELETED;
1326 tbptr[2].flags = BBDELETED;
1327 tbptr[1].icount = 0;
1328 tbptr[2].icount = 0;
1329 if (tbptr[3].pre_count == 2) {
1330 len += tbptr[3].icount + 3;
1331 bptr->icount += tbptr[3].icount + 3;
1332 tbptr[3].flags = BBDELETED;
1333 tbptr[3].icount = 0;
1343 # if defined(ENABLE_INTRP)
1347 #endif /* CONDITIONAL_LOADCONST */
1351 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1353 iptr[0].target = (void *) tbptr;
1355 MARKREACHED(tbptr, copy);
1358 /* pop 0 push 0 branch */
1361 COUNT(count_pcmd_bra);
1362 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1364 iptr[0].target = (void *) tbptr;
1366 MARKREACHED(tbptr, copy);
1368 superblockend = true;
1371 /* pop 1 push 0 table branch */
1373 case ICMD_TABLESWITCH:
1374 COUNT(count_pcmd_table);
1376 s4ptr = iptr->val.a;
1377 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1378 MARKREACHED(tbptr, copy);
1379 i = *s4ptr++; /* low */
1380 i = *s4ptr++ - i + 1; /* high */
1382 tptr = DMNEW(void*, i+1);
1383 iptr->target = (void *) tptr;
1385 tptr[0] = (void *) tbptr;
1389 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1391 tptr[0] = (void *) tbptr;
1394 MARKREACHED(tbptr, copy);
1397 superblockend = true;
1400 /* pop 1 push 0 table branch */
1402 case ICMD_LOOKUPSWITCH:
1403 COUNT(count_pcmd_table);
1405 s4ptr = iptr->val.a;
1406 tbptr = m->basicblocks + m->basicblockindex[*s4ptr++];
1407 MARKREACHED(tbptr, copy);
1408 i = *s4ptr++; /* count */
1410 tptr = DMNEW(void*, i+1);
1411 iptr->target = (void *) tptr;
1413 tptr[0] = (void *) tbptr;
1417 tbptr = m->basicblocks + m->basicblockindex[s4ptr[1]];
1419 tptr[0] = (void *) tbptr;
1422 MARKREACHED(tbptr, copy);
1426 superblockend = true;
1429 case ICMD_MONITORENTER:
1430 COUNT(count_check_null);
1431 case ICMD_MONITOREXIT:
1435 /* pop 2 push 0 branch */
1437 case ICMD_IF_ICMPEQ:
1438 case ICMD_IF_ICMPNE:
1439 case ICMD_IF_ICMPLT:
1440 case ICMD_IF_ICMPGE:
1441 case ICMD_IF_ICMPGT:
1442 case ICMD_IF_ICMPLE:
1443 COUNT(count_pcmd_bra);
1445 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1447 iptr[0].target = (void *) tbptr;
1449 MARKREACHED(tbptr, copy);
1452 case ICMD_IF_ACMPEQ:
1453 case ICMD_IF_ACMPNE:
1454 COUNT(count_pcmd_bra);
1456 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1458 iptr[0].target = (void *) tbptr;
1460 MARKREACHED(tbptr, copy);
1466 COUNT(count_check_null);
1467 COUNT(count_pcmd_mem);
1468 OPTT2_0(iptr->op1,TYPE_ADR);
1473 if (!IS_2_WORD_TYPE(curstack->type)) {
1475 #ifdef TYPECHECK_STACK_COMPCAT
1478 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1479 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1484 OP1_0ANY; /* second pop */
1487 iptr->opc = ICMD_POP;
1491 /* pop 0 push 1 dup */
1494 #ifdef TYPECHECK_STACK_COMPCAT
1497 if (IS_2_WORD_TYPE(curstack->type)) {
1498 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1503 COUNT(count_dup_instruction);
1509 if (IS_2_WORD_TYPE(curstack->type)) {
1511 iptr->opc = ICMD_DUP;
1516 /* ..., ????, cat1 */
1517 #ifdef TYPECHECK_STACK_COMPCAT
1519 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1520 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1526 NEWSTACK(copy->prev->type, copy->prev->varkind,
1527 copy->prev->varnum);
1528 NEWSTACK(copy->type, copy->varkind,
1535 /* pop 2 push 3 dup */
1538 #ifdef TYPECHECK_STACK_COMPCAT
1541 if (IS_2_WORD_TYPE(curstack->type) ||
1542 IS_2_WORD_TYPE(curstack->prev->type)) {
1543 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1553 if (IS_2_WORD_TYPE(curstack->type)) {
1554 /* ..., ????, cat2 */
1555 #ifdef TYPECHECK_STACK_COMPCAT
1557 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1558 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1563 iptr->opc = ICMD_DUP_X1;
1567 /* ..., ????, cat1 */
1568 #ifdef TYPECHECK_STACK_COMPCAT
1571 if (IS_2_WORD_TYPE(curstack->prev->type)
1572 || IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1573 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1582 /* pop 3 push 4 dup */
1586 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1587 /* ..., cat2, ???? */
1588 #ifdef TYPECHECK_STACK_COMPCAT
1590 if (IS_2_WORD_TYPE(curstack->type)) {
1591 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1596 iptr->opc = ICMD_DUP_X1;
1600 /* ..., cat1, ???? */
1601 #ifdef TYPECHECK_STACK_COMPCAT
1604 if (IS_2_WORD_TYPE(curstack->type)
1605 || IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1606 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1617 if (IS_2_WORD_TYPE(curstack->type)) {
1618 /* ..., ????, cat2 */
1619 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1620 /* ..., cat2, cat2 */
1621 iptr->opc = ICMD_DUP_X1;
1625 /* ..., cat1, cat2 */
1626 #ifdef TYPECHECK_STACK_COMPCAT
1629 if (IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1630 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1635 iptr->opc = ICMD_DUP_X2;
1641 /* ..., ????, ????, cat1 */
1642 if (IS_2_WORD_TYPE(curstack->prev->prev->type)) {
1643 /* ..., cat2, ????, cat1 */
1644 #ifdef TYPECHECK_STACK_COMPCAT
1646 if (IS_2_WORD_TYPE(curstack->prev->type)) {
1647 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1652 iptr->opc = ICMD_DUP2_X1;
1656 /* ..., cat1, ????, cat1 */
1657 #ifdef TYPECHECK_STACK_COMPCAT
1660 if (IS_2_WORD_TYPE(curstack->prev->type)
1661 || IS_2_WORD_TYPE(curstack->prev->prev->prev->type)) {
1662 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1672 /* pop 2 push 2 swap */
1675 #ifdef TYPECHECK_STACK_COMPCAT
1678 if (IS_2_WORD_TYPE(curstack->type)
1679 || IS_2_WORD_TYPE(curstack->prev->type)) {
1680 *exceptionptr = new_verifyerror(m, "Attempt to split long or double on the stack");
1692 #if !SUPPORT_DIVISION
1693 bte = (builtintable_entry *) iptr->val.a;
1697 if (md->memuse > rd->memuse)
1698 rd->memuse = md->memuse;
1699 if (md->argintreguse > rd->argintreguse)
1700 rd->argintreguse = md->argintreguse;
1702 /* make all stack variables saved */
1706 copy->flags |= SAVEDVAR;
1711 #endif /* !SUPPORT_DIVISION */
1722 COUNT(count_pcmd_op);
1728 #if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
1729 bte = (builtintable_entry *) iptr->val.a;
1733 if (md->memuse > rd->memuse)
1734 rd->memuse = md->memuse;
1735 if (md->argintreguse > rd->argintreguse)
1736 rd->argintreguse = md->argintreguse;
1738 /* make all stack variables saved */
1742 copy->flags |= SAVEDVAR;
1747 #endif /* !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV) */
1752 #if SUPPORT_LONG_LOGICAL
1756 #endif /* SUPPORT_LONG_LOGICAL */
1757 COUNT(count_pcmd_op);
1764 COUNT(count_pcmd_op);
1773 COUNT(count_pcmd_op);
1782 COUNT(count_pcmd_op);
1787 COUNT(count_pcmd_op);
1788 #if SUPPORT_LONG_CMP_CONST
1789 if ((len > 0) && (iptr[1].val.i == 0)) {
1790 switch (iptr[1].opc) {
1792 iptr[0].opc = ICMD_IF_LCMPEQ;
1794 iptr[0].op1 = iptr[1].op1;
1797 /* iptr[1].opc = ICMD_NOP; */
1799 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1801 iptr[0].target = (void *) tbptr;
1803 MARKREACHED(tbptr, copy);
1804 COUNT(count_pcmd_bra);
1807 iptr[0].opc = ICMD_IF_LCMPNE;
1808 goto icmd_lcmp_if_tail;
1810 iptr[0].opc = ICMD_IF_LCMPLT;
1811 goto icmd_lcmp_if_tail;
1813 iptr[0].opc = ICMD_IF_LCMPGT;
1814 goto icmd_lcmp_if_tail;
1816 iptr[0].opc = ICMD_IF_LCMPLE;
1817 goto icmd_lcmp_if_tail;
1819 iptr[0].opc = ICMD_IF_LCMPGE;
1820 goto icmd_lcmp_if_tail;
1822 OPTT2_1(TYPE_LNG, TYPE_INT);
1826 #endif /* SUPPORT_LONG_CMP_CONST */
1827 OPTT2_1(TYPE_LNG, TYPE_INT);
1831 COUNT(count_pcmd_op);
1832 OPTT2_1(TYPE_FLT, TYPE_INT);
1836 COUNT(count_pcmd_op);
1837 OPTT2_1(TYPE_DBL, TYPE_INT);
1845 case ICMD_INT2SHORT:
1846 COUNT(count_pcmd_op);
1847 OP1_1(TYPE_INT, TYPE_INT);
1850 COUNT(count_pcmd_op);
1851 OP1_1(TYPE_LNG, TYPE_LNG);
1854 COUNT(count_pcmd_op);
1855 OP1_1(TYPE_FLT, TYPE_FLT);
1858 COUNT(count_pcmd_op);
1859 OP1_1(TYPE_DBL, TYPE_DBL);
1863 COUNT(count_pcmd_op);
1864 OP1_1(TYPE_INT, TYPE_LNG);
1867 COUNT(count_pcmd_op);
1868 OP1_1(TYPE_INT, TYPE_FLT);
1871 COUNT(count_pcmd_op);
1872 OP1_1(TYPE_INT, TYPE_DBL);
1875 COUNT(count_pcmd_op);
1876 OP1_1(TYPE_LNG, TYPE_INT);
1879 COUNT(count_pcmd_op);
1880 OP1_1(TYPE_LNG, TYPE_FLT);
1883 COUNT(count_pcmd_op);
1884 OP1_1(TYPE_LNG, TYPE_DBL);
1887 COUNT(count_pcmd_op);
1888 OP1_1(TYPE_FLT, TYPE_INT);
1891 COUNT(count_pcmd_op);
1892 OP1_1(TYPE_FLT, TYPE_LNG);
1895 COUNT(count_pcmd_op);
1896 OP1_1(TYPE_FLT, TYPE_DBL);
1899 COUNT(count_pcmd_op);
1900 OP1_1(TYPE_DBL, TYPE_INT);
1903 COUNT(count_pcmd_op);
1904 OP1_1(TYPE_DBL, TYPE_LNG);
1907 COUNT(count_pcmd_op);
1908 OP1_1(TYPE_DBL, TYPE_FLT);
1911 case ICMD_CHECKCAST:
1912 if (iptr->op1 == 0) {
1913 /* array type cast-check */
1915 bte = builtintable_get_internal(BUILTIN_arraycheckcast);
1918 if (md->memuse > rd->memuse)
1919 rd->memuse = md->memuse;
1920 if (md->argintreguse > rd->argintreguse)
1921 rd->argintreguse = md->argintreguse;
1923 /* make all stack variables saved */
1927 copy->flags |= SAVEDVAR;
1931 OP1_1(TYPE_ADR, TYPE_ADR);
1934 case ICMD_INSTANCEOF:
1935 case ICMD_ARRAYLENGTH:
1936 OP1_1(TYPE_ADR, TYPE_INT);
1940 case ICMD_ANEWARRAY:
1941 OP1_1(TYPE_INT, TYPE_ADR);
1945 COUNT(count_check_null);
1946 COUNT(count_pcmd_mem);
1947 OP1_1(TYPE_ADR, iptr->op1);
1952 case ICMD_GETSTATIC:
1953 COUNT(count_pcmd_mem);
1963 tbptr = m->basicblocks + m->basicblockindex[iptr->op1];
1965 iptr[0].target = (void *) tbptr;
1967 /* This is a dirty hack. The typechecker
1968 * needs it because the OP1_0ANY below
1969 * overwrites iptr->dst.
1971 iptr->val.a = (void *) iptr->dst;
1973 tbptr->type = BBTYPE_SBR;
1975 /* We need to check for overflow right here because
1976 * the pushed value is poped after MARKREACHED. */
1978 MARKREACHED(tbptr, copy);
1982 /* pop many push any */
1985 #if defined(USEBUILTINTABLE)
1988 bte = (builtintable_entry *) iptr->val.a;
1992 case ICMD_INVOKESTATIC:
1993 case ICMD_INVOKESPECIAL:
1994 case ICMD_INVOKEVIRTUAL:
1995 case ICMD_INVOKEINTERFACE:
1996 COUNT(count_pcmd_met);
1998 md = um->methodref->parseddesc.md;
1999 /* if (lm->flags & ACC_STATIC) */
2000 /* {COUNT(count_check_null);} */
2005 if (md->memuse > rd->memuse)
2006 rd->memuse = md->memuse;
2007 if (md->argintreguse > rd->argintreguse)
2008 rd->argintreguse = md->argintreguse;
2009 if (md->argfltreguse > rd->argfltreguse)
2010 rd->argfltreguse = md->argfltreguse;
2015 for (i-- ; i >= 0; i--) {
2016 #if defined(SUPPORT_PASS_FLOATARGS_IN_INTREGS)
2017 /* If we pass float arguments in integer argument registers, we
2018 * are not allowed to precolor them here. Floats have to be moved
2019 * to this regs explicitly in codegen().
2020 * Only arguments that are passed by stack anyway can be precolored
2021 * (michi 2005/07/24) */
2022 if (!(copy->flags & SAVEDVAR) &&
2023 (!IS_FLT_DBL_TYPE(copy->type) || md->params[i].inmemory)) {
2025 if (!(copy->flags & SAVEDVAR)) {
2027 copy->varkind = ARGVAR;
2030 #if defined(ENABLE_INTRP)
2033 if (md->params[i].inmemory) {
2034 copy->flags = INMEMORY;
2035 copy->regoff = md->params[i].regoff;
2038 if (IS_FLT_DBL_TYPE(copy->type))
2039 #if defined(SUPPORT_PASS_FLOATARGS_IN_INTREGS)
2040 assert(0); /* XXX is this assert ok? */
2043 rd->argfltregs[md->params[i].regoff];
2046 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2047 if (IS_2_WORD_TYPE(copy->type))
2048 copy->regoff = PACK_REGS(
2049 rd->argintregs[GET_LOW_REG(md->params[i].regoff)],
2050 rd->argintregs[GET_HIGH_REG(md->params[i].regoff)]);
2054 rd->argintregs[md->params[i].regoff];
2057 #if defined(ENABLE_INTRP)
2065 copy->flags |= SAVEDVAR;
2071 if (md->returntype.type != TYPE_VOID)
2072 OP0_1(md->returntype.type);
2075 case ICMD_INLINE_START:
2076 case ICMD_INLINE_END:
2080 case ICMD_MULTIANEWARRAY:
2081 if (rd->argintreguse < 3)
2082 rd->argintreguse = 3;
2087 #if defined(SPECIALMEMUSE)
2088 # if defined(__DARWIN__)
2089 if (rd->memuse < (i + INT_ARG_CNT + LA_WORD_SIZE))
2090 rd->memuse = i + LA_WORD_SIZE + INT_ARG_CNT;
2092 if (rd->memuse < (i + LA_WORD_SIZE + 3))
2093 rd->memuse = i + LA_WORD_SIZE + 3;
2096 # if defined(__I386__)
2097 if (rd->memuse < i + 3)
2098 rd->memuse = i + 3; /* n integer args spilled on stack */
2099 # elif defined(__MIPS__) && SIZEOF_VOID_P == 4
2100 if (rd->memuse < i + 2)
2101 rd->memuse = i + 2; /* 4*4 bytes callee save space */
2104 rd->memuse = i; /* n integer args spilled on stack */
2105 # endif /* defined(__I386__) */
2109 /* check INT type here? Currently typecheck does this. */
2110 if (!(copy->flags & SAVEDVAR)) {
2111 copy->varkind = ARGVAR;
2112 copy->varnum = i + INT_ARG_CNT;
2113 copy->flags |= INMEMORY;
2114 #if defined(SPECIALMEMUSE)
2115 # if defined(__DARWIN__)
2116 copy->regoff = i + LA_WORD_SIZE + INT_ARG_CNT;
2118 copy->regoff = i + LA_WORD_SIZE + 3;
2121 # if defined(__I386__)
2122 copy->regoff = i + 3;
2123 # elif defined(__MIPS__) && SIZEOF_VOID_P == 4
2124 copy->regoff = i + 2;
2127 # endif /* defined(__I386__) */
2128 #endif /* defined(SPECIALMEMUSE) */
2133 copy->flags |= SAVEDVAR;
2141 case ICMD_CLEAR_ARGREN:
2142 for (i = iptr->op1; i < cd->maxlocals; i++)
2144 iptr->opc = opcode = ICMD_NOP;
2148 case ICMD_READONLY_ARG:
2149 case ICMD_READONLY_ARG+1:
2150 case ICMD_READONLY_ARG+2:
2151 case ICMD_READONLY_ARG+3:
2152 case ICMD_READONLY_ARG+4:
2155 if (curstack->varkind == LOCALVAR) {
2156 i = curstack->varnum;
2157 argren[iptr->op1] = i;
2160 opcode = iptr->opc = opcode - ICMD_READONLY_ARG + ICMD_ISTORE;
2167 new_internalerror("Unknown ICMD %d", opcode);
2173 } /* while instructions */
2175 bptr->outstack = curstack;
2176 bptr->outdepth = stackdepth;
2180 superblockend = true;
2182 } /* while blocks */
2183 } while (repeat && !deadcode);
2185 #if defined(STATISTICS)
2187 if (m->basicblockcount > count_max_basic_blocks)
2188 count_max_basic_blocks = m->basicblockcount;
2189 count_basic_blocks += m->basicblockcount;
2190 if (m->instructioncount > count_max_javainstr) count_max_javainstr = m->instructioncount;
2191 count_javainstr += m->instructioncount;
2192 if (m->stackcount > count_upper_bound_new_stack)
2193 count_upper_bound_new_stack = m->stackcount;
2194 if ((new - m->stack) > count_max_new_stack)
2195 count_max_new_stack = (new - m->stack);
2197 b_count = m->basicblockcount;
2198 bptr = m->basicblocks;
2199 while (--b_count >= 0) {
2200 if (bptr->flags > BBREACHED) {
2201 if (bptr->indepth >= 10)
2202 count_block_stack[10]++;
2204 count_block_stack[bptr->indepth]++;
2207 count_block_size_distribution[len]++;
2209 count_block_size_distribution[10]++;
2211 count_block_size_distribution[11]++;
2213 count_block_size_distribution[12]++;
2215 count_block_size_distribution[13]++;
2217 count_block_size_distribution[14]++;
2219 count_block_size_distribution[15]++;
2221 count_block_size_distribution[16]++;
2223 count_block_size_distribution[17]++;
2229 count_analyse_iterations[0]++;
2230 else if (loops == 2)
2231 count_analyse_iterations[1]++;
2232 else if (loops == 3)
2233 count_analyse_iterations[2]++;
2234 else if (loops == 4)
2235 count_analyse_iterations[3]++;
2237 count_analyse_iterations[4]++;
2239 if (m->basicblockcount <= 5)
2240 count_method_bb_distribution[0]++;
2241 else if (m->basicblockcount <= 10)
2242 count_method_bb_distribution[1]++;
2243 else if (m->basicblockcount <= 15)
2244 count_method_bb_distribution[2]++;
2245 else if (m->basicblockcount <= 20)
2246 count_method_bb_distribution[3]++;
2247 else if (m->basicblockcount <= 30)
2248 count_method_bb_distribution[4]++;
2249 else if (m->basicblockcount <= 40)
2250 count_method_bb_distribution[5]++;
2251 else if (m->basicblockcount <= 50)
2252 count_method_bb_distribution[6]++;
2253 else if (m->basicblockcount <= 75)
2254 count_method_bb_distribution[7]++;
2256 count_method_bb_distribution[8]++;
2260 /* just return methodinfo* to signal everything was ok */
2266 /**********************************************************************/
2267 /* DEBUGGING HELPERS */
2268 /**********************************************************************/
2270 void icmd_print_stack(codegendata *cd, stackptr s)
2282 j = cd->maxstack - i;
2288 if (s->flags & SAVEDVAR)
2289 switch (s->varkind) {
2291 if (s->flags & INMEMORY)
2292 printf(" M%02d", s->regoff);
2293 #ifdef HAS_ADDRESS_REGISTER_FILE
2294 else if (s->type == TYPE_ADR)
2295 printf(" R%02d", s->regoff);
2297 else if (IS_FLT_DBL_TYPE(s->type))
2298 printf(" F%02d", s->regoff);
2300 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2301 if (IS_2_WORD_TYPE(s->type))
2302 printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
2303 regs[GET_HIGH_REG(s->regoff)]);
2306 #if defined(ENABLE_INTRP)
2307 printf(" %3d", s->regoff);
2309 printf(" %3s", regs[s->regoff]);
2314 printf(" I%02d", s->varnum);
2317 printf(" L%02d", s->varnum);
2320 if (s->varnum == -1) {
2322 /* varkind ARGVAR "misused for this special case */
2324 } else /* "normal" Argvar */
2325 printf(" A%02d", s->varnum);
2326 #ifdef INVOKE_NEW_DEBUG
2327 if (s->flags & INMEMORY)
2328 printf("(M%i)", s->regoff);
2330 printf("(R%i)", s->regoff);
2334 printf(" !%02d", j);
2337 switch (s->varkind) {
2339 if (s->flags & INMEMORY)
2340 printf(" m%02d", s->regoff);
2341 #ifdef HAS_ADDRESS_REGISTER_FILE
2342 else if (s->type == TYPE_ADR)
2343 printf(" r%02d", s->regoff);
2345 else if (IS_FLT_DBL_TYPE(s->type))
2346 printf(" f%02d", s->regoff);
2348 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2349 if (IS_2_WORD_TYPE(s->type))
2350 printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
2351 regs[GET_HIGH_REG(s->regoff)]);
2354 #if defined(ENABLE_INTRP)
2355 printf(" %3d", s->regoff);
2357 printf(" %3s", regs[s->regoff]);
2362 printf(" i%02d", s->varnum);
2365 printf(" l%02d", s->varnum);
2368 if (s->varnum == -1) {
2370 /* varkind ARGVAR "misused for this special case */
2372 } else /* "normal" Argvar */
2373 printf(" a%02d", s->varnum);
2374 #ifdef INVOKE_NEW_DEBUG
2375 if (s->flags & INMEMORY)
2376 printf("(M%i)", s->regoff);
2378 printf("(R%i)", s->regoff);
2382 printf(" ?%02d", j);
2390 static void print_reg(stackptr s) {
2392 if (s->flags & SAVEDVAR)
2393 switch (s->varkind) {
2395 if (s->flags & INMEMORY)
2396 printf(" tm%02d", s->regoff);
2398 printf(" tr%02d", s->regoff);
2401 printf(" s %02d", s->varnum);
2404 printf(" l %02d", s->varnum);
2407 printf(" a %02d", s->varnum);
2410 printf(" ! %02d", s->varnum);
2413 switch (s->varkind) {
2415 if (s->flags & INMEMORY)
2416 printf(" Tm%02d", s->regoff);
2418 printf(" Tr%02d", s->regoff);
2421 printf(" S %02d", s->varnum);
2424 printf(" L %02d", s->varnum);
2427 printf(" A %02d", s->varnum);
2430 printf(" ? %02d", s->varnum);
2440 static char *jit_type[] = {
2449 /* show_icmd_method ************************************************************
2453 *******************************************************************************/
2455 void show_icmd_method(methodinfo *m, codegendata *cd, registerdata *rd)
2462 #if defined(USE_THREADS)
2463 /* We need to enter a lock here, since the binutils disassembler
2464 is not reentrant-able and we could not read functions printed
2465 at the same time. */
2467 builtin_monitorenter(lock_show_icmd);
2471 utf_fprint_classname(stdout, m->class->name);
2473 utf_fprint(stdout, m->name);
2474 utf_fprint(stdout, m->descriptor);
2475 printf("\n\nMax locals: %d\n", (int) cd->maxlocals);
2476 printf("Max stack: %d\n", (int) cd->maxstack);
2477 printf("Line number table length: %d\n", m->linenumbercount);
2479 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
2480 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
2481 printf(" L%03d ... ", ex->start->debug_nr );
2482 printf("L%03d = ", ex->end->debug_nr);
2483 printf("L%03d", ex->handler->debug_nr);
2484 printf(" (catchtype: ");
2485 if (ex->catchtype.any)
2486 if (IS_CLASSREF(ex->catchtype))
2487 utf_display_classname(ex->catchtype.ref->name);
2489 utf_display_classname(ex->catchtype.cls->name);
2495 printf("Local Table:\n");
2496 for (i = 0; i < cd->maxlocals; i++) {
2497 printf(" %3d: ", i);
2498 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
2499 #if defined(ENABLE_INTRP)
2502 if (rd->locals[i][j].type >= 0) {
2503 printf(" (%s) ", jit_type[j]);
2504 if (rd->locals[i][j].flags & INMEMORY)
2505 printf("m%2d", rd->locals[i][j].regoff);
2506 #ifdef HAS_ADDRESS_REGISTER_FILE
2507 else if (j == TYPE_ADR)
2508 printf("r%02d", rd->locals[i][j].regoff);
2510 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2511 printf("f%02d", rd->locals[i][j].regoff);
2513 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2514 if (IS_2_WORD_TYPE(j))
2516 regs[GET_LOW_REG(rd->locals[i][j].regoff)],
2517 regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
2520 printf("%3s", regs[rd->locals[i][j].regoff]);
2523 #if defined(ENABLE_INTRP)
2531 #if defined(ENABLE_LSRA)
2534 #if defined(ENABLE_INTRP)
2537 printf("Interface Table:\n");
2538 for (i = 0; i < cd->maxstack; i++) {
2539 if ((rd->interfaces[i][0].type >= 0) ||
2540 (rd->interfaces[i][1].type >= 0) ||
2541 (rd->interfaces[i][2].type >= 0) ||
2542 (rd->interfaces[i][3].type >= 0) ||
2543 (rd->interfaces[i][4].type >= 0)) {
2544 printf(" %3d: ", i);
2545 for (j = TYPE_INT; j <= TYPE_ADR; j++)
2546 if (rd->interfaces[i][j].type >= 0) {
2547 printf(" (%s) ", jit_type[j]);
2548 if (rd->interfaces[i][j].flags & SAVEDVAR) {
2549 if (rd->interfaces[i][j].flags & INMEMORY)
2550 printf("M%2d", rd->interfaces[i][j].regoff);
2551 #ifdef HAS_ADDRESS_REGISTER_FILE
2552 else if (j == TYPE_ADR)
2553 printf("R%02d", rd->interfaces[i][j].regoff);
2555 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2556 printf("F%02d", rd->interfaces[i][j].regoff);
2558 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2559 if (IS_2_WORD_TYPE(j))
2561 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
2562 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
2565 printf("%3s",regs[rd->interfaces[i][j].regoff]);
2569 if (rd->interfaces[i][j].flags & INMEMORY)
2570 printf("m%2d", rd->interfaces[i][j].regoff);
2571 #ifdef HAS_ADDRESS_REGISTER_FILE
2572 else if (j == TYPE_ADR)
2573 printf("r%02d", rd->interfaces[i][j].regoff);
2575 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
2576 printf("f%02d", rd->interfaces[i][j].regoff);
2578 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2579 if (IS_2_WORD_TYPE(j))
2581 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
2582 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
2585 printf("%3s",regs[rd->interfaces[i][j].regoff]);
2594 #if defined(ENABLE_INTRP)
2597 #if defined(ENABLE_LSRA)
2601 /* show code before first basic block */
2603 if (opt_showdisassemble) {
2604 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen);
2606 for (; u1ptr < (u1 *) ((ptrint) m->mcode + cd->dseglen + m->basicblocks[0].mpc);)
2607 u1ptr = disassinstr(u1ptr);
2612 /* show code of all basic blocks */
2614 for (bptr = m->basicblocks; bptr != NULL; bptr = bptr->next) {
2615 show_icmd_block(m, cd, bptr);
2618 /* show stubs code */
2620 if (opt_showdisassemble && opt_showexceptionstubs) {
2621 printf("\nException stubs code:\n");
2622 printf("Length: %d\n\n", (s4) (m->mcodelength -
2623 ((ptrint) cd->dseglen +
2624 m->basicblocks[m->basicblockcount].mpc)));
2626 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen +
2627 m->basicblocks[m->basicblockcount].mpc);
2629 for (; (ptrint) u1ptr < ((ptrint) m->mcode + m->mcodelength);)
2630 u1ptr = disassinstr(u1ptr);
2635 #if defined(USE_THREADS)
2636 builtin_monitorexit(lock_show_icmd);
2641 void show_icmd_block(methodinfo *m, codegendata *cd, basicblock *bptr)
2648 if (bptr->flags != BBDELETED) {
2649 deadcode = bptr->flags <= BBREACHED;
2652 for (j = cd->maxstack; j > 0; j--)
2655 icmd_print_stack(cd, bptr->instack);
2656 printf("] L%03d(%d - %d) flags=%d:\n", bptr->debug_nr, bptr->icount, bptr->pre_count,bptr->flags);
2657 iptr = bptr->iinstr;
2659 for (i = 0; i < bptr->icount; i++, iptr++) {
2662 for (j = cd->maxstack; j > 0; j--)
2666 icmd_print_stack(cd, iptr->dst);
2667 printf("] %5d (line: %5d) ", i, iptr->line);
2669 show_icmd(iptr, deadcode);
2673 if (opt_showdisassemble && (!deadcode)) {
2675 u1ptr = (u1 *) ((ptrint) m->mcode + cd->dseglen + bptr->mpc);
2677 if (bptr->next != NULL) {
2678 for (; u1ptr < (u1 *) ((ptrint) m->mcode + cd->dseglen + bptr->next->mpc);)
2679 u1ptr = disassinstr(u1ptr);
2682 for (; u1ptr < (u1 *) ((ptrint) m->mcode + m->mcodelength);)
2683 u1ptr = disassinstr(u1ptr);
2691 void show_icmd(instruction *iptr, bool deadcode)
2697 printf("%s", icmd_names[iptr->opc]);
2699 switch (iptr->opc) {
2700 case ICMD_IADDCONST:
2701 case ICMD_ISUBCONST:
2702 case ICMD_IMULCONST:
2706 case ICMD_IANDCONST:
2708 case ICMD_IXORCONST:
2709 case ICMD_ISHLCONST:
2710 case ICMD_ISHRCONST:
2711 case ICMD_IUSHRCONST:
2712 case ICMD_LSHLCONST:
2713 case ICMD_LSHRCONST:
2714 case ICMD_LUSHRCONST:
2716 case ICMD_ELSE_ICONST:
2717 case ICMD_IASTORECONST:
2718 case ICMD_BASTORECONST:
2719 case ICMD_CASTORECONST:
2720 case ICMD_SASTORECONST:
2721 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
2724 case ICMD_IFEQ_ICONST:
2725 case ICMD_IFNE_ICONST:
2726 case ICMD_IFLT_ICONST:
2727 case ICMD_IFGE_ICONST:
2728 case ICMD_IFGT_ICONST:
2729 case ICMD_IFLE_ICONST:
2730 printf("(%d) %d", iptr[1].op1, iptr->val.i);
2733 case ICMD_LADDCONST:
2734 case ICMD_LSUBCONST:
2735 case ICMD_LMULCONST:
2739 case ICMD_LANDCONST:
2741 case ICMD_LXORCONST:
2743 case ICMD_LASTORECONST:
2744 #if SIZEOF_VOID_P == 4
2745 printf(" %lld (0x%016llx)", iptr->val.l, iptr->val.l);
2747 printf(" %ld (0x%016lx)", iptr->val.l, iptr->val.l);
2752 printf(" %f (0x%08x)", iptr->val.f, iptr->val.i);
2756 #if SIZEOF_VOID_P == 4
2757 printf(" %g (0x%016llx)", iptr->val.d, iptr->val.l);
2759 printf(" %g (0x%016lx)", iptr->val.d, iptr->val.l);
2764 case ICMD_AASTORECONST:
2765 /* check if this is a constant string or a class reference */
2769 printf(" %p", iptr->val.a);
2771 printf(" (NOT RESOLVED)");
2773 printf(", Class = \"");
2774 utf_display(((constant_classref *) iptr->target)->name);
2778 printf(" %p", iptr->val.a);
2780 printf(", String = \"");
2781 utf_display(javastring_toutf(iptr->val.a, false));
2790 printf(" %d, ", ((fieldinfo *) iptr->val.a)->offset);
2792 printf(" (NOT RESOLVED), ");
2793 utf_display_classname(((unresolved_field *) iptr->target)->fieldref->classref->name);
2795 utf_display(((unresolved_field *) iptr->target)->fieldref->name);
2797 utf_display(((unresolved_field *) iptr->target)->fieldref->descriptor);
2801 case ICMD_PUTSTATIC:
2802 case ICMD_GETSTATIC:
2804 if (!(((fieldinfo *) iptr->val.a)->class->state & CLASS_INITIALIZED))
2805 printf(" (NOT INITIALIZED) ");
2809 printf(" (NOT RESOLVED) ");
2810 utf_display_classname(((unresolved_field *) iptr->target)->fieldref->classref->name);
2812 utf_display(((unresolved_field *) iptr->target)->fieldref->name);
2814 utf_display(((unresolved_field *) iptr->target)->fieldref->descriptor);
2818 case ICMD_PUTSTATICCONST:
2819 case ICMD_PUTFIELDCONST:
2820 switch (iptr[1].op1) {
2822 printf(" %d (0x%08x),", iptr->val.i, iptr->val.i);
2825 #if SIZEOF_VOID_P == 4
2826 printf(" %lld (0x%016llx),", iptr->val.l, iptr->val.l);
2828 printf(" %ld (0x%016lx),", iptr->val.l, iptr->val.l);
2832 printf(" %p,", iptr->val.a);
2835 printf(" %g (0x%08x),", iptr->val.f, iptr->val.i);
2838 #if SIZEOF_VOID_P == 4
2839 printf(" %g (0x%016llx),", iptr->val.d, iptr->val.l);
2841 printf(" %g (0x%016lx),", iptr->val.d, iptr->val.l);
2845 if (iptr->opc == ICMD_PUTFIELDCONST) {
2847 printf(" %d,", ((fieldinfo *) iptr[1].val.a)->offset);
2849 printf(" (NOT RESOLVED),");
2852 utf_display_classname(((unresolved_field *) iptr[1].target)->fieldref->classref->name);
2854 utf_display(((unresolved_field *) iptr[1].target)->fieldref->name);
2856 utf_display(((unresolved_field *) iptr[1].target)->fieldref->descriptor);
2861 printf(" %d + %d", iptr->op1, iptr->val.i);
2896 printf(" %d", iptr->op1);
2901 utf_display_classname(((classinfo *) iptr->val.a)->name);
2905 switch (iptr->op1) {
2933 case ICMD_ANEWARRAY:
2936 utf_display_classname(((classinfo *) iptr->val.a)->name);
2940 case ICMD_MULTIANEWARRAY:
2942 printf(" (NOT RESOLVED) %d ",iptr->op1);
2943 utf_display(((constant_classref *) iptr->val.a)->name);
2945 printf(" %d ",iptr->op1);
2946 utf_display_classname(((vftbl_t *) iptr->val.a)->class->name);
2950 case ICMD_CHECKCAST:
2951 case ICMD_INSTANCEOF:
2953 classinfo *c = iptr->val.a;
2955 if (c->flags & ACC_INTERFACE)
2956 printf(" (INTERFACE) ");
2958 printf(" (CLASS,%3d) ", c->vftbl->diffval);
2960 printf(" (NOT RESOLVED) ");
2962 utf_display_classname(((constant_classref *) iptr->target)->name);
2966 case ICMD_INLINE_START:
2968 utf_display_classname(iptr->method->class->name);
2970 utf_display_classname(iptr->method->name);
2971 utf_display_classname(iptr->method->descriptor);
2972 printf(", depth=%i", iptr->op1);
2975 case ICMD_INLINE_END:
2979 printf(" %s", ((builtintable_entry *) iptr->val.a)->name);
2982 case ICMD_INVOKEVIRTUAL:
2983 case ICMD_INVOKESPECIAL:
2984 case ICMD_INVOKESTATIC:
2985 case ICMD_INVOKEINTERFACE:
2987 printf(" (NOT RESOLVED) ");
2990 utf_display_classname(((unresolved_method *) iptr->target)->methodref->classref->name);
2992 utf_display(((unresolved_method *) iptr->target)->methodref->name);
2993 utf_display(((unresolved_method *) iptr->target)->methodref->descriptor);
3002 if (deadcode || !iptr->target)
3003 printf(" %d (0x%08x) op1=%d", iptr->val.i, iptr->val.i, iptr->op1);
3005 printf(" %d (0x%08x) L%03d", iptr->val.i, iptr->val.i, ((basicblock *) iptr->target)->debug_nr);
3014 if (deadcode || !iptr->target)
3015 #if SIZEOF_VOID_P == 4
3016 printf("(%lld) op1=%d", iptr->val.l, iptr->op1);
3018 printf("(%ld) op1=%d", iptr->val.l, iptr->op1);
3021 #if SIZEOF_VOID_P == 4
3022 printf("(%lld) L%03d", iptr->val.l, ((basicblock *) iptr->target)->debug_nr);
3024 printf("(%ld) L%03d", iptr->val.l, ((basicblock *) iptr->target)->debug_nr);
3031 case ICMD_IFNONNULL:
3032 case ICMD_IF_ICMPEQ:
3033 case ICMD_IF_ICMPNE:
3034 case ICMD_IF_ICMPLT:
3035 case ICMD_IF_ICMPGE:
3036 case ICMD_IF_ICMPGT:
3037 case ICMD_IF_ICMPLE:
3038 case ICMD_IF_LCMPEQ:
3039 case ICMD_IF_LCMPNE:
3040 case ICMD_IF_LCMPLT:
3041 case ICMD_IF_LCMPGE:
3042 case ICMD_IF_LCMPGT:
3043 case ICMD_IF_LCMPLE:
3044 case ICMD_IF_ACMPEQ:
3045 case ICMD_IF_ACMPNE:
3046 if (deadcode || !iptr->target)
3047 printf(" op1=%d", iptr->op1);
3049 printf(" L%03d", ((basicblock *) iptr->target)->debug_nr);
3052 case ICMD_TABLESWITCH:
3053 s4ptr = (s4*)iptr->val.a;
3055 if (deadcode || !iptr->target) {
3056 printf(" %d;", *s4ptr);
3059 tptr = (void **) iptr->target;
3060 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
3064 s4ptr++; /* skip default */
3065 j = *s4ptr++; /* low */
3066 j = *s4ptr++ - j; /* high */
3068 if (deadcode || !*tptr)
3069 printf(" %d", *s4ptr++);
3071 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
3078 case ICMD_LOOKUPSWITCH:
3079 s4ptr = (s4*)iptr->val.a;
3081 if (deadcode || !iptr->target) {
3082 printf(" %d;", *s4ptr);
3085 tptr = (void **) iptr->target;
3086 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
3089 s4ptr++; /* default */
3090 j = *s4ptr++; /* count */
3093 if (deadcode || !*tptr) {
3094 s4ptr++; /* skip value */
3095 printf(" %d",*s4ptr++);
3098 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
3106 printf(" (NOT RESOLVED), Class = \"");
3107 utf_display(((unresolved_class *) iptr->val.a)->classref->name);
3115 * These are local overrides for various environment variables in Emacs.
3116 * Please do not remove this and leave it at the end of the file, where
3117 * Emacs will automagically detect them.
3118 * ---------------------------------------------------------------------
3121 * indent-tabs-mode: t