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->nr );
366 printf("L%03d = ", ex->end->nr);
367 printf("L%03d", ex->handler->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) || defined(ENABLE_SSA)
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) || defined(ENABLE_SSA)
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 if (opt_debugcolor) printf("\033[30;m"); /* reset terminal color, this helps less -r, which gets confused else */
594 printf("\nBasic blocks: %d\n", m->basicblockcount);
595 printf("Code length: %d\n", (lastbptr->mpc - m->basicblocks[0].mpc));
596 printf("Data length: %d\n", cd->dseglen);
597 printf("Stub length: %d\n", (s4) (code->mcodelength -
598 ((ptrint) cd->dseglen + lastbptr->mpc)));
599 printf("Max locals: %d\n", cd->maxlocals);
600 printf("Max stack: %d\n", cd->maxstack);
601 printf("Line number table length: %d\n", m->linenumbercount);
603 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
604 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
605 printf(" L%03d ... ", ex->start->nr );
606 printf("L%03d = ", ex->end->nr);
607 printf("L%03d", ex->handler->nr);
608 printf(" (catchtype: ");
609 if (ex->catchtype.any)
610 if (IS_CLASSREF(ex->catchtype))
611 utf_display_printable_ascii_classname(ex->catchtype.ref->name);
613 utf_display_printable_ascii_classname(ex->catchtype.cls->name);
619 printf("Local Table:\n");
620 for (i = 0; i < cd->maxlocals; i++) {
623 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
624 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
625 # if defined(ENABLE_INTRP)
628 if (rd->locals[i][j].type >= 0) {
629 printf(" (%s) ", jit_type[j]);
630 if (rd->locals[i][j].flags & INMEMORY)
631 printf("m%2d", rd->locals[i][j].regoff);
632 # ifdef HAS_ADDRESS_REGISTER_FILE
633 else if (j == TYPE_ADR)
634 printf("r%02d", rd->locals[i][j].regoff);
636 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
637 printf("f%02d", rd->locals[i][j].regoff);
639 # if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
640 if (IS_2_WORD_TYPE(j))
642 regs[GET_LOW_REG(rd->locals[i][j].regoff)],
643 regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
646 printf("%3s", regs[rd->locals[i][j].regoff]);
649 # if defined(ENABLE_INTRP)
653 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
659 #if defined(ENABLE_LSRA) || defined(ENABLE_SSA)
662 #if defined(ENABLE_INTRP)
665 printf("Interface Table:\n");
666 for (i = 0; i < cd->maxstack; i++) {
667 if ((rd->interfaces[i][0].type >= 0) ||
668 (rd->interfaces[i][1].type >= 0) ||
669 (rd->interfaces[i][2].type >= 0) ||
670 (rd->interfaces[i][3].type >= 0) ||
671 (rd->interfaces[i][4].type >= 0)) {
674 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
675 # if defined(ENABLE_INTRP)
678 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
679 if (rd->interfaces[i][j].type >= 0) {
680 printf(" (%s) ", jit_type[j]);
681 if (rd->interfaces[i][j].flags & SAVEDVAR) {
682 if (rd->interfaces[i][j].flags & INMEMORY)
683 printf("M%2d", rd->interfaces[i][j].regoff);
684 #ifdef HAS_ADDRESS_REGISTER_FILE
685 else if (j == TYPE_ADR)
686 printf("R%02d", rd->interfaces[i][j].regoff);
688 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
689 printf("F%02d", rd->interfaces[i][j].regoff);
691 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
692 if (IS_2_WORD_TYPE(j))
694 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
695 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
698 printf("%3s",regs[rd->interfaces[i][j].regoff]);
702 if (rd->interfaces[i][j].flags & INMEMORY)
703 printf("m%2d", rd->interfaces[i][j].regoff);
704 #ifdef HAS_ADDRESS_REGISTER_FILE
705 else if (j == TYPE_ADR)
706 printf("r%02d", rd->interfaces[i][j].regoff);
708 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
709 printf("f%02d", rd->interfaces[i][j].regoff);
711 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
712 if (IS_2_WORD_TYPE(j))
714 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
715 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
718 printf("%3s",regs[rd->interfaces[i][j].regoff]);
724 # if defined(ENABLE_INTRP)
727 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
733 #if defined(ENABLE_INTRP)
736 #if defined(ENABLE_LSRA) || defined(ENABLE_SSA)
740 if (code->rplpoints) {
741 printf("Replacement Points:\n");
742 replace_show_replacement_points(code);
746 #if defined(ENABLE_DISASSEMBLER)
747 /* show code before first basic block */
749 if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd)) {
750 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen);
752 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + m->basicblocks[0].mpc);)
759 /* show code of all basic blocks */
761 for (bptr = m->basicblocks; bptr != NULL; bptr = bptr->next)
762 show_basicblock(jd, bptr);
764 #if defined(ENABLE_DISASSEMBLER)
765 /* show stubs code */
767 if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) && opt_showexceptionstubs) {
768 if (opt_debugcolor) printf("\033[32m"); /* green */
769 printf("\nStubs code:\n");
770 printf("Length: %d\n\n", (s4) (code->mcodelength -
771 ((ptrint) cd->dseglen + lastbptr->mpc)));
773 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen + lastbptr->mpc);
775 for (; (ptrint) u1ptr < ((ptrint) code->mcode + code->mcodelength);)
778 if (opt_debugcolor) printf("\033[m");
783 LOCK_MONITOR_EXIT(show_global_lock);
785 /* finally flush the output */
789 #endif /* !defined(NDEBUG) */
792 /* show_basicblock *************************************************************
794 Print the intermediate representation of a basic block.
796 NOTE: Currently this function may only be called after register allocation!
798 *******************************************************************************/
801 void new_show_basicblock(jitdata *jd, basicblock *bptr, int stage)
808 new_instruction *iptr;
811 /* get required compiler data */
817 if (bptr->flags != BBDELETED) {
818 deadcode = bptr->flags <= BBREACHED;
820 printf("======== %sL%03d ======== (flags: %d, bitflags: %01x, next: %d, type: ",
821 (bptr->bitflags & BBFLAG_REPLACEMENT) ? "<REPLACE> " : "",
822 bptr->nr, bptr->flags, bptr->bitflags,
823 (bptr->next) ? (bptr->next->nr) : -1);
825 switch (bptr->type) {
837 printf(", instruction count: %d, predecessors: %d [ ",
838 bptr->icount, bptr->predecessorcount);
840 for (i = 0; i < bptr->predecessorcount; i++)
841 printf("%d ", bptr->predecessors[i]->nr);
845 iptr = /*XXX*/ (new_instruction *) bptr->iinstr;
847 for (i = 0; i < bptr->icount; i++, iptr++) {
848 printf("%4d: ", iptr->line);
850 new_show_icmd(jd, iptr, deadcode, stage);
854 #if defined(ENABLE_DISASSEMBLER)
855 if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) &&
858 u1ptr = (u1 *) (code->mcode + cd->dseglen + bptr->mpc);
860 if (bptr->next != NULL) {
861 for (; u1ptr < (u1 *) (code->mcode + cd->dseglen + bptr->next->mpc);)
866 for (; u1ptr < (u1 *) (code->mcode + code->mcodelength);)
874 #endif /* !defined(NDEBUG) */
877 void show_basicblock(jitdata *jd, basicblock *bptr)
887 /* get required compiler data */
893 if (bptr->flags != BBDELETED) {
894 deadcode = bptr->flags <= BBREACHED;
899 for (j = cd->maxstack; j > 0; j--)
902 show_print_stack(cd, bptr->instack);
904 printf("] %sL%03d(flags: %d, bitflags: %01x, next: %d, type: ",
905 (bptr->bitflags & BBFLAG_REPLACEMENT) ? "<REPLACE> " : "",
906 bptr->nr, bptr->flags, bptr->bitflags,
907 (bptr->next) ? (bptr->next->nr) : -1);
909 switch (bptr->type) {
921 printf(", instruction count: %d, predecessors: %d [ ",
922 bptr->icount, bptr->predecessorcount);
924 for (i = 0; i < bptr->predecessorcount; i++)
925 printf("%d ", bptr->predecessors[i]->nr);
931 for (i = 0; i < bptr->icount; i++, iptr++) {
935 for (j = cd->maxstack; j > 0; j--)
938 show_print_stack(cd, iptr->dst);
940 printf("] %5d (line: %5d) ", i, iptr->line);
942 show_icmd(iptr, deadcode);
946 #if defined(ENABLE_DISASSEMBLER)
947 if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) && (!deadcode)) {
949 u1ptr = (u1 *) (code->mcode + cd->dseglen + bptr->mpc);
951 if (bptr->next != NULL) {
952 for (; u1ptr < (u1 *) (code->mcode + cd->dseglen + bptr->next->mpc);)
957 for (; u1ptr < (u1 *) (code->mcode + code->mcodelength);)
965 #endif /* !defined(NDEBUG) */
968 /* show_icmd *******************************************************************
970 Print the intermediate representation of an instruction.
972 NOTE: Currently this function may only be called after register allocation!
974 *******************************************************************************/
978 #define SHOW_TARGET(target) \
979 if (stage >= SHOW_STACK) { \
980 printf("--> L%03d ", (target).block->nr); \
982 else if (stage >= SHOW_PARSE) { \
983 printf("--> insindex %d (L%03d) ", (target).insindex, \
984 jd->new_basicblocks[jd->new_basicblockindex[ \
985 (target).insindex]].nr); \
988 printf("--> insindex %d ", (target).insindex); \
991 #define SHOW_INT_CONST(val) \
992 if (stage >= SHOW_PARSE) { \
993 printf("%ld ", (long) (val)); \
999 #define SHOW_LNG_CONST(val) \
1000 if (stage >= SHOW_PARSE) { \
1001 printf("%lld ", (long long)(val)); \
1004 printf("lconst "); \
1007 #define SHOW_FLT_CONST(val) \
1008 if (stage >= SHOW_PARSE) { \
1009 printf("%g ", (val)); \
1012 printf("fconst "); \
1015 #define SHOW_DBL_CONST(val) \
1016 if (stage >= SHOW_PARSE) { \
1017 printf("%g ", (val)); \
1020 printf("dconst "); \
1023 #define SHOW_INDEX(index) \
1024 if (stage >= SHOW_PARSE) { \
1025 printf("%d ", index); \
1031 #define SHOW_STRING(val) \
1032 if (stage >= SHOW_PARSE) { \
1034 utf_display_printable_ascii( \
1035 javastring_toutf((java_lang_String *)(val), false)); \
1039 printf("string "); \
1042 #define SHOW_CLASSREF_OR_CLASSINFO(c) \
1043 if (stage >= SHOW_PARSE) { \
1044 if (IS_CLASSREF(c)) \
1045 class_classref_print(c.ref); \
1047 class_print(c.cls); \
1054 #define SHOW_FIELD(fmiref) \
1055 if (stage >= SHOW_PARSE) { \
1056 field_fieldref_print(fmiref); \
1063 #define SHOW_STACKVAR(sp) \
1064 new_show_stackvar(jd, (sp), stage)
1066 #define SHOW_S1(iptr) \
1067 if (stage >= SHOW_STACK) { \
1068 SHOW_STACKVAR(iptr->s1.var); \
1071 #define SHOW_S2(iptr) \
1072 if (stage >= SHOW_STACK) { \
1073 SHOW_STACKVAR(iptr->sx.s23.s2.var); \
1076 #define SHOW_S3(iptr) \
1077 if (stage >= SHOW_STACK) { \
1078 SHOW_STACKVAR(iptr->sx.s23.s3.var); \
1081 #define SHOW_DST(iptr) \
1082 if (stage >= SHOW_STACK) { \
1084 SHOW_STACKVAR(iptr->dst.var); \
1087 #define SHOW_S1_LOCAL(iptr) \
1088 if (stage >= SHOW_STACK) { \
1089 printf("L%d ", iptr->s1.localindex); \
1092 #define SHOW_DST_LOCAL(iptr) \
1093 if (stage >= SHOW_STACK) { \
1094 printf("=> L%d ", iptr->dst.localindex); \
1097 static void new_show_stackvar(jitdata *jd, stackptr sp, int stage)
1102 case TYPE_INT: type = 'i'; break;
1103 case TYPE_LNG: type = 'l'; break;
1104 case TYPE_FLT: type = 'f'; break;
1105 case TYPE_DBL: type = 'd'; break;
1106 case TYPE_ADR: type = 'a'; break;
1107 default: type = '?';
1109 printf("S%c%d", type, (int) (sp - jd->new_stack));
1111 if (stage >= SHOW_REGS) {
1114 if (sp->flags & SAVEDVAR) {
1115 switch (sp->varkind) {
1117 if (sp->flags & INMEMORY)
1118 printf("M%02d", sp->regoff);
1119 #ifdef HAS_ADDRESS_REGISTER_FILE
1120 else if (sp->type == TYPE_ADR)
1121 printf("R%02d", sp->regoff);
1123 else if (IS_FLT_DBL_TYPE(sp->type))
1124 printf("F%02d", sp->regoff);
1126 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
1127 if (IS_2_WORD_TYPE(sp->type)) {
1128 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1129 # if defined(ENABLE_INTRP)
1131 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1132 GET_HIGH_REG(sp->regoff));
1135 printf("%3s/%3s", regs[GET_LOW_REG(sp->regoff)],
1136 regs[GET_HIGH_REG(sp->regoff)]);
1138 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1139 GET_HIGH_REG(sp->regoff));
1143 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
1145 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1146 # if defined(ENABLE_INTRP)
1148 printf("%3d", sp->regoff);
1151 printf("%3s", regs[sp->regoff]);
1153 printf("%3d", sp->regoff);
1159 printf("I%02d", sp->varnum);
1162 printf("L%02d", sp->varnum);
1165 if (sp->varnum == -1) {
1167 /* varkind ARGVAR "misused for this special case */
1170 else /* "normal" Argvar */
1171 printf("A%02d", sp->varnum);
1174 printf("!xx {kind=%d, num=%d}", sp->varkind, sp->varnum);
1177 else { /* not SAVEDVAR */
1178 switch (sp->varkind) {
1180 if (sp->flags & INMEMORY)
1181 printf("m%02d", sp->regoff);
1182 #ifdef HAS_ADDRESS_REGISTER_FILE
1183 else if (sp->type == TYPE_ADR)
1184 printf("r%02d", sp->regoff);
1186 else if (IS_FLT_DBL_TYPE(sp->type))
1187 printf("f%02d", sp->regoff);
1189 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
1190 if (IS_2_WORD_TYPE(sp->type)) {
1191 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1192 # if defined(ENABLE_INTRP)
1194 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1195 GET_HIGH_REG(sp->regoff));
1198 printf("%3s/%3s", regs[GET_LOW_REG(sp->regoff)],
1199 regs[GET_HIGH_REG(sp->regoff)]);
1201 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1202 GET_HIGH_REG(sp->regoff));
1206 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
1208 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1209 # if defined(ENABLE_INTRP)
1211 printf("%3d", sp->regoff);
1214 printf("%3s", regs[sp->regoff]);
1216 printf("%3d", sp->regoff);
1222 printf("i%02d", sp->varnum);
1225 printf("l%02d", sp->varnum);
1228 if (sp->varnum == -1) {
1230 /* varkind ARGVAR "misused for this special case */
1233 else /* "normal" Argvar */
1234 printf("a%02d", sp->varnum);
1237 printf("?xx {kind=%d, num=%d}", sp->varkind, sp->varnum);
1246 void new_show_icmd(jitdata *jd, new_instruction *iptr, bool deadcode, int stage)
1249 branch_target_t *table;
1250 lookup_target_t *lookup;
1251 constant_FMIref *fmiref;
1255 /* get the opcode and the condition */
1259 printf("%s ", icmd_names[opcode]);
1261 if (stage < SHOW_PARSE)
1267 /* Print the condition for conditional instructions. */
1269 /* XXX print condition from flags */
1271 if (iptr->flags.bits & INS_FLAG_UNRESOLVED)
1272 printf("(UNRESOLVED) ");
1277 case ICMD_CHECKNULL:
1278 case ICMD_CHECKNULL_POP:
1283 case ICMD_ARRAYLENGTH:
1302 case ICMD_INT2SHORT:
1350 /* binary/const INT */
1351 case ICMD_IADDCONST:
1352 case ICMD_ISUBCONST:
1353 case ICMD_IMULCONST:
1357 case ICMD_IANDCONST:
1359 case ICMD_IXORCONST:
1360 case ICMD_ISHLCONST:
1361 case ICMD_ISHRCONST:
1362 case ICMD_IUSHRCONST:
1363 case ICMD_LSHLCONST:
1364 case ICMD_LSHRCONST:
1365 case ICMD_LUSHRCONST:
1367 SHOW_INT_CONST(iptr->sx.val.i);
1371 /* ?ASTORECONST (trinary/const INT) */
1372 case ICMD_IASTORECONST:
1373 case ICMD_BASTORECONST:
1374 case ICMD_CASTORECONST:
1375 case ICMD_SASTORECONST:
1378 SHOW_INT_CONST(iptr->sx.s23.s3.constval);
1383 SHOW_INT_CONST(iptr->sx.val.i);
1387 /* binary/const LNG */
1388 case ICMD_LADDCONST:
1389 case ICMD_LSUBCONST:
1390 case ICMD_LMULCONST:
1394 case ICMD_LANDCONST:
1396 case ICMD_LXORCONST:
1398 SHOW_LNG_CONST(iptr->sx.val.l);
1402 /* trinary/const LNG (<= pointer size) */
1403 case ICMD_LASTORECONST:
1406 SHOW_LNG_CONST(iptr->sx.s23.s3.constval);
1411 SHOW_LNG_CONST(iptr->sx.val.l);
1417 SHOW_FLT_CONST(iptr->sx.val.f);
1423 SHOW_DBL_CONST(iptr->sx.val.d);
1429 if (iptr->flags.bits & INS_FLAG_CLASS) {
1430 SHOW_CLASSREF_OR_CLASSINFO(iptr->sx.val.c);
1432 else if (iptr->sx.val.anyptr == NULL) {
1436 SHOW_STRING(iptr->sx.val.stringconst);
1441 case ICMD_AASTORECONST:
1444 printf("%p ", (void*) iptr->sx.s23.s3.constval);
1447 case ICMD_GETFIELD: /* 1 -> 1 */
1448 case ICMD_PUTFIELD: /* 2 -> 0 */
1449 case ICMD_PUTSTATIC: /* 1 -> 0 */
1450 case ICMD_GETSTATIC: /* 0 -> 1 */
1451 case ICMD_PUTSTATICCONST: /* 0 -> 0 */
1452 case ICMD_PUTFIELDCONST: /* 1 -> 0 */
1453 if (opcode != ICMD_GETSTATIC && opcode != ICMD_PUTSTATICCONST) {
1455 if (opcode == ICMD_PUTFIELD) {
1459 NEW_INSTRUCTION_GET_FIELDREF(iptr, fmiref);
1462 if (opcode == ICMD_GETSTATIC || opcode == ICMD_GETFIELD) {
1468 SHOW_S1_LOCAL(iptr);
1469 SHOW_INT_CONST(iptr->sx.val.i);
1470 SHOW_DST_LOCAL(iptr);
1500 SHOW_S1_LOCAL(iptr);
1508 SHOW_S1_LOCAL(iptr);
1518 SHOW_DST_LOCAL(iptr);
1529 case ICMD_ANEWARRAY:
1533 case ICMD_MULTIANEWARRAY:
1534 if (stage >= SHOW_STACK) {
1535 argp = iptr->sx.s23.s2.args;
1536 i = iptr->s1.argcount;
1538 SHOW_STACKVAR(*(argp++));
1542 printf("argcount=%d ", iptr->s1.argcount);
1547 case ICMD_CHECKCAST:
1552 case ICMD_INSTANCEOF:
1557 case ICMD_INLINE_START:
1558 case ICMD_INLINE_END:
1562 if (stage >= SHOW_STACK) {
1563 argp = iptr->sx.s23.s2.args;
1564 i = iptr->s1.argcount;
1566 SHOW_STACKVAR(*(argp++));
1569 printf("%s ", iptr->sx.s23.s3.bte->cname);
1570 if (iptr->sx.s23.s3.bte->md->returntype.type != TYPE_VOID) {
1575 case ICMD_INVOKEVIRTUAL:
1576 case ICMD_INVOKESPECIAL:
1577 case ICMD_INVOKESTATIC:
1578 case ICMD_INVOKEINTERFACE:
1579 if (stage >= SHOW_STACK) {
1580 argp = iptr->sx.s23.s2.args;
1581 i = iptr->s1.argcount;
1583 SHOW_STACKVAR(*(argp++));
1586 NEW_INSTRUCTION_GET_METHODREF(iptr, fmiref);
1587 method_methodref_print(fmiref);
1588 if (fmiref->parseddesc.md->returntype.type != TYPE_VOID) {
1600 SHOW_TARGET(iptr->dst);
1610 SHOW_TARGET(iptr->dst);
1614 case ICMD_INLINE_GOTO:
1615 SHOW_TARGET(iptr->dst);
1619 SHOW_TARGET(iptr->sx.s23.s3.jsrtarget);
1624 case ICMD_IFNONNULL:
1626 SHOW_TARGET(iptr->dst);
1629 case ICMD_IF_ICMPEQ:
1630 case ICMD_IF_ICMPNE:
1631 case ICMD_IF_ICMPLT:
1632 case ICMD_IF_ICMPGE:
1633 case ICMD_IF_ICMPGT:
1634 case ICMD_IF_ICMPLE:
1636 case ICMD_IF_LCMPEQ:
1637 case ICMD_IF_LCMPNE:
1638 case ICMD_IF_LCMPLT:
1639 case ICMD_IF_LCMPGE:
1640 case ICMD_IF_LCMPGT:
1641 case ICMD_IF_LCMPLE:
1643 case ICMD_IF_FCMPEQ:
1644 case ICMD_IF_FCMPNE:
1646 case ICMD_IF_FCMPL_LT:
1647 case ICMD_IF_FCMPL_GE:
1648 case ICMD_IF_FCMPL_GT:
1649 case ICMD_IF_FCMPL_LE:
1651 case ICMD_IF_FCMPG_LT:
1652 case ICMD_IF_FCMPG_GE:
1653 case ICMD_IF_FCMPG_GT:
1654 case ICMD_IF_FCMPG_LE:
1656 case ICMD_IF_DCMPEQ:
1657 case ICMD_IF_DCMPNE:
1659 case ICMD_IF_DCMPL_LT:
1660 case ICMD_IF_DCMPL_GE:
1661 case ICMD_IF_DCMPL_GT:
1662 case ICMD_IF_DCMPL_LE:
1664 case ICMD_IF_DCMPG_LT:
1665 case ICMD_IF_DCMPG_GE:
1666 case ICMD_IF_DCMPG_GT:
1667 case ICMD_IF_DCMPG_LE:
1669 case ICMD_IF_ACMPEQ:
1670 case ICMD_IF_ACMPNE:
1673 SHOW_TARGET(iptr->dst);
1676 case ICMD_TABLESWITCH:
1680 case ICMD_LOOKUPSWITCH:
1698 if (stage >= SHOW_STACK) {
1699 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1700 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1702 SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
1703 SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
1708 if (stage >= SHOW_STACK) {
1709 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1710 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1712 SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
1713 SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
1714 SHOW_STACKVAR(iptr->dst.dupslots[2+2]);
1719 if (stage >= SHOW_STACK) {
1720 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1721 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1722 SHOW_STACKVAR(iptr->dst.dupslots[2]);
1724 SHOW_STACKVAR(iptr->dst.dupslots[3+0]);
1725 SHOW_STACKVAR(iptr->dst.dupslots[3+1]);
1726 SHOW_STACKVAR(iptr->dst.dupslots[3+2]);
1727 SHOW_STACKVAR(iptr->dst.dupslots[3+3]);
1728 SHOW_STACKVAR(iptr->dst.dupslots[3+4]);
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]);
1738 SHOW_STACKVAR(iptr->dst.dupslots[3+0]);
1739 SHOW_STACKVAR(iptr->dst.dupslots[3+1]);
1740 SHOW_STACKVAR(iptr->dst.dupslots[3+2]);
1741 SHOW_STACKVAR(iptr->dst.dupslots[3+3]);
1746 if (stage >= SHOW_STACK) {
1747 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1748 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1749 SHOW_STACKVAR(iptr->dst.dupslots[2]);
1750 SHOW_STACKVAR(iptr->dst.dupslots[4]);
1752 SHOW_STACKVAR(iptr->dst.dupslots[4+0]);
1753 SHOW_STACKVAR(iptr->dst.dupslots[4+1]);
1754 SHOW_STACKVAR(iptr->dst.dupslots[4+2]);
1755 SHOW_STACKVAR(iptr->dst.dupslots[4+3]);
1756 SHOW_STACKVAR(iptr->dst.dupslots[4+4]);
1757 SHOW_STACKVAR(iptr->dst.dupslots[4+5]);
1762 if (stage >= SHOW_STACK) {
1763 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1764 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1766 SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
1767 SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
1773 #endif /* !defined(NDEBUG) */
1775 #if !defined(NDEBUG)
1776 void show_icmd(instruction *iptr, bool deadcode)
1787 constant_classref *cr;
1788 unresolved_field *uf;
1791 /* get the opcode and the condition */
1793 opcode = iptr->opc & ICMD_OPCODE_MASK;
1794 condition = (iptr->opc & ICMD_CONDITION_MASK) >> 8;
1796 /* Print the condition for conditional instructions. */
1799 printf(" (condition: %s)", icmd_names[condition]);
1802 printf("%s", icmd_names[iptr->opc]);
1804 switch (iptr->opc) {
1805 case ICMD_IADDCONST:
1806 case ICMD_ISUBCONST:
1807 case ICMD_IMULCONST:
1811 case ICMD_IANDCONST:
1813 case ICMD_IXORCONST:
1814 case ICMD_ISHLCONST:
1815 case ICMD_ISHRCONST:
1816 case ICMD_IUSHRCONST:
1817 case ICMD_LSHLCONST:
1818 case ICMD_LSHRCONST:
1819 case ICMD_LUSHRCONST:
1821 case ICMD_IASTORECONST:
1822 case ICMD_BASTORECONST:
1823 case ICMD_CASTORECONST:
1824 case ICMD_SASTORECONST:
1825 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
1828 case ICMD_LADDCONST:
1829 case ICMD_LSUBCONST:
1830 case ICMD_LMULCONST:
1834 case ICMD_LANDCONST:
1836 case ICMD_LXORCONST:
1838 case ICMD_LASTORECONST:
1839 #if SIZEOF_VOID_P == 4
1840 printf(" %lld (0x%016llx)", iptr->val.l, iptr->val.l);
1842 printf(" %ld (0x%016lx)", iptr->val.l, iptr->val.l);
1847 printf(" %f (0x%08x)", iptr->val.f, iptr->val.i);
1851 #if SIZEOF_VOID_P == 4
1852 printf(" %g (0x%016llx)", iptr->val.d, iptr->val.l);
1854 printf(" %g (0x%016lx)", iptr->val.d, iptr->val.l);
1859 case ICMD_AASTORECONST:
1860 /* check if this is a constant string or a class reference */
1862 if (ICMD_ACONST_IS_CLASS(iptr)) {
1863 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1864 printf(" (NOT RESOLVED) classref = ");
1865 class_classref_print(ICMD_ACONST_UNRESOLVED_CLASSREF(iptr));
1868 printf(" class = ");
1869 class_print(ICMD_ACONST_RESOLVED_CLASSINFO(iptr));
1873 printf(" %p", iptr->val.a);
1876 printf(", String = \"");
1877 utf_display_printable_ascii(javastring_toutf(iptr->val.a, false));
1885 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1886 uf = INSTRUCTION_UNRESOLVED_FIELD(iptr);
1887 printf(" (NOT RESOLVED) ");
1889 field_fieldref_print(uf->fieldref);
1892 f = INSTRUCTION_RESOLVED_FIELDINFO(iptr);
1893 printf(" %d, ", f->offset);
1899 case ICMD_PUTSTATIC:
1900 case ICMD_GETSTATIC:
1901 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1902 uf = INSTRUCTION_UNRESOLVED_FIELD(iptr);
1903 printf(" (NOT RESOLVED) ");
1905 field_fieldref_print(uf->fieldref);
1908 f = INSTRUCTION_RESOLVED_FIELDINFO(iptr);
1909 if (!CLASS_IS_OR_ALMOST_INITIALIZED(f->class))
1910 printf(" (NOT INITIALIZED) ");
1918 case ICMD_PUTSTATICCONST:
1919 case ICMD_PUTFIELDCONST:
1920 switch (iptr[1].op1) {
1922 printf(" %d (0x%08x),", iptr->val.i, iptr->val.i);
1925 #if SIZEOF_VOID_P == 4
1926 printf(" %lld (0x%016llx),", iptr->val.l, iptr->val.l);
1928 printf(" %ld (0x%016lx),", iptr->val.l, iptr->val.l);
1932 printf(" %p,", iptr->val.a);
1935 printf(" %g (0x%08x),", iptr->val.f, iptr->val.i);
1938 #if SIZEOF_VOID_P == 4
1939 printf(" %g (0x%016llx),", iptr->val.d, iptr->val.l);
1941 printf(" %g (0x%016lx),", iptr->val.d, iptr->val.l);
1946 if (INSTRUCTION_IS_UNRESOLVED(iptr + 1)) {
1947 uf = INSTRUCTION_UNRESOLVED_FIELD(iptr + 1);
1948 printf(" (NOT RESOLVED) ");
1949 field_fieldref_print(uf->fieldref);
1952 f = INSTRUCTION_RESOLVED_FIELDINFO(iptr + 1);
1953 if ((iptr->opc == ICMD_PUTSTATICCONST) &&
1954 !CLASS_IS_OR_ALMOST_INITIALIZED(f->class))
1955 printf(" (NOT INITIALIZED), ");
1957 printf(" %d, ", f->offset);
1963 #if defined(ENABLE_SSA)
1964 printf(" %d + %d -> %d", iptr->op1, iptr->val._i.i, iptr->val._i.op1_t);
1966 printf(" %d + %d", iptr->op1, iptr->val.i);
2002 printf(" %d", iptr->op1);
2008 utf_display_printable_ascii_classname(c->name);
2012 switch (iptr->op1) {
2040 case ICMD_ANEWARRAY:
2044 utf_display_printable_ascii_classname(c->name);
2048 case ICMD_MULTIANEWARRAY:
2053 printf(" (NOT RESOLVED) %d ", iptr->op1);
2054 utf_display_printable_ascii(cr->name);
2057 printf(" %d ", iptr->op1);
2058 utf_display_printable_ascii_classname(c->name);
2062 case ICMD_CHECKCAST:
2063 case ICMD_INSTANCEOF:
2068 if (c->flags & ACC_INTERFACE)
2069 printf(" (INTERFACE) ");
2071 printf(" (CLASS,%3d) ", c->vftbl->diffval);
2073 printf(" (NOT RESOLVED) ");
2074 utf_display_printable_ascii_classname(cr->name);
2077 case ICMD_INLINE_START:
2078 case ICMD_INLINE_END:
2080 insinfo_inline *insinfo = (insinfo_inline *) iptr->target;
2082 method_print(insinfo->method);
2087 printf(" %s", ((builtintable_entry *) iptr->val.a)->cname);
2090 case ICMD_INVOKEVIRTUAL:
2091 case ICMD_INVOKESPECIAL:
2092 case ICMD_INVOKESTATIC:
2093 case ICMD_INVOKEINTERFACE:
2095 constant_FMIref *mref;
2097 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
2098 printf(" (NOT RESOLVED) ");
2099 mref = INSTRUCTION_UNRESOLVED_METHOD(iptr)->methodref;
2103 mref = INSTRUCTION_RESOLVED_FMIREF(iptr);
2105 method_methodref_print(mref);
2115 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
2117 /* if ((iptr->opc & ICMD_CONDITION_MASK) == 0) { */
2118 if (deadcode || !iptr->target)
2119 printf(" op1=%d", iptr->op1);
2121 printf(" L%03d (%p)", ((basicblock *) iptr->target)->nr, iptr->target);
2131 #if SIZEOF_VOID_P == 4
2132 printf(" %lld (%016llx)", iptr->val.l, iptr->val.l);
2134 printf(" %ld (%016lx)", iptr->val.l, iptr->val.l);
2137 /* if ((iptr->opc & ICMD_CONDITION_MASK) == 0) { */
2138 if (deadcode || !iptr->target)
2139 printf(" op1=%d", iptr->op1);
2141 printf(" L%03d", ((basicblock *) iptr->target)->nr);
2147 case ICMD_INLINE_GOTO:
2148 if (deadcode || !iptr->target)
2149 printf(" op1=%d", iptr->op1);
2151 printf(" L%03d (%p)", ((basicblock *) iptr->target)->nr,iptr->target);
2155 case ICMD_IFNONNULL:
2156 case ICMD_IF_ICMPEQ:
2157 case ICMD_IF_ICMPNE:
2158 case ICMD_IF_ICMPLT:
2159 case ICMD_IF_ICMPGE:
2160 case ICMD_IF_ICMPGT:
2161 case ICMD_IF_ICMPLE:
2163 case ICMD_IF_LCMPEQ:
2164 case ICMD_IF_LCMPNE:
2165 case ICMD_IF_LCMPLT:
2166 case ICMD_IF_LCMPGE:
2167 case ICMD_IF_LCMPGT:
2168 case ICMD_IF_LCMPLE:
2170 case ICMD_IF_FCMPEQ:
2171 case ICMD_IF_FCMPNE:
2173 case ICMD_IF_FCMPL_LT:
2174 case ICMD_IF_FCMPL_GE:
2175 case ICMD_IF_FCMPL_GT:
2176 case ICMD_IF_FCMPL_LE:
2178 case ICMD_IF_FCMPG_LT:
2179 case ICMD_IF_FCMPG_GE:
2180 case ICMD_IF_FCMPG_GT:
2181 case ICMD_IF_FCMPG_LE:
2183 case ICMD_IF_DCMPEQ:
2184 case ICMD_IF_DCMPNE:
2186 case ICMD_IF_DCMPL_LT:
2187 case ICMD_IF_DCMPL_GE:
2188 case ICMD_IF_DCMPL_GT:
2189 case ICMD_IF_DCMPL_LE:
2191 case ICMD_IF_DCMPG_LT:
2192 case ICMD_IF_DCMPG_GE:
2193 case ICMD_IF_DCMPG_GT:
2194 case ICMD_IF_DCMPG_LE:
2196 case ICMD_IF_ACMPEQ:
2197 case ICMD_IF_ACMPNE:
2198 /* if (!(iptr->opc & ICMD_CONDITION_MASK)) { */
2199 if (deadcode || !iptr->target)
2200 printf(" op1=%d", iptr->op1);
2202 printf(" L%03d (%p)", ((basicblock *) iptr->target)->nr,iptr->target);
2206 case ICMD_TABLESWITCH:
2207 s4ptr = (s4*)iptr->val.a;
2209 if (deadcode || !iptr->target) {
2210 printf(" %d;", *s4ptr);
2213 tptr = (void **) iptr->target;
2214 printf(" L%03d;", ((basicblock *) *tptr)->nr);
2218 s4ptr++; /* skip default */
2219 j = *s4ptr++; /* low */
2220 j = *s4ptr++ - j; /* high */
2222 if (deadcode || !*tptr)
2223 printf(" %d", *s4ptr++);
2225 printf(" L%03d", ((basicblock *) *tptr)->nr);
2232 case ICMD_LOOKUPSWITCH:
2233 s4ptr = (s4*)iptr->val.a;
2235 if (deadcode || !iptr->target) {
2236 printf(" %d;", *s4ptr);
2239 tptr = (void **) iptr->target;
2240 printf(" L%03d;", ((basicblock *) *tptr)->nr);
2243 s4ptr++; /* default */
2244 j = *s4ptr++; /* count */
2247 if (deadcode || !*tptr) {
2248 s4ptr++; /* skip value */
2249 printf(" %d",*s4ptr++);
2252 printf(" L%03d", ((basicblock *) *tptr)->nr);
2260 printf(" (NOT RESOLVED) Class = \"");
2261 utf_display_printable_ascii(((unresolved_class *) iptr->val.a)->classref->name);
2266 #endif /* !defined(NDEBUG) */
2269 * These are local overrides for various environment variables in Emacs.
2270 * Please do not remove this and leave it at the end of the file, where
2271 * Emacs will automagically detect them.
2272 * ---------------------------------------------------------------------
2275 * indent-tabs-mode: t
2279 * vim:noexpandtab:sw=4:ts=4: