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"
48 #include "vm/jit/abi.h"
49 #include "vm/jit/jit.h"
50 #include "vm/jit/show.h"
51 #include "vm/jit/disass.h"
52 #include "vm/jit/stack.h"
53 #include "vm/jit/parse.h"
55 #include "vmcore/options.h"
58 /* global variables ***********************************************************/
60 #if defined(ENABLE_THREADS) && !defined(NDEBUG)
61 static java_objectheader *show_global_lock;
65 /* prototypes *****************************************************************/
68 static void show_variable_intern(jitdata *jd, s4 index, int stage);
72 /* show_init *******************************************************************
74 Initialized the show subsystem (called by jit_init).
76 *******************************************************************************/
81 #if defined(ENABLE_THREADS)
82 /* initialize the show lock */
84 show_global_lock = NEW(java_objectheader);
86 lock_init_object_lock(show_global_lock);
97 char *show_jit_type_names[] = {
108 char show_jit_type_letters[] = {
122 /* show_method *****************************************************************
124 Print the intermediate representation of a method.
126 NOTE: Currently this function may only be called after register allocation!
128 *******************************************************************************/
131 void show_method(jitdata *jd, int stage)
138 basicblock *lastbptr;
142 #if defined(ENABLE_DISASSEMBLER)
146 /* get required compiler data */
153 /* We need to enter a lock here, since the binutils disassembler
154 is not reentrant-able and we could not read functions printed
157 LOCK_MONITOR_ENTER(show_global_lock);
159 #if defined(ENABLE_INTRP)
161 irstage = SHOW_PARSE;
166 /* get the last basic block */
168 for (lastbptr = jd->basicblocks; lastbptr->next != NULL; lastbptr = lastbptr->next);
174 if (jd->isleafmethod)
175 printf("LEAFMETHOD\n");
177 printf("\nBasic blocks: %d\n", jd->basicblockcount);
178 if (stage >= SHOW_CODE) {
179 printf("Code length: %d\n", (lastbptr->mpc - jd->basicblocks[0].mpc));
180 printf("Data length: %d\n", cd->dseglen);
181 printf("Stub length: %d\n", (s4) (code->mcodelength -
182 ((ptrint) cd->dseglen + lastbptr->mpc)));
184 printf("Variables: %d (%d used)\n", jd->varcount, jd->vartop);
185 if (stage >= SHOW_STACK)
186 printf("Max interfaces: %d\n", jd->maxinterfaces);
187 printf("Max locals: %d\n", jd->maxlocals);
188 printf("Max stack: %d\n", m->maxstack);
189 printf("Linenumbers: %d\n", m->linenumbercount);
190 printf("Branch to entry: %s\n", (jd->branchtoentry) ? "yes" : "no");
191 printf("Branch to end: %s\n", (jd->branchtoend) ? "yes" : "no");
192 if (stage >= SHOW_STACK) {
193 printf("Number of RETURNs: %d", jd->returncount);
194 if (jd->returncount == 1)
195 printf(" (block L%03d)", jd->returnblock->nr);
199 if (stage >= SHOW_PARSE) {
200 printf("Exceptions (Number: %d):\n", jd->exceptiontablelength);
201 for (ex = jd->exceptiontable; ex != NULL; ex = ex->down) {
202 printf(" L%03d ... ", ex->start->nr );
203 printf("L%03d = ", ex->end->nr);
204 printf("L%03d", ex->handler->nr);
205 printf(" (catchtype: ");
206 if (ex->catchtype.any)
207 if (IS_CLASSREF(ex->catchtype))
208 class_classref_print(ex->catchtype.ref);
210 class_print(ex->catchtype.cls);
217 if (irstage >= SHOW_PARSE && rd && jd->localcount > 0) {
218 printf("Local Table:\n");
219 for (i = 0; i < jd->localcount; i++) {
222 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
223 # if defined(ENABLE_INTRP)
226 printf(" (%s) ", show_jit_type_names[VAR(i)->type]);
227 if (irstage >= SHOW_REGS)
228 show_allocation(VAR(i)->type, VAR(i)->flags, VAR(i)->vv.regoff);
230 # if defined(ENABLE_INTRP)
233 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
238 if (jd->maxlocals > 0 && jd->local_map != NULL) {
239 printf("Local Map:\n");
241 for (j = 0; j < jd->maxlocals; j++) {
245 for (i = 0; i < 5; i++) {
246 printf(" %5s ",show_jit_type_names[i]);
247 for (j = 0; j < jd->maxlocals; j++) {
248 if (jd->local_map[j*5+i] == UNUSED)
251 printf("%4i ",jd->local_map[j*5+i]);
258 if (jd->maxinterfaces > 0 && jd->interface_map && irstage >= SHOW_STACK) {
260 interface_info *mapptr = jd->interface_map;
262 /* look if there exist any INOUTS */
263 for (i = 0; (i < (5 * jd->maxinterfaces)) && !exist; i++, mapptr++)
264 exist = (mapptr->flags != UNUSED);
267 printf("Interface Table: (In/Outvars)\n");
269 for (j = 0; j < jd->maxinterfaces; j++) {
274 for (i = 0; i < 5; i++) {
275 printf(" %5s ",show_jit_type_names[i]);
276 for (j = 0; j < jd->maxinterfaces; j++) {
277 s4 flags = jd->interface_map[j*5+i].flags;
278 s4 regoff = jd->interface_map[j*5+i].regoff;
284 if (irstage >= SHOW_REGS) {
285 if (flags & SAVEDVAR) {
286 if (flags & INMEMORY)
292 if (flags & INMEMORY)
297 printf("%c%03d(", ch, regoff);
298 show_allocation(i, flags, regoff);
302 if (flags & SAVEDVAR)
315 if (rd->memuse && irstage >= SHOW_REGS) {
319 printf("Stack slots: (memuse=%d", rd->memuse);
320 if (irstage >= SHOW_CODE) {
321 printf(", stackframesize=%d", cd->stackframesize);
322 max = cd->stackframesize;
325 for (i = 0; i < max; ++i) {
326 #if defined(HAS_4BYTE_STACKSLOT)
327 printf(" M%02d = 0x%02x(sp): ", i, i * 4);
329 printf(" M%02d = 0x%02x(sp): ", i, i * 8);
331 for (j = 0; j < jd->vartop; ++j) {
333 if ((v->flags & INMEMORY) && (v->vv.regoff == i)) {
334 show_variable(jd, j, irstage);
345 #if defined(ENABLE_REPLACEMENT)
346 if (code->rplpoints) {
347 printf("Replacement Points:\n");
348 replace_show_replacement_points(code);
351 #endif /* defined(ENABLE_REPLACEMENT) */
353 #if defined(ENABLE_DISASSEMBLER)
354 /* show code before first basic block */
356 if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd)) {
357 pc = (u1 *) ((ptrint) code->mcode + cd->dseglen);
359 for (; pc < (u1 *) ((ptrint) code->mcode + cd->dseglen + jd->basicblocks[0].mpc);)
366 /* show code of all basic blocks */
368 for (bptr = jd->basicblocks; bptr != NULL; bptr = bptr->next)
369 show_basicblock(jd, bptr, stage);
371 #if defined(ENABLE_DISASSEMBLER)
372 /* show stubs code */
374 if (stage >= SHOW_CODE && opt_showdisassemble && opt_showexceptionstubs) {
375 printf("\nStubs code:\n");
376 printf("Length: %d\n\n", (s4) (code->mcodelength -
377 ((ptrint) cd->dseglen + lastbptr->mpc)));
379 pc = (u1 *) ((ptrint) code->mcode + cd->dseglen + lastbptr->mpc);
381 for (; (ptrint) pc < ((ptrint) code->mcode + code->mcodelength);)
388 LOCK_MONITOR_EXIT(show_global_lock);
390 /* finally flush the output */
394 #endif /* !defined(NDEBUG) */
397 #if !defined(NDEBUG) && defined(ENABLE_INLINING)
398 static void show_inline_info(jitdata *jd, insinfo_inline *ii, s4 opcode, s4 stage)
403 printf("(pt %d+%d+%d st ",
404 ii->throughcount - (ii->stackvarscount - ii->paramcount),
405 ii->stackvarscount - ii->paramcount,
407 show_variable_array(jd, ii->stackvars, ii->stackvarscount, stage);
409 if (opcode == ICMD_INLINE_START || opcode == ICMD_INLINE_END) {
411 jl = (opcode == ICMD_INLINE_START) ? ii->javalocals_start : ii->javalocals_end;
412 n = (opcode == ICMD_INLINE_START) ? ii->method->maxlocals : ii->outer->maxlocals;
413 show_javalocals_array(jd, jl, n, stage);
420 method_print(ii->outer);
424 method_print(ii->method);
426 #endif /* !defined(NDEBUG) && defined(ENABLE_INLINING) */
429 /* show_basicblock *************************************************************
431 Print the intermediate representation of a basic block.
433 NOTE: Currently this function may only be called after register allocation!
435 *******************************************************************************/
438 void show_basicblock(jitdata *jd, basicblock *bptr, int stage)
446 #if defined(ENABLE_DISASSEMBLER)
447 methodinfo *m; /* this is only a dummy */
450 s4 currentlinenumber;
453 /* get required compiler data */
458 if (bptr->flags != BBDELETED) {
459 #if defined(ENABLE_INTRP)
462 irstage = SHOW_PARSE;
467 deadcode = (bptr->flags < BBREACHED);
471 printf("======== %sL%03d ======== %s(flags: %d, bitflags: %01x, next: %d, type: ",
472 #if defined(ENABLE_REPLACEMENT)
473 (bptr->bitflags & BBFLAG_REPLACEMENT) ? "<REPLACE> " :
477 (deadcode && stage >= SHOW_STACK) ? "DEADCODE! " : "",
478 bptr->flags, bptr->bitflags,
479 (bptr->next) ? (bptr->next->nr) : -1);
481 switch (bptr->type) {
493 printf(", icount: %d", bptr->icount);
495 if (irstage >= SHOW_CFG) {
496 printf(", preds: %d [ ", bptr->predecessorcount);
498 for (i = 0; i < bptr->predecessorcount; i++)
499 printf("%d ", bptr->predecessors[i]->nr);
507 printf(" (clone of L%03d)", bptr->original->nr);
509 basicblock *b = bptr->copied_to;
511 printf(" (copied to ");
512 for (; b; b = b->copied_to)
513 printf("L%03d ", b->nr);
520 if (irstage >= SHOW_STACK) {
522 show_variable_array(jd, bptr->invars, bptr->indepth, irstage);
523 printf(" javalocals: ");
524 show_javalocals_array(jd, bptr->javalocals, bptr->method->maxlocals, irstage);
528 #if defined(ENABLE_INLINING)
529 if (bptr->inlineinfo) {
530 printf("inlineinfo: ");
531 show_inline_info(jd, bptr->inlineinfo, -1, irstage);
534 #endif /* defined(ENABLE_INLINING) */
538 for (i = 0; i < bptr->icount; i++, iptr++) {
539 printf("%4d:%4d: ", iptr->line, iptr->flags.bits >> INS_FLAG_ID_SHIFT);
541 show_icmd(jd, iptr, deadcode, irstage);
545 if (irstage >= SHOW_STACK) {
547 show_variable_array(jd, bptr->outvars, bptr->outdepth, irstage);
551 #if defined(ENABLE_DISASSEMBLER)
552 if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) &&
556 pc = (u1 *) (code->mcode + cd->dseglen + bptr->mpc);
559 if (bptr->next != NULL) {
560 for (; pc < (u1 *) (code->mcode + cd->dseglen + bptr->next->mpc);) {
562 dseg_get_linenumber_from_pc(&m, code->entrypoint, pc);
564 if (currentlinenumber != linenumber) {
565 linenumber = currentlinenumber;
566 printf("%4d:\n", linenumber);
573 for (; pc < (u1 *) (code->mcode + code->mcodelength);) {
575 dseg_get_linenumber_from_pc(&m, code->entrypoint, pc);
577 if (currentlinenumber != linenumber) {
578 linenumber = currentlinenumber;
579 printf("%4d:\n", linenumber);
590 #endif /* !defined(NDEBUG) */
593 /* show_icmd *******************************************************************
595 Print the intermediate representation of an instruction.
597 NOTE: Currently this function may only be called after register allocation!
599 *******************************************************************************/
603 #define SHOW_TARGET(target) \
604 if (stage >= SHOW_PARSE) { \
605 printf("--> L%03d ", (target).block->nr); \
608 printf("--> insindex %d ", (target).insindex); \
611 #define SHOW_INT_CONST(val) \
612 if (stage >= SHOW_PARSE) { \
613 printf("%d (0x%08x) ", (val), (val)); \
619 #if SIZEOF_VOID_P == 4
620 #define SHOW_LNG_CONST(val) \
621 if (stage >= SHOW_PARSE) \
622 printf("%lld (0x%016llx) ", (val), (val)); \
626 #define SHOW_LNG_CONST(val) \
627 if (stage >= SHOW_PARSE) \
628 printf("%ld (0x%016lx) ", (val), (val)); \
633 #if SIZEOF_VOID_P == 4
634 #define SHOW_ADR_CONST(val) \
635 if (stage >= SHOW_PARSE) \
636 printf("0x%08x ", (ptrint) (val)); \
640 #define SHOW_ADR_CONST(val) \
641 if (stage >= SHOW_PARSE) \
642 printf("0x%016lx ", (ptrint) (val)); \
647 #define SHOW_FLT_CONST(val) \
648 if (stage >= SHOW_PARSE) { \
651 printf("%g (0x%08x) ", (val), v.i); \
657 #if SIZEOF_VOID_P == 4
658 #define SHOW_DBL_CONST(val) \
659 if (stage >= SHOW_PARSE) { \
662 printf("%g (0x%016llx) ", (val), v.l); \
667 #define SHOW_DBL_CONST(val) \
668 if (stage >= SHOW_PARSE) { \
671 printf("%g (0x%016lx) ", (val), v.l); \
677 #define SHOW_INDEX(index) \
678 if (stage >= SHOW_PARSE) { \
679 printf("%d ", index); \
685 #define SHOW_STRING(val) \
686 if (stage >= SHOW_PARSE) { \
688 utf_display_printable_ascii( \
689 javastring_toutf((java_objectheader *)(val), false)); \
696 #define SHOW_CLASSREF_OR_CLASSINFO(c) \
697 if (stage >= SHOW_PARSE) { \
698 if (IS_CLASSREF(c)) \
699 class_classref_print(c.ref); \
701 class_print(c.cls); \
708 #define SHOW_FIELD(fmiref) \
709 if (stage >= SHOW_PARSE) { \
710 field_fieldref_print(fmiref); \
717 #define SHOW_VARIABLE(v) \
718 show_variable(jd, (v), stage)
720 #define SHOW_S1(iptr) \
721 if (stage >= SHOW_STACK) { \
722 SHOW_VARIABLE(iptr->s1.varindex); \
725 #define SHOW_S2(iptr) \
726 if (stage >= SHOW_STACK) { \
727 SHOW_VARIABLE(iptr->sx.s23.s2.varindex); \
730 #define SHOW_S3(iptr) \
731 if (stage >= SHOW_STACK) { \
732 SHOW_VARIABLE(iptr->sx.s23.s3.varindex); \
735 #define SHOW_DST(iptr) \
736 if (stage >= SHOW_STACK) { \
738 SHOW_VARIABLE(iptr->dst.varindex); \
741 #define SHOW_S1_LOCAL(iptr) \
742 if (stage >= SHOW_STACK) { \
743 printf("L%d ", iptr->s1.varindex); \
746 printf("JavaL%d ", iptr->s1.varindex); \
749 #define SHOW_DST_LOCAL(iptr) \
750 if (stage >= SHOW_STACK) { \
751 printf("=> L%d ", iptr->dst.varindex); \
754 printf("=> JavaL%d ", iptr->dst.varindex); \
757 void show_allocation(s4 type, s4 flags, s4 regoff)
759 if (type == TYPE_RET) {
764 if (flags & INMEMORY) {
765 printf("M%02d", regoff);
769 #ifdef HAS_ADDRESS_REGISTER_FILE
770 if (type == TYPE_ADR) {
771 printf("R%02d", regoff);
776 if (IS_FLT_DBL_TYPE(type)) {
777 printf("F%02d", regoff);
781 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
782 if (IS_2_WORD_TYPE(type)) {
783 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
784 # if defined(ENABLE_INTRP)
786 printf("%3d/%3d", GET_LOW_REG(regoff),
787 GET_HIGH_REG(regoff));
790 printf("%3s/%3s", abi_registers_integer_name[GET_LOW_REG(regoff)],
791 abi_registers_integer_name[GET_HIGH_REG(regoff)]);
793 printf("%3d/%3d", GET_LOW_REG(regoff),
794 GET_HIGH_REG(regoff));
798 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
800 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
801 # if defined(ENABLE_INTRP)
803 printf("%3d", regoff);
806 printf("%3s", abi_registers_integer_name[regoff]);
808 printf("%3d", regoff);
812 void show_variable(jitdata *jd, s4 index, int stage)
814 show_variable_intern(jd, index, stage);
818 static void show_variable_intern(jitdata *jd, s4 index, int stage)
824 if (index < 0 || index >= jd->vartop) {
825 printf("<INVALID INDEX:%d>", index);
832 case TYPE_INT: type = 'i'; break;
833 case TYPE_LNG: type = 'l'; break;
834 case TYPE_FLT: type = 'f'; break;
835 case TYPE_DBL: type = 'd'; break;
836 case TYPE_ADR: type = 'a'; break;
837 case TYPE_RET: type = 'r'; break;
841 if (index < jd->localcount) {
843 if (v->flags & (PREALLOC | INOUT))
844 printf("<INVALID FLAGS!>");
847 if (v->flags & PREALLOC) {
849 if (v->flags & INOUT) {
850 /* PREALLOC is used to avoid allocation of TYPE_RET */
851 if (v->type == TYPE_RET)
854 printf("<INVALID FLAGS!>");
857 else if (v->flags & INOUT)
863 printf("%c%c%d", kind, type, index);
865 if (v->flags & SAVEDVAR)
868 if (stage >= SHOW_REGS || (v->flags & PREALLOC)) {
870 show_allocation(v->type, v->flags, v->vv.regoff);
874 if (v->type == TYPE_RET && (v->flags & PREALLOC)) {
875 printf("(L%03d)", v->vv.retaddr->nr);
879 static void show_variable_array_intern(jitdata *jd, s4 *vars, int n, int stage,
891 for (i=0; i<n; ++i) {
895 if (vars[i] == UNUSED)
897 else if (javalocals) {
898 nr = (UNUSED - vars[i]) - 1;
899 printf("ret(L%03d)", nr);
902 printf("<INVALID INDEX:%d>", vars[i]);
906 show_variable_intern(jd, vars[i], stage);
911 void show_variable_array(jitdata *jd, s4 *vars, int n, int stage)
913 show_variable_array_intern(jd, vars, n, stage, false);
916 void show_javalocals_array(jitdata *jd, s4 *vars, int n, int stage)
918 show_variable_array_intern(jd, vars, n, stage, true);
921 void show_icmd(jitdata *jd, instruction *iptr, bool deadcode, int stage)
924 branch_target_t *table;
925 lookup_target_t *lookup;
926 constant_FMIref *fmiref;
930 /* get the opcode and the condition */
934 printf("%s ", icmd_table[opcode].name);
936 if (stage < SHOW_PARSE)
942 /* Print the condition for conditional instructions. */
944 /* XXX print condition from flags */
946 if (iptr->flags.bits & INS_FLAG_UNRESOLVED)
947 printf("(UNRESOLVED) ");
957 case ICMD_ARRAYLENGTH:
1024 /* binary/const INT */
1025 case ICMD_IADDCONST:
1026 case ICMD_ISUBCONST:
1027 case ICMD_IMULCONST:
1031 case ICMD_IANDCONST:
1033 case ICMD_IXORCONST:
1034 case ICMD_ISHLCONST:
1035 case ICMD_ISHRCONST:
1036 case ICMD_IUSHRCONST:
1037 case ICMD_LSHLCONST:
1038 case ICMD_LSHRCONST:
1039 case ICMD_LUSHRCONST:
1041 SHOW_INT_CONST(iptr->sx.val.i);
1045 /* ?ASTORECONST (trinary/const INT) */
1046 case ICMD_IASTORECONST:
1047 case ICMD_BASTORECONST:
1048 case ICMD_CASTORECONST:
1049 case ICMD_SASTORECONST:
1052 SHOW_INT_CONST(iptr->sx.s23.s3.constval);
1057 SHOW_INT_CONST(iptr->sx.val.i);
1061 /* binary/const LNG */
1062 case ICMD_LADDCONST:
1063 case ICMD_LSUBCONST:
1064 case ICMD_LMULCONST:
1068 case ICMD_LANDCONST:
1070 case ICMD_LXORCONST:
1072 SHOW_LNG_CONST(iptr->sx.val.l);
1076 /* trinary/const LNG (<= pointer size) */
1077 case ICMD_LASTORECONST:
1080 SHOW_ADR_CONST(iptr->sx.s23.s3.constval);
1085 SHOW_LNG_CONST(iptr->sx.val.l);
1091 SHOW_FLT_CONST(iptr->sx.val.f);
1097 SHOW_DBL_CONST(iptr->sx.val.d);
1103 if (iptr->flags.bits & INS_FLAG_CLASS) {
1104 SHOW_ADR_CONST(iptr->sx.val.anyptr);
1105 SHOW_CLASSREF_OR_CLASSINFO(iptr->sx.val.c);
1107 else if (iptr->sx.val.anyptr == NULL) {
1111 SHOW_ADR_CONST(iptr->sx.val.anyptr);
1112 SHOW_STRING(iptr->sx.val.stringconst);
1117 case ICMD_AASTORECONST:
1120 printf("%p ", (void*) iptr->sx.s23.s3.constval);
1123 case ICMD_GETFIELD: /* 1 -> 1 */
1124 case ICMD_PUTFIELD: /* 2 -> 0 */
1125 case ICMD_PUTSTATIC: /* 1 -> 0 */
1126 case ICMD_GETSTATIC: /* 0 -> 1 */
1127 case ICMD_PUTSTATICCONST: /* 0 -> 0 */
1128 case ICMD_PUTFIELDCONST: /* 1 -> 0 */
1129 if (opcode != ICMD_GETSTATIC && opcode != ICMD_PUTSTATICCONST) {
1131 if (opcode == ICMD_PUTFIELD) {
1135 INSTRUCTION_GET_FIELDREF(iptr, fmiref);
1138 if (opcode == ICMD_GETSTATIC || opcode == ICMD_GETFIELD) {
1144 SHOW_S1_LOCAL(iptr);
1145 SHOW_INT_CONST(iptr->sx.val.i);
1146 SHOW_DST_LOCAL(iptr);
1176 SHOW_S1_LOCAL(iptr);
1177 if (stage >= SHOW_STACK) {
1178 printf(" ---> L%03d", iptr->dst.block->nr);
1187 SHOW_S1_LOCAL(iptr);
1197 SHOW_DST_LOCAL(iptr);
1198 if (stage >= SHOW_STACK && iptr->sx.s23.s3.javaindex != UNUSED)
1199 printf(" (javaindex %d)", iptr->sx.s23.s3.javaindex);
1200 if (iptr->flags.bits & INS_FLAG_RETADDR) {
1201 printf(" (retaddr L%03d)", (UNUSED - iptr->sx.s23.s2.retaddrnr) - 1);
1213 case ICMD_ANEWARRAY:
1217 case ICMD_MULTIANEWARRAY:
1218 if (stage >= SHOW_STACK) {
1219 argp = iptr->sx.s23.s2.args;
1220 i = iptr->s1.argcount;
1222 SHOW_VARIABLE(*(argp++));
1226 printf("argcount=%d ", iptr->s1.argcount);
1231 case ICMD_CHECKCAST:
1234 class_classref_or_classinfo_print(iptr->sx.s23.s3.c);
1238 case ICMD_INSTANCEOF:
1243 case ICMD_INLINE_START:
1244 case ICMD_INLINE_END:
1245 case ICMD_INLINE_BODY:
1246 #if defined(ENABLE_INLINING)
1248 insinfo_inline *ii = iptr->sx.s23.s3.inlineinfo;
1249 show_inline_info(jd, ii, opcode, stage);
1255 if (stage >= SHOW_STACK) {
1256 argp = iptr->sx.s23.s2.args;
1257 i = iptr->s1.argcount;
1259 if ((iptr->s1.argcount - 1 - i) == iptr->sx.s23.s3.bte->md->paramcount)
1260 printf(" pass-through: ");
1261 SHOW_VARIABLE(*(argp++));
1264 printf("%s ", iptr->sx.s23.s3.bte->cname);
1265 if (iptr->sx.s23.s3.bte->md->returntype.type != TYPE_VOID) {
1270 case ICMD_INVOKEVIRTUAL:
1271 case ICMD_INVOKESPECIAL:
1272 case ICMD_INVOKESTATIC:
1273 case ICMD_INVOKEINTERFACE:
1274 if (stage >= SHOW_STACK) {
1276 INSTRUCTION_GET_METHODDESC(iptr, md);
1277 argp = iptr->sx.s23.s2.args;
1278 i = iptr->s1.argcount;
1280 if ((iptr->s1.argcount - 1 - i) == md->paramcount)
1281 printf(" pass-through: ");
1282 SHOW_VARIABLE(*(argp++));
1285 INSTRUCTION_GET_METHODREF(iptr, fmiref);
1286 method_methodref_print(fmiref);
1287 if (fmiref->parseddesc.md->returntype.type != TYPE_VOID) {
1300 SHOW_INT_CONST(iptr->sx.val.i);
1301 SHOW_TARGET(iptr->dst);
1311 SHOW_LNG_CONST(iptr->sx.val.l);
1312 SHOW_TARGET(iptr->dst);
1316 SHOW_TARGET(iptr->dst);
1320 SHOW_TARGET(iptr->sx.s23.s3.jsrtarget);
1325 case ICMD_IFNONNULL:
1327 SHOW_TARGET(iptr->dst);
1330 case ICMD_IF_ICMPEQ:
1331 case ICMD_IF_ICMPNE:
1332 case ICMD_IF_ICMPLT:
1333 case ICMD_IF_ICMPGE:
1334 case ICMD_IF_ICMPGT:
1335 case ICMD_IF_ICMPLE:
1337 case ICMD_IF_LCMPEQ:
1338 case ICMD_IF_LCMPNE:
1339 case ICMD_IF_LCMPLT:
1340 case ICMD_IF_LCMPGE:
1341 case ICMD_IF_LCMPGT:
1342 case ICMD_IF_LCMPLE:
1344 case ICMD_IF_FCMPEQ:
1345 case ICMD_IF_FCMPNE:
1347 case ICMD_IF_FCMPL_LT:
1348 case ICMD_IF_FCMPL_GE:
1349 case ICMD_IF_FCMPL_GT:
1350 case ICMD_IF_FCMPL_LE:
1352 case ICMD_IF_FCMPG_LT:
1353 case ICMD_IF_FCMPG_GE:
1354 case ICMD_IF_FCMPG_GT:
1355 case ICMD_IF_FCMPG_LE:
1357 case ICMD_IF_DCMPEQ:
1358 case ICMD_IF_DCMPNE:
1360 case ICMD_IF_DCMPL_LT:
1361 case ICMD_IF_DCMPL_GE:
1362 case ICMD_IF_DCMPL_GT:
1363 case ICMD_IF_DCMPL_LE:
1365 case ICMD_IF_DCMPG_LT:
1366 case ICMD_IF_DCMPG_GE:
1367 case ICMD_IF_DCMPG_GT:
1368 case ICMD_IF_DCMPG_LE:
1370 case ICMD_IF_ACMPEQ:
1371 case ICMD_IF_ACMPNE:
1374 SHOW_TARGET(iptr->dst);
1377 case ICMD_TABLESWITCH:
1379 table = iptr->dst.table;
1381 i = iptr->sx.s23.s3.tablehigh - iptr->sx.s23.s2.tablelow + 1;
1383 printf("high=%d low=%d count=%d\n", iptr->sx.s23.s3.tablehigh, iptr->sx.s23.s2.tablelow, i);
1385 printf("\t\t%d --> ", (int) (table - iptr->dst.table));
1386 printf("L%03d\n", table->block->nr);
1392 case ICMD_LOOKUPSWITCH:
1395 printf("count=%d, default=L%03d\n",
1396 iptr->sx.s23.s2.lookupcount,
1397 iptr->sx.s23.s3.lookupdefault.block->nr);
1399 lookup = iptr->dst.lookup;
1400 i = iptr->sx.s23.s2.lookupcount;
1403 printf("\t\t%d --> L%03d\n",
1405 lookup->target.block->nr);
1420 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1421 /* XXX this needs more work */
1423 unresolved_class_debug_dump(iptr->sx.s23.s2.uc, stdout);
1436 #endif /* !defined(NDEBUG) */
1440 * These are local overrides for various environment variables in Emacs.
1441 * Please do not remove this and leave it at the end of the file, where
1442 * Emacs will automagically detect them.
1443 * ---------------------------------------------------------------------
1446 * indent-tabs-mode: t
1450 * vim:noexpandtab:sw=4:ts=4: