1 /* src/vm/jit/show.c - showing the intermediate representation
3 Copyright (C) 1996-2005, 2006, 2007 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
36 #include "mm/memory.h"
38 #if defined(ENABLE_THREADS)
39 # include "threads/native/lock.h"
41 # include "threads/none/lock.h"
44 #include "vm/global.h"
45 #include "vm/builtin.h"
46 #include "vm/stringlocal.h"
47 #include "vm/jit/jit.h"
48 #include "vm/jit/show.h"
49 #include "vm/jit/disass.h"
50 #include "vm/jit/stack.h"
51 #include "vm/jit/parse.h"
52 #include "vmcore/options.h"
55 /* global variables ***********************************************************/
57 #if defined(ENABLE_THREADS) && !defined(NDEBUG)
58 static java_objectheader *show_global_lock;
62 /* prototypes *****************************************************************/
65 static void show_variable_intern(jitdata *jd, s4 index, int stage);
69 /* show_init *******************************************************************
71 Initialized the show subsystem (called by jit_init).
73 *******************************************************************************/
78 #if defined(ENABLE_THREADS)
79 /* initialize the show lock */
81 show_global_lock = NEW(java_objectheader);
83 lock_init_object_lock(show_global_lock);
94 char *show_jit_type_names[] = {
105 char show_jit_type_letters[] = {
119 /* show_method *****************************************************************
121 Print the intermediate representation of a method.
123 NOTE: Currently this function may only be called after register allocation!
125 *******************************************************************************/
128 void show_method(jitdata *jd, int stage)
135 basicblock *lastbptr;
139 #if defined(ENABLE_DISASSEMBLER)
143 /* get required compiler data */
150 /* We need to enter a lock here, since the binutils disassembler
151 is not reentrant-able and we could not read functions printed
154 LOCK_MONITOR_ENTER(show_global_lock);
156 #if defined(ENABLE_INTRP)
158 irstage = SHOW_PARSE;
163 /* get the last basic block */
165 for (lastbptr = jd->basicblocks; lastbptr->next != NULL; lastbptr = lastbptr->next);
171 if (jd->isleafmethod)
172 printf("LEAFMETHOD\n");
174 printf("\nBasic blocks: %d\n", jd->basicblockcount);
175 if (stage >= SHOW_CODE) {
176 printf("Code length: %d\n", (lastbptr->mpc - jd->basicblocks[0].mpc));
177 printf("Data length: %d\n", cd->dseglen);
178 printf("Stub length: %d\n", (s4) (code->mcodelength -
179 ((ptrint) cd->dseglen + lastbptr->mpc)));
181 printf("Variables: %d (%d used)\n", jd->varcount, jd->vartop);
182 if (stage >= SHOW_STACK)
183 printf("Max interfaces: %d\n", jd->maxinterfaces);
184 printf("Max locals: %d\n", jd->maxlocals);
185 printf("Max stack: %d\n", m->maxstack);
186 printf("Linenumbers: %d\n", m->linenumbercount);
187 printf("Branch to entry: %s\n", (jd->branchtoentry) ? "yes" : "no");
188 printf("Branch to end: %s\n", (jd->branchtoend) ? "yes" : "no");
189 if (stage >= SHOW_STACK) {
190 printf("Number of RETURNs: %d", jd->returncount);
191 if (jd->returncount == 1)
192 printf(" (block L%03d)", jd->returnblock->nr);
196 if (stage >= SHOW_PARSE) {
197 printf("Exceptions (Number: %d):\n", jd->exceptiontablelength);
198 for (ex = jd->exceptiontable; ex != NULL; ex = ex->down) {
199 printf(" L%03d ... ", ex->start->nr );
200 printf("L%03d = ", ex->end->nr);
201 printf("L%03d", ex->handler->nr);
202 printf(" (catchtype: ");
203 if (ex->catchtype.any)
204 if (IS_CLASSREF(ex->catchtype))
205 class_classref_print(ex->catchtype.ref);
207 class_print(ex->catchtype.cls);
214 if (irstage >= SHOW_PARSE && rd && jd->localcount > 0) {
215 printf("Local Table:\n");
216 for (i = 0; i < jd->localcount; i++) {
219 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
220 # if defined(ENABLE_INTRP)
223 printf(" (%s) ", show_jit_type_names[VAR(i)->type]);
224 if (irstage >= SHOW_REGS)
225 show_allocation(VAR(i)->type, VAR(i)->flags, VAR(i)->vv.regoff);
227 # if defined(ENABLE_INTRP)
230 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
235 if (jd->maxlocals > 0 && jd->local_map != NULL) {
236 printf("Local Map:\n");
238 for (j = 0; j < jd->maxlocals; j++) {
242 for (i = 0; i < 5; i++) {
243 printf(" %5s ",show_jit_type_names[i]);
244 for (j = 0; j < jd->maxlocals; j++) {
245 if (jd->local_map[j*5+i] == UNUSED)
248 printf("%4i ",jd->local_map[j*5+i]);
255 if (jd->maxinterfaces > 0 && jd->interface_map && irstage >= SHOW_STACK) {
257 interface_info *mapptr = jd->interface_map;
259 /* look if there exist any INOUTS */
260 for (i = 0; (i < (5 * jd->maxinterfaces)) && !exist; i++, mapptr++)
261 exist = (mapptr->flags != UNUSED);
264 printf("Interface Table: (In/Outvars)\n");
266 for (j = 0; j < jd->maxinterfaces; j++) {
271 for (i = 0; i < 5; i++) {
272 printf(" %5s ",show_jit_type_names[i]);
273 for (j = 0; j < jd->maxinterfaces; j++) {
274 s4 flags = jd->interface_map[j*5+i].flags;
275 s4 regoff = jd->interface_map[j*5+i].regoff;
281 if (irstage >= SHOW_REGS) {
282 if (flags & SAVEDVAR) {
283 if (flags & INMEMORY)
289 if (flags & INMEMORY)
294 printf("%c%03d(", ch, regoff);
295 show_allocation(i, flags, regoff);
299 if (flags & SAVEDVAR)
312 if (rd->memuse && irstage >= SHOW_REGS) {
316 printf("Stack slots: (memuse=%d", rd->memuse);
317 if (irstage >= SHOW_CODE) {
318 printf(", stackframesize=%d", cd->stackframesize);
319 max = cd->stackframesize;
322 for (i = 0; i < max; ++i) {
323 #if defined(HAS_4BYTE_STACKSLOT)
324 printf(" M%02d = 0x%02x(sp): ", i, i * 4);
326 printf(" M%02d = 0x%02x(sp): ", i, i * 8);
328 for (j = 0; j < jd->vartop; ++j) {
330 if ((v->flags & INMEMORY) && (v->vv.regoff == i)) {
331 show_variable(jd, j, irstage);
342 #if defined(ENABLE_REPLACEMENT)
343 if (code->rplpoints) {
344 printf("Replacement Points:\n");
345 replace_show_replacement_points(code);
348 #endif /* defined(ENABLE_REPLACEMENT) */
350 #if defined(ENABLE_DISASSEMBLER)
351 /* show code before first basic block */
353 if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd)) {
354 pc = (u1 *) ((ptrint) code->mcode + cd->dseglen);
356 for (; pc < (u1 *) ((ptrint) code->mcode + cd->dseglen + jd->basicblocks[0].mpc);)
363 /* show code of all basic blocks */
365 for (bptr = jd->basicblocks; bptr != NULL; bptr = bptr->next)
366 show_basicblock(jd, bptr, stage);
368 #if defined(ENABLE_DISASSEMBLER)
369 /* show stubs code */
371 if (stage >= SHOW_CODE && opt_showdisassemble && opt_showexceptionstubs) {
372 printf("\nStubs code:\n");
373 printf("Length: %d\n\n", (s4) (code->mcodelength -
374 ((ptrint) cd->dseglen + lastbptr->mpc)));
376 pc = (u1 *) ((ptrint) code->mcode + cd->dseglen + lastbptr->mpc);
378 for (; (ptrint) pc < ((ptrint) code->mcode + code->mcodelength);)
385 LOCK_MONITOR_EXIT(show_global_lock);
387 /* finally flush the output */
391 #endif /* !defined(NDEBUG) */
394 #if !defined(NDEBUG) && defined(ENABLE_INLINING)
395 static void show_inline_info(jitdata *jd, insinfo_inline *ii, s4 opcode, s4 stage)
400 printf("(pt %d+%d+%d st ",
401 ii->throughcount - (ii->stackvarscount - ii->paramcount),
402 ii->stackvarscount - ii->paramcount,
404 show_variable_array(jd, ii->stackvars, ii->stackvarscount, stage);
406 if (opcode == ICMD_INLINE_START || opcode == ICMD_INLINE_END) {
408 jl = (opcode == ICMD_INLINE_START) ? ii->javalocals_start : ii->javalocals_end;
409 n = (opcode == ICMD_INLINE_START) ? ii->method->maxlocals : ii->outer->maxlocals;
410 show_javalocals_array(jd, jl, n, stage);
417 method_print(ii->outer);
421 method_print(ii->method);
423 #endif /* !defined(NDEBUG) && defined(ENABLE_INLINING) */
426 /* show_basicblock *************************************************************
428 Print the intermediate representation of a basic block.
430 NOTE: Currently this function may only be called after register allocation!
432 *******************************************************************************/
435 void show_basicblock(jitdata *jd, basicblock *bptr, int stage)
443 #if defined(ENABLE_DISASSEMBLER)
444 methodinfo *m; /* this is only a dummy */
447 s4 currentlinenumber;
450 /* get required compiler data */
455 if (bptr->flags != BBDELETED) {
456 #if defined(ENABLE_INTRP)
459 irstage = SHOW_PARSE;
464 deadcode = (bptr->flags < BBREACHED);
468 printf("======== %sL%03d ======== %s(flags: %d, bitflags: %01x, next: %d, type: ",
469 #if defined(ENABLE_REPLACEMENT)
470 (bptr->bitflags & BBFLAG_REPLACEMENT) ? "<REPLACE> " :
474 (deadcode && stage >= SHOW_STACK) ? "DEADCODE! " : "",
475 bptr->flags, bptr->bitflags,
476 (bptr->next) ? (bptr->next->nr) : -1);
478 switch (bptr->type) {
490 printf(", icount: %d", bptr->icount);
492 if (irstage >= SHOW_CFG) {
493 printf(", preds: %d [ ", bptr->predecessorcount);
495 for (i = 0; i < bptr->predecessorcount; i++)
496 printf("%d ", bptr->predecessors[i]->nr);
504 printf(" (clone of L%03d)", bptr->original->nr);
506 basicblock *b = bptr->copied_to;
508 printf(" (copied to ");
509 for (; b; b = b->copied_to)
510 printf("L%03d ", b->nr);
517 if (irstage >= SHOW_STACK) {
519 show_variable_array(jd, bptr->invars, bptr->indepth, irstage);
520 printf(" javalocals: ");
521 show_javalocals_array(jd, bptr->javalocals, bptr->method->maxlocals, irstage);
525 #if defined(ENABLE_INLINING)
526 if (bptr->inlineinfo) {
527 printf("inlineinfo: ");
528 show_inline_info(jd, bptr->inlineinfo, -1, irstage);
531 #endif /* defined(ENABLE_INLINING) */
535 for (i = 0; i < bptr->icount; i++, iptr++) {
536 printf("%4d:%4d: ", iptr->line, iptr->flags.bits >> INS_FLAG_ID_SHIFT);
538 show_icmd(jd, iptr, deadcode, irstage);
542 if (irstage >= SHOW_STACK) {
544 show_variable_array(jd, bptr->outvars, bptr->outdepth, irstage);
548 #if defined(ENABLE_DISASSEMBLER)
549 if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) &&
553 pc = (u1 *) (code->mcode + cd->dseglen + bptr->mpc);
556 if (bptr->next != NULL) {
557 for (; pc < (u1 *) (code->mcode + cd->dseglen + bptr->next->mpc);) {
559 dseg_get_linenumber_from_pc(&m, code->entrypoint, pc);
561 if (currentlinenumber != linenumber) {
562 linenumber = currentlinenumber;
563 printf("%4d:\n", linenumber);
570 for (; pc < (u1 *) (code->mcode + code->mcodelength);) {
572 dseg_get_linenumber_from_pc(&m, code->entrypoint, pc);
574 if (currentlinenumber != linenumber) {
575 linenumber = currentlinenumber;
576 printf("%4d:\n", linenumber);
587 #endif /* !defined(NDEBUG) */
590 /* show_icmd *******************************************************************
592 Print the intermediate representation of an instruction.
594 NOTE: Currently this function may only be called after register allocation!
596 *******************************************************************************/
600 #define SHOW_TARGET(target) \
601 if (stage >= SHOW_STACK) { \
602 printf("--> L%03d ", (target).block->nr); \
604 else if (stage >= SHOW_PARSE) { \
605 printf("--> insindex %d (L%03d) ", (target).insindex, \
606 jd->basicblocks[jd->basicblockindex[ \
607 (target).insindex]].nr); \
610 printf("--> insindex %d ", (target).insindex); \
613 #define SHOW_INT_CONST(val) \
614 if (stage >= SHOW_PARSE) { \
615 printf("%d (0x%08x) ", (val), (val)); \
621 #if SIZEOF_VOID_P == 4
622 #define SHOW_LNG_CONST(val) \
623 if (stage >= SHOW_PARSE) \
624 printf("%lld (0x%016llx) ", (val), (val)); \
628 #define SHOW_LNG_CONST(val) \
629 if (stage >= SHOW_PARSE) \
630 printf("%ld (0x%016lx) ", (val), (val)); \
635 #if SIZEOF_VOID_P == 4
636 #define SHOW_ADR_CONST(val) \
637 if (stage >= SHOW_PARSE) \
638 printf("0x%08x ", (ptrint) (val)); \
642 #define SHOW_ADR_CONST(val) \
643 if (stage >= SHOW_PARSE) \
644 printf("0x%016lx ", (ptrint) (val)); \
649 #define SHOW_FLT_CONST(val) \
650 if (stage >= SHOW_PARSE) { \
653 printf("%g (0x%08x) ", (val), v.i); \
659 #if SIZEOF_VOID_P == 4
660 #define SHOW_DBL_CONST(val) \
661 if (stage >= SHOW_PARSE) { \
664 printf("%g (0x%016llx) ", (val), v.l); \
669 #define SHOW_DBL_CONST(val) \
670 if (stage >= SHOW_PARSE) { \
673 printf("%g (0x%016lx) ", (val), v.l); \
679 #define SHOW_INDEX(index) \
680 if (stage >= SHOW_PARSE) { \
681 printf("%d ", index); \
687 #define SHOW_STRING(val) \
688 if (stage >= SHOW_PARSE) { \
690 utf_display_printable_ascii( \
691 javastring_toutf((java_objectheader *)(val), false)); \
698 #define SHOW_CLASSREF_OR_CLASSINFO(c) \
699 if (stage >= SHOW_PARSE) { \
700 if (IS_CLASSREF(c)) \
701 class_classref_print(c.ref); \
703 class_print(c.cls); \
710 #define SHOW_FIELD(fmiref) \
711 if (stage >= SHOW_PARSE) { \
712 field_fieldref_print(fmiref); \
719 #define SHOW_VARIABLE(v) \
720 show_variable(jd, (v), stage)
722 #define SHOW_S1(iptr) \
723 if (stage >= SHOW_STACK) { \
724 SHOW_VARIABLE(iptr->s1.varindex); \
727 #define SHOW_S2(iptr) \
728 if (stage >= SHOW_STACK) { \
729 SHOW_VARIABLE(iptr->sx.s23.s2.varindex); \
732 #define SHOW_S3(iptr) \
733 if (stage >= SHOW_STACK) { \
734 SHOW_VARIABLE(iptr->sx.s23.s3.varindex); \
737 #define SHOW_DST(iptr) \
738 if (stage >= SHOW_STACK) { \
740 SHOW_VARIABLE(iptr->dst.varindex); \
743 #define SHOW_S1_LOCAL(iptr) \
744 if (stage >= SHOW_STACK) { \
745 printf("L%d ", iptr->s1.varindex); \
748 printf("JavaL%d ", iptr->s1.varindex); \
751 #define SHOW_DST_LOCAL(iptr) \
752 if (stage >= SHOW_STACK) { \
753 printf("=> L%d ", iptr->dst.varindex); \
756 printf("=> JavaL%d ", iptr->dst.varindex); \
759 void show_allocation(s4 type, s4 flags, s4 regoff)
761 if (type == TYPE_RET) {
766 if (flags & INMEMORY) {
767 printf("M%02d", regoff);
771 #ifdef HAS_ADDRESS_REGISTER_FILE
772 if (type == TYPE_ADR) {
773 printf("R%02d", regoff);
778 if (IS_FLT_DBL_TYPE(type)) {
779 printf("F%02d", regoff);
783 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
784 if (IS_2_WORD_TYPE(type)) {
785 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
786 # if defined(ENABLE_INTRP)
788 printf("%3d/%3d", GET_LOW_REG(regoff),
789 GET_HIGH_REG(regoff));
792 printf("%3s/%3s", regs[GET_LOW_REG(regoff)],
793 regs[GET_HIGH_REG(regoff)]);
795 printf("%3d/%3d", GET_LOW_REG(regoff),
796 GET_HIGH_REG(regoff));
800 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
802 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
803 # if defined(ENABLE_INTRP)
805 printf("%3d", regoff);
808 printf("%3s", regs[regoff]);
810 printf("%3d", regoff);
814 void show_variable(jitdata *jd, s4 index, int stage)
816 show_variable_intern(jd, index, stage);
820 static void show_variable_intern(jitdata *jd, s4 index, int stage)
826 if (index < 0 || index >= jd->vartop) {
827 printf("<INVALID INDEX:%d>", index);
834 case TYPE_INT: type = 'i'; break;
835 case TYPE_LNG: type = 'l'; break;
836 case TYPE_FLT: type = 'f'; break;
837 case TYPE_DBL: type = 'd'; break;
838 case TYPE_ADR: type = 'a'; break;
839 case TYPE_RET: type = 'r'; break;
843 if (index < jd->localcount) {
845 if (v->flags & (PREALLOC | INOUT))
846 printf("<INVALID FLAGS!>");
849 if (v->flags & PREALLOC) {
851 if (v->flags & INOUT) {
852 /* PREALLOC is used to avoid allocation of TYPE_RET */
853 if (v->type == TYPE_RET)
856 printf("<INVALID FLAGS!>");
859 else if (v->flags & INOUT)
865 printf("%c%c%d", kind, type, index);
867 if (v->flags & SAVEDVAR)
870 if (stage >= SHOW_REGS || (v->flags & PREALLOC)) {
872 show_allocation(v->type, v->flags, v->vv.regoff);
876 if (v->type == TYPE_RET && (v->flags & PREALLOC)) {
877 printf("(L%03d)", v->vv.retaddr->nr);
881 static void show_variable_array_intern(jitdata *jd, s4 *vars, int n, int stage,
893 for (i=0; i<n; ++i) {
897 if (vars[i] == UNUSED)
899 else if (javalocals) {
900 nr = (UNUSED - vars[i]) - 1;
901 printf("ret(L%03d)", nr);
904 printf("<INVALID INDEX:%d>", vars[i]);
908 show_variable_intern(jd, vars[i], stage);
913 void show_variable_array(jitdata *jd, s4 *vars, int n, int stage)
915 show_variable_array_intern(jd, vars, n, stage, false);
918 void show_javalocals_array(jitdata *jd, s4 *vars, int n, int stage)
920 show_variable_array_intern(jd, vars, n, stage, true);
923 void show_icmd(jitdata *jd, instruction *iptr, bool deadcode, int stage)
926 branch_target_t *table;
927 lookup_target_t *lookup;
928 constant_FMIref *fmiref;
932 /* get the opcode and the condition */
936 printf("%s ", icmd_table[opcode].name);
938 if (stage < SHOW_PARSE)
944 /* Print the condition for conditional instructions. */
946 /* XXX print condition from flags */
948 if (iptr->flags.bits & INS_FLAG_UNRESOLVED)
949 printf("(UNRESOLVED) ");
959 case ICMD_ARRAYLENGTH:
1026 /* binary/const INT */
1027 case ICMD_IADDCONST:
1028 case ICMD_ISUBCONST:
1029 case ICMD_IMULCONST:
1033 case ICMD_IANDCONST:
1035 case ICMD_IXORCONST:
1036 case ICMD_ISHLCONST:
1037 case ICMD_ISHRCONST:
1038 case ICMD_IUSHRCONST:
1039 case ICMD_LSHLCONST:
1040 case ICMD_LSHRCONST:
1041 case ICMD_LUSHRCONST:
1043 SHOW_INT_CONST(iptr->sx.val.i);
1047 /* ?ASTORECONST (trinary/const INT) */
1048 case ICMD_IASTORECONST:
1049 case ICMD_BASTORECONST:
1050 case ICMD_CASTORECONST:
1051 case ICMD_SASTORECONST:
1054 SHOW_INT_CONST(iptr->sx.s23.s3.constval);
1059 SHOW_INT_CONST(iptr->sx.val.i);
1063 /* binary/const LNG */
1064 case ICMD_LADDCONST:
1065 case ICMD_LSUBCONST:
1066 case ICMD_LMULCONST:
1070 case ICMD_LANDCONST:
1072 case ICMD_LXORCONST:
1074 SHOW_LNG_CONST(iptr->sx.val.l);
1078 /* trinary/const LNG (<= pointer size) */
1079 case ICMD_LASTORECONST:
1082 SHOW_ADR_CONST(iptr->sx.s23.s3.constval);
1087 SHOW_LNG_CONST(iptr->sx.val.l);
1093 SHOW_FLT_CONST(iptr->sx.val.f);
1099 SHOW_DBL_CONST(iptr->sx.val.d);
1105 if (iptr->flags.bits & INS_FLAG_CLASS) {
1106 SHOW_ADR_CONST(iptr->sx.val.anyptr);
1107 SHOW_CLASSREF_OR_CLASSINFO(iptr->sx.val.c);
1109 else if (iptr->sx.val.anyptr == NULL) {
1113 SHOW_ADR_CONST(iptr->sx.val.anyptr);
1114 SHOW_STRING(iptr->sx.val.stringconst);
1119 case ICMD_AASTORECONST:
1122 printf("%p ", (void*) iptr->sx.s23.s3.constval);
1125 case ICMD_GETFIELD: /* 1 -> 1 */
1126 case ICMD_PUTFIELD: /* 2 -> 0 */
1127 case ICMD_PUTSTATIC: /* 1 -> 0 */
1128 case ICMD_GETSTATIC: /* 0 -> 1 */
1129 case ICMD_PUTSTATICCONST: /* 0 -> 0 */
1130 case ICMD_PUTFIELDCONST: /* 1 -> 0 */
1131 if (opcode != ICMD_GETSTATIC && opcode != ICMD_PUTSTATICCONST) {
1133 if (opcode == ICMD_PUTFIELD) {
1137 INSTRUCTION_GET_FIELDREF(iptr, fmiref);
1140 if (opcode == ICMD_GETSTATIC || opcode == ICMD_GETFIELD) {
1146 SHOW_S1_LOCAL(iptr);
1147 SHOW_INT_CONST(iptr->sx.val.i);
1148 SHOW_DST_LOCAL(iptr);
1178 SHOW_S1_LOCAL(iptr);
1179 if (stage >= SHOW_STACK) {
1180 printf(" ---> L%03d", iptr->dst.block->nr);
1189 SHOW_S1_LOCAL(iptr);
1199 SHOW_DST_LOCAL(iptr);
1200 if (stage >= SHOW_STACK && iptr->sx.s23.s3.javaindex != UNUSED)
1201 printf(" (javaindex %d)", iptr->sx.s23.s3.javaindex);
1202 if (iptr->flags.bits & INS_FLAG_RETADDR) {
1203 printf(" (retaddr L%03d)", (UNUSED - iptr->sx.s23.s2.retaddrnr) - 1);
1215 case ICMD_ANEWARRAY:
1219 case ICMD_MULTIANEWARRAY:
1220 if (stage >= SHOW_STACK) {
1221 argp = iptr->sx.s23.s2.args;
1222 i = iptr->s1.argcount;
1224 SHOW_VARIABLE(*(argp++));
1228 printf("argcount=%d ", iptr->s1.argcount);
1233 case ICMD_CHECKCAST:
1236 class_classref_or_classinfo_print(iptr->sx.s23.s3.c);
1240 case ICMD_INSTANCEOF:
1245 case ICMD_INLINE_START:
1246 case ICMD_INLINE_END:
1247 case ICMD_INLINE_BODY:
1248 #if defined(ENABLE_INLINING)
1250 insinfo_inline *ii = iptr->sx.s23.s3.inlineinfo;
1251 show_inline_info(jd, ii, opcode, stage);
1257 if (stage >= SHOW_STACK) {
1258 argp = iptr->sx.s23.s2.args;
1259 i = iptr->s1.argcount;
1261 if ((iptr->s1.argcount - 1 - i) == iptr->sx.s23.s3.bte->md->paramcount)
1262 printf(" pass-through: ");
1263 SHOW_VARIABLE(*(argp++));
1266 printf("%s ", iptr->sx.s23.s3.bte->cname);
1267 if (iptr->sx.s23.s3.bte->md->returntype.type != TYPE_VOID) {
1272 case ICMD_INVOKEVIRTUAL:
1273 case ICMD_INVOKESPECIAL:
1274 case ICMD_INVOKESTATIC:
1275 case ICMD_INVOKEINTERFACE:
1276 if (stage >= SHOW_STACK) {
1278 INSTRUCTION_GET_METHODDESC(iptr, md);
1279 argp = iptr->sx.s23.s2.args;
1280 i = iptr->s1.argcount;
1282 if ((iptr->s1.argcount - 1 - i) == md->paramcount)
1283 printf(" pass-through: ");
1284 SHOW_VARIABLE(*(argp++));
1287 INSTRUCTION_GET_METHODREF(iptr, fmiref);
1288 method_methodref_print(fmiref);
1289 if (fmiref->parseddesc.md->returntype.type != TYPE_VOID) {
1302 SHOW_INT_CONST(iptr->sx.val.i);
1303 SHOW_TARGET(iptr->dst);
1313 SHOW_LNG_CONST(iptr->sx.val.l);
1314 SHOW_TARGET(iptr->dst);
1318 SHOW_TARGET(iptr->dst);
1322 SHOW_TARGET(iptr->sx.s23.s3.jsrtarget);
1327 case ICMD_IFNONNULL:
1329 SHOW_TARGET(iptr->dst);
1332 case ICMD_IF_ICMPEQ:
1333 case ICMD_IF_ICMPNE:
1334 case ICMD_IF_ICMPLT:
1335 case ICMD_IF_ICMPGE:
1336 case ICMD_IF_ICMPGT:
1337 case ICMD_IF_ICMPLE:
1339 case ICMD_IF_LCMPEQ:
1340 case ICMD_IF_LCMPNE:
1341 case ICMD_IF_LCMPLT:
1342 case ICMD_IF_LCMPGE:
1343 case ICMD_IF_LCMPGT:
1344 case ICMD_IF_LCMPLE:
1346 case ICMD_IF_FCMPEQ:
1347 case ICMD_IF_FCMPNE:
1349 case ICMD_IF_FCMPL_LT:
1350 case ICMD_IF_FCMPL_GE:
1351 case ICMD_IF_FCMPL_GT:
1352 case ICMD_IF_FCMPL_LE:
1354 case ICMD_IF_FCMPG_LT:
1355 case ICMD_IF_FCMPG_GE:
1356 case ICMD_IF_FCMPG_GT:
1357 case ICMD_IF_FCMPG_LE:
1359 case ICMD_IF_DCMPEQ:
1360 case ICMD_IF_DCMPNE:
1362 case ICMD_IF_DCMPL_LT:
1363 case ICMD_IF_DCMPL_GE:
1364 case ICMD_IF_DCMPL_GT:
1365 case ICMD_IF_DCMPL_LE:
1367 case ICMD_IF_DCMPG_LT:
1368 case ICMD_IF_DCMPG_GE:
1369 case ICMD_IF_DCMPG_GT:
1370 case ICMD_IF_DCMPG_LE:
1372 case ICMD_IF_ACMPEQ:
1373 case ICMD_IF_ACMPNE:
1376 SHOW_TARGET(iptr->dst);
1379 case ICMD_TABLESWITCH:
1381 table = iptr->dst.table;
1383 i = iptr->sx.s23.s3.tablehigh - iptr->sx.s23.s2.tablelow + 1;
1385 printf("high=%d low=%d count=%d\n", iptr->sx.s23.s3.tablehigh, iptr->sx.s23.s2.tablelow, i);
1387 printf("\t\t%d --> ", (int) (table - iptr->dst.table));
1388 if (stage >= SHOW_STACK) {
1389 printf("L%03d\n", table->block->nr);
1392 printf("insindex %d (L%03d)\n", table->insindex, BLOCK_OF(table->insindex)->nr);
1399 case ICMD_LOOKUPSWITCH:
1402 printf("count=%d, default=", iptr->sx.s23.s2.lookupcount);
1403 if (stage >= SHOW_STACK) {
1404 printf("L%03d\n", iptr->sx.s23.s3.lookupdefault.block->nr);
1407 printf("insindex %d (L%03d)\n", iptr->sx.s23.s3.lookupdefault.insindex, BLOCK_OF(iptr->sx.s23.s3.lookupdefault.insindex)->nr);
1410 lookup = iptr->dst.lookup;
1411 i = iptr->sx.s23.s2.lookupcount;
1413 printf("\t\t%d --> ", lookup->value);
1414 if (stage >= SHOW_STACK) {
1415 printf("L%03d\n", lookup->target.block->nr);
1418 printf("insindex %d (L%03d)\n", lookup->target.insindex, BLOCK_OF(lookup->target.insindex)->nr);
1434 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1435 /* XXX this needs more work */
1437 unresolved_class_debug_dump(iptr->sx.s23.s2.uc, stdout);
1450 #endif /* !defined(NDEBUG) */
1454 * These are local overrides for various environment variables in Emacs.
1455 * Please do not remove this and leave it at the end of the file, where
1456 * Emacs will automagically detect them.
1457 * ---------------------------------------------------------------------
1460 * indent-tabs-mode: t
1464 * vim:noexpandtab:sw=4:ts=4: