1 /* 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"
44 #include "vm/global.h"
45 #include "vm/options.h"
46 #include "vm/builtin.h"
47 #include "vm/stringlocal.h"
48 #include "vm/jit/jit.h"
49 #include "vm/jit/show.h"
50 #include "vm/jit/disass.h"
52 #if defined(ENABLE_THREADS)
53 #include "threads/native/lock.h"
56 /* global variables ***********************************************************/
58 #if defined(ENABLE_THREADS) && !defined(NDEBUG)
59 static java_objectheader *show_global_lock;
63 /* show_init *******************************************************************
65 Initialized the show subsystem (called by jit_init).
67 *******************************************************************************/
72 #if defined(ENABLE_THREADS)
73 /* initialize the show lock */
75 show_global_lock = NEW(java_objectheader);
77 lock_init_object_lock(show_global_lock);
87 /* show_print_stack ************************************************************
89 Print the stack representation starting with the given top stackptr.
91 NOTE: Currently this function may only be called after register allocation!
93 *******************************************************************************/
96 static void show_print_stack(codegendata *cd, stackptr s)
108 j = cd->maxstack - i;
114 if (s->flags & SAVEDVAR)
115 switch (s->varkind) {
117 if (s->flags & INMEMORY)
118 printf(" M%02d", s->regoff);
119 #ifdef HAS_ADDRESS_REGISTER_FILE
120 else if (s->type == TYPE_ADR)
121 printf(" R%02d", s->regoff);
123 else if (IS_FLT_DBL_TYPE(s->type))
124 printf(" F%02d", s->regoff);
126 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
127 if (IS_2_WORD_TYPE(s->type)) {
128 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
129 # if defined(ENABLE_INTRP)
131 printf(" %3d/%3d", GET_LOW_REG(s->regoff),
132 GET_HIGH_REG(s->regoff));
135 printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
136 regs[GET_HIGH_REG(s->regoff)]);
138 printf(" %3d/%3d", GET_LOW_REG(s->regoff),
139 GET_HIGH_REG(s->regoff));
143 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
145 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
146 # if defined(ENABLE_INTRP)
148 printf(" %3d", s->regoff);
151 printf(" %3s", regs[s->regoff]);
153 printf(" %3d", s->regoff);
159 printf(" I%02d", s->varnum);
162 printf(" L%02d", s->varnum);
165 if (s->varnum == -1) {
167 /* varkind ARGVAR "misused for this special case */
170 else /* "normal" Argvar */
171 printf(" A%02d", s->varnum);
177 switch (s->varkind) {
179 if (s->flags & INMEMORY)
180 printf(" m%02d", s->regoff);
181 #ifdef HAS_ADDRESS_REGISTER_FILE
182 else if (s->type == TYPE_ADR)
183 printf(" r%02d", s->regoff);
185 else if (IS_FLT_DBL_TYPE(s->type))
186 printf(" f%02d", s->regoff);
188 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
189 if (IS_2_WORD_TYPE(s->type)) {
190 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
191 # if defined(ENABLE_INTRP)
193 printf(" %3d/%3d", GET_LOW_REG(s->regoff),
194 GET_HIGH_REG(s->regoff));
197 printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
198 regs[GET_HIGH_REG(s->regoff)]);
200 printf(" %3d/%3d", GET_LOW_REG(s->regoff),
201 GET_HIGH_REG(s->regoff));
205 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
207 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
208 # if defined(ENABLE_INTRP)
210 printf(" %3d", s->regoff);
213 printf(" %3s", regs[s->regoff]);
215 printf(" %3d", s->regoff);
221 printf(" i%02d", s->varnum);
224 printf(" l%02d", s->varnum);
227 if (s->varnum == -1) {
229 /* varkind ARGVAR "misused for this special case */
232 else /* "normal" Argvar */
233 printf(" a%02d", s->varnum);
241 #endif /* !defined(NDEBUG) */
245 static void print_reg(stackptr s) {
247 if (s->flags & SAVEDVAR)
248 switch (s->varkind) {
250 if (s->flags & INMEMORY)
251 printf(" tm%02d", s->regoff);
253 printf(" tr%02d", s->regoff);
256 printf(" s %02d", s->varnum);
259 printf(" l %02d", s->varnum);
262 printf(" a %02d", s->varnum);
265 printf(" ! %02d", s->varnum);
268 switch (s->varkind) {
270 if (s->flags & INMEMORY)
271 printf(" Tm%02d", s->regoff);
273 printf(" Tr%02d", s->regoff);
276 printf(" S %02d", s->varnum);
279 printf(" L %02d", s->varnum);
282 printf(" A %02d", s->varnum);
285 printf(" ? %02d", s->varnum);
296 static char *jit_type[] = {
306 /* show_method *****************************************************************
308 Print the intermediate representation of a method.
310 NOTE: Currently this function may only be called after register allocation!
312 *******************************************************************************/
315 void new_show_method(jitdata *jd, int stage)
326 /* get required compiler data */
333 #if defined(ENABLE_THREADS)
334 /* We need to enter a lock here, since the binutils disassembler
335 is not reentrant-able and we could not read functions printed
338 builtin_monitorenter(show_global_lock);
345 printf("\n(NEW INSTRUCTION FORMAT)\n");
346 printf("\nBasic blocks: %d\n", jd->new_basicblockcount);
347 printf("Max locals: %d\n", cd->maxlocals);
348 printf("Max stack: %d\n", cd->maxstack);
349 printf("Line number table length: %d\n", m->linenumbercount);
351 if (stage >= SHOW_PARSE) {
352 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
353 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
354 printf(" L%03d ... ", ex->start->debug_nr );
355 printf("L%03d = ", ex->end->debug_nr);
356 printf("L%03d", ex->handler->debug_nr);
357 printf(" (catchtype: ");
358 if (ex->catchtype.any)
359 if (IS_CLASSREF(ex->catchtype))
360 utf_display_printable_ascii_classname(ex->catchtype.ref->name);
362 utf_display_printable_ascii_classname(ex->catchtype.cls->name);
369 if (stage >= SHOW_PARSE && rd) {
370 printf("Local Table:\n");
371 for (i = 0; i < cd->maxlocals; i++) {
374 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
375 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
376 # if defined(ENABLE_INTRP)
379 if (rd->locals[i][j].type >= 0) {
380 printf(" (%s) ", jit_type[j]);
381 if (stage >= SHOW_REGS) {
382 if (rd->locals[i][j].flags & INMEMORY)
383 printf("m%2d", rd->locals[i][j].regoff);
384 # ifdef HAS_ADDRESS_REGISTER_FILE
385 else if (j == TYPE_ADR)
386 printf("r%02d", rd->locals[i][j].regoff);
388 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
389 printf("f%02d", rd->locals[i][j].regoff);
391 # if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
392 if (IS_2_WORD_TYPE(j))
394 regs[GET_LOW_REG(rd->locals[i][j].regoff)],
395 regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
398 printf("%3s", regs[rd->locals[i][j].regoff]);
402 # if defined(ENABLE_INTRP)
406 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
413 if (stage >= SHOW_STACK && rd) {
414 #if defined(ENABLE_LSRA)
417 #if defined(ENABLE_INTRP)
420 printf("Interface Table:\n");
421 for (i = 0; i < cd->maxstack; i++) {
422 if ((rd->interfaces[i][0].type >= 0) ||
423 (rd->interfaces[i][1].type >= 0) ||
424 (rd->interfaces[i][2].type >= 0) ||
425 (rd->interfaces[i][3].type >= 0) ||
426 (rd->interfaces[i][4].type >= 0)) {
429 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
430 # if defined(ENABLE_INTRP)
433 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
434 if (rd->interfaces[i][j].type >= 0) {
435 printf(" (%s) ", jit_type[j]);
436 if (stage >= SHOW_REGS) {
437 if (rd->interfaces[i][j].flags & SAVEDVAR) {
438 if (rd->interfaces[i][j].flags & INMEMORY)
439 printf("M%2d", rd->interfaces[i][j].regoff);
440 #ifdef HAS_ADDRESS_REGISTER_FILE
441 else if (j == TYPE_ADR)
442 printf("R%02d", rd->interfaces[i][j].regoff);
444 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
445 printf("F%02d", rd->interfaces[i][j].regoff);
447 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
448 if (IS_2_WORD_TYPE(j))
450 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
451 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
454 printf("%3s",regs[rd->interfaces[i][j].regoff]);
458 if (rd->interfaces[i][j].flags & INMEMORY)
459 printf("m%2d", rd->interfaces[i][j].regoff);
460 #ifdef HAS_ADDRESS_REGISTER_FILE
461 else if (j == TYPE_ADR)
462 printf("r%02d", rd->interfaces[i][j].regoff);
464 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
465 printf("f%02d", rd->interfaces[i][j].regoff);
467 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
468 if (IS_2_WORD_TYPE(j))
470 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
471 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
474 printf("%3s",regs[rd->interfaces[i][j].regoff]);
481 # if defined(ENABLE_INTRP)
484 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
490 #if defined(ENABLE_INTRP)
493 #if defined(ENABLE_LSRA)
496 } /* if >= SHOW_STACK */
498 if (code->rplpoints) {
499 printf("Replacement Points:\n");
500 replace_show_replacement_points(code);
504 #if defined(ENABLE_DISASSEMBLER)
505 /* show code before first basic block */
507 if (stage >= SHOW_CODE && opt_showdisassemble) {
508 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen);
510 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + jd->new_basicblocks[0].mpc);)
517 /* show code of all basic blocks */
519 for (bptr = jd->new_basicblocks; bptr != NULL; bptr = bptr->next)
520 new_show_basicblock(jd, bptr, stage);
522 #if defined(ENABLE_DISASSEMBLER)
523 /* show stubs code */
525 if (stage >= SHOW_CODE && opt_showdisassemble && opt_showexceptionstubs) {
526 printf("\nException stubs code:\n");
527 printf("Length: %d\n\n", (s4) (code->mcodelength -
528 ((ptrint) cd->dseglen +
529 jd->new_basicblocks[jd->new_basicblockcount].mpc)));
531 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen +
532 jd->new_basicblocks[jd->new_basicblockcount].mpc);
534 for (; (ptrint) u1ptr < ((ptrint) code->mcode + code->mcodelength);)
541 #if defined(ENABLE_THREADS)
542 builtin_monitorexit(show_global_lock);
545 /* finally flush the output */
549 #endif /* !defined(NDEBUG) */
552 void show_method(jitdata *jd)
563 /* get required compiler data */
570 #if defined(ENABLE_THREADS)
571 /* We need to enter a lock here, since the binutils disassembler
572 is not reentrant-able and we could not read functions printed
575 builtin_monitorenter(show_global_lock);
582 printf("\nBasic blocks: %d\n", m->basicblockcount);
583 printf("Max locals: %d\n", cd->maxlocals);
584 printf("Max stack: %d\n", cd->maxstack);
585 printf("Line number table length: %d\n", m->linenumbercount);
587 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
588 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
589 printf(" L%03d ... ", ex->start->debug_nr );
590 printf("L%03d = ", ex->end->debug_nr);
591 printf("L%03d", ex->handler->debug_nr);
592 printf(" (catchtype: ");
593 if (ex->catchtype.any)
594 if (IS_CLASSREF(ex->catchtype))
595 utf_display_printable_ascii_classname(ex->catchtype.ref->name);
597 utf_display_printable_ascii_classname(ex->catchtype.cls->name);
603 printf("Local Table:\n");
604 for (i = 0; i < cd->maxlocals; i++) {
607 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
608 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
609 # if defined(ENABLE_INTRP)
612 if (rd->locals[i][j].type >= 0) {
613 printf(" (%s) ", jit_type[j]);
614 if (rd->locals[i][j].flags & INMEMORY)
615 printf("m%2d", rd->locals[i][j].regoff);
616 # ifdef HAS_ADDRESS_REGISTER_FILE
617 else if (j == TYPE_ADR)
618 printf("r%02d", rd->locals[i][j].regoff);
620 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
621 printf("f%02d", rd->locals[i][j].regoff);
623 # if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
624 if (IS_2_WORD_TYPE(j))
626 regs[GET_LOW_REG(rd->locals[i][j].regoff)],
627 regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
630 printf("%3s", regs[rd->locals[i][j].regoff]);
633 # if defined(ENABLE_INTRP)
637 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
643 #if defined(ENABLE_LSRA)
646 #if defined(ENABLE_INTRP)
649 printf("Interface Table:\n");
650 for (i = 0; i < cd->maxstack; i++) {
651 if ((rd->interfaces[i][0].type >= 0) ||
652 (rd->interfaces[i][1].type >= 0) ||
653 (rd->interfaces[i][2].type >= 0) ||
654 (rd->interfaces[i][3].type >= 0) ||
655 (rd->interfaces[i][4].type >= 0)) {
658 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
659 # if defined(ENABLE_INTRP)
662 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
663 if (rd->interfaces[i][j].type >= 0) {
664 printf(" (%s) ", jit_type[j]);
665 if (rd->interfaces[i][j].flags & SAVEDVAR) {
666 if (rd->interfaces[i][j].flags & INMEMORY)
667 printf("M%2d", rd->interfaces[i][j].regoff);
668 #ifdef HAS_ADDRESS_REGISTER_FILE
669 else if (j == TYPE_ADR)
670 printf("R%02d", rd->interfaces[i][j].regoff);
672 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
673 printf("F%02d", rd->interfaces[i][j].regoff);
675 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
676 if (IS_2_WORD_TYPE(j))
678 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
679 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
682 printf("%3s",regs[rd->interfaces[i][j].regoff]);
686 if (rd->interfaces[i][j].flags & INMEMORY)
687 printf("m%2d", rd->interfaces[i][j].regoff);
688 #ifdef HAS_ADDRESS_REGISTER_FILE
689 else if (j == TYPE_ADR)
690 printf("r%02d", rd->interfaces[i][j].regoff);
692 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
693 printf("f%02d", rd->interfaces[i][j].regoff);
695 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
696 if (IS_2_WORD_TYPE(j))
698 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
699 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
702 printf("%3s",regs[rd->interfaces[i][j].regoff]);
708 # if defined(ENABLE_INTRP)
711 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
717 #if defined(ENABLE_INTRP)
720 #if defined(ENABLE_LSRA)
724 if (code->rplpoints) {
725 printf("Replacement Points:\n");
726 replace_show_replacement_points(code);
730 #if defined(ENABLE_DISASSEMBLER)
731 /* show code before first basic block */
733 if (opt_showdisassemble) {
734 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen);
736 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + m->basicblocks[0].mpc);)
743 /* show code of all basic blocks */
745 for (bptr = m->basicblocks; bptr != NULL; bptr = bptr->next)
746 show_basicblock(jd, bptr);
748 #if defined(ENABLE_DISASSEMBLER)
749 /* show stubs code */
751 if (opt_showdisassemble && opt_showexceptionstubs) {
752 printf("\nException stubs code:\n");
753 printf("Length: %d\n\n", (s4) (code->mcodelength -
754 ((ptrint) cd->dseglen +
755 m->basicblocks[m->basicblockcount].mpc)));
757 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen +
758 m->basicblocks[m->basicblockcount].mpc);
760 for (; (ptrint) u1ptr < ((ptrint) code->mcode + code->mcodelength);)
767 #if defined(ENABLE_THREADS)
768 builtin_monitorexit(show_global_lock);
771 /* finally flush the output */
775 #endif /* !defined(NDEBUG) */
778 /* show_basicblock *************************************************************
780 Print the intermediate representation of a basic block.
782 NOTE: Currently this function may only be called after register allocation!
784 *******************************************************************************/
787 void new_show_basicblock(jitdata *jd, basicblock *bptr, int stage)
794 new_instruction *iptr;
797 /* get required compiler data */
803 if (bptr->flags != BBDELETED) {
804 deadcode = bptr->flags <= BBREACHED;
806 printf("======== %sL%03d ======== (flags: %d, bitflags: %01x, next: %d, type: ",
807 (bptr->bitflags & BBFLAG_REPLACEMENT) ? "<REPLACE> " : "",
808 bptr->debug_nr, bptr->flags, bptr->bitflags,
809 (bptr->next) ? (bptr->next->debug_nr) : -1);
811 switch (bptr->type) {
823 printf(", instruction count: %d, predecessors: %d):\n",
824 bptr->icount, bptr->pre_count);
826 iptr = /*XXX*/ (new_instruction *) bptr->iinstr;
828 for (i = 0; i < bptr->icount; i++, iptr++) {
829 printf("%4d: ", iptr->line);
831 new_show_icmd(jd, iptr, deadcode, stage);
835 #if defined(ENABLE_DISASSEMBLER)
836 if (stage >= SHOW_CODE && opt_showdisassemble && (!deadcode)) {
838 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->mpc);
840 if (bptr->next != NULL) {
841 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->next->mpc);)
846 for (; u1ptr < (u1 *) ((ptrint) code->mcode + code->mcodelength);)
854 #endif /* !defined(NDEBUG) */
857 void show_basicblock(jitdata *jd, basicblock *bptr)
867 /* get required compiler data */
873 if (bptr->flags != BBDELETED) {
874 deadcode = bptr->flags <= BBREACHED;
879 for (j = cd->maxstack; j > 0; j--)
882 show_print_stack(cd, bptr->instack);
884 printf("] %sL%03d(flags: %d, bitflags: %01x, next: %d, type: ",
885 (bptr->bitflags & BBFLAG_REPLACEMENT) ? "<REPLACE> " : "",
886 bptr->debug_nr, bptr->flags, bptr->bitflags,
887 (bptr->next) ? (bptr->next->debug_nr) : -1);
889 switch (bptr->type) {
901 printf(", instruction count: %d, predecessors: %d):\n",
902 bptr->icount, bptr->pre_count);
906 for (i = 0; i < bptr->icount; i++, iptr++) {
910 for (j = cd->maxstack; j > 0; j--)
913 show_print_stack(cd, iptr->dst);
915 printf("] %5d (line: %5d) ", i, iptr->line);
917 show_icmd(iptr, deadcode);
921 #if defined(ENABLE_DISASSEMBLER)
922 if (opt_showdisassemble && (!deadcode)) {
924 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->mpc);
926 if (bptr->next != NULL) {
927 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->next->mpc);)
932 for (; u1ptr < (u1 *) ((ptrint) code->mcode + code->mcodelength);)
940 #endif /* !defined(NDEBUG) */
943 /* show_icmd *******************************************************************
945 Print the intermediate representation of an instruction.
947 NOTE: Currently this function may only be called after register allocation!
949 *******************************************************************************/
953 #define SHOW_TARGET(target) \
954 if (stage >= SHOW_STACK) { \
955 printf("--> L%03d ", (target).block->debug_nr); \
957 else if (stage >= SHOW_PARSE) { \
958 printf("--> insindex %d (L%03d) ", (target).insindex, \
959 jd->new_basicblocks[jd->new_basicblockindex[ \
960 (target).insindex]].debug_nr); \
963 printf("--> insindex %d ", (target).insindex); \
966 #define SHOW_INT_CONST(val) \
967 if (stage >= SHOW_PARSE) { \
968 printf("%ld ", (long) (val)); \
974 #define SHOW_LNG_CONST(val) \
975 if (stage >= SHOW_PARSE) { \
976 printf("%lld ", (long long)(val)); \
982 #define SHOW_FLT_CONST(val) \
983 if (stage >= SHOW_PARSE) { \
984 printf("%g ", (val)); \
990 #define SHOW_DBL_CONST(val) \
991 if (stage >= SHOW_PARSE) { \
992 printf("%g ", (val)); \
998 #define SHOW_INDEX(index) \
999 if (stage >= SHOW_PARSE) { \
1000 printf("%d ", index); \
1006 #define SHOW_STRING(val) \
1007 if (stage >= SHOW_PARSE) { \
1009 utf_display_printable_ascii( \
1010 javastring_toutf((java_lang_String *)(val), false)); \
1014 printf("string "); \
1017 #define SHOW_CLASSREF_OR_CLASSINFO(c) \
1018 if (stage >= SHOW_PARSE) { \
1019 if (IS_CLASSREF(c)) \
1020 class_classref_print(c.ref); \
1022 class_print(c.cls); \
1029 #define SHOW_FIELD(fmiref) \
1030 if (stage >= SHOW_PARSE) { \
1031 field_fieldref_print(fmiref); \
1038 #define SHOW_STACKVAR(sp) \
1039 new_show_stackvar(jd, (sp), stage)
1041 #define SHOW_S1(iptr) \
1042 if (stage >= SHOW_STACK) { \
1043 SHOW_STACKVAR(iptr->s1.var); \
1046 #define SHOW_S2(iptr) \
1047 if (stage >= SHOW_STACK) { \
1048 SHOW_STACKVAR(iptr->sx.s23.s2.var); \
1051 #define SHOW_S3(iptr) \
1052 if (stage >= SHOW_STACK) { \
1053 SHOW_STACKVAR(iptr->sx.s23.s3.var); \
1056 #define SHOW_DST(iptr) \
1057 if (stage >= SHOW_STACK) { \
1059 SHOW_STACKVAR(iptr->dst.var); \
1062 #define SHOW_S1_LOCAL(iptr) \
1063 if (stage >= SHOW_STACK) { \
1064 printf("L%d ", iptr->s1.localindex); \
1067 #define SHOW_DST_LOCAL(iptr) \
1068 if (stage >= SHOW_STACK) { \
1069 printf("=> L%d ", iptr->dst.localindex); \
1072 static void new_show_stackvar(jitdata *jd, stackptr sp, int stage)
1077 case TYPE_INT: type = 'i'; break;
1078 case TYPE_LNG: type = 'l'; break;
1079 case TYPE_FLT: type = 'f'; break;
1080 case TYPE_DBL: type = 'd'; break;
1081 case TYPE_ADR: type = 'a'; break;
1082 default: type = '?';
1084 printf("S%c%d", type, (int) (sp - jd->new_stack));
1086 if (stage >= SHOW_REGS) {
1089 if (sp->flags & SAVEDVAR) {
1090 switch (sp->varkind) {
1092 if (sp->flags & INMEMORY)
1093 printf("M%02d", sp->regoff);
1094 #ifdef HAS_ADDRESS_REGISTER_FILE
1095 else if (sp->type == TYPE_ADR)
1096 printf("R%02d", sp->regoff);
1098 else if (IS_FLT_DBL_TYPE(sp->type))
1099 printf("F%02d", sp->regoff);
1101 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
1102 if (IS_2_WORD_TYPE(sp->type)) {
1103 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1104 # if defined(ENABLE_INTRP)
1106 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1107 GET_HIGH_REG(sp->regoff));
1110 printf("%3s/%3s", regs[GET_LOW_REG(sp->regoff)],
1111 regs[GET_HIGH_REG(sp->regoff)]);
1113 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1114 GET_HIGH_REG(sp->regoff));
1118 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
1120 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1121 # if defined(ENABLE_INTRP)
1123 printf("%3d", sp->regoff);
1126 printf("%3s", regs[sp->regoff]);
1128 printf("%3d", sp->regoff);
1134 printf("I%02d", sp->varnum);
1137 printf("L%02d", sp->varnum);
1140 if (sp->varnum == -1) {
1142 /* varkind ARGVAR "misused for this special case */
1145 else /* "normal" Argvar */
1146 printf("A%02d", sp->varnum);
1152 else { /* not SAVEDVAR */
1153 switch (sp->varkind) {
1155 if (sp->flags & INMEMORY)
1156 printf("m%02d", sp->regoff);
1157 #ifdef HAS_ADDRESS_REGISTER_FILE
1158 else if (sp->type == TYPE_ADR)
1159 printf("r%02d", sp->regoff);
1161 else if (IS_FLT_DBL_TYPE(sp->type))
1162 printf("f%02d", sp->regoff);
1164 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
1165 if (IS_2_WORD_TYPE(sp->type)) {
1166 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1167 # if defined(ENABLE_INTRP)
1169 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1170 GET_HIGH_REG(sp->regoff));
1173 printf("%3s/%3s", regs[GET_LOW_REG(sp->regoff)],
1174 regs[GET_HIGH_REG(sp->regoff)]);
1176 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1177 GET_HIGH_REG(sp->regoff));
1181 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
1183 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1184 # if defined(ENABLE_INTRP)
1186 printf("%3d", sp->regoff);
1189 printf("%3s", regs[sp->regoff]);
1191 printf("%3d", sp->regoff);
1197 printf("i%02d", sp->varnum);
1200 printf("l%02d", sp->varnum);
1203 if (sp->varnum == -1) {
1205 /* varkind ARGVAR "misused for this special case */
1208 else /* "normal" Argvar */
1209 printf("a%02d", sp->varnum);
1221 void new_show_icmd(jitdata *jd, new_instruction *iptr, bool deadcode, int stage)
1224 branch_target_t *table;
1225 lookup_target_t *lookup;
1226 constant_FMIref *fmiref;
1230 /* get the opcode and the condition */
1234 printf("%s ", icmd_names[opcode]);
1236 if (stage < SHOW_PARSE)
1242 /* Print the condition for conditional instructions. */
1244 /* XXX print condition from flags */
1249 case ICMD_CHECKNULL:
1250 case ICMD_CHECKNULL_POP:
1255 case ICMD_ARRAYLENGTH:
1274 case ICMD_INT2SHORT:
1322 /* binary/const INT */
1323 case ICMD_IADDCONST:
1324 case ICMD_ISUBCONST:
1325 case ICMD_IMULCONST:
1329 case ICMD_IANDCONST:
1331 case ICMD_IXORCONST:
1332 case ICMD_ISHLCONST:
1333 case ICMD_ISHRCONST:
1334 case ICMD_IUSHRCONST:
1335 case ICMD_LSHLCONST:
1336 case ICMD_LSHRCONST:
1337 case ICMD_LUSHRCONST:
1339 SHOW_INT_CONST(iptr->sx.val.i);
1344 case ICMD_IASTORECONST:
1345 case ICMD_BASTORECONST:
1346 case ICMD_CASTORECONST:
1347 case ICMD_SASTORECONST:
1350 SHOW_INT_CONST(iptr->sx.s23.s3.constval);
1355 SHOW_INT_CONST(iptr->sx.val.i);
1359 case ICMD_IFEQ_ICONST:
1360 case ICMD_IFNE_ICONST:
1361 case ICMD_IFLT_ICONST:
1362 case ICMD_IFGE_ICONST:
1363 case ICMD_IFGT_ICONST:
1364 case ICMD_IFLE_ICONST:
1367 case ICMD_ELSE_ICONST:
1370 /* binary/const LNG */
1371 case ICMD_LADDCONST:
1372 case ICMD_LSUBCONST:
1373 case ICMD_LMULCONST:
1377 case ICMD_LANDCONST:
1379 case ICMD_LXORCONST:
1380 case ICMD_LASTORECONST:
1382 SHOW_LNG_CONST(iptr->sx.val.l);
1388 SHOW_LNG_CONST(iptr->sx.val.l);
1394 SHOW_FLT_CONST(iptr->sx.val.f);
1400 SHOW_DBL_CONST(iptr->sx.val.d);
1406 if (iptr->flags.bits & INS_FLAG_CLASS) {
1407 SHOW_CLASSREF_OR_CLASSINFO(iptr->sx.val.c);
1409 else if (iptr->sx.val.anyptr == NULL) {
1413 SHOW_STRING(iptr->sx.val.stringconst);
1418 case ICMD_AASTORECONST:
1421 printf("%p ", (void*) iptr->sx.s23.s3.constval);
1424 case ICMD_GETFIELD: /* 1 -> 1 */
1425 case ICMD_PUTFIELD: /* 2 -> 0 */
1426 case ICMD_PUTSTATIC: /* 1 -> 0 */
1427 case ICMD_GETSTATIC: /* 0 -> 1 */
1428 case ICMD_PUTSTATICCONST: /* 0 -> 0 */
1429 case ICMD_PUTFIELDCONST: /* 1 -> 0 */
1430 if (opcode != ICMD_GETSTATIC && opcode != ICMD_PUTSTATICCONST) {
1432 if (opcode == ICMD_PUTFIELD) {
1436 if (iptr->flags.bits & INS_FLAG_UNRESOLVED)
1437 printf("(UNRESOLVED) ");
1438 NEW_INSTRUCTION_GET_FIELDREF(iptr, fmiref);
1441 if (opcode == ICMD_GETSTATIC || opcode == ICMD_GETFIELD) {
1447 SHOW_S1_LOCAL(iptr);
1448 SHOW_INT_CONST(iptr->sx.val.i);
1449 SHOW_DST_LOCAL(iptr);
1479 SHOW_S1_LOCAL(iptr);
1487 SHOW_S1_LOCAL(iptr);
1497 SHOW_DST_LOCAL(iptr);
1508 case ICMD_ANEWARRAY:
1512 case ICMD_MULTIANEWARRAY:
1513 if (stage >= SHOW_STACK) {
1514 argp = iptr->sx.s23.s2.args;
1515 i = iptr->s1.argcount;
1517 SHOW_STACKVAR(*(argp++));
1521 printf("argcount=%d ", iptr->s1.argcount);
1526 case ICMD_CHECKCAST:
1531 case ICMD_INSTANCEOF:
1536 case ICMD_INLINE_START:
1537 case ICMD_INLINE_END:
1541 if (stage >= SHOW_STACK) {
1542 argp = iptr->sx.s23.s2.args;
1543 i = iptr->s1.argcount;
1545 SHOW_STACKVAR(*(argp++));
1548 printf("%s ", iptr->sx.s23.s3.bte->name);
1549 if (iptr->sx.s23.s3.bte->md->returntype.type != TYPE_VOID) {
1554 case ICMD_INVOKEVIRTUAL:
1555 case ICMD_INVOKESPECIAL:
1556 case ICMD_INVOKESTATIC:
1557 case ICMD_INVOKEINTERFACE:
1558 if (stage >= SHOW_STACK) {
1559 argp = iptr->sx.s23.s2.args;
1560 i = iptr->s1.argcount;
1562 SHOW_STACKVAR(*(argp++));
1565 if (iptr->flags.bits & INS_FLAG_UNRESOLVED) {
1566 printf("(UNRESOLVED) ");
1568 NEW_INSTRUCTION_GET_METHODREF(iptr, fmiref);
1569 method_methodref_print(fmiref);
1570 if (fmiref->parseddesc.md->returntype.type != TYPE_VOID) {
1582 SHOW_TARGET(iptr->dst);
1592 SHOW_TARGET(iptr->dst);
1596 case ICMD_INLINE_GOTO:
1597 SHOW_TARGET(iptr->dst);
1601 SHOW_TARGET(iptr->sx.s23.s3.jsrtarget);
1606 case ICMD_IFNONNULL:
1608 SHOW_TARGET(iptr->dst);
1611 case ICMD_IF_ICMPEQ:
1612 case ICMD_IF_ICMPNE:
1613 case ICMD_IF_ICMPLT:
1614 case ICMD_IF_ICMPGE:
1615 case ICMD_IF_ICMPGT:
1616 case ICMD_IF_ICMPLE:
1618 case ICMD_IF_LCMPEQ:
1619 case ICMD_IF_LCMPNE:
1620 case ICMD_IF_LCMPLT:
1621 case ICMD_IF_LCMPGE:
1622 case ICMD_IF_LCMPGT:
1623 case ICMD_IF_LCMPLE:
1625 case ICMD_IF_FCMPEQ:
1626 case ICMD_IF_FCMPNE:
1628 case ICMD_IF_FCMPL_LT:
1629 case ICMD_IF_FCMPL_GE:
1630 case ICMD_IF_FCMPL_GT:
1631 case ICMD_IF_FCMPL_LE:
1633 case ICMD_IF_FCMPG_LT:
1634 case ICMD_IF_FCMPG_GE:
1635 case ICMD_IF_FCMPG_GT:
1636 case ICMD_IF_FCMPG_LE:
1638 case ICMD_IF_DCMPEQ:
1639 case ICMD_IF_DCMPNE:
1641 case ICMD_IF_DCMPL_LT:
1642 case ICMD_IF_DCMPL_GE:
1643 case ICMD_IF_DCMPL_GT:
1644 case ICMD_IF_DCMPL_LE:
1646 case ICMD_IF_DCMPG_LT:
1647 case ICMD_IF_DCMPG_GE:
1648 case ICMD_IF_DCMPG_GT:
1649 case ICMD_IF_DCMPG_LE:
1651 case ICMD_IF_ACMPEQ:
1652 case ICMD_IF_ACMPNE:
1655 SHOW_TARGET(iptr->dst);
1658 case ICMD_TABLESWITCH:
1662 case ICMD_LOOKUPSWITCH:
1680 if (stage >= SHOW_STACK) {
1681 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1682 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1684 SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
1685 SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
1690 if (stage >= SHOW_STACK) {
1691 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1692 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1694 SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
1695 SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
1696 SHOW_STACKVAR(iptr->dst.dupslots[2+2]);
1701 if (stage >= SHOW_STACK) {
1702 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1703 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1704 SHOW_STACKVAR(iptr->dst.dupslots[2]);
1706 SHOW_STACKVAR(iptr->dst.dupslots[3+0]);
1707 SHOW_STACKVAR(iptr->dst.dupslots[3+1]);
1708 SHOW_STACKVAR(iptr->dst.dupslots[3+2]);
1709 SHOW_STACKVAR(iptr->dst.dupslots[3+3]);
1710 SHOW_STACKVAR(iptr->dst.dupslots[3+4]);
1715 if (stage >= SHOW_STACK) {
1716 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1717 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1718 SHOW_STACKVAR(iptr->dst.dupslots[2]);
1720 SHOW_STACKVAR(iptr->dst.dupslots[3+0]);
1721 SHOW_STACKVAR(iptr->dst.dupslots[3+1]);
1722 SHOW_STACKVAR(iptr->dst.dupslots[3+2]);
1723 SHOW_STACKVAR(iptr->dst.dupslots[3+3]);
1728 if (stage >= SHOW_STACK) {
1729 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1730 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1731 SHOW_STACKVAR(iptr->dst.dupslots[2]);
1732 SHOW_STACKVAR(iptr->dst.dupslots[4]);
1734 SHOW_STACKVAR(iptr->dst.dupslots[4+0]);
1735 SHOW_STACKVAR(iptr->dst.dupslots[4+1]);
1736 SHOW_STACKVAR(iptr->dst.dupslots[4+2]);
1737 SHOW_STACKVAR(iptr->dst.dupslots[4+3]);
1738 SHOW_STACKVAR(iptr->dst.dupslots[4+4]);
1739 SHOW_STACKVAR(iptr->dst.dupslots[4+5]);
1744 if (stage >= SHOW_STACK) {
1745 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1746 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1748 SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
1749 SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
1755 #endif /* !defined(NDEBUG) */
1757 #if !defined(NDEBUG)
1758 void show_icmd(instruction *iptr, bool deadcode)
1767 constant_classref *cr;
1768 unresolved_field *uf;
1770 /* get the opcode and the condition */
1772 opcode = iptr->opc & ICMD_OPCODE_MASK;
1773 condition = (iptr->opc & ICMD_CONDITION_MASK) >> 8;
1775 printf("%s", icmd_names[opcode]);
1777 /* Print the condition for conditional instructions. */
1780 printf(" (condition: %s)", icmd_names[condition]);
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_IFEQ_ICONST:
1807 case ICMD_IFNE_ICONST:
1808 case ICMD_IFLT_ICONST:
1809 case ICMD_IFGE_ICONST:
1810 case ICMD_IFGT_ICONST:
1811 case ICMD_IFLE_ICONST:
1812 printf(" %d, %d (0x%08x)", iptr[1].op1, iptr->val.i, iptr->val.i);
1815 case ICMD_ELSE_ICONST:
1816 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
1819 case ICMD_LADDCONST:
1820 case ICMD_LSUBCONST:
1821 case ICMD_LMULCONST:
1825 case ICMD_LANDCONST:
1827 case ICMD_LXORCONST:
1829 case ICMD_LASTORECONST:
1830 #if SIZEOF_VOID_P == 4
1831 printf(" %lld (0x%016llx)", iptr->val.l, iptr->val.l);
1833 printf(" %ld (0x%016lx)", iptr->val.l, iptr->val.l);
1838 printf(" %f (0x%08x)", iptr->val.f, iptr->val.i);
1842 #if SIZEOF_VOID_P == 4
1843 printf(" %g (0x%016llx)", iptr->val.d, iptr->val.l);
1845 printf(" %g (0x%016lx)", iptr->val.d, iptr->val.l);
1850 case ICMD_AASTORECONST:
1851 /* check if this is a constant string or a class reference */
1853 if (ICMD_ACONST_IS_CLASS(iptr)) {
1854 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1855 printf(" (NOT RESOLVED) classref = ");
1856 class_classref_print(ICMD_ACONST_UNRESOLVED_CLASSREF(iptr));
1859 printf(" class = ");
1860 class_print(ICMD_ACONST_RESOLVED_CLASSINFO(iptr));
1864 printf(" %p", iptr->val.a);
1867 printf(", String = \"");
1868 utf_display_printable_ascii(javastring_toutf(iptr->val.a, false));
1876 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1877 uf = INSTRUCTION_UNRESOLVED_FIELD(iptr);
1878 printf(" (NOT RESOLVED) ");
1880 field_fieldref_print(uf->fieldref);
1883 f = INSTRUCTION_RESOLVED_FIELDINFO(iptr);
1884 printf(" %d, ", f->offset);
1890 case ICMD_PUTSTATIC:
1891 case ICMD_GETSTATIC:
1892 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1893 uf = INSTRUCTION_UNRESOLVED_FIELD(iptr);
1894 printf(" (NOT RESOLVED) ");
1896 field_fieldref_print(uf->fieldref);
1899 f = INSTRUCTION_RESOLVED_FIELDINFO(iptr);
1900 if (!CLASS_IS_OR_ALMOST_INITIALIZED(f->class))
1901 printf(" (NOT INITIALIZED) ");
1909 case ICMD_PUTSTATICCONST:
1910 case ICMD_PUTFIELDCONST:
1911 switch (iptr[1].op1) {
1913 printf(" %d (0x%08x),", iptr->val.i, iptr->val.i);
1916 #if SIZEOF_VOID_P == 4
1917 printf(" %lld (0x%016llx),", iptr->val.l, iptr->val.l);
1919 printf(" %ld (0x%016lx),", iptr->val.l, iptr->val.l);
1923 printf(" %p,", iptr->val.a);
1926 printf(" %g (0x%08x),", iptr->val.f, iptr->val.i);
1929 #if SIZEOF_VOID_P == 4
1930 printf(" %g (0x%016llx),", iptr->val.d, iptr->val.l);
1932 printf(" %g (0x%016lx),", iptr->val.d, iptr->val.l);
1937 if (INSTRUCTION_IS_UNRESOLVED(iptr + 1)) {
1938 uf = INSTRUCTION_UNRESOLVED_FIELD(iptr + 1);
1939 printf(" (NOT RESOLVED) ");
1940 field_fieldref_print(uf->fieldref);
1943 f = INSTRUCTION_RESOLVED_FIELDINFO(iptr + 1);
1944 if ((iptr->opc == ICMD_PUTSTATICCONST) &&
1945 !CLASS_IS_OR_ALMOST_INITIALIZED(f->class))
1946 printf(" (NOT INITIALIZED), ");
1948 printf(" %d, ", f->offset);
1954 printf(" %d + %d", iptr->op1, iptr->val.i);
1989 printf(" %d", iptr->op1);
1995 utf_display_printable_ascii_classname(c->name);
1999 switch (iptr->op1) {
2027 case ICMD_ANEWARRAY:
2031 utf_display_printable_ascii_classname(c->name);
2035 case ICMD_MULTIANEWARRAY:
2040 printf(" (NOT RESOLVED) %d ", iptr->op1);
2041 utf_display_printable_ascii(cr->name);
2044 printf(" %d ", iptr->op1);
2045 utf_display_printable_ascii_classname(c->name);
2049 case ICMD_CHECKCAST:
2050 case ICMD_INSTANCEOF:
2055 if (c->flags & ACC_INTERFACE)
2056 printf(" (INTERFACE) ");
2058 printf(" (CLASS,%3d) ", c->vftbl->diffval);
2060 printf(" (NOT RESOLVED) ");
2061 utf_display_printable_ascii_classname(cr->name);
2064 case ICMD_INLINE_START:
2065 case ICMD_INLINE_END:
2067 insinfo_inline *insinfo = (insinfo_inline *) iptr->target;
2069 method_print(insinfo->method);
2074 printf(" %s", ((builtintable_entry *) iptr->val.a)->name);
2077 case ICMD_INVOKEVIRTUAL:
2078 case ICMD_INVOKESPECIAL:
2079 case ICMD_INVOKESTATIC:
2080 case ICMD_INVOKEINTERFACE:
2082 constant_FMIref *mref;
2084 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
2085 printf(" (NOT RESOLVED) ");
2086 mref = INSTRUCTION_UNRESOLVED_METHOD(iptr)->methodref;
2090 mref = INSTRUCTION_RESOLVED_FMIREF(iptr);
2092 method_methodref_print(mref);
2102 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
2104 if ((iptr->opc & ICMD_CONDITION_MASK) == 0) {
2105 if (deadcode || !iptr->target)
2106 printf(" op1=%d", iptr->op1);
2108 printf(" L%03d (%p)", ((basicblock *) iptr->target)->debug_nr, iptr->target);
2118 #if SIZEOF_VOID_P == 4
2119 printf(" %lld (%016llx)", iptr->val.l, iptr->val.l);
2121 printf(" %ld (%016lx)", iptr->val.l, iptr->val.l);
2124 if ((iptr->opc & ICMD_CONDITION_MASK) == 0) {
2125 if (deadcode || !iptr->target)
2126 printf(" op1=%d", iptr->op1);
2128 printf(" L%03d", ((basicblock *) iptr->target)->debug_nr);
2134 case ICMD_INLINE_GOTO:
2135 if (deadcode || !iptr->target)
2136 printf(" op1=%d", iptr->op1);
2138 printf(" L%03d (%p)", ((basicblock *) iptr->target)->debug_nr,iptr->target);
2142 case ICMD_IFNONNULL:
2143 case ICMD_IF_ICMPEQ:
2144 case ICMD_IF_ICMPNE:
2145 case ICMD_IF_ICMPLT:
2146 case ICMD_IF_ICMPGE:
2147 case ICMD_IF_ICMPGT:
2148 case ICMD_IF_ICMPLE:
2150 case ICMD_IF_LCMPEQ:
2151 case ICMD_IF_LCMPNE:
2152 case ICMD_IF_LCMPLT:
2153 case ICMD_IF_LCMPGE:
2154 case ICMD_IF_LCMPGT:
2155 case ICMD_IF_LCMPLE:
2157 case ICMD_IF_FCMPEQ:
2158 case ICMD_IF_FCMPNE:
2160 case ICMD_IF_FCMPL_LT:
2161 case ICMD_IF_FCMPL_GE:
2162 case ICMD_IF_FCMPL_GT:
2163 case ICMD_IF_FCMPL_LE:
2165 case ICMD_IF_FCMPG_LT:
2166 case ICMD_IF_FCMPG_GE:
2167 case ICMD_IF_FCMPG_GT:
2168 case ICMD_IF_FCMPG_LE:
2170 case ICMD_IF_DCMPEQ:
2171 case ICMD_IF_DCMPNE:
2173 case ICMD_IF_DCMPL_LT:
2174 case ICMD_IF_DCMPL_GE:
2175 case ICMD_IF_DCMPL_GT:
2176 case ICMD_IF_DCMPL_LE:
2178 case ICMD_IF_DCMPG_LT:
2179 case ICMD_IF_DCMPG_GE:
2180 case ICMD_IF_DCMPG_GT:
2181 case ICMD_IF_DCMPG_LE:
2183 case ICMD_IF_ACMPEQ:
2184 case ICMD_IF_ACMPNE:
2185 if (!(iptr->opc & ICMD_CONDITION_MASK)) {
2186 if (deadcode || !iptr->target)
2187 printf(" op1=%d", iptr->op1);
2189 printf(" L%03d (%p)", ((basicblock *) iptr->target)->debug_nr,iptr->target);
2193 case ICMD_TABLESWITCH:
2194 s4ptr = (s4*)iptr->val.a;
2196 if (deadcode || !iptr->target) {
2197 printf(" %d;", *s4ptr);
2200 tptr = (void **) iptr->target;
2201 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
2205 s4ptr++; /* skip default */
2206 j = *s4ptr++; /* low */
2207 j = *s4ptr++ - j; /* high */
2209 if (deadcode || !*tptr)
2210 printf(" %d", *s4ptr++);
2212 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
2219 case ICMD_LOOKUPSWITCH:
2220 s4ptr = (s4*)iptr->val.a;
2222 if (deadcode || !iptr->target) {
2223 printf(" %d;", *s4ptr);
2226 tptr = (void **) iptr->target;
2227 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
2230 s4ptr++; /* default */
2231 j = *s4ptr++; /* count */
2234 if (deadcode || !*tptr) {
2235 s4ptr++; /* skip value */
2236 printf(" %d",*s4ptr++);
2239 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
2247 printf(" (NOT RESOLVED) Class = \"");
2248 utf_display_printable_ascii(((unresolved_class *) iptr->val.a)->classref->name);
2253 #endif /* !defined(NDEBUG) */
2256 * These are local overrides for various environment variables in Emacs.
2257 * Please do not remove this and leave it at the end of the file, where
2258 * Emacs will automagically detect them.
2259 * ---------------------------------------------------------------------
2262 * indent-tabs-mode: t
2266 * vim:noexpandtab:sw=4:ts=4: