1 /* src/vm/jit/show.c - showing the intermediate representation
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
43 #include "mm/memory.h"
45 #if defined(ENABLE_THREADS)
46 # include "threads/native/lock.h"
48 # include "threads/none/lock.h"
51 #include "vm/global.h"
52 #include "vm/options.h"
53 #include "vm/builtin.h"
54 #include "vm/stringlocal.h"
55 #include "vm/jit/jit.h"
56 #include "vm/jit/show.h"
57 #include "vm/jit/disass.h"
60 /* global variables ***********************************************************/
62 #if defined(ENABLE_THREADS) && !defined(NDEBUG)
63 static java_objectheader *show_global_lock;
67 /* show_init *******************************************************************
69 Initialized the show subsystem (called by jit_init).
71 *******************************************************************************/
76 #if defined(ENABLE_THREADS)
77 /* initialize the show lock */
79 show_global_lock = NEW(java_objectheader);
81 lock_init_object_lock(show_global_lock);
91 /* show_print_stack ************************************************************
93 Print the stack representation starting with the given top stackptr.
95 NOTE: Currently this function may only be called after register allocation!
97 *******************************************************************************/
100 static void show_print_stack(codegendata *cd, stackptr s)
112 j = cd->maxstack - i;
118 if (s->flags & SAVEDVAR)
119 switch (s->varkind) {
121 if (s->flags & INMEMORY)
122 printf(" M%02d", s->regoff);
123 #ifdef HAS_ADDRESS_REGISTER_FILE
124 else if (s->type == TYPE_ADR)
125 printf(" R%02d", s->regoff);
127 else if (IS_FLT_DBL_TYPE(s->type))
128 printf(" F%02d", s->regoff);
130 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
131 if (IS_2_WORD_TYPE(s->type)) {
132 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
133 # if defined(ENABLE_INTRP)
135 printf(" %3d/%3d", GET_LOW_REG(s->regoff),
136 GET_HIGH_REG(s->regoff));
139 printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
140 regs[GET_HIGH_REG(s->regoff)]);
142 printf(" %3d/%3d", GET_LOW_REG(s->regoff),
143 GET_HIGH_REG(s->regoff));
147 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
149 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
150 # if defined(ENABLE_INTRP)
152 printf(" %3d", s->regoff);
155 printf(" %3s", regs[s->regoff]);
157 printf(" %3d", s->regoff);
163 printf(" I%02d", s->varnum);
166 printf(" L%02d", s->varnum);
169 if (s->varnum == -1) {
171 /* varkind ARGVAR "misused for this special case */
174 else /* "normal" Argvar */
175 printf(" A%02d", s->varnum);
181 switch (s->varkind) {
183 if (s->flags & INMEMORY)
184 printf(" m%02d", s->regoff);
185 #ifdef HAS_ADDRESS_REGISTER_FILE
186 else if (s->type == TYPE_ADR)
187 printf(" r%02d", s->regoff);
189 else if (IS_FLT_DBL_TYPE(s->type))
190 printf(" f%02d", s->regoff);
192 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
193 if (IS_2_WORD_TYPE(s->type)) {
194 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
195 # if defined(ENABLE_INTRP)
197 printf(" %3d/%3d", GET_LOW_REG(s->regoff),
198 GET_HIGH_REG(s->regoff));
201 printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
202 regs[GET_HIGH_REG(s->regoff)]);
204 printf(" %3d/%3d", GET_LOW_REG(s->regoff),
205 GET_HIGH_REG(s->regoff));
209 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
211 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
212 # if defined(ENABLE_INTRP)
214 printf(" %3d", s->regoff);
217 printf(" %3s", regs[s->regoff]);
219 printf(" %3d", s->regoff);
225 printf(" i%02d", s->varnum);
228 printf(" l%02d", s->varnum);
231 if (s->varnum == -1) {
233 /* varkind ARGVAR "misused for this special case */
236 else /* "normal" Argvar */
237 printf(" a%02d", s->varnum);
245 #endif /* !defined(NDEBUG) */
249 static void print_reg(stackptr s) {
251 if (s->flags & SAVEDVAR)
252 switch (s->varkind) {
254 if (s->flags & INMEMORY)
255 printf(" tm%02d", s->regoff);
257 printf(" tr%02d", s->regoff);
260 printf(" s %02d", s->varnum);
263 printf(" l %02d", s->varnum);
266 printf(" a %02d", s->varnum);
269 printf(" ! %02d", s->varnum);
272 switch (s->varkind) {
274 if (s->flags & INMEMORY)
275 printf(" Tm%02d", s->regoff);
277 printf(" Tr%02d", s->regoff);
280 printf(" S %02d", s->varnum);
283 printf(" L %02d", s->varnum);
286 printf(" A %02d", s->varnum);
289 printf(" ? %02d", s->varnum);
300 static char *jit_type[] = {
310 /* show_method *****************************************************************
312 Print the intermediate representation of a method.
314 NOTE: Currently this function may only be called after register allocation!
316 *******************************************************************************/
319 void new_show_method(jitdata *jd, int stage)
326 basicblock *lastbptr;
331 /* get required compiler data */
338 /* We need to enter a lock here, since the binutils disassembler
339 is not reentrant-able and we could not read functions printed
342 LOCK_MONITOR_ENTER(show_global_lock);
344 /* get the last basic block */
346 for (lastbptr = jd->new_basicblocks; lastbptr != NULL; lastbptr = lastbptr->next);
352 printf("\n(NEW INSTRUCTION FORMAT)\n");
353 printf("\nBasic blocks: %d\n", jd->new_basicblockcount);
354 printf("Code length: %d\n", (lastbptr->mpc - jd->new_basicblocks[0].mpc));
355 printf("Data length: %d\n", cd->dseglen);
356 printf("Stub length: %d\n", (s4) (code->mcodelength -
357 ((ptrint) cd->dseglen + lastbptr->mpc)));
358 printf("Max locals: %d\n", cd->maxlocals);
359 printf("Max stack: %d\n", cd->maxstack);
360 printf("Line number table length: %d\n", m->linenumbercount);
362 if (stage >= SHOW_PARSE) {
363 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
364 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
365 printf(" L%03d ... ", ex->start->debug_nr );
366 printf("L%03d = ", ex->end->debug_nr);
367 printf("L%03d", ex->handler->debug_nr);
368 printf(" (catchtype: ");
369 if (ex->catchtype.any)
370 if (IS_CLASSREF(ex->catchtype))
371 utf_display_printable_ascii_classname(ex->catchtype.ref->name);
373 utf_display_printable_ascii_classname(ex->catchtype.cls->name);
380 if (stage >= SHOW_PARSE && rd) {
381 printf("Local Table:\n");
382 for (i = 0; i < cd->maxlocals; i++) {
385 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
386 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
387 # if defined(ENABLE_INTRP)
390 if (rd->locals[i][j].type >= 0) {
391 printf(" (%s) ", jit_type[j]);
392 if (stage >= SHOW_REGS) {
393 if (rd->locals[i][j].flags & INMEMORY)
394 printf("m%2d", rd->locals[i][j].regoff);
395 # ifdef HAS_ADDRESS_REGISTER_FILE
396 else if (j == TYPE_ADR)
397 printf("r%02d", rd->locals[i][j].regoff);
399 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
400 printf("f%02d", rd->locals[i][j].regoff);
402 # if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
403 if (IS_2_WORD_TYPE(j))
405 regs[GET_LOW_REG(rd->locals[i][j].regoff)],
406 regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
409 printf("%3s", regs[rd->locals[i][j].regoff]);
413 # if defined(ENABLE_INTRP)
417 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
424 if (stage >= SHOW_STACK && rd) {
425 #if defined(ENABLE_LSRA)
428 #if defined(ENABLE_INTRP)
431 printf("Interface Table:\n");
432 for (i = 0; i < cd->maxstack; i++) {
433 if ((rd->interfaces[i][0].type >= 0) ||
434 (rd->interfaces[i][1].type >= 0) ||
435 (rd->interfaces[i][2].type >= 0) ||
436 (rd->interfaces[i][3].type >= 0) ||
437 (rd->interfaces[i][4].type >= 0)) {
440 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
441 # if defined(ENABLE_INTRP)
444 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
445 if (rd->interfaces[i][j].type >= 0) {
446 printf(" (%s) ", jit_type[j]);
447 if (stage >= SHOW_REGS) {
448 if (rd->interfaces[i][j].flags & SAVEDVAR) {
449 if (rd->interfaces[i][j].flags & INMEMORY)
450 printf("M%2d", rd->interfaces[i][j].regoff);
451 #ifdef HAS_ADDRESS_REGISTER_FILE
452 else if (j == TYPE_ADR)
453 printf("R%02d", rd->interfaces[i][j].regoff);
455 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
456 printf("F%02d", rd->interfaces[i][j].regoff);
458 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
459 if (IS_2_WORD_TYPE(j))
461 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
462 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
465 printf("%3s",regs[rd->interfaces[i][j].regoff]);
469 if (rd->interfaces[i][j].flags & INMEMORY)
470 printf("m%2d", rd->interfaces[i][j].regoff);
471 #ifdef HAS_ADDRESS_REGISTER_FILE
472 else if (j == TYPE_ADR)
473 printf("r%02d", rd->interfaces[i][j].regoff);
475 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
476 printf("f%02d", rd->interfaces[i][j].regoff);
478 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
479 if (IS_2_WORD_TYPE(j))
481 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
482 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
485 printf("%3s",regs[rd->interfaces[i][j].regoff]);
492 # if defined(ENABLE_INTRP)
495 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
501 #if defined(ENABLE_INTRP)
504 #if defined(ENABLE_LSRA)
507 } /* if >= SHOW_STACK */
509 if (code->rplpoints) {
510 printf("Replacement Points:\n");
511 replace_show_replacement_points(code);
515 #if defined(ENABLE_DISASSEMBLER)
516 /* show code before first basic block */
518 if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd)) {
519 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen);
521 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + jd->new_basicblocks[0].mpc);)
528 /* show code of all basic blocks */
530 for (bptr = jd->new_basicblocks; bptr != NULL; bptr = bptr->next)
531 new_show_basicblock(jd, bptr, stage);
533 #if defined(ENABLE_DISASSEMBLER)
534 /* show stubs code */
536 if (stage >= SHOW_CODE && opt_showdisassemble && opt_showexceptionstubs) {
537 printf("\nStubs code:\n");
538 printf("Length: %d\n\n", (s4) (code->mcodelength -
539 ((ptrint) cd->dseglen + lastbptr->mpc)));
541 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen + lastbptr->mpc);
543 for (; (ptrint) u1ptr < ((ptrint) code->mcode + code->mcodelength);)
550 LOCK_MONITOR_EXIT(show_global_lock);
552 /* finally flush the output */
556 #endif /* !defined(NDEBUG) */
559 void show_method(jitdata *jd)
566 basicblock *lastbptr;
571 /* get required compiler data */
578 /* We need to enter a lock here, since the binutils disassembler
579 is not reentrant-able and we could not read functions printed
582 LOCK_MONITOR_ENTER(show_global_lock);
584 /* get the last basic block */
586 for (bptr = m->basicblocks; bptr != NULL; bptr = bptr->next)
593 printf("\nBasic blocks: %d\n", m->basicblockcount);
594 printf("Code length: %d\n", (lastbptr->mpc - m->basicblocks[0].mpc));
595 printf("Data length: %d\n", cd->dseglen);
596 printf("Stub length: %d\n", (s4) (code->mcodelength -
597 ((ptrint) cd->dseglen + lastbptr->mpc)));
598 printf("Max locals: %d\n", cd->maxlocals);
599 printf("Max stack: %d\n", cd->maxstack);
600 printf("Line number table length: %d\n", m->linenumbercount);
602 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
603 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
604 printf(" L%03d ... ", ex->start->debug_nr );
605 printf("L%03d = ", ex->end->debug_nr);
606 printf("L%03d", ex->handler->debug_nr);
607 printf(" (catchtype: ");
608 if (ex->catchtype.any)
609 if (IS_CLASSREF(ex->catchtype))
610 utf_display_printable_ascii_classname(ex->catchtype.ref->name);
612 utf_display_printable_ascii_classname(ex->catchtype.cls->name);
618 printf("Local Table:\n");
619 for (i = 0; i < cd->maxlocals; i++) {
622 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
623 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
624 # if defined(ENABLE_INTRP)
627 if (rd->locals[i][j].type >= 0) {
628 printf(" (%s) ", jit_type[j]);
629 if (rd->locals[i][j].flags & INMEMORY)
630 printf("m%2d", rd->locals[i][j].regoff);
631 # ifdef HAS_ADDRESS_REGISTER_FILE
632 else if (j == TYPE_ADR)
633 printf("r%02d", rd->locals[i][j].regoff);
635 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
636 printf("f%02d", rd->locals[i][j].regoff);
638 # if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
639 if (IS_2_WORD_TYPE(j))
641 regs[GET_LOW_REG(rd->locals[i][j].regoff)],
642 regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
645 printf("%3s", regs[rd->locals[i][j].regoff]);
648 # if defined(ENABLE_INTRP)
652 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
658 #if defined(ENABLE_LSRA)
661 #if defined(ENABLE_INTRP)
664 printf("Interface Table:\n");
665 for (i = 0; i < cd->maxstack; i++) {
666 if ((rd->interfaces[i][0].type >= 0) ||
667 (rd->interfaces[i][1].type >= 0) ||
668 (rd->interfaces[i][2].type >= 0) ||
669 (rd->interfaces[i][3].type >= 0) ||
670 (rd->interfaces[i][4].type >= 0)) {
673 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
674 # if defined(ENABLE_INTRP)
677 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
678 if (rd->interfaces[i][j].type >= 0) {
679 printf(" (%s) ", jit_type[j]);
680 if (rd->interfaces[i][j].flags & SAVEDVAR) {
681 if (rd->interfaces[i][j].flags & INMEMORY)
682 printf("M%2d", rd->interfaces[i][j].regoff);
683 #ifdef HAS_ADDRESS_REGISTER_FILE
684 else if (j == TYPE_ADR)
685 printf("R%02d", rd->interfaces[i][j].regoff);
687 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
688 printf("F%02d", rd->interfaces[i][j].regoff);
690 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
691 if (IS_2_WORD_TYPE(j))
693 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
694 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
697 printf("%3s",regs[rd->interfaces[i][j].regoff]);
701 if (rd->interfaces[i][j].flags & INMEMORY)
702 printf("m%2d", rd->interfaces[i][j].regoff);
703 #ifdef HAS_ADDRESS_REGISTER_FILE
704 else if (j == TYPE_ADR)
705 printf("r%02d", rd->interfaces[i][j].regoff);
707 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
708 printf("f%02d", rd->interfaces[i][j].regoff);
710 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
711 if (IS_2_WORD_TYPE(j))
713 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
714 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
717 printf("%3s",regs[rd->interfaces[i][j].regoff]);
723 # if defined(ENABLE_INTRP)
726 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
732 #if defined(ENABLE_INTRP)
735 #if defined(ENABLE_LSRA)
739 if (code->rplpoints) {
740 printf("Replacement Points:\n");
741 replace_show_replacement_points(code);
745 #if defined(ENABLE_DISASSEMBLER)
746 /* show code before first basic block */
748 if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd)) {
749 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen);
751 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + m->basicblocks[0].mpc);)
758 /* show code of all basic blocks */
760 for (bptr = m->basicblocks; bptr != NULL; bptr = bptr->next)
761 show_basicblock(jd, bptr);
763 #if defined(ENABLE_DISASSEMBLER)
764 /* show stubs code */
766 if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) && opt_showexceptionstubs) {
767 printf("\nStubs code:\n");
768 printf("Length: %d\n\n", (s4) (code->mcodelength -
769 ((ptrint) cd->dseglen + lastbptr->mpc)));
771 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen + lastbptr->mpc);
773 for (; (ptrint) u1ptr < ((ptrint) code->mcode + code->mcodelength);)
780 LOCK_MONITOR_EXIT(show_global_lock);
782 /* finally flush the output */
786 #endif /* !defined(NDEBUG) */
789 /* show_basicblock *************************************************************
791 Print the intermediate representation of a basic block.
793 NOTE: Currently this function may only be called after register allocation!
795 *******************************************************************************/
798 void new_show_basicblock(jitdata *jd, basicblock *bptr, int stage)
805 new_instruction *iptr;
808 /* get required compiler data */
814 if (bptr->flags != BBDELETED) {
815 deadcode = bptr->flags <= BBREACHED;
817 printf("======== %sL%03d ======== (flags: %d, bitflags: %01x, next: %d, type: ",
818 (bptr->bitflags & BBFLAG_REPLACEMENT) ? "<REPLACE> " : "",
819 bptr->debug_nr, bptr->flags, bptr->bitflags,
820 (bptr->next) ? (bptr->next->debug_nr) : -1);
822 switch (bptr->type) {
834 printf(", instruction count: %d, predecessors: %d):\n",
835 bptr->icount, bptr->predecessorcount);
837 iptr = /*XXX*/ (new_instruction *) bptr->iinstr;
839 for (i = 0; i < bptr->icount; i++, iptr++) {
840 printf("%4d: ", iptr->line);
842 new_show_icmd(jd, iptr, deadcode, stage);
846 #if defined(ENABLE_DISASSEMBLER)
847 if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) &&
850 u1ptr = (u1 *) (code->mcode + cd->dseglen + bptr->mpc);
852 if (bptr->next != NULL) {
853 for (; u1ptr < (u1 *) (code->mcode + cd->dseglen + bptr->next->mpc);)
858 for (; u1ptr < (u1 *) (code->mcode + code->mcodelength);)
866 #endif /* !defined(NDEBUG) */
869 void show_basicblock(jitdata *jd, basicblock *bptr)
879 /* get required compiler data */
885 if (bptr->flags != BBDELETED) {
886 deadcode = bptr->flags <= BBREACHED;
891 for (j = cd->maxstack; j > 0; j--)
894 show_print_stack(cd, bptr->instack);
896 printf("] %sL%03d(flags: %d, bitflags: %01x, next: %d, type: ",
897 (bptr->bitflags & BBFLAG_REPLACEMENT) ? "<REPLACE> " : "",
898 bptr->debug_nr, bptr->flags, bptr->bitflags,
899 (bptr->next) ? (bptr->next->debug_nr) : -1);
901 switch (bptr->type) {
913 printf(", instruction count: %d, predecessors: %d):\n",
914 bptr->icount, bptr->predecessorcount);
918 for (i = 0; i < bptr->icount; i++, iptr++) {
922 for (j = cd->maxstack; j > 0; j--)
925 show_print_stack(cd, iptr->dst);
927 printf("] %5d (line: %5d) ", i, iptr->line);
929 show_icmd(iptr, deadcode);
933 #if defined(ENABLE_DISASSEMBLER)
934 if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) && (!deadcode)) {
936 u1ptr = (u1 *) (code->mcode + cd->dseglen + bptr->mpc);
938 if (bptr->next != NULL) {
939 for (; u1ptr < (u1 *) (code->mcode + cd->dseglen + bptr->next->mpc);)
944 for (; u1ptr < (u1 *) (code->mcode + code->mcodelength);)
952 #endif /* !defined(NDEBUG) */
955 /* show_icmd *******************************************************************
957 Print the intermediate representation of an instruction.
959 NOTE: Currently this function may only be called after register allocation!
961 *******************************************************************************/
965 #define SHOW_TARGET(target) \
966 if (stage >= SHOW_STACK) { \
967 printf("--> L%03d ", (target).block->debug_nr); \
969 else if (stage >= SHOW_PARSE) { \
970 printf("--> insindex %d (L%03d) ", (target).insindex, \
971 jd->new_basicblocks[jd->new_basicblockindex[ \
972 (target).insindex]].debug_nr); \
975 printf("--> insindex %d ", (target).insindex); \
978 #define SHOW_INT_CONST(val) \
979 if (stage >= SHOW_PARSE) { \
980 printf("%ld ", (long) (val)); \
986 #define SHOW_LNG_CONST(val) \
987 if (stage >= SHOW_PARSE) { \
988 printf("%lld ", (long long)(val)); \
994 #define SHOW_FLT_CONST(val) \
995 if (stage >= SHOW_PARSE) { \
996 printf("%g ", (val)); \
1002 #define SHOW_DBL_CONST(val) \
1003 if (stage >= SHOW_PARSE) { \
1004 printf("%g ", (val)); \
1007 printf("dconst "); \
1010 #define SHOW_INDEX(index) \
1011 if (stage >= SHOW_PARSE) { \
1012 printf("%d ", index); \
1018 #define SHOW_STRING(val) \
1019 if (stage >= SHOW_PARSE) { \
1021 utf_display_printable_ascii( \
1022 javastring_toutf((java_lang_String *)(val), false)); \
1026 printf("string "); \
1029 #define SHOW_CLASSREF_OR_CLASSINFO(c) \
1030 if (stage >= SHOW_PARSE) { \
1031 if (IS_CLASSREF(c)) \
1032 class_classref_print(c.ref); \
1034 class_print(c.cls); \
1041 #define SHOW_FIELD(fmiref) \
1042 if (stage >= SHOW_PARSE) { \
1043 field_fieldref_print(fmiref); \
1050 #define SHOW_STACKVAR(sp) \
1051 new_show_stackvar(jd, (sp), stage)
1053 #define SHOW_S1(iptr) \
1054 if (stage >= SHOW_STACK) { \
1055 SHOW_STACKVAR(iptr->s1.var); \
1058 #define SHOW_S2(iptr) \
1059 if (stage >= SHOW_STACK) { \
1060 SHOW_STACKVAR(iptr->sx.s23.s2.var); \
1063 #define SHOW_S3(iptr) \
1064 if (stage >= SHOW_STACK) { \
1065 SHOW_STACKVAR(iptr->sx.s23.s3.var); \
1068 #define SHOW_DST(iptr) \
1069 if (stage >= SHOW_STACK) { \
1071 SHOW_STACKVAR(iptr->dst.var); \
1074 #define SHOW_S1_LOCAL(iptr) \
1075 if (stage >= SHOW_STACK) { \
1076 printf("L%d ", iptr->s1.localindex); \
1079 #define SHOW_DST_LOCAL(iptr) \
1080 if (stage >= SHOW_STACK) { \
1081 printf("=> L%d ", iptr->dst.localindex); \
1084 static void new_show_stackvar(jitdata *jd, stackptr sp, int stage)
1089 case TYPE_INT: type = 'i'; break;
1090 case TYPE_LNG: type = 'l'; break;
1091 case TYPE_FLT: type = 'f'; break;
1092 case TYPE_DBL: type = 'd'; break;
1093 case TYPE_ADR: type = 'a'; break;
1094 default: type = '?';
1096 printf("S%c%d", type, (int) (sp - jd->new_stack));
1098 if (stage >= SHOW_REGS) {
1101 if (sp->flags & SAVEDVAR) {
1102 switch (sp->varkind) {
1104 if (sp->flags & INMEMORY)
1105 printf("M%02d", sp->regoff);
1106 #ifdef HAS_ADDRESS_REGISTER_FILE
1107 else if (sp->type == TYPE_ADR)
1108 printf("R%02d", sp->regoff);
1110 else if (IS_FLT_DBL_TYPE(sp->type))
1111 printf("F%02d", sp->regoff);
1113 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
1114 if (IS_2_WORD_TYPE(sp->type)) {
1115 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1116 # if defined(ENABLE_INTRP)
1118 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1119 GET_HIGH_REG(sp->regoff));
1122 printf("%3s/%3s", regs[GET_LOW_REG(sp->regoff)],
1123 regs[GET_HIGH_REG(sp->regoff)]);
1125 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1126 GET_HIGH_REG(sp->regoff));
1130 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
1132 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1133 # if defined(ENABLE_INTRP)
1135 printf("%3d", sp->regoff);
1138 printf("%3s", regs[sp->regoff]);
1140 printf("%3d", sp->regoff);
1146 printf("I%02d", sp->varnum);
1149 printf("L%02d", sp->varnum);
1152 if (sp->varnum == -1) {
1154 /* varkind ARGVAR "misused for this special case */
1157 else /* "normal" Argvar */
1158 printf("A%02d", sp->varnum);
1161 printf("!xx {kind=%d, num=%d}", sp->varkind, sp->varnum);
1164 else { /* not SAVEDVAR */
1165 switch (sp->varkind) {
1167 if (sp->flags & INMEMORY)
1168 printf("m%02d", sp->regoff);
1169 #ifdef HAS_ADDRESS_REGISTER_FILE
1170 else if (sp->type == TYPE_ADR)
1171 printf("r%02d", sp->regoff);
1173 else if (IS_FLT_DBL_TYPE(sp->type))
1174 printf("f%02d", sp->regoff);
1176 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
1177 if (IS_2_WORD_TYPE(sp->type)) {
1178 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1179 # if defined(ENABLE_INTRP)
1181 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1182 GET_HIGH_REG(sp->regoff));
1185 printf("%3s/%3s", regs[GET_LOW_REG(sp->regoff)],
1186 regs[GET_HIGH_REG(sp->regoff)]);
1188 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1189 GET_HIGH_REG(sp->regoff));
1193 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
1195 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1196 # if defined(ENABLE_INTRP)
1198 printf("%3d", sp->regoff);
1201 printf("%3s", regs[sp->regoff]);
1203 printf("%3d", sp->regoff);
1209 printf("i%02d", sp->varnum);
1212 printf("l%02d", sp->varnum);
1215 if (sp->varnum == -1) {
1217 /* varkind ARGVAR "misused for this special case */
1220 else /* "normal" Argvar */
1221 printf("a%02d", sp->varnum);
1224 printf("?xx {kind=%d, num=%d}", sp->varkind, sp->varnum);
1233 void new_show_icmd(jitdata *jd, new_instruction *iptr, bool deadcode, int stage)
1236 branch_target_t *table;
1237 lookup_target_t *lookup;
1238 constant_FMIref *fmiref;
1242 /* get the opcode and the condition */
1246 printf("%s ", icmd_names[opcode]);
1248 if (stage < SHOW_PARSE)
1254 /* Print the condition for conditional instructions. */
1256 /* XXX print condition from flags */
1258 if (iptr->flags.bits & INS_FLAG_UNRESOLVED)
1259 printf("(UNRESOLVED) ");
1264 case ICMD_CHECKNULL:
1265 case ICMD_CHECKNULL_POP:
1270 case ICMD_ARRAYLENGTH:
1289 case ICMD_INT2SHORT:
1337 /* binary/const INT */
1338 case ICMD_IADDCONST:
1339 case ICMD_ISUBCONST:
1340 case ICMD_IMULCONST:
1344 case ICMD_IANDCONST:
1346 case ICMD_IXORCONST:
1347 case ICMD_ISHLCONST:
1348 case ICMD_ISHRCONST:
1349 case ICMD_IUSHRCONST:
1350 case ICMD_LSHLCONST:
1351 case ICMD_LSHRCONST:
1352 case ICMD_LUSHRCONST:
1354 SHOW_INT_CONST(iptr->sx.val.i);
1358 /* ?ASTORECONST (trinary/const INT) */
1359 case ICMD_IASTORECONST:
1360 case ICMD_BASTORECONST:
1361 case ICMD_CASTORECONST:
1362 case ICMD_SASTORECONST:
1365 SHOW_INT_CONST(iptr->sx.s23.s3.constval);
1370 SHOW_INT_CONST(iptr->sx.val.i);
1374 /* binary/const LNG */
1375 case ICMD_LADDCONST:
1376 case ICMD_LSUBCONST:
1377 case ICMD_LMULCONST:
1381 case ICMD_LANDCONST:
1383 case ICMD_LXORCONST:
1385 SHOW_LNG_CONST(iptr->sx.val.l);
1389 /* trinary/const LNG (<= pointer size) */
1390 case ICMD_LASTORECONST:
1393 SHOW_LNG_CONST(iptr->sx.s23.s3.constval);
1398 SHOW_LNG_CONST(iptr->sx.val.l);
1404 SHOW_FLT_CONST(iptr->sx.val.f);
1410 SHOW_DBL_CONST(iptr->sx.val.d);
1416 if (iptr->flags.bits & INS_FLAG_CLASS) {
1417 SHOW_CLASSREF_OR_CLASSINFO(iptr->sx.val.c);
1419 else if (iptr->sx.val.anyptr == NULL) {
1423 SHOW_STRING(iptr->sx.val.stringconst);
1428 case ICMD_AASTORECONST:
1431 printf("%p ", (void*) iptr->sx.s23.s3.constval);
1434 case ICMD_GETFIELD: /* 1 -> 1 */
1435 case ICMD_PUTFIELD: /* 2 -> 0 */
1436 case ICMD_PUTSTATIC: /* 1 -> 0 */
1437 case ICMD_GETSTATIC: /* 0 -> 1 */
1438 case ICMD_PUTSTATICCONST: /* 0 -> 0 */
1439 case ICMD_PUTFIELDCONST: /* 1 -> 0 */
1440 if (opcode != ICMD_GETSTATIC && opcode != ICMD_PUTSTATICCONST) {
1442 if (opcode == ICMD_PUTFIELD) {
1446 NEW_INSTRUCTION_GET_FIELDREF(iptr, fmiref);
1449 if (opcode == ICMD_GETSTATIC || opcode == ICMD_GETFIELD) {
1455 SHOW_S1_LOCAL(iptr);
1456 SHOW_INT_CONST(iptr->sx.val.i);
1457 SHOW_DST_LOCAL(iptr);
1487 SHOW_S1_LOCAL(iptr);
1495 SHOW_S1_LOCAL(iptr);
1505 SHOW_DST_LOCAL(iptr);
1516 case ICMD_ANEWARRAY:
1520 case ICMD_MULTIANEWARRAY:
1521 if (stage >= SHOW_STACK) {
1522 argp = iptr->sx.s23.s2.args;
1523 i = iptr->s1.argcount;
1525 SHOW_STACKVAR(*(argp++));
1529 printf("argcount=%d ", iptr->s1.argcount);
1534 case ICMD_CHECKCAST:
1539 case ICMD_INSTANCEOF:
1544 case ICMD_INLINE_START:
1545 case ICMD_INLINE_END:
1549 if (stage >= SHOW_STACK) {
1550 argp = iptr->sx.s23.s2.args;
1551 i = iptr->s1.argcount;
1553 SHOW_STACKVAR(*(argp++));
1556 printf("%s ", iptr->sx.s23.s3.bte->name);
1557 if (iptr->sx.s23.s3.bte->md->returntype.type != TYPE_VOID) {
1562 case ICMD_INVOKEVIRTUAL:
1563 case ICMD_INVOKESPECIAL:
1564 case ICMD_INVOKESTATIC:
1565 case ICMD_INVOKEINTERFACE:
1566 if (stage >= SHOW_STACK) {
1567 argp = iptr->sx.s23.s2.args;
1568 i = iptr->s1.argcount;
1570 SHOW_STACKVAR(*(argp++));
1573 NEW_INSTRUCTION_GET_METHODREF(iptr, fmiref);
1574 method_methodref_print(fmiref);
1575 if (fmiref->parseddesc.md->returntype.type != TYPE_VOID) {
1587 SHOW_TARGET(iptr->dst);
1597 SHOW_TARGET(iptr->dst);
1601 case ICMD_INLINE_GOTO:
1602 SHOW_TARGET(iptr->dst);
1606 SHOW_TARGET(iptr->sx.s23.s3.jsrtarget);
1611 case ICMD_IFNONNULL:
1613 SHOW_TARGET(iptr->dst);
1616 case ICMD_IF_ICMPEQ:
1617 case ICMD_IF_ICMPNE:
1618 case ICMD_IF_ICMPLT:
1619 case ICMD_IF_ICMPGE:
1620 case ICMD_IF_ICMPGT:
1621 case ICMD_IF_ICMPLE:
1623 case ICMD_IF_LCMPEQ:
1624 case ICMD_IF_LCMPNE:
1625 case ICMD_IF_LCMPLT:
1626 case ICMD_IF_LCMPGE:
1627 case ICMD_IF_LCMPGT:
1628 case ICMD_IF_LCMPLE:
1630 case ICMD_IF_FCMPEQ:
1631 case ICMD_IF_FCMPNE:
1633 case ICMD_IF_FCMPL_LT:
1634 case ICMD_IF_FCMPL_GE:
1635 case ICMD_IF_FCMPL_GT:
1636 case ICMD_IF_FCMPL_LE:
1638 case ICMD_IF_FCMPG_LT:
1639 case ICMD_IF_FCMPG_GE:
1640 case ICMD_IF_FCMPG_GT:
1641 case ICMD_IF_FCMPG_LE:
1643 case ICMD_IF_DCMPEQ:
1644 case ICMD_IF_DCMPNE:
1646 case ICMD_IF_DCMPL_LT:
1647 case ICMD_IF_DCMPL_GE:
1648 case ICMD_IF_DCMPL_GT:
1649 case ICMD_IF_DCMPL_LE:
1651 case ICMD_IF_DCMPG_LT:
1652 case ICMD_IF_DCMPG_GE:
1653 case ICMD_IF_DCMPG_GT:
1654 case ICMD_IF_DCMPG_LE:
1656 case ICMD_IF_ACMPEQ:
1657 case ICMD_IF_ACMPNE:
1660 SHOW_TARGET(iptr->dst);
1663 case ICMD_TABLESWITCH:
1667 case ICMD_LOOKUPSWITCH:
1685 if (stage >= SHOW_STACK) {
1686 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1687 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1689 SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
1690 SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
1695 if (stage >= SHOW_STACK) {
1696 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1697 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1699 SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
1700 SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
1701 SHOW_STACKVAR(iptr->dst.dupslots[2+2]);
1706 if (stage >= SHOW_STACK) {
1707 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1708 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1709 SHOW_STACKVAR(iptr->dst.dupslots[2]);
1711 SHOW_STACKVAR(iptr->dst.dupslots[3+0]);
1712 SHOW_STACKVAR(iptr->dst.dupslots[3+1]);
1713 SHOW_STACKVAR(iptr->dst.dupslots[3+2]);
1714 SHOW_STACKVAR(iptr->dst.dupslots[3+3]);
1715 SHOW_STACKVAR(iptr->dst.dupslots[3+4]);
1720 if (stage >= SHOW_STACK) {
1721 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1722 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1723 SHOW_STACKVAR(iptr->dst.dupslots[2]);
1725 SHOW_STACKVAR(iptr->dst.dupslots[3+0]);
1726 SHOW_STACKVAR(iptr->dst.dupslots[3+1]);
1727 SHOW_STACKVAR(iptr->dst.dupslots[3+2]);
1728 SHOW_STACKVAR(iptr->dst.dupslots[3+3]);
1733 if (stage >= SHOW_STACK) {
1734 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1735 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1736 SHOW_STACKVAR(iptr->dst.dupslots[2]);
1737 SHOW_STACKVAR(iptr->dst.dupslots[4]);
1739 SHOW_STACKVAR(iptr->dst.dupslots[4+0]);
1740 SHOW_STACKVAR(iptr->dst.dupslots[4+1]);
1741 SHOW_STACKVAR(iptr->dst.dupslots[4+2]);
1742 SHOW_STACKVAR(iptr->dst.dupslots[4+3]);
1743 SHOW_STACKVAR(iptr->dst.dupslots[4+4]);
1744 SHOW_STACKVAR(iptr->dst.dupslots[4+5]);
1749 if (stage >= SHOW_STACK) {
1750 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1751 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1753 SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
1754 SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
1760 #endif /* !defined(NDEBUG) */
1762 #if !defined(NDEBUG)
1763 void show_icmd(instruction *iptr, bool deadcode)
1774 constant_classref *cr;
1775 unresolved_field *uf;
1778 /* get the opcode and the condition */
1780 opcode = iptr->opc & ICMD_OPCODE_MASK;
1781 condition = (iptr->opc & ICMD_CONDITION_MASK) >> 8;
1783 /* Print the condition for conditional instructions. */
1786 printf(" (condition: %s)", icmd_names[condition]);
1789 printf("%s", icmd_names[iptr->opc]);
1791 switch (iptr->opc) {
1792 case ICMD_IADDCONST:
1793 case ICMD_ISUBCONST:
1794 case ICMD_IMULCONST:
1798 case ICMD_IANDCONST:
1800 case ICMD_IXORCONST:
1801 case ICMD_ISHLCONST:
1802 case ICMD_ISHRCONST:
1803 case ICMD_IUSHRCONST:
1804 case ICMD_LSHLCONST:
1805 case ICMD_LSHRCONST:
1806 case ICMD_LUSHRCONST:
1808 case ICMD_IASTORECONST:
1809 case ICMD_BASTORECONST:
1810 case ICMD_CASTORECONST:
1811 case ICMD_SASTORECONST:
1812 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
1815 case ICMD_LADDCONST:
1816 case ICMD_LSUBCONST:
1817 case ICMD_LMULCONST:
1821 case ICMD_LANDCONST:
1823 case ICMD_LXORCONST:
1825 case ICMD_LASTORECONST:
1826 #if SIZEOF_VOID_P == 4
1827 printf(" %lld (0x%016llx)", iptr->val.l, iptr->val.l);
1829 printf(" %ld (0x%016lx)", iptr->val.l, iptr->val.l);
1834 printf(" %f (0x%08x)", iptr->val.f, iptr->val.i);
1838 #if SIZEOF_VOID_P == 4
1839 printf(" %g (0x%016llx)", iptr->val.d, iptr->val.l);
1841 printf(" %g (0x%016lx)", iptr->val.d, iptr->val.l);
1846 case ICMD_AASTORECONST:
1847 /* check if this is a constant string or a class reference */
1849 if (ICMD_ACONST_IS_CLASS(iptr)) {
1850 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1851 printf(" (NOT RESOLVED) classref = ");
1852 class_classref_print(ICMD_ACONST_UNRESOLVED_CLASSREF(iptr));
1855 printf(" class = ");
1856 class_print(ICMD_ACONST_RESOLVED_CLASSINFO(iptr));
1860 printf(" %p", iptr->val.a);
1863 printf(", String = \"");
1864 utf_display_printable_ascii(javastring_toutf(iptr->val.a, false));
1872 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1873 uf = INSTRUCTION_UNRESOLVED_FIELD(iptr);
1874 printf(" (NOT RESOLVED) ");
1876 field_fieldref_print(uf->fieldref);
1879 f = INSTRUCTION_RESOLVED_FIELDINFO(iptr);
1880 printf(" %d, ", f->offset);
1886 case ICMD_PUTSTATIC:
1887 case ICMD_GETSTATIC:
1888 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1889 uf = INSTRUCTION_UNRESOLVED_FIELD(iptr);
1890 printf(" (NOT RESOLVED) ");
1892 field_fieldref_print(uf->fieldref);
1895 f = INSTRUCTION_RESOLVED_FIELDINFO(iptr);
1896 if (!CLASS_IS_OR_ALMOST_INITIALIZED(f->class))
1897 printf(" (NOT INITIALIZED) ");
1905 case ICMD_PUTSTATICCONST:
1906 case ICMD_PUTFIELDCONST:
1907 switch (iptr[1].op1) {
1909 printf(" %d (0x%08x),", iptr->val.i, iptr->val.i);
1912 #if SIZEOF_VOID_P == 4
1913 printf(" %lld (0x%016llx),", iptr->val.l, iptr->val.l);
1915 printf(" %ld (0x%016lx),", iptr->val.l, iptr->val.l);
1919 printf(" %p,", iptr->val.a);
1922 printf(" %g (0x%08x),", iptr->val.f, iptr->val.i);
1925 #if SIZEOF_VOID_P == 4
1926 printf(" %g (0x%016llx),", iptr->val.d, iptr->val.l);
1928 printf(" %g (0x%016lx),", iptr->val.d, iptr->val.l);
1933 if (INSTRUCTION_IS_UNRESOLVED(iptr + 1)) {
1934 uf = INSTRUCTION_UNRESOLVED_FIELD(iptr + 1);
1935 printf(" (NOT RESOLVED) ");
1936 field_fieldref_print(uf->fieldref);
1939 f = INSTRUCTION_RESOLVED_FIELDINFO(iptr + 1);
1940 if ((iptr->opc == ICMD_PUTSTATICCONST) &&
1941 !CLASS_IS_OR_ALMOST_INITIALIZED(f->class))
1942 printf(" (NOT INITIALIZED), ");
1944 printf(" %d, ", f->offset);
1950 printf(" %d + %d", iptr->op1, iptr->val.i);
1985 printf(" %d", iptr->op1);
1991 utf_display_printable_ascii_classname(c->name);
1995 switch (iptr->op1) {
2023 case ICMD_ANEWARRAY:
2027 utf_display_printable_ascii_classname(c->name);
2031 case ICMD_MULTIANEWARRAY:
2036 printf(" (NOT RESOLVED) %d ", iptr->op1);
2037 utf_display_printable_ascii(cr->name);
2040 printf(" %d ", iptr->op1);
2041 utf_display_printable_ascii_classname(c->name);
2045 case ICMD_CHECKCAST:
2046 case ICMD_INSTANCEOF:
2051 if (c->flags & ACC_INTERFACE)
2052 printf(" (INTERFACE) ");
2054 printf(" (CLASS,%3d) ", c->vftbl->diffval);
2056 printf(" (NOT RESOLVED) ");
2057 utf_display_printable_ascii_classname(cr->name);
2060 case ICMD_INLINE_START:
2061 case ICMD_INLINE_END:
2063 insinfo_inline *insinfo = (insinfo_inline *) iptr->target;
2065 method_print(insinfo->method);
2070 printf(" %s", ((builtintable_entry *) iptr->val.a)->name);
2073 case ICMD_INVOKEVIRTUAL:
2074 case ICMD_INVOKESPECIAL:
2075 case ICMD_INVOKESTATIC:
2076 case ICMD_INVOKEINTERFACE:
2078 constant_FMIref *mref;
2080 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
2081 printf(" (NOT RESOLVED) ");
2082 mref = INSTRUCTION_UNRESOLVED_METHOD(iptr)->methodref;
2086 mref = INSTRUCTION_RESOLVED_FMIREF(iptr);
2088 method_methodref_print(mref);
2098 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
2100 /* if ((iptr->opc & ICMD_CONDITION_MASK) == 0) { */
2101 if (deadcode || !iptr->target)
2102 printf(" op1=%d", iptr->op1);
2104 printf(" L%03d (%p)", ((basicblock *) iptr->target)->debug_nr, iptr->target);
2114 #if SIZEOF_VOID_P == 4
2115 printf(" %lld (%016llx)", iptr->val.l, iptr->val.l);
2117 printf(" %ld (%016lx)", iptr->val.l, iptr->val.l);
2120 /* if ((iptr->opc & ICMD_CONDITION_MASK) == 0) { */
2121 if (deadcode || !iptr->target)
2122 printf(" op1=%d", iptr->op1);
2124 printf(" L%03d", ((basicblock *) iptr->target)->debug_nr);
2130 case ICMD_INLINE_GOTO:
2131 if (deadcode || !iptr->target)
2132 printf(" op1=%d", iptr->op1);
2134 printf(" L%03d (%p)", ((basicblock *) iptr->target)->debug_nr,iptr->target);
2138 case ICMD_IFNONNULL:
2139 case ICMD_IF_ICMPEQ:
2140 case ICMD_IF_ICMPNE:
2141 case ICMD_IF_ICMPLT:
2142 case ICMD_IF_ICMPGE:
2143 case ICMD_IF_ICMPGT:
2144 case ICMD_IF_ICMPLE:
2146 case ICMD_IF_LCMPEQ:
2147 case ICMD_IF_LCMPNE:
2148 case ICMD_IF_LCMPLT:
2149 case ICMD_IF_LCMPGE:
2150 case ICMD_IF_LCMPGT:
2151 case ICMD_IF_LCMPLE:
2153 case ICMD_IF_FCMPEQ:
2154 case ICMD_IF_FCMPNE:
2156 case ICMD_IF_FCMPL_LT:
2157 case ICMD_IF_FCMPL_GE:
2158 case ICMD_IF_FCMPL_GT:
2159 case ICMD_IF_FCMPL_LE:
2161 case ICMD_IF_FCMPG_LT:
2162 case ICMD_IF_FCMPG_GE:
2163 case ICMD_IF_FCMPG_GT:
2164 case ICMD_IF_FCMPG_LE:
2166 case ICMD_IF_DCMPEQ:
2167 case ICMD_IF_DCMPNE:
2169 case ICMD_IF_DCMPL_LT:
2170 case ICMD_IF_DCMPL_GE:
2171 case ICMD_IF_DCMPL_GT:
2172 case ICMD_IF_DCMPL_LE:
2174 case ICMD_IF_DCMPG_LT:
2175 case ICMD_IF_DCMPG_GE:
2176 case ICMD_IF_DCMPG_GT:
2177 case ICMD_IF_DCMPG_LE:
2179 case ICMD_IF_ACMPEQ:
2180 case ICMD_IF_ACMPNE:
2181 /* if (!(iptr->opc & ICMD_CONDITION_MASK)) { */
2182 if (deadcode || !iptr->target)
2183 printf(" op1=%d", iptr->op1);
2185 printf(" L%03d (%p)", ((basicblock *) iptr->target)->debug_nr,iptr->target);
2189 case ICMD_TABLESWITCH:
2190 s4ptr = (s4*)iptr->val.a;
2192 if (deadcode || !iptr->target) {
2193 printf(" %d;", *s4ptr);
2196 tptr = (void **) iptr->target;
2197 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
2201 s4ptr++; /* skip default */
2202 j = *s4ptr++; /* low */
2203 j = *s4ptr++ - j; /* high */
2205 if (deadcode || !*tptr)
2206 printf(" %d", *s4ptr++);
2208 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
2215 case ICMD_LOOKUPSWITCH:
2216 s4ptr = (s4*)iptr->val.a;
2218 if (deadcode || !iptr->target) {
2219 printf(" %d;", *s4ptr);
2222 tptr = (void **) iptr->target;
2223 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
2226 s4ptr++; /* default */
2227 j = *s4ptr++; /* count */
2230 if (deadcode || !*tptr) {
2231 s4ptr++; /* skip value */
2232 printf(" %d",*s4ptr++);
2235 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
2243 printf(" (NOT RESOLVED) Class = \"");
2244 utf_display_printable_ascii(((unresolved_class *) iptr->val.a)->classref->name);
2249 #endif /* !defined(NDEBUG) */
2252 * These are local overrides for various environment variables in Emacs.
2253 * Please do not remove this and leave it at the end of the file, where
2254 * Emacs will automagically detect them.
2255 * ---------------------------------------------------------------------
2258 * indent-tabs-mode: t
2262 * vim:noexpandtab:sw=4:ts=4: