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
42 #include "mm/memory.h"
44 #if defined(ENABLE_THREADS)
45 # include "threads/native/lock.h"
47 # include "threads/none/lock.h"
50 #include "vm/global.h"
51 #include "vm/options.h"
52 #include "vm/builtin.h"
53 #include "vm/stringlocal.h"
54 #include "vm/jit/jit.h"
55 #include "vm/jit/show.h"
56 #include "vm/jit/disass.h"
57 #include "vm/jit/stack.h"
58 #include "vm/jit/parse.h"
61 /* global variables ***********************************************************/
63 #if defined(ENABLE_THREADS) && !defined(NDEBUG)
64 static java_objectheader *show_global_lock;
68 /* prototypes *****************************************************************/
71 static void show_variable_intern(jitdata *jd, s4 index, int stage);
75 /* show_init *******************************************************************
77 Initialized the show subsystem (called by jit_init).
79 *******************************************************************************/
84 #if defined(ENABLE_THREADS)
85 /* initialize the show lock */
87 show_global_lock = NEW(java_objectheader);
89 lock_init_object_lock(show_global_lock);
100 char *show_jit_type_names[] = {
111 char show_jit_type_letters[] = {
125 /* show_method *****************************************************************
127 Print the intermediate representation of a method.
129 NOTE: Currently this function may only be called after register allocation!
131 *******************************************************************************/
134 void show_method(jitdata *jd, int stage)
141 basicblock *lastbptr;
145 #if defined(ENABLE_DISASSEMBLER)
149 /* get required compiler data */
156 /* We need to enter a lock here, since the binutils disassembler
157 is not reentrant-able and we could not read functions printed
160 LOCK_MONITOR_ENTER(show_global_lock);
162 #if defined(ENABLE_INTRP)
164 irstage = SHOW_PARSE;
169 /* get the last basic block */
171 for (lastbptr = jd->basicblocks; lastbptr->next != NULL; lastbptr = lastbptr->next);
177 if (jd->isleafmethod)
178 printf("LEAFMETHOD\n");
180 printf("\nBasic blocks: %d\n", jd->basicblockcount);
181 if (stage >= SHOW_CODE) {
182 printf("Code length: %d\n", (lastbptr->mpc - jd->basicblocks[0].mpc));
183 printf("Data length: %d\n", cd->dseglen);
184 printf("Stub length: %d\n", (s4) (code->mcodelength -
185 ((ptrint) cd->dseglen + lastbptr->mpc)));
187 printf("Variables: %d (%d used)\n", jd->varcount, jd->vartop);
188 if (stage >= SHOW_STACK)
189 printf("Max interfaces: %d\n", jd->maxinterfaces);
190 printf("Max locals: %d\n", jd->maxlocals);
191 printf("Max stack: %d\n", m->maxstack);
192 printf("Linenumbers: %d\n", m->linenumbercount);
193 printf("Branch to entry: %s\n", (jd->branchtoentry) ? "yes" : "no");
194 printf("Branch to end: %s\n", (jd->branchtoend) ? "yes" : "no");
195 if (stage >= SHOW_STACK) {
196 printf("Number of RETURNs: %d", jd->returncount);
197 if (jd->returncount == 1)
198 printf(" (block L%03d)", jd->returnblock->nr);
202 if (stage >= SHOW_PARSE) {
203 printf("Exceptions (Number: %d):\n", jd->exceptiontablelength);
204 for (ex = jd->exceptiontable; ex != NULL; ex = ex->down) {
205 printf(" L%03d ... ", ex->start->nr );
206 printf("L%03d = ", ex->end->nr);
207 printf("L%03d", ex->handler->nr);
208 printf(" (catchtype: ");
209 if (ex->catchtype.any)
210 if (IS_CLASSREF(ex->catchtype))
211 class_classref_print(ex->catchtype.ref);
213 class_print(ex->catchtype.cls);
220 if (irstage >= SHOW_PARSE && rd && jd->localcount > 0) {
221 printf("Local Table:\n");
222 for (i = 0; i < jd->localcount; i++) {
225 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
226 # if defined(ENABLE_INTRP)
229 printf(" (%s) ", show_jit_type_names[VAR(i)->type]);
230 if (irstage >= SHOW_REGS)
231 show_allocation(VAR(i)->type, VAR(i)->flags, VAR(i)->vv.regoff);
233 # if defined(ENABLE_INTRP)
236 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
241 if (jd->maxlocals > 0 && jd->local_map != NULL) {
242 printf("Local Map:\n");
244 for (j = 0; j < jd->maxlocals; j++) {
248 for (i = 0; i < 5; i++) {
249 printf(" %5s ",show_jit_type_names[i]);
250 for (j = 0; j < jd->maxlocals; j++) {
251 if (jd->local_map[j*5+i] == UNUSED)
254 printf("%4i ",jd->local_map[j*5+i]);
261 if (jd->maxinterfaces > 0 && jd->interface_map && irstage >= SHOW_STACK) {
263 interface_info *mapptr = jd->interface_map;
265 /* look if there exist any INOUTS */
266 for (i = 0; (i < (5 * jd->maxinterfaces)) && !exist; i++, mapptr++)
267 exist = (mapptr->flags != UNUSED);
270 printf("Interface Table: (In/Outvars)\n");
272 for (j = 0; j < jd->maxinterfaces; j++) {
277 for (i = 0; i < 5; i++) {
278 printf(" %5s ",show_jit_type_names[i]);
279 for (j = 0; j < jd->maxinterfaces; j++) {
280 s4 flags = jd->interface_map[j*5+i].flags;
281 s4 regoff = jd->interface_map[j*5+i].regoff;
287 if (irstage >= SHOW_REGS) {
288 if (flags & SAVEDVAR) {
289 if (flags & INMEMORY)
295 if (flags & INMEMORY)
300 printf("%c%03d(", ch, regoff);
301 show_allocation(i, flags, regoff);
305 if (flags & SAVEDVAR)
318 if (rd->memuse && irstage >= SHOW_REGS) {
322 printf("Stack slots: (memuse=%d", rd->memuse);
323 if (irstage >= SHOW_CODE) {
324 printf(", stackframesize=%d", cd->stackframesize);
325 max = cd->stackframesize;
328 for (i = 0; i < max; ++i) {
329 #if defined(HAS_4BYTE_STACKSLOT)
330 printf(" M%02d = 0x%02x(sp): ", i, i * 4);
332 printf(" M%02d = 0x%02x(sp): ", i, i * 8);
334 for (j = 0; j < jd->vartop; ++j) {
336 if ((v->flags & INMEMORY) && (v->vv.regoff == i)) {
337 show_variable(jd, j, irstage);
348 if (code->rplpoints) {
349 printf("Replacement Points:\n");
350 replace_show_replacement_points(code);
354 #if defined(ENABLE_DISASSEMBLER)
355 /* show code before first basic block */
357 if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd)) {
358 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen);
360 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + jd->basicblocks[0].mpc);)
367 /* show code of all basic blocks */
369 for (bptr = jd->basicblocks; bptr != NULL; bptr = bptr->next)
370 show_basicblock(jd, bptr, stage);
372 #if defined(ENABLE_DISASSEMBLER)
373 /* show stubs code */
375 if (stage >= SHOW_CODE && opt_showdisassemble && opt_showexceptionstubs) {
376 printf("\nStubs code:\n");
377 printf("Length: %d\n\n", (s4) (code->mcodelength -
378 ((ptrint) cd->dseglen + lastbptr->mpc)));
380 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen + lastbptr->mpc);
382 for (; (ptrint) u1ptr < ((ptrint) code->mcode + code->mcodelength);)
389 LOCK_MONITOR_EXIT(show_global_lock);
391 /* finally flush the output */
395 #endif /* !defined(NDEBUG) */
398 #if !defined(NDEBUG) && defined(ENABLE_INLINING)
399 static void show_inline_info(jitdata *jd, insinfo_inline *ii, s4 opcode, s4 stage)
404 printf("(pt %d+%d+%d st ",
405 ii->throughcount - (ii->stackvarscount - ii->paramcount),
406 ii->stackvarscount - ii->paramcount,
408 show_variable_array(jd, ii->stackvars, ii->stackvarscount, stage);
410 if (opcode == ICMD_INLINE_START || opcode == ICMD_INLINE_END) {
412 jl = (opcode == ICMD_INLINE_START) ? ii->javalocals_start : ii->javalocals_end;
413 n = (opcode == ICMD_INLINE_START) ? ii->method->maxlocals : ii->outer->maxlocals;
414 show_javalocals_array(jd, jl, n, stage);
421 method_print(ii->outer);
425 method_print(ii->method);
427 #endif /* !defined(NDEBUG) && defined(ENABLE_INLINING) */
430 /* show_basicblock *************************************************************
432 Print the intermediate representation of a basic block.
434 NOTE: Currently this function may only be called after register allocation!
436 *******************************************************************************/
439 void show_basicblock(jitdata *jd, basicblock *bptr, int stage)
447 #if defined(ENABLE_DISASSEMBLER)
451 /* get required compiler data */
456 if (bptr->flags != BBDELETED) {
457 #if defined(ENABLE_INTRP)
460 irstage = SHOW_PARSE;
465 deadcode = (bptr->flags < BBREACHED);
469 printf("======== %sL%03d ======== %s(flags: %d, bitflags: %01x, next: %d, type: ",
470 (bptr->bitflags & BBFLAG_REPLACEMENT) ? "<REPLACE> " : "",
472 (deadcode && stage >= SHOW_STACK) ? "DEADCODE! " : "",
473 bptr->flags, bptr->bitflags,
474 (bptr->next) ? (bptr->next->nr) : -1);
476 switch (bptr->type) {
488 printf(", icount: %d", bptr->icount);
490 if (irstage >= SHOW_CFG) {
491 printf(", preds: %d [ ", bptr->predecessorcount);
493 for (i = 0; i < bptr->predecessorcount; i++)
494 printf("%d ", bptr->predecessors[i]->nr);
502 printf(" (clone of L%03d)", bptr->original->nr);
504 basicblock *b = bptr->copied_to;
506 printf(" (copied to ");
507 for (; b; b = b->copied_to)
508 printf("L%03d ", b->nr);
515 if (irstage >= SHOW_STACK) {
517 show_variable_array(jd, bptr->invars, bptr->indepth, irstage);
518 printf(" javalocals: ");
519 show_javalocals_array(jd, bptr->javalocals, bptr->method->maxlocals, irstage);
523 #if defined(ENABLE_INLINING)
524 if (bptr->inlineinfo) {
525 printf("inlineinfo: ");
526 show_inline_info(jd, bptr->inlineinfo, -1, irstage);
529 #endif /* defined(ENABLE_INLINING) */
533 for (i = 0; i < bptr->icount; i++, iptr++) {
534 printf("%4d:%4d: ", iptr->line, iptr->flags.bits >> INS_FLAG_ID_SHIFT);
536 show_icmd(jd, iptr, deadcode, irstage);
540 if (irstage >= SHOW_STACK) {
542 show_variable_array(jd, bptr->outvars, bptr->outdepth, irstage);
546 #if defined(ENABLE_DISASSEMBLER)
547 if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) &&
551 u1ptr = (u1 *) (code->mcode + cd->dseglen + bptr->mpc);
553 if (bptr->next != NULL) {
554 for (; u1ptr < (u1 *) (code->mcode + cd->dseglen + bptr->next->mpc);)
559 for (; u1ptr < (u1 *) (code->mcode + code->mcodelength);)
567 #endif /* !defined(NDEBUG) */
570 /* show_icmd *******************************************************************
572 Print the intermediate representation of an instruction.
574 NOTE: Currently this function may only be called after register allocation!
576 *******************************************************************************/
580 #define SHOW_TARGET(target) \
581 if (stage >= SHOW_STACK) { \
582 printf("--> L%03d ", (target).block->nr); \
584 else if (stage >= SHOW_PARSE) { \
585 printf("--> insindex %d (L%03d) ", (target).insindex, \
586 jd->basicblocks[jd->basicblockindex[ \
587 (target).insindex]].nr); \
590 printf("--> insindex %d ", (target).insindex); \
593 #define SHOW_INT_CONST(val) \
594 if (stage >= SHOW_PARSE) { \
595 printf("%d (0x%08x) ", (val), (val)); \
601 #if SIZEOF_VOID_P == 4
602 #define SHOW_LNG_CONST(val) \
603 if (stage >= SHOW_PARSE) \
604 printf("%lld (0x%016llx) ", (val), (val)); \
608 #define SHOW_LNG_CONST(val) \
609 if (stage >= SHOW_PARSE) \
610 printf("%ld (0x%016lx) ", (val), (val)); \
615 #if SIZEOF_VOID_P == 4
616 #define SHOW_ADR_CONST(val) \
617 if (stage >= SHOW_PARSE) \
618 printf("0x%08x ", (ptrint) (val)); \
622 #define SHOW_ADR_CONST(val) \
623 if (stage >= SHOW_PARSE) \
624 printf("0x%016lx ", (ptrint) (val)); \
629 #define SHOW_FLT_CONST(val) \
630 if (stage >= SHOW_PARSE) { \
633 printf("%g (0x%08x) ", (val), v.i); \
639 #if SIZEOF_VOID_P == 4
640 #define SHOW_DBL_CONST(val) \
641 if (stage >= SHOW_PARSE) { \
644 printf("%g (0x%016llx) ", (val), v.l); \
649 #define SHOW_DBL_CONST(val) \
650 if (stage >= SHOW_PARSE) { \
653 printf("%g (0x%016lx) ", (val), v.l); \
659 #define SHOW_INDEX(index) \
660 if (stage >= SHOW_PARSE) { \
661 printf("%d ", index); \
667 #define SHOW_STRING(val) \
668 if (stage >= SHOW_PARSE) { \
670 utf_display_printable_ascii( \
671 javastring_toutf((java_lang_String *)(val), false)); \
678 #define SHOW_CLASSREF_OR_CLASSINFO(c) \
679 if (stage >= SHOW_PARSE) { \
680 if (IS_CLASSREF(c)) \
681 class_classref_print(c.ref); \
683 class_print(c.cls); \
690 #define SHOW_FIELD(fmiref) \
691 if (stage >= SHOW_PARSE) { \
692 field_fieldref_print(fmiref); \
699 #define SHOW_VARIABLE(v) \
700 show_variable(jd, (v), stage)
702 #define SHOW_S1(iptr) \
703 if (stage >= SHOW_STACK) { \
704 SHOW_VARIABLE(iptr->s1.varindex); \
707 #define SHOW_S2(iptr) \
708 if (stage >= SHOW_STACK) { \
709 SHOW_VARIABLE(iptr->sx.s23.s2.varindex); \
712 #define SHOW_S3(iptr) \
713 if (stage >= SHOW_STACK) { \
714 SHOW_VARIABLE(iptr->sx.s23.s3.varindex); \
717 #define SHOW_DST(iptr) \
718 if (stage >= SHOW_STACK) { \
720 SHOW_VARIABLE(iptr->dst.varindex); \
723 #define SHOW_S1_LOCAL(iptr) \
724 if (stage >= SHOW_STACK) { \
725 printf("L%d ", iptr->s1.varindex); \
728 printf("JavaL%d ", iptr->s1.varindex); \
731 #define SHOW_DST_LOCAL(iptr) \
732 if (stage >= SHOW_STACK) { \
733 printf("=> L%d ", iptr->dst.varindex); \
736 printf("=> JavaL%d ", iptr->dst.varindex); \
739 void show_allocation(s4 type, s4 flags, s4 regoff)
741 if (flags & INMEMORY) {
742 printf("M%02d", regoff);
746 #ifdef HAS_ADDRESS_REGISTER_FILE
747 if (type == TYPE_ADR) {
748 printf("R%02d", regoff);
753 if (IS_FLT_DBL_TYPE(type)) {
754 printf("F%02d", regoff);
758 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
759 if (IS_2_WORD_TYPE(type)) {
760 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
761 # if defined(ENABLE_INTRP)
763 printf("%3d/%3d", GET_LOW_REG(regoff),
764 GET_HIGH_REG(regoff));
767 printf("%3s/%3s", regs[GET_LOW_REG(regoff)],
768 regs[GET_HIGH_REG(regoff)]);
770 printf("%3d/%3d", GET_LOW_REG(regoff),
771 GET_HIGH_REG(regoff));
775 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
777 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
778 # if defined(ENABLE_INTRP)
780 printf("%3d", regoff);
783 printf("%3s", regs[regoff]);
785 printf("%3d", regoff);
789 void show_variable(jitdata *jd, s4 index, int stage)
791 show_variable_intern(jd, index, stage);
795 static void show_variable_intern(jitdata *jd, s4 index, int stage)
801 if (index < 0 || index >= jd->vartop) {
802 printf("<INVALID INDEX:%d>", index);
809 case TYPE_INT: type = 'i'; break;
810 case TYPE_LNG: type = 'l'; break;
811 case TYPE_FLT: type = 'f'; break;
812 case TYPE_DBL: type = 'd'; break;
813 case TYPE_ADR: type = 'a'; break;
814 case TYPE_RET: type = 'r'; break;
818 if (index < jd->localcount) {
820 if (v->flags & (PREALLOC | INOUT))
821 printf("<INVALID FLAGS!>");
824 if (v->flags & PREALLOC) {
826 if (v->flags & INOUT)
827 printf("<INVALID FLAGS!>");
829 else if (v->flags & INOUT)
835 printf("%c%c%d", kind, type, index);
837 if (v->flags & SAVEDVAR)
840 if (stage >= SHOW_REGS || (v->flags & PREALLOC)) {
842 show_allocation(v->type, v->flags, v->vv.regoff);
847 static void show_variable_array_intern(jitdata *jd, s4 *vars, int n, int stage,
859 for (i=0; i<n; ++i) {
863 if (vars[i] == UNUSED)
865 else if (javalocals) {
866 nr = (UNUSED - vars[i]) - 1;
867 printf("ret(L%03d)", nr);
870 printf("<INVALID INDEX:%d>", vars[i]);
874 show_variable_intern(jd, vars[i], stage);
879 void show_variable_array(jitdata *jd, s4 *vars, int n, int stage)
881 show_variable_array_intern(jd, vars, n, stage, false);
884 void show_javalocals_array(jitdata *jd, s4 *vars, int n, int stage)
886 show_variable_array_intern(jd, vars, n, stage, true);
889 void show_icmd(jitdata *jd, instruction *iptr, bool deadcode, int stage)
892 branch_target_t *table;
893 lookup_target_t *lookup;
894 constant_FMIref *fmiref;
898 /* get the opcode and the condition */
902 printf("%s ", icmd_table[opcode].name);
904 if (stage < SHOW_PARSE)
910 /* Print the condition for conditional instructions. */
912 /* XXX print condition from flags */
914 if (iptr->flags.bits & INS_FLAG_UNRESOLVED)
915 printf("(UNRESOLVED) ");
925 case ICMD_ARRAYLENGTH:
992 /* binary/const INT */
1001 case ICMD_IXORCONST:
1002 case ICMD_ISHLCONST:
1003 case ICMD_ISHRCONST:
1004 case ICMD_IUSHRCONST:
1005 case ICMD_LSHLCONST:
1006 case ICMD_LSHRCONST:
1007 case ICMD_LUSHRCONST:
1009 SHOW_INT_CONST(iptr->sx.val.i);
1013 /* ?ASTORECONST (trinary/const INT) */
1014 case ICMD_IASTORECONST:
1015 case ICMD_BASTORECONST:
1016 case ICMD_CASTORECONST:
1017 case ICMD_SASTORECONST:
1020 SHOW_INT_CONST(iptr->sx.s23.s3.constval);
1025 SHOW_INT_CONST(iptr->sx.val.i);
1029 /* binary/const LNG */
1030 case ICMD_LADDCONST:
1031 case ICMD_LSUBCONST:
1032 case ICMD_LMULCONST:
1036 case ICMD_LANDCONST:
1038 case ICMD_LXORCONST:
1040 SHOW_LNG_CONST(iptr->sx.val.l);
1044 /* trinary/const LNG (<= pointer size) */
1045 case ICMD_LASTORECONST:
1048 SHOW_ADR_CONST(iptr->sx.s23.s3.constval);
1053 SHOW_LNG_CONST(iptr->sx.val.l);
1059 SHOW_FLT_CONST(iptr->sx.val.f);
1065 SHOW_DBL_CONST(iptr->sx.val.d);
1071 if (iptr->flags.bits & INS_FLAG_CLASS) {
1072 SHOW_ADR_CONST(iptr->sx.val.anyptr);
1073 SHOW_CLASSREF_OR_CLASSINFO(iptr->sx.val.c);
1075 else if (iptr->sx.val.anyptr == NULL) {
1079 SHOW_ADR_CONST(iptr->sx.val.anyptr);
1080 SHOW_STRING(iptr->sx.val.stringconst);
1085 case ICMD_AASTORECONST:
1088 printf("%p ", (void*) iptr->sx.s23.s3.constval);
1091 case ICMD_GETFIELD: /* 1 -> 1 */
1092 case ICMD_PUTFIELD: /* 2 -> 0 */
1093 case ICMD_PUTSTATIC: /* 1 -> 0 */
1094 case ICMD_GETSTATIC: /* 0 -> 1 */
1095 case ICMD_PUTSTATICCONST: /* 0 -> 0 */
1096 case ICMD_PUTFIELDCONST: /* 1 -> 0 */
1097 if (opcode != ICMD_GETSTATIC && opcode != ICMD_PUTSTATICCONST) {
1099 if (opcode == ICMD_PUTFIELD) {
1103 INSTRUCTION_GET_FIELDREF(iptr, fmiref);
1106 if (opcode == ICMD_GETSTATIC || opcode == ICMD_GETFIELD) {
1112 SHOW_S1_LOCAL(iptr);
1113 SHOW_INT_CONST(iptr->sx.val.i);
1114 SHOW_DST_LOCAL(iptr);
1144 SHOW_S1_LOCAL(iptr);
1145 if (stage >= SHOW_STACK) {
1146 printf(" ---> L%03d", iptr->dst.block->nr);
1155 SHOW_S1_LOCAL(iptr);
1165 SHOW_DST_LOCAL(iptr);
1166 if (stage >= SHOW_STACK && iptr->sx.s23.s3.javaindex != UNUSED)
1167 printf(" (javaindex %d)", iptr->sx.s23.s3.javaindex);
1168 if (iptr->flags.bits & INS_FLAG_RETADDR) {
1169 printf(" (retaddr L%03d)", (UNUSED - iptr->sx.s23.s2.retaddrnr) - 1);
1181 case ICMD_ANEWARRAY:
1185 case ICMD_MULTIANEWARRAY:
1186 if (stage >= SHOW_STACK) {
1187 argp = iptr->sx.s23.s2.args;
1188 i = iptr->s1.argcount;
1190 SHOW_VARIABLE(*(argp++));
1194 printf("argcount=%d ", iptr->s1.argcount);
1199 case ICMD_CHECKCAST:
1202 class_classref_or_classinfo_print(iptr->sx.s23.s3.c);
1206 case ICMD_INSTANCEOF:
1211 case ICMD_INLINE_START:
1212 case ICMD_INLINE_END:
1213 #if defined(ENABLE_INLINING)
1215 insinfo_inline *ii = iptr->sx.s23.s3.inlineinfo;
1216 show_inline_info(jd, ii, opcode, stage);
1222 if (stage >= SHOW_STACK) {
1223 argp = iptr->sx.s23.s2.args;
1224 i = iptr->s1.argcount;
1226 if ((iptr->s1.argcount - 1 - i) == iptr->sx.s23.s3.bte->md->paramcount)
1227 printf(" pass-through: ");
1228 SHOW_VARIABLE(*(argp++));
1231 printf("%s ", iptr->sx.s23.s3.bte->cname);
1232 if (iptr->sx.s23.s3.bte->md->returntype.type != TYPE_VOID) {
1237 case ICMD_INVOKEVIRTUAL:
1238 case ICMD_INVOKESPECIAL:
1239 case ICMD_INVOKESTATIC:
1240 case ICMD_INVOKEINTERFACE:
1241 if (stage >= SHOW_STACK) {
1243 INSTRUCTION_GET_METHODDESC(iptr, md);
1244 argp = iptr->sx.s23.s2.args;
1245 i = iptr->s1.argcount;
1247 if ((iptr->s1.argcount - 1 - i) == md->paramcount)
1248 printf(" pass-through: ");
1249 SHOW_VARIABLE(*(argp++));
1252 INSTRUCTION_GET_METHODREF(iptr, fmiref);
1253 method_methodref_print(fmiref);
1254 if (fmiref->parseddesc.md->returntype.type != TYPE_VOID) {
1267 SHOW_INT_CONST(iptr->sx.val.i);
1268 SHOW_TARGET(iptr->dst);
1278 SHOW_LNG_CONST(iptr->sx.val.l);
1279 SHOW_TARGET(iptr->dst);
1283 case ICMD_INLINE_GOTO:
1284 SHOW_TARGET(iptr->dst);
1288 SHOW_TARGET(iptr->sx.s23.s3.jsrtarget);
1293 case ICMD_IFNONNULL:
1295 SHOW_TARGET(iptr->dst);
1298 case ICMD_IF_ICMPEQ:
1299 case ICMD_IF_ICMPNE:
1300 case ICMD_IF_ICMPLT:
1301 case ICMD_IF_ICMPGE:
1302 case ICMD_IF_ICMPGT:
1303 case ICMD_IF_ICMPLE:
1305 case ICMD_IF_LCMPEQ:
1306 case ICMD_IF_LCMPNE:
1307 case ICMD_IF_LCMPLT:
1308 case ICMD_IF_LCMPGE:
1309 case ICMD_IF_LCMPGT:
1310 case ICMD_IF_LCMPLE:
1312 case ICMD_IF_FCMPEQ:
1313 case ICMD_IF_FCMPNE:
1315 case ICMD_IF_FCMPL_LT:
1316 case ICMD_IF_FCMPL_GE:
1317 case ICMD_IF_FCMPL_GT:
1318 case ICMD_IF_FCMPL_LE:
1320 case ICMD_IF_FCMPG_LT:
1321 case ICMD_IF_FCMPG_GE:
1322 case ICMD_IF_FCMPG_GT:
1323 case ICMD_IF_FCMPG_LE:
1325 case ICMD_IF_DCMPEQ:
1326 case ICMD_IF_DCMPNE:
1328 case ICMD_IF_DCMPL_LT:
1329 case ICMD_IF_DCMPL_GE:
1330 case ICMD_IF_DCMPL_GT:
1331 case ICMD_IF_DCMPL_LE:
1333 case ICMD_IF_DCMPG_LT:
1334 case ICMD_IF_DCMPG_GE:
1335 case ICMD_IF_DCMPG_GT:
1336 case ICMD_IF_DCMPG_LE:
1338 case ICMD_IF_ACMPEQ:
1339 case ICMD_IF_ACMPNE:
1342 SHOW_TARGET(iptr->dst);
1345 case ICMD_TABLESWITCH:
1347 table = iptr->dst.table;
1349 i = iptr->sx.s23.s3.tablehigh - iptr->sx.s23.s2.tablelow + 1;
1351 printf("high=%d low=%d count=%d\n", iptr->sx.s23.s3.tablehigh, iptr->sx.s23.s2.tablelow, i);
1353 printf("\t\t%d --> ", (int) (table - iptr->dst.table));
1354 if (stage >= SHOW_STACK) {
1355 printf("L%03d\n", table->block->nr);
1358 printf("insindex %d (L%03d)\n", table->insindex, BLOCK_OF(table->insindex)->nr);
1365 case ICMD_LOOKUPSWITCH:
1368 printf("count=%d, default=", iptr->sx.s23.s2.lookupcount);
1369 if (stage >= SHOW_STACK) {
1370 printf("L%03d\n", iptr->sx.s23.s3.lookupdefault.block->nr);
1373 printf("insindex %d (L%03d)\n", iptr->sx.s23.s3.lookupdefault.insindex, BLOCK_OF(iptr->sx.s23.s3.lookupdefault.insindex)->nr);
1376 lookup = iptr->dst.lookup;
1377 i = iptr->sx.s23.s2.lookupcount;
1379 printf("\t\t%d --> ", lookup->value);
1380 if (stage >= SHOW_STACK) {
1381 printf("L%03d\n", lookup->target.block->nr);
1384 printf("insindex %d (L%03d)\n", lookup->target.insindex, BLOCK_OF(lookup->target.insindex)->nr);
1400 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1401 /* XXX this needs more work */
1403 unresolved_class_debug_dump(iptr->sx.s23.s2.uc, stdout);
1416 #endif /* !defined(NDEBUG) */
1420 * These are local overrides for various environment variables in Emacs.
1421 * Please do not remove this and leave it at the end of the file, where
1422 * Emacs will automagically detect them.
1423 * ---------------------------------------------------------------------
1426 * indent-tabs-mode: t
1430 * vim:noexpandtab:sw=4:ts=4: