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)
330 /* get required compiler data */
337 /* We need to enter a lock here, since the binutils disassembler
338 is not reentrant-able and we could not read functions printed
341 LOCK_MONITOR_ENTER(show_global_lock);
347 printf("\n(NEW INSTRUCTION FORMAT)\n");
348 printf("\nBasic blocks: %d\n", jd->new_basicblockcount);
349 printf("Code length: %d\n", (jd->new_basicblocks[jd->new_basicblockcount].mpc -
350 jd->new_basicblocks[0].mpc));
351 printf("Data length: %d\n", cd->dseglen);
352 printf("Stub length: %d\n", (s4) (code->mcodelength -
353 ((ptrint) cd->dseglen +
354 jd->new_basicblocks[jd->new_basicblockcount].mpc)));
355 printf("Max locals: %d\n", cd->maxlocals);
356 printf("Max stack: %d\n", cd->maxstack);
357 printf("Line number table length: %d\n", m->linenumbercount);
359 if (stage >= SHOW_PARSE) {
360 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
361 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
362 printf(" L%03d ... ", ex->start->debug_nr );
363 printf("L%03d = ", ex->end->debug_nr);
364 printf("L%03d", ex->handler->debug_nr);
365 printf(" (catchtype: ");
366 if (ex->catchtype.any)
367 if (IS_CLASSREF(ex->catchtype))
368 utf_display_printable_ascii_classname(ex->catchtype.ref->name);
370 utf_display_printable_ascii_classname(ex->catchtype.cls->name);
377 if (stage >= SHOW_PARSE && rd) {
378 printf("Local Table:\n");
379 for (i = 0; i < cd->maxlocals; i++) {
382 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
383 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
384 # if defined(ENABLE_INTRP)
387 if (rd->locals[i][j].type >= 0) {
388 printf(" (%s) ", jit_type[j]);
389 if (stage >= SHOW_REGS) {
390 if (rd->locals[i][j].flags & INMEMORY)
391 printf("m%2d", rd->locals[i][j].regoff);
392 # ifdef HAS_ADDRESS_REGISTER_FILE
393 else if (j == TYPE_ADR)
394 printf("r%02d", rd->locals[i][j].regoff);
396 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
397 printf("f%02d", rd->locals[i][j].regoff);
399 # if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
400 if (IS_2_WORD_TYPE(j))
402 regs[GET_LOW_REG(rd->locals[i][j].regoff)],
403 regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
406 printf("%3s", regs[rd->locals[i][j].regoff]);
410 # if defined(ENABLE_INTRP)
414 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
421 if (stage >= SHOW_STACK && rd) {
422 #if defined(ENABLE_LSRA)
425 #if defined(ENABLE_INTRP)
428 printf("Interface Table:\n");
429 for (i = 0; i < cd->maxstack; i++) {
430 if ((rd->interfaces[i][0].type >= 0) ||
431 (rd->interfaces[i][1].type >= 0) ||
432 (rd->interfaces[i][2].type >= 0) ||
433 (rd->interfaces[i][3].type >= 0) ||
434 (rd->interfaces[i][4].type >= 0)) {
437 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
438 # if defined(ENABLE_INTRP)
441 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
442 if (rd->interfaces[i][j].type >= 0) {
443 printf(" (%s) ", jit_type[j]);
444 if (stage >= SHOW_REGS) {
445 if (rd->interfaces[i][j].flags & SAVEDVAR) {
446 if (rd->interfaces[i][j].flags & INMEMORY)
447 printf("M%2d", rd->interfaces[i][j].regoff);
448 #ifdef HAS_ADDRESS_REGISTER_FILE
449 else if (j == TYPE_ADR)
450 printf("R%02d", rd->interfaces[i][j].regoff);
452 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
453 printf("F%02d", rd->interfaces[i][j].regoff);
455 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
456 if (IS_2_WORD_TYPE(j))
458 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
459 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
462 printf("%3s",regs[rd->interfaces[i][j].regoff]);
466 if (rd->interfaces[i][j].flags & INMEMORY)
467 printf("m%2d", rd->interfaces[i][j].regoff);
468 #ifdef HAS_ADDRESS_REGISTER_FILE
469 else if (j == TYPE_ADR)
470 printf("r%02d", rd->interfaces[i][j].regoff);
472 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
473 printf("f%02d", rd->interfaces[i][j].regoff);
475 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
476 if (IS_2_WORD_TYPE(j))
478 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
479 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
482 printf("%3s",regs[rd->interfaces[i][j].regoff]);
489 # if defined(ENABLE_INTRP)
492 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
498 #if defined(ENABLE_INTRP)
501 #if defined(ENABLE_LSRA)
504 } /* if >= SHOW_STACK */
506 if (code->rplpoints) {
507 printf("Replacement Points:\n");
508 replace_show_replacement_points(code);
512 #if defined(ENABLE_DISASSEMBLER)
513 /* show code before first basic block */
515 if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd)) {
516 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen);
518 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + jd->new_basicblocks[0].mpc);)
525 /* show code of all basic blocks */
527 for (bptr = jd->new_basicblocks; bptr != NULL; bptr = bptr->next)
528 new_show_basicblock(jd, bptr, stage);
530 #if defined(ENABLE_DISASSEMBLER)
531 /* show stubs code */
533 if (stage >= SHOW_CODE && opt_showdisassemble && opt_showexceptionstubs) {
534 printf("\nStubs code:\n");
535 printf("Length: %d\n\n", (s4) (code->mcodelength -
536 ((ptrint) cd->dseglen +
537 jd->new_basicblocks[jd->new_basicblockcount].mpc)));
539 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen +
540 jd->new_basicblocks[jd->new_basicblockcount].mpc);
542 for (; (ptrint) u1ptr < ((ptrint) code->mcode + code->mcodelength);)
549 LOCK_MONITOR_EXIT(show_global_lock);
551 /* finally flush the output */
555 #endif /* !defined(NDEBUG) */
558 void show_method(jitdata *jd)
569 /* get required compiler data */
576 /* We need to enter a lock here, since the binutils disassembler
577 is not reentrant-able and we could not read functions printed
580 LOCK_MONITOR_ENTER(show_global_lock);
586 printf("\nBasic blocks: %d\n", m->basicblockcount);
587 printf("Code length: %d\n", (m->basicblocks[m->basicblockcount].mpc -
588 m->basicblocks[0].mpc));
589 printf("Data length: %d\n", cd->dseglen);
590 printf("Stub length: %d\n", (s4) (code->mcodelength -
591 ((ptrint) cd->dseglen +
592 m->basicblocks[m->basicblockcount].mpc)));
593 printf("Max locals: %d\n", cd->maxlocals);
594 printf("Max stack: %d\n", cd->maxstack);
595 printf("Line number table length: %d\n", m->linenumbercount);
597 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
598 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
599 printf(" L%03d ... ", ex->start->debug_nr );
600 printf("L%03d = ", ex->end->debug_nr);
601 printf("L%03d", ex->handler->debug_nr);
602 printf(" (catchtype: ");
603 if (ex->catchtype.any)
604 if (IS_CLASSREF(ex->catchtype))
605 utf_display_printable_ascii_classname(ex->catchtype.ref->name);
607 utf_display_printable_ascii_classname(ex->catchtype.cls->name);
613 printf("Local Table:\n");
614 for (i = 0; i < cd->maxlocals; i++) {
617 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
618 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
619 # if defined(ENABLE_INTRP)
622 if (rd->locals[i][j].type >= 0) {
623 printf(" (%s) ", jit_type[j]);
624 if (rd->locals[i][j].flags & INMEMORY)
625 printf("m%2d", rd->locals[i][j].regoff);
626 # ifdef HAS_ADDRESS_REGISTER_FILE
627 else if (j == TYPE_ADR)
628 printf("r%02d", rd->locals[i][j].regoff);
630 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
631 printf("f%02d", rd->locals[i][j].regoff);
633 # if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
634 if (IS_2_WORD_TYPE(j))
636 regs[GET_LOW_REG(rd->locals[i][j].regoff)],
637 regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
640 printf("%3s", regs[rd->locals[i][j].regoff]);
643 # if defined(ENABLE_INTRP)
647 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
653 #if defined(ENABLE_LSRA)
656 #if defined(ENABLE_INTRP)
659 printf("Interface Table:\n");
660 for (i = 0; i < cd->maxstack; i++) {
661 if ((rd->interfaces[i][0].type >= 0) ||
662 (rd->interfaces[i][1].type >= 0) ||
663 (rd->interfaces[i][2].type >= 0) ||
664 (rd->interfaces[i][3].type >= 0) ||
665 (rd->interfaces[i][4].type >= 0)) {
668 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
669 # if defined(ENABLE_INTRP)
672 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
673 if (rd->interfaces[i][j].type >= 0) {
674 printf(" (%s) ", jit_type[j]);
675 if (rd->interfaces[i][j].flags & SAVEDVAR) {
676 if (rd->interfaces[i][j].flags & INMEMORY)
677 printf("M%2d", rd->interfaces[i][j].regoff);
678 #ifdef HAS_ADDRESS_REGISTER_FILE
679 else if (j == TYPE_ADR)
680 printf("R%02d", rd->interfaces[i][j].regoff);
682 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
683 printf("F%02d", rd->interfaces[i][j].regoff);
685 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
686 if (IS_2_WORD_TYPE(j))
688 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
689 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
692 printf("%3s",regs[rd->interfaces[i][j].regoff]);
696 if (rd->interfaces[i][j].flags & INMEMORY)
697 printf("m%2d", rd->interfaces[i][j].regoff);
698 #ifdef HAS_ADDRESS_REGISTER_FILE
699 else if (j == TYPE_ADR)
700 printf("r%02d", rd->interfaces[i][j].regoff);
702 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
703 printf("f%02d", rd->interfaces[i][j].regoff);
705 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
706 if (IS_2_WORD_TYPE(j))
708 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
709 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
712 printf("%3s",regs[rd->interfaces[i][j].regoff]);
718 # if defined(ENABLE_INTRP)
721 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
727 #if defined(ENABLE_INTRP)
730 #if defined(ENABLE_LSRA)
734 if (code->rplpoints) {
735 printf("Replacement Points:\n");
736 replace_show_replacement_points(code);
740 #if defined(ENABLE_DISASSEMBLER)
741 /* show code before first basic block */
743 if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd)) {
744 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen);
746 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + m->basicblocks[0].mpc);)
753 /* show code of all basic blocks */
755 for (bptr = m->basicblocks; bptr != NULL; bptr = bptr->next)
756 show_basicblock(jd, bptr);
758 #if defined(ENABLE_DISASSEMBLER)
759 /* show stubs code */
761 if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) && opt_showexceptionstubs) {
762 printf("\nStubs code:\n");
763 printf("Length: %d\n\n", (s4) (code->mcodelength -
764 ((ptrint) cd->dseglen +
765 m->basicblocks[m->basicblockcount].mpc)));
767 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen +
768 m->basicblocks[m->basicblockcount].mpc);
770 for (; (ptrint) u1ptr < ((ptrint) code->mcode + code->mcodelength);)
777 LOCK_MONITOR_EXIT(show_global_lock);
779 /* finally flush the output */
783 #endif /* !defined(NDEBUG) */
786 /* show_basicblock *************************************************************
788 Print the intermediate representation of a basic block.
790 NOTE: Currently this function may only be called after register allocation!
792 *******************************************************************************/
795 void new_show_basicblock(jitdata *jd, basicblock *bptr, int stage)
802 new_instruction *iptr;
805 /* get required compiler data */
811 if (bptr->flags != BBDELETED) {
812 deadcode = bptr->flags <= BBREACHED;
814 printf("======== %sL%03d ======== (flags: %d, bitflags: %01x, next: %d, type: ",
815 (bptr->bitflags & BBFLAG_REPLACEMENT) ? "<REPLACE> " : "",
816 bptr->debug_nr, bptr->flags, bptr->bitflags,
817 (bptr->next) ? (bptr->next->debug_nr) : -1);
819 switch (bptr->type) {
831 printf(", instruction count: %d, predecessors: %d):\n",
832 bptr->icount, bptr->predecessorcount);
834 iptr = /*XXX*/ (new_instruction *) bptr->iinstr;
836 for (i = 0; i < bptr->icount; i++, iptr++) {
837 printf("%4d: ", iptr->line);
839 new_show_icmd(jd, iptr, deadcode, stage);
843 #if defined(ENABLE_DISASSEMBLER)
844 if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) &&
847 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->mpc);
849 if (bptr->next != NULL) {
850 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->next->mpc);)
855 for (; u1ptr < (u1 *) ((ptrint) code->mcode + code->mcodelength);)
863 #endif /* !defined(NDEBUG) */
866 void show_basicblock(jitdata *jd, basicblock *bptr)
876 /* get required compiler data */
882 if (bptr->flags != BBDELETED) {
883 deadcode = bptr->flags <= BBREACHED;
888 for (j = cd->maxstack; j > 0; j--)
891 show_print_stack(cd, bptr->instack);
893 printf("] %sL%03d(flags: %d, bitflags: %01x, next: %d, type: ",
894 (bptr->bitflags & BBFLAG_REPLACEMENT) ? "<REPLACE> " : "",
895 bptr->debug_nr, bptr->flags, bptr->bitflags,
896 (bptr->next) ? (bptr->next->debug_nr) : -1);
898 switch (bptr->type) {
910 printf(", instruction count: %d, predecessors: %d):\n",
911 bptr->icount, bptr->predecessorcount);
915 for (i = 0; i < bptr->icount; i++, iptr++) {
919 for (j = cd->maxstack; j > 0; j--)
922 show_print_stack(cd, iptr->dst);
924 printf("] %5d (line: %5d) ", i, iptr->line);
926 show_icmd(iptr, deadcode);
930 #if defined(ENABLE_DISASSEMBLER)
931 if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) && (!deadcode)) {
933 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->mpc);
935 if (bptr->next != NULL) {
936 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->next->mpc);)
941 for (; u1ptr < (u1 *) ((ptrint) code->mcode + code->mcodelength);)
949 #endif /* !defined(NDEBUG) */
952 /* show_icmd *******************************************************************
954 Print the intermediate representation of an instruction.
956 NOTE: Currently this function may only be called after register allocation!
958 *******************************************************************************/
962 #define SHOW_TARGET(target) \
963 if (stage >= SHOW_STACK) { \
964 printf("--> L%03d ", (target).block->debug_nr); \
966 else if (stage >= SHOW_PARSE) { \
967 printf("--> insindex %d (L%03d) ", (target).insindex, \
968 jd->new_basicblocks[jd->new_basicblockindex[ \
969 (target).insindex]].debug_nr); \
972 printf("--> insindex %d ", (target).insindex); \
975 #define SHOW_INT_CONST(val) \
976 if (stage >= SHOW_PARSE) { \
977 printf("%ld ", (long) (val)); \
983 #define SHOW_LNG_CONST(val) \
984 if (stage >= SHOW_PARSE) { \
985 printf("%lld ", (long long)(val)); \
991 #define SHOW_FLT_CONST(val) \
992 if (stage >= SHOW_PARSE) { \
993 printf("%g ", (val)); \
999 #define SHOW_DBL_CONST(val) \
1000 if (stage >= SHOW_PARSE) { \
1001 printf("%g ", (val)); \
1004 printf("dconst "); \
1007 #define SHOW_INDEX(index) \
1008 if (stage >= SHOW_PARSE) { \
1009 printf("%d ", index); \
1015 #define SHOW_STRING(val) \
1016 if (stage >= SHOW_PARSE) { \
1018 utf_display_printable_ascii( \
1019 javastring_toutf((java_lang_String *)(val), false)); \
1023 printf("string "); \
1026 #define SHOW_CLASSREF_OR_CLASSINFO(c) \
1027 if (stage >= SHOW_PARSE) { \
1028 if (IS_CLASSREF(c)) \
1029 class_classref_print(c.ref); \
1031 class_print(c.cls); \
1038 #define SHOW_FIELD(fmiref) \
1039 if (stage >= SHOW_PARSE) { \
1040 field_fieldref_print(fmiref); \
1047 #define SHOW_STACKVAR(sp) \
1048 new_show_stackvar(jd, (sp), stage)
1050 #define SHOW_S1(iptr) \
1051 if (stage >= SHOW_STACK) { \
1052 SHOW_STACKVAR(iptr->s1.var); \
1055 #define SHOW_S2(iptr) \
1056 if (stage >= SHOW_STACK) { \
1057 SHOW_STACKVAR(iptr->sx.s23.s2.var); \
1060 #define SHOW_S3(iptr) \
1061 if (stage >= SHOW_STACK) { \
1062 SHOW_STACKVAR(iptr->sx.s23.s3.var); \
1065 #define SHOW_DST(iptr) \
1066 if (stage >= SHOW_STACK) { \
1068 SHOW_STACKVAR(iptr->dst.var); \
1071 #define SHOW_S1_LOCAL(iptr) \
1072 if (stage >= SHOW_STACK) { \
1073 printf("L%d ", iptr->s1.localindex); \
1076 #define SHOW_DST_LOCAL(iptr) \
1077 if (stage >= SHOW_STACK) { \
1078 printf("=> L%d ", iptr->dst.localindex); \
1081 static void new_show_stackvar(jitdata *jd, stackptr sp, int stage)
1086 case TYPE_INT: type = 'i'; break;
1087 case TYPE_LNG: type = 'l'; break;
1088 case TYPE_FLT: type = 'f'; break;
1089 case TYPE_DBL: type = 'd'; break;
1090 case TYPE_ADR: type = 'a'; break;
1091 default: type = '?';
1093 printf("S%c%d", type, (int) (sp - jd->new_stack));
1095 if (stage >= SHOW_REGS) {
1098 if (sp->flags & SAVEDVAR) {
1099 switch (sp->varkind) {
1101 if (sp->flags & INMEMORY)
1102 printf("M%02d", sp->regoff);
1103 #ifdef HAS_ADDRESS_REGISTER_FILE
1104 else if (sp->type == TYPE_ADR)
1105 printf("R%02d", sp->regoff);
1107 else if (IS_FLT_DBL_TYPE(sp->type))
1108 printf("F%02d", sp->regoff);
1110 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
1111 if (IS_2_WORD_TYPE(sp->type)) {
1112 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1113 # if defined(ENABLE_INTRP)
1115 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1116 GET_HIGH_REG(sp->regoff));
1119 printf("%3s/%3s", regs[GET_LOW_REG(sp->regoff)],
1120 regs[GET_HIGH_REG(sp->regoff)]);
1122 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1123 GET_HIGH_REG(sp->regoff));
1127 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
1129 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1130 # if defined(ENABLE_INTRP)
1132 printf("%3d", sp->regoff);
1135 printf("%3s", regs[sp->regoff]);
1137 printf("%3d", sp->regoff);
1143 printf("I%02d", sp->varnum);
1146 printf("L%02d", sp->varnum);
1149 if (sp->varnum == -1) {
1151 /* varkind ARGVAR "misused for this special case */
1154 else /* "normal" Argvar */
1155 printf("A%02d", sp->varnum);
1158 printf("!xx {kind=%d, num=%d}", sp->varkind, sp->varnum);
1161 else { /* not SAVEDVAR */
1162 switch (sp->varkind) {
1164 if (sp->flags & INMEMORY)
1165 printf("m%02d", sp->regoff);
1166 #ifdef HAS_ADDRESS_REGISTER_FILE
1167 else if (sp->type == TYPE_ADR)
1168 printf("r%02d", sp->regoff);
1170 else if (IS_FLT_DBL_TYPE(sp->type))
1171 printf("f%02d", sp->regoff);
1173 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
1174 if (IS_2_WORD_TYPE(sp->type)) {
1175 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1176 # if defined(ENABLE_INTRP)
1178 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1179 GET_HIGH_REG(sp->regoff));
1182 printf("%3s/%3s", regs[GET_LOW_REG(sp->regoff)],
1183 regs[GET_HIGH_REG(sp->regoff)]);
1185 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1186 GET_HIGH_REG(sp->regoff));
1190 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
1192 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1193 # if defined(ENABLE_INTRP)
1195 printf("%3d", sp->regoff);
1198 printf("%3s", regs[sp->regoff]);
1200 printf("%3d", sp->regoff);
1206 printf("i%02d", sp->varnum);
1209 printf("l%02d", sp->varnum);
1212 if (sp->varnum == -1) {
1214 /* varkind ARGVAR "misused for this special case */
1217 else /* "normal" Argvar */
1218 printf("a%02d", sp->varnum);
1221 printf("?xx {kind=%d, num=%d}", sp->varkind, sp->varnum);
1230 void new_show_icmd(jitdata *jd, new_instruction *iptr, bool deadcode, int stage)
1233 branch_target_t *table;
1234 lookup_target_t *lookup;
1235 constant_FMIref *fmiref;
1239 /* get the opcode and the condition */
1243 printf("%s ", icmd_names[opcode]);
1245 if (stage < SHOW_PARSE)
1251 /* Print the condition for conditional instructions. */
1253 /* XXX print condition from flags */
1255 if (iptr->flags.bits & INS_FLAG_UNRESOLVED)
1256 printf("(UNRESOLVED) ");
1261 case ICMD_CHECKNULL:
1262 case ICMD_CHECKNULL_POP:
1267 case ICMD_ARRAYLENGTH:
1286 case ICMD_INT2SHORT:
1334 /* binary/const INT */
1335 case ICMD_IADDCONST:
1336 case ICMD_ISUBCONST:
1337 case ICMD_IMULCONST:
1341 case ICMD_IANDCONST:
1343 case ICMD_IXORCONST:
1344 case ICMD_ISHLCONST:
1345 case ICMD_ISHRCONST:
1346 case ICMD_IUSHRCONST:
1347 case ICMD_LSHLCONST:
1348 case ICMD_LSHRCONST:
1349 case ICMD_LUSHRCONST:
1351 SHOW_INT_CONST(iptr->sx.val.i);
1355 /* ?ASTORECONST (trinary/const INT) */
1356 case ICMD_IASTORECONST:
1357 case ICMD_BASTORECONST:
1358 case ICMD_CASTORECONST:
1359 case ICMD_SASTORECONST:
1362 SHOW_INT_CONST(iptr->sx.s23.s3.constval);
1367 SHOW_INT_CONST(iptr->sx.val.i);
1371 /* binary/const LNG */
1372 case ICMD_LADDCONST:
1373 case ICMD_LSUBCONST:
1374 case ICMD_LMULCONST:
1378 case ICMD_LANDCONST:
1380 case ICMD_LXORCONST:
1382 SHOW_LNG_CONST(iptr->sx.val.l);
1386 /* trinary/const LNG (<= pointer size) */
1387 case ICMD_LASTORECONST:
1390 SHOW_LNG_CONST(iptr->sx.s23.s3.constval);
1395 SHOW_LNG_CONST(iptr->sx.val.l);
1401 SHOW_FLT_CONST(iptr->sx.val.f);
1407 SHOW_DBL_CONST(iptr->sx.val.d);
1413 if (iptr->flags.bits & INS_FLAG_CLASS) {
1414 SHOW_CLASSREF_OR_CLASSINFO(iptr->sx.val.c);
1416 else if (iptr->sx.val.anyptr == NULL) {
1420 SHOW_STRING(iptr->sx.val.stringconst);
1425 case ICMD_AASTORECONST:
1428 printf("%p ", (void*) iptr->sx.s23.s3.constval);
1431 case ICMD_GETFIELD: /* 1 -> 1 */
1432 case ICMD_PUTFIELD: /* 2 -> 0 */
1433 case ICMD_PUTSTATIC: /* 1 -> 0 */
1434 case ICMD_GETSTATIC: /* 0 -> 1 */
1435 case ICMD_PUTSTATICCONST: /* 0 -> 0 */
1436 case ICMD_PUTFIELDCONST: /* 1 -> 0 */
1437 if (opcode != ICMD_GETSTATIC && opcode != ICMD_PUTSTATICCONST) {
1439 if (opcode == ICMD_PUTFIELD) {
1443 NEW_INSTRUCTION_GET_FIELDREF(iptr, fmiref);
1446 if (opcode == ICMD_GETSTATIC || opcode == ICMD_GETFIELD) {
1452 SHOW_S1_LOCAL(iptr);
1453 SHOW_INT_CONST(iptr->sx.val.i);
1454 SHOW_DST_LOCAL(iptr);
1484 SHOW_S1_LOCAL(iptr);
1492 SHOW_S1_LOCAL(iptr);
1502 SHOW_DST_LOCAL(iptr);
1513 case ICMD_ANEWARRAY:
1517 case ICMD_MULTIANEWARRAY:
1518 if (stage >= SHOW_STACK) {
1519 argp = iptr->sx.s23.s2.args;
1520 i = iptr->s1.argcount;
1522 SHOW_STACKVAR(*(argp++));
1526 printf("argcount=%d ", iptr->s1.argcount);
1531 case ICMD_CHECKCAST:
1536 case ICMD_INSTANCEOF:
1541 case ICMD_INLINE_START:
1542 case ICMD_INLINE_END:
1546 if (stage >= SHOW_STACK) {
1547 argp = iptr->sx.s23.s2.args;
1548 i = iptr->s1.argcount;
1550 SHOW_STACKVAR(*(argp++));
1553 printf("%s ", iptr->sx.s23.s3.bte->name);
1554 if (iptr->sx.s23.s3.bte->md->returntype.type != TYPE_VOID) {
1559 case ICMD_INVOKEVIRTUAL:
1560 case ICMD_INVOKESPECIAL:
1561 case ICMD_INVOKESTATIC:
1562 case ICMD_INVOKEINTERFACE:
1563 if (stage >= SHOW_STACK) {
1564 argp = iptr->sx.s23.s2.args;
1565 i = iptr->s1.argcount;
1567 SHOW_STACKVAR(*(argp++));
1570 NEW_INSTRUCTION_GET_METHODREF(iptr, fmiref);
1571 method_methodref_print(fmiref);
1572 if (fmiref->parseddesc.md->returntype.type != TYPE_VOID) {
1584 SHOW_TARGET(iptr->dst);
1594 SHOW_TARGET(iptr->dst);
1598 case ICMD_INLINE_GOTO:
1599 SHOW_TARGET(iptr->dst);
1603 SHOW_TARGET(iptr->sx.s23.s3.jsrtarget);
1608 case ICMD_IFNONNULL:
1610 SHOW_TARGET(iptr->dst);
1613 case ICMD_IF_ICMPEQ:
1614 case ICMD_IF_ICMPNE:
1615 case ICMD_IF_ICMPLT:
1616 case ICMD_IF_ICMPGE:
1617 case ICMD_IF_ICMPGT:
1618 case ICMD_IF_ICMPLE:
1620 case ICMD_IF_LCMPEQ:
1621 case ICMD_IF_LCMPNE:
1622 case ICMD_IF_LCMPLT:
1623 case ICMD_IF_LCMPGE:
1624 case ICMD_IF_LCMPGT:
1625 case ICMD_IF_LCMPLE:
1627 case ICMD_IF_FCMPEQ:
1628 case ICMD_IF_FCMPNE:
1630 case ICMD_IF_FCMPL_LT:
1631 case ICMD_IF_FCMPL_GE:
1632 case ICMD_IF_FCMPL_GT:
1633 case ICMD_IF_FCMPL_LE:
1635 case ICMD_IF_FCMPG_LT:
1636 case ICMD_IF_FCMPG_GE:
1637 case ICMD_IF_FCMPG_GT:
1638 case ICMD_IF_FCMPG_LE:
1640 case ICMD_IF_DCMPEQ:
1641 case ICMD_IF_DCMPNE:
1643 case ICMD_IF_DCMPL_LT:
1644 case ICMD_IF_DCMPL_GE:
1645 case ICMD_IF_DCMPL_GT:
1646 case ICMD_IF_DCMPL_LE:
1648 case ICMD_IF_DCMPG_LT:
1649 case ICMD_IF_DCMPG_GE:
1650 case ICMD_IF_DCMPG_GT:
1651 case ICMD_IF_DCMPG_LE:
1653 case ICMD_IF_ACMPEQ:
1654 case ICMD_IF_ACMPNE:
1657 SHOW_TARGET(iptr->dst);
1660 case ICMD_TABLESWITCH:
1664 case ICMD_LOOKUPSWITCH:
1682 if (stage >= SHOW_STACK) {
1683 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1684 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1686 SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
1687 SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
1692 if (stage >= SHOW_STACK) {
1693 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1694 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1696 SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
1697 SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
1698 SHOW_STACKVAR(iptr->dst.dupslots[2+2]);
1703 if (stage >= SHOW_STACK) {
1704 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1705 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1706 SHOW_STACKVAR(iptr->dst.dupslots[2]);
1708 SHOW_STACKVAR(iptr->dst.dupslots[3+0]);
1709 SHOW_STACKVAR(iptr->dst.dupslots[3+1]);
1710 SHOW_STACKVAR(iptr->dst.dupslots[3+2]);
1711 SHOW_STACKVAR(iptr->dst.dupslots[3+3]);
1712 SHOW_STACKVAR(iptr->dst.dupslots[3+4]);
1717 if (stage >= SHOW_STACK) {
1718 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1719 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1720 SHOW_STACKVAR(iptr->dst.dupslots[2]);
1722 SHOW_STACKVAR(iptr->dst.dupslots[3+0]);
1723 SHOW_STACKVAR(iptr->dst.dupslots[3+1]);
1724 SHOW_STACKVAR(iptr->dst.dupslots[3+2]);
1725 SHOW_STACKVAR(iptr->dst.dupslots[3+3]);
1730 if (stage >= SHOW_STACK) {
1731 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1732 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1733 SHOW_STACKVAR(iptr->dst.dupslots[2]);
1734 SHOW_STACKVAR(iptr->dst.dupslots[4]);
1736 SHOW_STACKVAR(iptr->dst.dupslots[4+0]);
1737 SHOW_STACKVAR(iptr->dst.dupslots[4+1]);
1738 SHOW_STACKVAR(iptr->dst.dupslots[4+2]);
1739 SHOW_STACKVAR(iptr->dst.dupslots[4+3]);
1740 SHOW_STACKVAR(iptr->dst.dupslots[4+4]);
1741 SHOW_STACKVAR(iptr->dst.dupslots[4+5]);
1746 if (stage >= SHOW_STACK) {
1747 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1748 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1750 SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
1751 SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
1757 #endif /* !defined(NDEBUG) */
1759 #if !defined(NDEBUG)
1760 void show_icmd(instruction *iptr, bool deadcode)
1771 constant_classref *cr;
1772 unresolved_field *uf;
1775 /* get the opcode and the condition */
1777 opcode = iptr->opc & ICMD_OPCODE_MASK;
1778 condition = (iptr->opc & ICMD_CONDITION_MASK) >> 8;
1780 /* Print the condition for conditional instructions. */
1783 printf(" (condition: %s)", icmd_names[condition]);
1786 printf("%s", icmd_names[iptr->opc]);
1788 switch (iptr->opc) {
1789 case ICMD_IADDCONST:
1790 case ICMD_ISUBCONST:
1791 case ICMD_IMULCONST:
1795 case ICMD_IANDCONST:
1797 case ICMD_IXORCONST:
1798 case ICMD_ISHLCONST:
1799 case ICMD_ISHRCONST:
1800 case ICMD_IUSHRCONST:
1801 case ICMD_LSHLCONST:
1802 case ICMD_LSHRCONST:
1803 case ICMD_LUSHRCONST:
1805 case ICMD_IASTORECONST:
1806 case ICMD_BASTORECONST:
1807 case ICMD_CASTORECONST:
1808 case ICMD_SASTORECONST:
1809 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
1812 case ICMD_LADDCONST:
1813 case ICMD_LSUBCONST:
1814 case ICMD_LMULCONST:
1818 case ICMD_LANDCONST:
1820 case ICMD_LXORCONST:
1822 case ICMD_LASTORECONST:
1823 #if SIZEOF_VOID_P == 4
1824 printf(" %lld (0x%016llx)", iptr->val.l, iptr->val.l);
1826 printf(" %ld (0x%016lx)", iptr->val.l, iptr->val.l);
1831 printf(" %f (0x%08x)", iptr->val.f, iptr->val.i);
1835 #if SIZEOF_VOID_P == 4
1836 printf(" %g (0x%016llx)", iptr->val.d, iptr->val.l);
1838 printf(" %g (0x%016lx)", iptr->val.d, iptr->val.l);
1843 case ICMD_AASTORECONST:
1844 /* check if this is a constant string or a class reference */
1846 if (ICMD_ACONST_IS_CLASS(iptr)) {
1847 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1848 printf(" (NOT RESOLVED) classref = ");
1849 class_classref_print(ICMD_ACONST_UNRESOLVED_CLASSREF(iptr));
1852 printf(" class = ");
1853 class_print(ICMD_ACONST_RESOLVED_CLASSINFO(iptr));
1857 printf(" %p", iptr->val.a);
1860 printf(", String = \"");
1861 utf_display_printable_ascii(javastring_toutf(iptr->val.a, false));
1869 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1870 uf = INSTRUCTION_UNRESOLVED_FIELD(iptr);
1871 printf(" (NOT RESOLVED) ");
1873 field_fieldref_print(uf->fieldref);
1876 f = INSTRUCTION_RESOLVED_FIELDINFO(iptr);
1877 printf(" %d, ", f->offset);
1883 case ICMD_PUTSTATIC:
1884 case ICMD_GETSTATIC:
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 if (!CLASS_IS_OR_ALMOST_INITIALIZED(f->class))
1894 printf(" (NOT INITIALIZED) ");
1902 case ICMD_PUTSTATICCONST:
1903 case ICMD_PUTFIELDCONST:
1904 switch (iptr[1].op1) {
1906 printf(" %d (0x%08x),", iptr->val.i, iptr->val.i);
1909 #if SIZEOF_VOID_P == 4
1910 printf(" %lld (0x%016llx),", iptr->val.l, iptr->val.l);
1912 printf(" %ld (0x%016lx),", iptr->val.l, iptr->val.l);
1916 printf(" %p,", iptr->val.a);
1919 printf(" %g (0x%08x),", iptr->val.f, iptr->val.i);
1922 #if SIZEOF_VOID_P == 4
1923 printf(" %g (0x%016llx),", iptr->val.d, iptr->val.l);
1925 printf(" %g (0x%016lx),", iptr->val.d, iptr->val.l);
1930 if (INSTRUCTION_IS_UNRESOLVED(iptr + 1)) {
1931 uf = INSTRUCTION_UNRESOLVED_FIELD(iptr + 1);
1932 printf(" (NOT RESOLVED) ");
1933 field_fieldref_print(uf->fieldref);
1936 f = INSTRUCTION_RESOLVED_FIELDINFO(iptr + 1);
1937 if ((iptr->opc == ICMD_PUTSTATICCONST) &&
1938 !CLASS_IS_OR_ALMOST_INITIALIZED(f->class))
1939 printf(" (NOT INITIALIZED), ");
1941 printf(" %d, ", f->offset);
1947 printf(" %d + %d", iptr->op1, iptr->val.i);
1982 printf(" %d", iptr->op1);
1988 utf_display_printable_ascii_classname(c->name);
1992 switch (iptr->op1) {
2020 case ICMD_ANEWARRAY:
2024 utf_display_printable_ascii_classname(c->name);
2028 case ICMD_MULTIANEWARRAY:
2033 printf(" (NOT RESOLVED) %d ", iptr->op1);
2034 utf_display_printable_ascii(cr->name);
2037 printf(" %d ", iptr->op1);
2038 utf_display_printable_ascii_classname(c->name);
2042 case ICMD_CHECKCAST:
2043 case ICMD_INSTANCEOF:
2048 if (c->flags & ACC_INTERFACE)
2049 printf(" (INTERFACE) ");
2051 printf(" (CLASS,%3d) ", c->vftbl->diffval);
2053 printf(" (NOT RESOLVED) ");
2054 utf_display_printable_ascii_classname(cr->name);
2057 case ICMD_INLINE_START:
2058 case ICMD_INLINE_END:
2060 insinfo_inline *insinfo = (insinfo_inline *) iptr->target;
2062 method_print(insinfo->method);
2067 printf(" %s", ((builtintable_entry *) iptr->val.a)->name);
2070 case ICMD_INVOKEVIRTUAL:
2071 case ICMD_INVOKESPECIAL:
2072 case ICMD_INVOKESTATIC:
2073 case ICMD_INVOKEINTERFACE:
2075 constant_FMIref *mref;
2077 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
2078 printf(" (NOT RESOLVED) ");
2079 mref = INSTRUCTION_UNRESOLVED_METHOD(iptr)->methodref;
2083 mref = INSTRUCTION_RESOLVED_FMIREF(iptr);
2085 method_methodref_print(mref);
2095 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
2097 /* if ((iptr->opc & ICMD_CONDITION_MASK) == 0) { */
2098 if (deadcode || !iptr->target)
2099 printf(" op1=%d", iptr->op1);
2101 printf(" L%03d (%p)", ((basicblock *) iptr->target)->debug_nr, iptr->target);
2111 #if SIZEOF_VOID_P == 4
2112 printf(" %lld (%016llx)", iptr->val.l, iptr->val.l);
2114 printf(" %ld (%016lx)", iptr->val.l, iptr->val.l);
2117 /* if ((iptr->opc & ICMD_CONDITION_MASK) == 0) { */
2118 if (deadcode || !iptr->target)
2119 printf(" op1=%d", iptr->op1);
2121 printf(" L%03d", ((basicblock *) iptr->target)->debug_nr);
2127 case ICMD_INLINE_GOTO:
2128 if (deadcode || !iptr->target)
2129 printf(" op1=%d", iptr->op1);
2131 printf(" L%03d (%p)", ((basicblock *) iptr->target)->debug_nr,iptr->target);
2135 case ICMD_IFNONNULL:
2136 case ICMD_IF_ICMPEQ:
2137 case ICMD_IF_ICMPNE:
2138 case ICMD_IF_ICMPLT:
2139 case ICMD_IF_ICMPGE:
2140 case ICMD_IF_ICMPGT:
2141 case ICMD_IF_ICMPLE:
2143 case ICMD_IF_LCMPEQ:
2144 case ICMD_IF_LCMPNE:
2145 case ICMD_IF_LCMPLT:
2146 case ICMD_IF_LCMPGE:
2147 case ICMD_IF_LCMPGT:
2148 case ICMD_IF_LCMPLE:
2150 case ICMD_IF_FCMPEQ:
2151 case ICMD_IF_FCMPNE:
2153 case ICMD_IF_FCMPL_LT:
2154 case ICMD_IF_FCMPL_GE:
2155 case ICMD_IF_FCMPL_GT:
2156 case ICMD_IF_FCMPL_LE:
2158 case ICMD_IF_FCMPG_LT:
2159 case ICMD_IF_FCMPG_GE:
2160 case ICMD_IF_FCMPG_GT:
2161 case ICMD_IF_FCMPG_LE:
2163 case ICMD_IF_DCMPEQ:
2164 case ICMD_IF_DCMPNE:
2166 case ICMD_IF_DCMPL_LT:
2167 case ICMD_IF_DCMPL_GE:
2168 case ICMD_IF_DCMPL_GT:
2169 case ICMD_IF_DCMPL_LE:
2171 case ICMD_IF_DCMPG_LT:
2172 case ICMD_IF_DCMPG_GE:
2173 case ICMD_IF_DCMPG_GT:
2174 case ICMD_IF_DCMPG_LE:
2176 case ICMD_IF_ACMPEQ:
2177 case ICMD_IF_ACMPNE:
2178 /* if (!(iptr->opc & ICMD_CONDITION_MASK)) { */
2179 if (deadcode || !iptr->target)
2180 printf(" op1=%d", iptr->op1);
2182 printf(" L%03d (%p)", ((basicblock *) iptr->target)->debug_nr,iptr->target);
2186 case ICMD_TABLESWITCH:
2187 s4ptr = (s4*)iptr->val.a;
2189 if (deadcode || !iptr->target) {
2190 printf(" %d;", *s4ptr);
2193 tptr = (void **) iptr->target;
2194 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
2198 s4ptr++; /* skip default */
2199 j = *s4ptr++; /* low */
2200 j = *s4ptr++ - j; /* high */
2202 if (deadcode || !*tptr)
2203 printf(" %d", *s4ptr++);
2205 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
2212 case ICMD_LOOKUPSWITCH:
2213 s4ptr = (s4*)iptr->val.a;
2215 if (deadcode || !iptr->target) {
2216 printf(" %d;", *s4ptr);
2219 tptr = (void **) iptr->target;
2220 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
2223 s4ptr++; /* default */
2224 j = *s4ptr++; /* count */
2227 if (deadcode || !*tptr) {
2228 s4ptr++; /* skip value */
2229 printf(" %d",*s4ptr++);
2232 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
2240 printf(" (NOT RESOLVED) Class = \"");
2241 utf_display_printable_ascii(((unresolved_class *) iptr->val.a)->classref->name);
2246 #endif /* !defined(NDEBUG) */
2249 * These are local overrides for various environment variables in Emacs.
2250 * Please do not remove this and leave it at the end of the file, where
2251 * Emacs will automagically detect them.
2252 * ---------------------------------------------------------------------
2255 * indent-tabs-mode: t
2259 * vim:noexpandtab:sw=4:ts=4: