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("Max locals: %d\n", cd->maxlocals);
353 printf("Max stack: %d\n", cd->maxstack);
354 printf("Line number table length: %d\n", m->linenumbercount);
356 if (stage >= SHOW_PARSE) {
357 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
358 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
359 printf(" L%03d ... ", ex->start->debug_nr );
360 printf("L%03d = ", ex->end->debug_nr);
361 printf("L%03d", ex->handler->debug_nr);
362 printf(" (catchtype: ");
363 if (ex->catchtype.any)
364 if (IS_CLASSREF(ex->catchtype))
365 utf_display_printable_ascii_classname(ex->catchtype.ref->name);
367 utf_display_printable_ascii_classname(ex->catchtype.cls->name);
374 if (stage >= SHOW_PARSE && rd) {
375 printf("Local Table:\n");
376 for (i = 0; i < cd->maxlocals; i++) {
379 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
380 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
381 # if defined(ENABLE_INTRP)
384 if (rd->locals[i][j].type >= 0) {
385 printf(" (%s) ", jit_type[j]);
386 if (stage >= SHOW_REGS) {
387 if (rd->locals[i][j].flags & INMEMORY)
388 printf("m%2d", rd->locals[i][j].regoff);
389 # ifdef HAS_ADDRESS_REGISTER_FILE
390 else if (j == TYPE_ADR)
391 printf("r%02d", rd->locals[i][j].regoff);
393 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
394 printf("f%02d", rd->locals[i][j].regoff);
396 # if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
397 if (IS_2_WORD_TYPE(j))
399 regs[GET_LOW_REG(rd->locals[i][j].regoff)],
400 regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
403 printf("%3s", regs[rd->locals[i][j].regoff]);
407 # if defined(ENABLE_INTRP)
411 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
418 if (stage >= SHOW_STACK && rd) {
419 #if defined(ENABLE_LSRA)
422 #if defined(ENABLE_INTRP)
425 printf("Interface Table:\n");
426 for (i = 0; i < cd->maxstack; i++) {
427 if ((rd->interfaces[i][0].type >= 0) ||
428 (rd->interfaces[i][1].type >= 0) ||
429 (rd->interfaces[i][2].type >= 0) ||
430 (rd->interfaces[i][3].type >= 0) ||
431 (rd->interfaces[i][4].type >= 0)) {
434 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
435 # if defined(ENABLE_INTRP)
438 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
439 if (rd->interfaces[i][j].type >= 0) {
440 printf(" (%s) ", jit_type[j]);
441 if (stage >= SHOW_REGS) {
442 if (rd->interfaces[i][j].flags & SAVEDVAR) {
443 if (rd->interfaces[i][j].flags & INMEMORY)
444 printf("M%2d", rd->interfaces[i][j].regoff);
445 #ifdef HAS_ADDRESS_REGISTER_FILE
446 else if (j == TYPE_ADR)
447 printf("R%02d", rd->interfaces[i][j].regoff);
449 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
450 printf("F%02d", rd->interfaces[i][j].regoff);
452 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
453 if (IS_2_WORD_TYPE(j))
455 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
456 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
459 printf("%3s",regs[rd->interfaces[i][j].regoff]);
463 if (rd->interfaces[i][j].flags & INMEMORY)
464 printf("m%2d", rd->interfaces[i][j].regoff);
465 #ifdef HAS_ADDRESS_REGISTER_FILE
466 else if (j == TYPE_ADR)
467 printf("r%02d", rd->interfaces[i][j].regoff);
469 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
470 printf("f%02d", rd->interfaces[i][j].regoff);
472 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
473 if (IS_2_WORD_TYPE(j))
475 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
476 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
479 printf("%3s",regs[rd->interfaces[i][j].regoff]);
486 # if defined(ENABLE_INTRP)
489 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
495 #if defined(ENABLE_INTRP)
498 #if defined(ENABLE_LSRA)
501 } /* if >= SHOW_STACK */
503 if (code->rplpoints) {
504 printf("Replacement Points:\n");
505 replace_show_replacement_points(code);
509 #if defined(ENABLE_DISASSEMBLER)
510 /* show code before first basic block */
512 if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd)) {
513 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen);
515 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + jd->new_basicblocks[0].mpc);)
522 /* show code of all basic blocks */
524 for (bptr = jd->new_basicblocks; bptr != NULL; bptr = bptr->next)
525 new_show_basicblock(jd, bptr, stage);
527 #if defined(ENABLE_DISASSEMBLER)
528 /* show stubs code */
530 if (stage >= SHOW_CODE && opt_showdisassemble && opt_showexceptionstubs) {
531 printf("\nException stubs code:\n");
532 printf("Length: %d\n\n", (s4) (code->mcodelength -
533 ((ptrint) cd->dseglen +
534 jd->new_basicblocks[jd->new_basicblockcount].mpc)));
536 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen +
537 jd->new_basicblocks[jd->new_basicblockcount].mpc);
539 for (; (ptrint) u1ptr < ((ptrint) code->mcode + code->mcodelength);)
546 LOCK_MONITOR_EXIT(show_global_lock);
548 /* finally flush the output */
552 #endif /* !defined(NDEBUG) */
555 void show_method(jitdata *jd)
566 /* get required compiler data */
573 /* We need to enter a lock here, since the binutils disassembler
574 is not reentrant-able and we could not read functions printed
577 LOCK_MONITOR_ENTER(show_global_lock);
583 printf("\nBasic blocks: %d\n", m->basicblockcount);
584 printf("Code length: %d\n", (m->basicblocks[m->basicblockcount].mpc -
585 m->basicblocks[0].mpc));
586 printf("Data length: %d\n", cd->dseglen);
587 printf("Max locals: %d\n", cd->maxlocals);
588 printf("Max stack: %d\n", cd->maxstack);
589 printf("Line number table length: %d\n", m->linenumbercount);
591 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
592 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
593 printf(" L%03d ... ", ex->start->debug_nr );
594 printf("L%03d = ", ex->end->debug_nr);
595 printf("L%03d", ex->handler->debug_nr);
596 printf(" (catchtype: ");
597 if (ex->catchtype.any)
598 if (IS_CLASSREF(ex->catchtype))
599 utf_display_printable_ascii_classname(ex->catchtype.ref->name);
601 utf_display_printable_ascii_classname(ex->catchtype.cls->name);
607 printf("Local Table:\n");
608 for (i = 0; i < cd->maxlocals; i++) {
611 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
612 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
613 # if defined(ENABLE_INTRP)
616 if (rd->locals[i][j].type >= 0) {
617 printf(" (%s) ", jit_type[j]);
618 if (rd->locals[i][j].flags & INMEMORY)
619 printf("m%2d", rd->locals[i][j].regoff);
620 # ifdef HAS_ADDRESS_REGISTER_FILE
621 else if (j == TYPE_ADR)
622 printf("r%02d", rd->locals[i][j].regoff);
624 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
625 printf("f%02d", rd->locals[i][j].regoff);
627 # if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
628 if (IS_2_WORD_TYPE(j))
630 regs[GET_LOW_REG(rd->locals[i][j].regoff)],
631 regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
634 printf("%3s", regs[rd->locals[i][j].regoff]);
637 # if defined(ENABLE_INTRP)
641 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
647 #if defined(ENABLE_LSRA)
650 #if defined(ENABLE_INTRP)
653 printf("Interface Table:\n");
654 for (i = 0; i < cd->maxstack; i++) {
655 if ((rd->interfaces[i][0].type >= 0) ||
656 (rd->interfaces[i][1].type >= 0) ||
657 (rd->interfaces[i][2].type >= 0) ||
658 (rd->interfaces[i][3].type >= 0) ||
659 (rd->interfaces[i][4].type >= 0)) {
662 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
663 # if defined(ENABLE_INTRP)
666 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
667 if (rd->interfaces[i][j].type >= 0) {
668 printf(" (%s) ", jit_type[j]);
669 if (rd->interfaces[i][j].flags & SAVEDVAR) {
670 if (rd->interfaces[i][j].flags & INMEMORY)
671 printf("M%2d", rd->interfaces[i][j].regoff);
672 #ifdef HAS_ADDRESS_REGISTER_FILE
673 else if (j == TYPE_ADR)
674 printf("R%02d", rd->interfaces[i][j].regoff);
676 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
677 printf("F%02d", rd->interfaces[i][j].regoff);
679 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
680 if (IS_2_WORD_TYPE(j))
682 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
683 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
686 printf("%3s",regs[rd->interfaces[i][j].regoff]);
690 if (rd->interfaces[i][j].flags & INMEMORY)
691 printf("m%2d", rd->interfaces[i][j].regoff);
692 #ifdef HAS_ADDRESS_REGISTER_FILE
693 else if (j == TYPE_ADR)
694 printf("r%02d", rd->interfaces[i][j].regoff);
696 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
697 printf("f%02d", rd->interfaces[i][j].regoff);
699 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
700 if (IS_2_WORD_TYPE(j))
702 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
703 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
706 printf("%3s",regs[rd->interfaces[i][j].regoff]);
712 # if defined(ENABLE_INTRP)
715 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
721 #if defined(ENABLE_INTRP)
724 #if defined(ENABLE_LSRA)
728 if (code->rplpoints) {
729 printf("Replacement Points:\n");
730 replace_show_replacement_points(code);
734 #if defined(ENABLE_DISASSEMBLER)
735 /* show code before first basic block */
737 if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd)) {
738 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen);
740 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + m->basicblocks[0].mpc);)
747 /* show code of all basic blocks */
749 for (bptr = m->basicblocks; bptr != NULL; bptr = bptr->next)
750 show_basicblock(jd, bptr);
752 #if defined(ENABLE_DISASSEMBLER)
753 /* show stubs code */
755 if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) && opt_showexceptionstubs) {
756 printf("\nException stubs code:\n");
757 printf("Code length: %d\n\n", (s4) (code->mcodelength -
758 ((ptrint) cd->dseglen +
759 m->basicblocks[m->basicblockcount].mpc)));
761 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen +
762 m->basicblocks[m->basicblockcount].mpc);
764 for (; (ptrint) u1ptr < ((ptrint) code->mcode + code->mcodelength);)
771 LOCK_MONITOR_EXIT(show_global_lock);
773 /* finally flush the output */
777 #endif /* !defined(NDEBUG) */
780 /* show_basicblock *************************************************************
782 Print the intermediate representation of a basic block.
784 NOTE: Currently this function may only be called after register allocation!
786 *******************************************************************************/
789 void new_show_basicblock(jitdata *jd, basicblock *bptr, int stage)
796 new_instruction *iptr;
799 /* get required compiler data */
805 if (bptr->flags != BBDELETED) {
806 deadcode = bptr->flags <= BBREACHED;
808 printf("======== %sL%03d ======== (flags: %d, bitflags: %01x, next: %d, type: ",
809 (bptr->bitflags & BBFLAG_REPLACEMENT) ? "<REPLACE> " : "",
810 bptr->debug_nr, bptr->flags, bptr->bitflags,
811 (bptr->next) ? (bptr->next->debug_nr) : -1);
813 switch (bptr->type) {
825 printf(", instruction count: %d, predecessors: %d):\n",
826 bptr->icount, bptr->pre_count);
828 iptr = /*XXX*/ (new_instruction *) bptr->iinstr;
830 for (i = 0; i < bptr->icount; i++, iptr++) {
831 printf("%4d: ", iptr->line);
833 new_show_icmd(jd, iptr, deadcode, stage);
837 #if defined(ENABLE_DISASSEMBLER)
838 if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) &&
841 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->mpc);
843 if (bptr->next != NULL) {
844 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->next->mpc);)
849 for (; u1ptr < (u1 *) ((ptrint) code->mcode + code->mcodelength);)
857 #endif /* !defined(NDEBUG) */
860 void show_basicblock(jitdata *jd, basicblock *bptr)
870 /* get required compiler data */
876 if (bptr->flags != BBDELETED) {
877 deadcode = bptr->flags <= BBREACHED;
882 for (j = cd->maxstack; j > 0; j--)
885 show_print_stack(cd, bptr->instack);
887 printf("] %sL%03d(flags: %d, bitflags: %01x, next: %d, type: ",
888 (bptr->bitflags & BBFLAG_REPLACEMENT) ? "<REPLACE> " : "",
889 bptr->debug_nr, bptr->flags, bptr->bitflags,
890 (bptr->next) ? (bptr->next->debug_nr) : -1);
892 switch (bptr->type) {
904 printf(", instruction count: %d, predecessors: %d):\n",
905 bptr->icount, bptr->pre_count);
909 for (i = 0; i < bptr->icount; i++, iptr++) {
913 for (j = cd->maxstack; j > 0; j--)
916 show_print_stack(cd, iptr->dst);
918 printf("] %5d (line: %5d) ", i, iptr->line);
920 show_icmd(iptr, deadcode);
924 #if defined(ENABLE_DISASSEMBLER)
925 if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) && (!deadcode)) {
927 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->mpc);
929 if (bptr->next != NULL) {
930 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->next->mpc);)
935 for (; u1ptr < (u1 *) ((ptrint) code->mcode + code->mcodelength);)
943 #endif /* !defined(NDEBUG) */
946 /* show_icmd *******************************************************************
948 Print the intermediate representation of an instruction.
950 NOTE: Currently this function may only be called after register allocation!
952 *******************************************************************************/
956 #define SHOW_TARGET(target) \
957 if (stage >= SHOW_STACK) { \
958 printf("--> L%03d ", (target).block->debug_nr); \
960 else if (stage >= SHOW_PARSE) { \
961 printf("--> insindex %d (L%03d) ", (target).insindex, \
962 jd->new_basicblocks[jd->new_basicblockindex[ \
963 (target).insindex]].debug_nr); \
966 printf("--> insindex %d ", (target).insindex); \
969 #define SHOW_INT_CONST(val) \
970 if (stage >= SHOW_PARSE) { \
971 printf("%ld ", (long) (val)); \
977 #define SHOW_LNG_CONST(val) \
978 if (stage >= SHOW_PARSE) { \
979 printf("%lld ", (long long)(val)); \
985 #define SHOW_FLT_CONST(val) \
986 if (stage >= SHOW_PARSE) { \
987 printf("%g ", (val)); \
993 #define SHOW_DBL_CONST(val) \
994 if (stage >= SHOW_PARSE) { \
995 printf("%g ", (val)); \
1001 #define SHOW_INDEX(index) \
1002 if (stage >= SHOW_PARSE) { \
1003 printf("%d ", index); \
1009 #define SHOW_STRING(val) \
1010 if (stage >= SHOW_PARSE) { \
1012 utf_display_printable_ascii( \
1013 javastring_toutf((java_lang_String *)(val), false)); \
1017 printf("string "); \
1020 #define SHOW_CLASSREF_OR_CLASSINFO(c) \
1021 if (stage >= SHOW_PARSE) { \
1022 if (IS_CLASSREF(c)) \
1023 class_classref_print(c.ref); \
1025 class_print(c.cls); \
1032 #define SHOW_FIELD(fmiref) \
1033 if (stage >= SHOW_PARSE) { \
1034 field_fieldref_print(fmiref); \
1041 #define SHOW_STACKVAR(sp) \
1042 new_show_stackvar(jd, (sp), stage)
1044 #define SHOW_S1(iptr) \
1045 if (stage >= SHOW_STACK) { \
1046 SHOW_STACKVAR(iptr->s1.var); \
1049 #define SHOW_S2(iptr) \
1050 if (stage >= SHOW_STACK) { \
1051 SHOW_STACKVAR(iptr->sx.s23.s2.var); \
1054 #define SHOW_S3(iptr) \
1055 if (stage >= SHOW_STACK) { \
1056 SHOW_STACKVAR(iptr->sx.s23.s3.var); \
1059 #define SHOW_DST(iptr) \
1060 if (stage >= SHOW_STACK) { \
1062 SHOW_STACKVAR(iptr->dst.var); \
1065 #define SHOW_S1_LOCAL(iptr) \
1066 if (stage >= SHOW_STACK) { \
1067 printf("L%d ", iptr->s1.localindex); \
1070 #define SHOW_DST_LOCAL(iptr) \
1071 if (stage >= SHOW_STACK) { \
1072 printf("=> L%d ", iptr->dst.localindex); \
1075 static void new_show_stackvar(jitdata *jd, stackptr sp, int stage)
1080 case TYPE_INT: type = 'i'; break;
1081 case TYPE_LNG: type = 'l'; break;
1082 case TYPE_FLT: type = 'f'; break;
1083 case TYPE_DBL: type = 'd'; break;
1084 case TYPE_ADR: type = 'a'; break;
1085 default: type = '?';
1087 printf("S%c%d", type, (int) (sp - jd->new_stack));
1089 if (stage >= SHOW_REGS) {
1092 if (sp->flags & SAVEDVAR) {
1093 switch (sp->varkind) {
1095 if (sp->flags & INMEMORY)
1096 printf("M%02d", sp->regoff);
1097 #ifdef HAS_ADDRESS_REGISTER_FILE
1098 else if (sp->type == TYPE_ADR)
1099 printf("R%02d", sp->regoff);
1101 else if (IS_FLT_DBL_TYPE(sp->type))
1102 printf("F%02d", sp->regoff);
1104 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
1105 if (IS_2_WORD_TYPE(sp->type)) {
1106 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1107 # if defined(ENABLE_INTRP)
1109 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1110 GET_HIGH_REG(sp->regoff));
1113 printf("%3s/%3s", regs[GET_LOW_REG(sp->regoff)],
1114 regs[GET_HIGH_REG(sp->regoff)]);
1116 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1117 GET_HIGH_REG(sp->regoff));
1121 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
1123 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1124 # if defined(ENABLE_INTRP)
1126 printf("%3d", sp->regoff);
1129 printf("%3s", regs[sp->regoff]);
1131 printf("%3d", sp->regoff);
1137 printf("I%02d", sp->varnum);
1140 printf("L%02d", sp->varnum);
1143 if (sp->varnum == -1) {
1145 /* varkind ARGVAR "misused for this special case */
1148 else /* "normal" Argvar */
1149 printf("A%02d", sp->varnum);
1152 printf("!xx {kind=%d, num=%d}", sp->varkind, sp->varnum);
1155 else { /* not SAVEDVAR */
1156 switch (sp->varkind) {
1158 if (sp->flags & INMEMORY)
1159 printf("m%02d", sp->regoff);
1160 #ifdef HAS_ADDRESS_REGISTER_FILE
1161 else if (sp->type == TYPE_ADR)
1162 printf("r%02d", sp->regoff);
1164 else if (IS_FLT_DBL_TYPE(sp->type))
1165 printf("f%02d", sp->regoff);
1167 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
1168 if (IS_2_WORD_TYPE(sp->type)) {
1169 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1170 # if defined(ENABLE_INTRP)
1172 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1173 GET_HIGH_REG(sp->regoff));
1176 printf("%3s/%3s", regs[GET_LOW_REG(sp->regoff)],
1177 regs[GET_HIGH_REG(sp->regoff)]);
1179 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1180 GET_HIGH_REG(sp->regoff));
1184 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
1186 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1187 # if defined(ENABLE_INTRP)
1189 printf("%3d", sp->regoff);
1192 printf("%3s", regs[sp->regoff]);
1194 printf("%3d", sp->regoff);
1200 printf("i%02d", sp->varnum);
1203 printf("l%02d", sp->varnum);
1206 if (sp->varnum == -1) {
1208 /* varkind ARGVAR "misused for this special case */
1211 else /* "normal" Argvar */
1212 printf("a%02d", sp->varnum);
1215 printf("?xx {kind=%d, num=%d}", sp->varkind, sp->varnum);
1224 void new_show_icmd(jitdata *jd, new_instruction *iptr, bool deadcode, int stage)
1227 branch_target_t *table;
1228 lookup_target_t *lookup;
1229 constant_FMIref *fmiref;
1233 /* get the opcode and the condition */
1237 printf("%s ", icmd_names[opcode]);
1239 if (stage < SHOW_PARSE)
1245 /* Print the condition for conditional instructions. */
1247 /* XXX print condition from flags */
1249 if (iptr->flags.bits & INS_FLAG_UNRESOLVED)
1250 printf("(UNRESOLVED) ");
1255 case ICMD_CHECKNULL:
1256 case ICMD_CHECKNULL_POP:
1261 case ICMD_ARRAYLENGTH:
1280 case ICMD_INT2SHORT:
1328 /* binary/const INT */
1329 case ICMD_IADDCONST:
1330 case ICMD_ISUBCONST:
1331 case ICMD_IMULCONST:
1335 case ICMD_IANDCONST:
1337 case ICMD_IXORCONST:
1338 case ICMD_ISHLCONST:
1339 case ICMD_ISHRCONST:
1340 case ICMD_IUSHRCONST:
1341 case ICMD_LSHLCONST:
1342 case ICMD_LSHRCONST:
1343 case ICMD_LUSHRCONST:
1345 SHOW_INT_CONST(iptr->sx.val.i);
1349 /* ?ASTORECONST (trinary/const INT) */
1350 case ICMD_IASTORECONST:
1351 case ICMD_BASTORECONST:
1352 case ICMD_CASTORECONST:
1353 case ICMD_SASTORECONST:
1356 SHOW_INT_CONST(iptr->sx.s23.s3.constval);
1361 SHOW_INT_CONST(iptr->sx.val.i);
1365 /* binary/const LNG */
1366 case ICMD_LADDCONST:
1367 case ICMD_LSUBCONST:
1368 case ICMD_LMULCONST:
1372 case ICMD_LANDCONST:
1374 case ICMD_LXORCONST:
1376 SHOW_LNG_CONST(iptr->sx.val.l);
1380 /* trinary/const LNG (<= pointer size) */
1381 case ICMD_LASTORECONST:
1384 SHOW_LNG_CONST(iptr->sx.s23.s3.constval);
1389 SHOW_LNG_CONST(iptr->sx.val.l);
1395 SHOW_FLT_CONST(iptr->sx.val.f);
1401 SHOW_DBL_CONST(iptr->sx.val.d);
1407 if (iptr->flags.bits & INS_FLAG_CLASS) {
1408 SHOW_CLASSREF_OR_CLASSINFO(iptr->sx.val.c);
1410 else if (iptr->sx.val.anyptr == NULL) {
1414 SHOW_STRING(iptr->sx.val.stringconst);
1419 case ICMD_AASTORECONST:
1422 printf("%p ", (void*) iptr->sx.s23.s3.constval);
1425 case ICMD_GETFIELD: /* 1 -> 1 */
1426 case ICMD_PUTFIELD: /* 2 -> 0 */
1427 case ICMD_PUTSTATIC: /* 1 -> 0 */
1428 case ICMD_GETSTATIC: /* 0 -> 1 */
1429 case ICMD_PUTSTATICCONST: /* 0 -> 0 */
1430 case ICMD_PUTFIELDCONST: /* 1 -> 0 */
1431 if (opcode != ICMD_GETSTATIC && opcode != ICMD_PUTSTATICCONST) {
1433 if (opcode == ICMD_PUTFIELD) {
1437 NEW_INSTRUCTION_GET_FIELDREF(iptr, fmiref);
1440 if (opcode == ICMD_GETSTATIC || opcode == ICMD_GETFIELD) {
1446 SHOW_S1_LOCAL(iptr);
1447 SHOW_INT_CONST(iptr->sx.val.i);
1448 SHOW_DST_LOCAL(iptr);
1478 SHOW_S1_LOCAL(iptr);
1486 SHOW_S1_LOCAL(iptr);
1496 SHOW_DST_LOCAL(iptr);
1507 case ICMD_ANEWARRAY:
1511 case ICMD_MULTIANEWARRAY:
1512 if (stage >= SHOW_STACK) {
1513 argp = iptr->sx.s23.s2.args;
1514 i = iptr->s1.argcount;
1516 SHOW_STACKVAR(*(argp++));
1520 printf("argcount=%d ", iptr->s1.argcount);
1525 case ICMD_CHECKCAST:
1530 case ICMD_INSTANCEOF:
1535 case ICMD_INLINE_START:
1536 case ICMD_INLINE_END:
1540 if (stage >= SHOW_STACK) {
1541 argp = iptr->sx.s23.s2.args;
1542 i = iptr->s1.argcount;
1544 SHOW_STACKVAR(*(argp++));
1547 printf("%s ", iptr->sx.s23.s3.bte->name);
1548 if (iptr->sx.s23.s3.bte->md->returntype.type != TYPE_VOID) {
1553 case ICMD_INVOKEVIRTUAL:
1554 case ICMD_INVOKESPECIAL:
1555 case ICMD_INVOKESTATIC:
1556 case ICMD_INVOKEINTERFACE:
1557 if (stage >= SHOW_STACK) {
1558 argp = iptr->sx.s23.s2.args;
1559 i = iptr->s1.argcount;
1561 SHOW_STACKVAR(*(argp++));
1564 NEW_INSTRUCTION_GET_METHODREF(iptr, fmiref);
1565 method_methodref_print(fmiref);
1566 if (fmiref->parseddesc.md->returntype.type != TYPE_VOID) {
1578 SHOW_TARGET(iptr->dst);
1588 SHOW_TARGET(iptr->dst);
1592 case ICMD_INLINE_GOTO:
1593 SHOW_TARGET(iptr->dst);
1597 SHOW_TARGET(iptr->sx.s23.s3.jsrtarget);
1602 case ICMD_IFNONNULL:
1604 SHOW_TARGET(iptr->dst);
1607 case ICMD_IF_ICMPEQ:
1608 case ICMD_IF_ICMPNE:
1609 case ICMD_IF_ICMPLT:
1610 case ICMD_IF_ICMPGE:
1611 case ICMD_IF_ICMPGT:
1612 case ICMD_IF_ICMPLE:
1614 case ICMD_IF_LCMPEQ:
1615 case ICMD_IF_LCMPNE:
1616 case ICMD_IF_LCMPLT:
1617 case ICMD_IF_LCMPGE:
1618 case ICMD_IF_LCMPGT:
1619 case ICMD_IF_LCMPLE:
1621 case ICMD_IF_FCMPEQ:
1622 case ICMD_IF_FCMPNE:
1624 case ICMD_IF_FCMPL_LT:
1625 case ICMD_IF_FCMPL_GE:
1626 case ICMD_IF_FCMPL_GT:
1627 case ICMD_IF_FCMPL_LE:
1629 case ICMD_IF_FCMPG_LT:
1630 case ICMD_IF_FCMPG_GE:
1631 case ICMD_IF_FCMPG_GT:
1632 case ICMD_IF_FCMPG_LE:
1634 case ICMD_IF_DCMPEQ:
1635 case ICMD_IF_DCMPNE:
1637 case ICMD_IF_DCMPL_LT:
1638 case ICMD_IF_DCMPL_GE:
1639 case ICMD_IF_DCMPL_GT:
1640 case ICMD_IF_DCMPL_LE:
1642 case ICMD_IF_DCMPG_LT:
1643 case ICMD_IF_DCMPG_GE:
1644 case ICMD_IF_DCMPG_GT:
1645 case ICMD_IF_DCMPG_LE:
1647 case ICMD_IF_ACMPEQ:
1648 case ICMD_IF_ACMPNE:
1651 SHOW_TARGET(iptr->dst);
1654 case ICMD_TABLESWITCH:
1658 case ICMD_LOOKUPSWITCH:
1676 if (stage >= SHOW_STACK) {
1677 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1678 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1680 SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
1681 SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
1686 if (stage >= SHOW_STACK) {
1687 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1688 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1690 SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
1691 SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
1692 SHOW_STACKVAR(iptr->dst.dupslots[2+2]);
1697 if (stage >= SHOW_STACK) {
1698 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1699 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1700 SHOW_STACKVAR(iptr->dst.dupslots[2]);
1702 SHOW_STACKVAR(iptr->dst.dupslots[3+0]);
1703 SHOW_STACKVAR(iptr->dst.dupslots[3+1]);
1704 SHOW_STACKVAR(iptr->dst.dupslots[3+2]);
1705 SHOW_STACKVAR(iptr->dst.dupslots[3+3]);
1706 SHOW_STACKVAR(iptr->dst.dupslots[3+4]);
1711 if (stage >= SHOW_STACK) {
1712 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1713 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1714 SHOW_STACKVAR(iptr->dst.dupslots[2]);
1716 SHOW_STACKVAR(iptr->dst.dupslots[3+0]);
1717 SHOW_STACKVAR(iptr->dst.dupslots[3+1]);
1718 SHOW_STACKVAR(iptr->dst.dupslots[3+2]);
1719 SHOW_STACKVAR(iptr->dst.dupslots[3+3]);
1724 if (stage >= SHOW_STACK) {
1725 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1726 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1727 SHOW_STACKVAR(iptr->dst.dupslots[2]);
1728 SHOW_STACKVAR(iptr->dst.dupslots[4]);
1730 SHOW_STACKVAR(iptr->dst.dupslots[4+0]);
1731 SHOW_STACKVAR(iptr->dst.dupslots[4+1]);
1732 SHOW_STACKVAR(iptr->dst.dupslots[4+2]);
1733 SHOW_STACKVAR(iptr->dst.dupslots[4+3]);
1734 SHOW_STACKVAR(iptr->dst.dupslots[4+4]);
1735 SHOW_STACKVAR(iptr->dst.dupslots[4+5]);
1740 if (stage >= SHOW_STACK) {
1741 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1742 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1744 SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
1745 SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
1751 #endif /* !defined(NDEBUG) */
1753 #if !defined(NDEBUG)
1754 void show_icmd(instruction *iptr, bool deadcode)
1765 constant_classref *cr;
1766 unresolved_field *uf;
1769 /* get the opcode and the condition */
1771 opcode = iptr->opc & ICMD_OPCODE_MASK;
1772 condition = (iptr->opc & ICMD_CONDITION_MASK) >> 8;
1774 /* Print the condition for conditional instructions. */
1777 printf(" (condition: %s)", icmd_names[condition]);
1780 printf("%s", icmd_names[iptr->opc]);
1782 switch (iptr->opc) {
1783 case ICMD_IADDCONST:
1784 case ICMD_ISUBCONST:
1785 case ICMD_IMULCONST:
1789 case ICMD_IANDCONST:
1791 case ICMD_IXORCONST:
1792 case ICMD_ISHLCONST:
1793 case ICMD_ISHRCONST:
1794 case ICMD_IUSHRCONST:
1795 case ICMD_LSHLCONST:
1796 case ICMD_LSHRCONST:
1797 case ICMD_LUSHRCONST:
1799 case ICMD_IASTORECONST:
1800 case ICMD_BASTORECONST:
1801 case ICMD_CASTORECONST:
1802 case ICMD_SASTORECONST:
1803 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
1806 case ICMD_LADDCONST:
1807 case ICMD_LSUBCONST:
1808 case ICMD_LMULCONST:
1812 case ICMD_LANDCONST:
1814 case ICMD_LXORCONST:
1816 case ICMD_LASTORECONST:
1817 #if SIZEOF_VOID_P == 4
1818 printf(" %lld (0x%016llx)", iptr->val.l, iptr->val.l);
1820 printf(" %ld (0x%016lx)", iptr->val.l, iptr->val.l);
1825 printf(" %f (0x%08x)", iptr->val.f, iptr->val.i);
1829 #if SIZEOF_VOID_P == 4
1830 printf(" %g (0x%016llx)", iptr->val.d, iptr->val.l);
1832 printf(" %g (0x%016lx)", iptr->val.d, iptr->val.l);
1837 case ICMD_AASTORECONST:
1838 /* check if this is a constant string or a class reference */
1840 if (ICMD_ACONST_IS_CLASS(iptr)) {
1841 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1842 printf(" (NOT RESOLVED) classref = ");
1843 class_classref_print(ICMD_ACONST_UNRESOLVED_CLASSREF(iptr));
1846 printf(" class = ");
1847 class_print(ICMD_ACONST_RESOLVED_CLASSINFO(iptr));
1851 printf(" %p", iptr->val.a);
1854 printf(", String = \"");
1855 utf_display_printable_ascii(javastring_toutf(iptr->val.a, false));
1863 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1864 uf = INSTRUCTION_UNRESOLVED_FIELD(iptr);
1865 printf(" (NOT RESOLVED) ");
1867 field_fieldref_print(uf->fieldref);
1870 f = INSTRUCTION_RESOLVED_FIELDINFO(iptr);
1871 printf(" %d, ", f->offset);
1877 case ICMD_PUTSTATIC:
1878 case ICMD_GETSTATIC:
1879 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1880 uf = INSTRUCTION_UNRESOLVED_FIELD(iptr);
1881 printf(" (NOT RESOLVED) ");
1883 field_fieldref_print(uf->fieldref);
1886 f = INSTRUCTION_RESOLVED_FIELDINFO(iptr);
1887 if (!CLASS_IS_OR_ALMOST_INITIALIZED(f->class))
1888 printf(" (NOT INITIALIZED) ");
1896 case ICMD_PUTSTATICCONST:
1897 case ICMD_PUTFIELDCONST:
1898 switch (iptr[1].op1) {
1900 printf(" %d (0x%08x),", iptr->val.i, iptr->val.i);
1903 #if SIZEOF_VOID_P == 4
1904 printf(" %lld (0x%016llx),", iptr->val.l, iptr->val.l);
1906 printf(" %ld (0x%016lx),", iptr->val.l, iptr->val.l);
1910 printf(" %p,", iptr->val.a);
1913 printf(" %g (0x%08x),", iptr->val.f, iptr->val.i);
1916 #if SIZEOF_VOID_P == 4
1917 printf(" %g (0x%016llx),", iptr->val.d, iptr->val.l);
1919 printf(" %g (0x%016lx),", iptr->val.d, iptr->val.l);
1924 if (INSTRUCTION_IS_UNRESOLVED(iptr + 1)) {
1925 uf = INSTRUCTION_UNRESOLVED_FIELD(iptr + 1);
1926 printf(" (NOT RESOLVED) ");
1927 field_fieldref_print(uf->fieldref);
1930 f = INSTRUCTION_RESOLVED_FIELDINFO(iptr + 1);
1931 if ((iptr->opc == ICMD_PUTSTATICCONST) &&
1932 !CLASS_IS_OR_ALMOST_INITIALIZED(f->class))
1933 printf(" (NOT INITIALIZED), ");
1935 printf(" %d, ", f->offset);
1941 printf(" %d + %d", iptr->op1, iptr->val.i);
1976 printf(" %d", iptr->op1);
1982 utf_display_printable_ascii_classname(c->name);
1986 switch (iptr->op1) {
2014 case ICMD_ANEWARRAY:
2018 utf_display_printable_ascii_classname(c->name);
2022 case ICMD_MULTIANEWARRAY:
2027 printf(" (NOT RESOLVED) %d ", iptr->op1);
2028 utf_display_printable_ascii(cr->name);
2031 printf(" %d ", iptr->op1);
2032 utf_display_printable_ascii_classname(c->name);
2036 case ICMD_CHECKCAST:
2037 case ICMD_INSTANCEOF:
2042 if (c->flags & ACC_INTERFACE)
2043 printf(" (INTERFACE) ");
2045 printf(" (CLASS,%3d) ", c->vftbl->diffval);
2047 printf(" (NOT RESOLVED) ");
2048 utf_display_printable_ascii_classname(cr->name);
2051 case ICMD_INLINE_START:
2052 case ICMD_INLINE_END:
2054 insinfo_inline *insinfo = (insinfo_inline *) iptr->target;
2056 method_print(insinfo->method);
2061 printf(" %s", ((builtintable_entry *) iptr->val.a)->name);
2064 case ICMD_INVOKEVIRTUAL:
2065 case ICMD_INVOKESPECIAL:
2066 case ICMD_INVOKESTATIC:
2067 case ICMD_INVOKEINTERFACE:
2069 constant_FMIref *mref;
2071 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
2072 printf(" (NOT RESOLVED) ");
2073 mref = INSTRUCTION_UNRESOLVED_METHOD(iptr)->methodref;
2077 mref = INSTRUCTION_RESOLVED_FMIREF(iptr);
2079 method_methodref_print(mref);
2089 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
2091 /* if ((iptr->opc & ICMD_CONDITION_MASK) == 0) { */
2092 if (deadcode || !iptr->target)
2093 printf(" op1=%d", iptr->op1);
2095 printf(" L%03d (%p)", ((basicblock *) iptr->target)->debug_nr, iptr->target);
2105 #if SIZEOF_VOID_P == 4
2106 printf(" %lld (%016llx)", iptr->val.l, iptr->val.l);
2108 printf(" %ld (%016lx)", iptr->val.l, iptr->val.l);
2111 /* if ((iptr->opc & ICMD_CONDITION_MASK) == 0) { */
2112 if (deadcode || !iptr->target)
2113 printf(" op1=%d", iptr->op1);
2115 printf(" L%03d", ((basicblock *) iptr->target)->debug_nr);
2121 case ICMD_INLINE_GOTO:
2122 if (deadcode || !iptr->target)
2123 printf(" op1=%d", iptr->op1);
2125 printf(" L%03d (%p)", ((basicblock *) iptr->target)->debug_nr,iptr->target);
2129 case ICMD_IFNONNULL:
2130 case ICMD_IF_ICMPEQ:
2131 case ICMD_IF_ICMPNE:
2132 case ICMD_IF_ICMPLT:
2133 case ICMD_IF_ICMPGE:
2134 case ICMD_IF_ICMPGT:
2135 case ICMD_IF_ICMPLE:
2137 case ICMD_IF_LCMPEQ:
2138 case ICMD_IF_LCMPNE:
2139 case ICMD_IF_LCMPLT:
2140 case ICMD_IF_LCMPGE:
2141 case ICMD_IF_LCMPGT:
2142 case ICMD_IF_LCMPLE:
2144 case ICMD_IF_FCMPEQ:
2145 case ICMD_IF_FCMPNE:
2147 case ICMD_IF_FCMPL_LT:
2148 case ICMD_IF_FCMPL_GE:
2149 case ICMD_IF_FCMPL_GT:
2150 case ICMD_IF_FCMPL_LE:
2152 case ICMD_IF_FCMPG_LT:
2153 case ICMD_IF_FCMPG_GE:
2154 case ICMD_IF_FCMPG_GT:
2155 case ICMD_IF_FCMPG_LE:
2157 case ICMD_IF_DCMPEQ:
2158 case ICMD_IF_DCMPNE:
2160 case ICMD_IF_DCMPL_LT:
2161 case ICMD_IF_DCMPL_GE:
2162 case ICMD_IF_DCMPL_GT:
2163 case ICMD_IF_DCMPL_LE:
2165 case ICMD_IF_DCMPG_LT:
2166 case ICMD_IF_DCMPG_GE:
2167 case ICMD_IF_DCMPG_GT:
2168 case ICMD_IF_DCMPG_LE:
2170 case ICMD_IF_ACMPEQ:
2171 case ICMD_IF_ACMPNE:
2172 /* if (!(iptr->opc & ICMD_CONDITION_MASK)) { */
2173 if (deadcode || !iptr->target)
2174 printf(" op1=%d", iptr->op1);
2176 printf(" L%03d (%p)", ((basicblock *) iptr->target)->debug_nr,iptr->target);
2180 case ICMD_TABLESWITCH:
2181 s4ptr = (s4*)iptr->val.a;
2183 if (deadcode || !iptr->target) {
2184 printf(" %d;", *s4ptr);
2187 tptr = (void **) iptr->target;
2188 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
2192 s4ptr++; /* skip default */
2193 j = *s4ptr++; /* low */
2194 j = *s4ptr++ - j; /* high */
2196 if (deadcode || !*tptr)
2197 printf(" %d", *s4ptr++);
2199 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
2206 case ICMD_LOOKUPSWITCH:
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)->debug_nr);
2217 s4ptr++; /* default */
2218 j = *s4ptr++; /* count */
2221 if (deadcode || !*tptr) {
2222 s4ptr++; /* skip value */
2223 printf(" %d",*s4ptr++);
2226 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
2234 printf(" (NOT RESOLVED) Class = \"");
2235 utf_display_printable_ascii(((unresolved_class *) iptr->val.a)->classref->name);
2240 #endif /* !defined(NDEBUG) */
2243 * These are local overrides for various environment variables in Emacs.
2244 * Please do not remove this and leave it at the end of the file, where
2245 * Emacs will automagically detect them.
2246 * ---------------------------------------------------------------------
2249 * indent-tabs-mode: t
2253 * vim:noexpandtab:sw=4:ts=4: