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 defined(ENABLE_REPLACEMENT)
349 if (code->rplpoints) {
350 printf("Replacement Points:\n");
351 replace_show_replacement_points(code);
354 #endif /* defined(ENABLE_REPLACEMENT) */
356 #if defined(ENABLE_DISASSEMBLER)
357 /* show code before first basic block */
359 if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd)) {
360 pc = (u1 *) ((ptrint) code->mcode + cd->dseglen);
362 for (; pc < (u1 *) ((ptrint) code->mcode + cd->dseglen + jd->basicblocks[0].mpc);)
369 /* show code of all basic blocks */
371 for (bptr = jd->basicblocks; bptr != NULL; bptr = bptr->next)
372 show_basicblock(jd, bptr, stage);
374 #if defined(ENABLE_DISASSEMBLER)
375 /* show stubs code */
377 if (stage >= SHOW_CODE && opt_showdisassemble && opt_showexceptionstubs) {
378 printf("\nStubs code:\n");
379 printf("Length: %d\n\n", (s4) (code->mcodelength -
380 ((ptrint) cd->dseglen + lastbptr->mpc)));
382 pc = (u1 *) ((ptrint) code->mcode + cd->dseglen + lastbptr->mpc);
384 for (; (ptrint) pc < ((ptrint) code->mcode + code->mcodelength);)
391 LOCK_MONITOR_EXIT(show_global_lock);
393 /* finally flush the output */
397 #endif /* !defined(NDEBUG) */
400 #if !defined(NDEBUG) && defined(ENABLE_INLINING)
401 static void show_inline_info(jitdata *jd, insinfo_inline *ii, s4 opcode, s4 stage)
406 printf("(pt %d+%d+%d st ",
407 ii->throughcount - (ii->stackvarscount - ii->paramcount),
408 ii->stackvarscount - ii->paramcount,
410 show_variable_array(jd, ii->stackvars, ii->stackvarscount, stage);
412 if (opcode == ICMD_INLINE_START || opcode == ICMD_INLINE_END) {
414 jl = (opcode == ICMD_INLINE_START) ? ii->javalocals_start : ii->javalocals_end;
415 n = (opcode == ICMD_INLINE_START) ? ii->method->maxlocals : ii->outer->maxlocals;
416 show_javalocals_array(jd, jl, n, stage);
423 method_print(ii->outer);
427 method_print(ii->method);
429 #endif /* !defined(NDEBUG) && defined(ENABLE_INLINING) */
432 /* show_basicblock *************************************************************
434 Print the intermediate representation of a basic block.
436 NOTE: Currently this function may only be called after register allocation!
438 *******************************************************************************/
441 void show_basicblock(jitdata *jd, basicblock *bptr, int stage)
449 #if defined(ENABLE_DISASSEMBLER)
450 methodinfo *m; /* this is only a dummy */
453 s4 currentlinenumber;
456 /* get required compiler data */
461 if (bptr->flags != BBDELETED) {
462 #if defined(ENABLE_INTRP)
465 irstage = SHOW_PARSE;
470 deadcode = (bptr->flags < BBREACHED);
474 printf("======== %sL%03d ======== %s(flags: %d, bitflags: %01x, next: %d, type: ",
475 #if defined(ENABLE_REPLACEMENT)
476 (bptr->bitflags & BBFLAG_REPLACEMENT) ? "<REPLACE> " :
480 (deadcode && stage >= SHOW_STACK) ? "DEADCODE! " : "",
481 bptr->flags, bptr->bitflags,
482 (bptr->next) ? (bptr->next->nr) : -1);
484 switch (bptr->type) {
496 printf(", icount: %d", bptr->icount);
498 if (irstage >= SHOW_CFG) {
499 printf(", preds: %d [ ", bptr->predecessorcount);
501 for (i = 0; i < bptr->predecessorcount; i++)
502 printf("%d ", bptr->predecessors[i]->nr);
510 printf(" (clone of L%03d)", bptr->original->nr);
512 basicblock *b = bptr->copied_to;
514 printf(" (copied to ");
515 for (; b; b = b->copied_to)
516 printf("L%03d ", b->nr);
523 if (irstage >= SHOW_STACK) {
525 show_variable_array(jd, bptr->invars, bptr->indepth, irstage);
526 printf(" javalocals: ");
527 show_javalocals_array(jd, bptr->javalocals, bptr->method->maxlocals, irstage);
531 #if defined(ENABLE_INLINING)
532 if (bptr->inlineinfo) {
533 printf("inlineinfo: ");
534 show_inline_info(jd, bptr->inlineinfo, -1, irstage);
537 #endif /* defined(ENABLE_INLINING) */
541 for (i = 0; i < bptr->icount; i++, iptr++) {
542 printf("%4d:%4d: ", iptr->line, iptr->flags.bits >> INS_FLAG_ID_SHIFT);
544 show_icmd(jd, iptr, deadcode, irstage);
548 if (irstage >= SHOW_STACK) {
550 show_variable_array(jd, bptr->outvars, bptr->outdepth, irstage);
554 #if defined(ENABLE_DISASSEMBLER)
555 if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) &&
559 pc = (u1 *) (code->mcode + cd->dseglen + bptr->mpc);
562 if (bptr->next != NULL) {
563 for (; pc < (u1 *) (code->mcode + cd->dseglen + bptr->next->mpc);) {
565 dseg_get_linenumber_from_pc(&m, code->entrypoint, pc);
567 if (currentlinenumber != linenumber) {
568 linenumber = currentlinenumber;
569 printf("%4d:\n", linenumber);
576 for (; pc < (u1 *) (code->mcode + code->mcodelength);) {
578 dseg_get_linenumber_from_pc(&m, code->entrypoint, pc);
580 if (currentlinenumber != linenumber) {
581 linenumber = currentlinenumber;
582 printf("%4d:\n", linenumber);
593 #endif /* !defined(NDEBUG) */
596 /* show_icmd *******************************************************************
598 Print the intermediate representation of an instruction.
600 NOTE: Currently this function may only be called after register allocation!
602 *******************************************************************************/
606 #define SHOW_TARGET(target) \
607 if (stage >= SHOW_STACK) { \
608 printf("--> L%03d ", (target).block->nr); \
610 else if (stage >= SHOW_PARSE) { \
611 printf("--> insindex %d (L%03d) ", (target).insindex, \
612 jd->basicblocks[jd->basicblockindex[ \
613 (target).insindex]].nr); \
616 printf("--> insindex %d ", (target).insindex); \
619 #define SHOW_INT_CONST(val) \
620 if (stage >= SHOW_PARSE) { \
621 printf("%d (0x%08x) ", (val), (val)); \
627 #if SIZEOF_VOID_P == 4
628 #define SHOW_LNG_CONST(val) \
629 if (stage >= SHOW_PARSE) \
630 printf("%lld (0x%016llx) ", (val), (val)); \
634 #define SHOW_LNG_CONST(val) \
635 if (stage >= SHOW_PARSE) \
636 printf("%ld (0x%016lx) ", (val), (val)); \
641 #if SIZEOF_VOID_P == 4
642 #define SHOW_ADR_CONST(val) \
643 if (stage >= SHOW_PARSE) \
644 printf("0x%08x ", (ptrint) (val)); \
648 #define SHOW_ADR_CONST(val) \
649 if (stage >= SHOW_PARSE) \
650 printf("0x%016lx ", (ptrint) (val)); \
655 #define SHOW_FLT_CONST(val) \
656 if (stage >= SHOW_PARSE) { \
659 printf("%g (0x%08x) ", (val), v.i); \
665 #if SIZEOF_VOID_P == 4
666 #define SHOW_DBL_CONST(val) \
667 if (stage >= SHOW_PARSE) { \
670 printf("%g (0x%016llx) ", (val), v.l); \
675 #define SHOW_DBL_CONST(val) \
676 if (stage >= SHOW_PARSE) { \
679 printf("%g (0x%016lx) ", (val), v.l); \
685 #define SHOW_INDEX(index) \
686 if (stage >= SHOW_PARSE) { \
687 printf("%d ", index); \
693 #define SHOW_STRING(val) \
694 if (stage >= SHOW_PARSE) { \
696 utf_display_printable_ascii( \
697 javastring_toutf((java_lang_String *)(val), false)); \
704 #define SHOW_CLASSREF_OR_CLASSINFO(c) \
705 if (stage >= SHOW_PARSE) { \
706 if (IS_CLASSREF(c)) \
707 class_classref_print(c.ref); \
709 class_print(c.cls); \
716 #define SHOW_FIELD(fmiref) \
717 if (stage >= SHOW_PARSE) { \
718 field_fieldref_print(fmiref); \
725 #define SHOW_VARIABLE(v) \
726 show_variable(jd, (v), stage)
728 #define SHOW_S1(iptr) \
729 if (stage >= SHOW_STACK) { \
730 SHOW_VARIABLE(iptr->s1.varindex); \
733 #define SHOW_S2(iptr) \
734 if (stage >= SHOW_STACK) { \
735 SHOW_VARIABLE(iptr->sx.s23.s2.varindex); \
738 #define SHOW_S3(iptr) \
739 if (stage >= SHOW_STACK) { \
740 SHOW_VARIABLE(iptr->sx.s23.s3.varindex); \
743 #define SHOW_DST(iptr) \
744 if (stage >= SHOW_STACK) { \
746 SHOW_VARIABLE(iptr->dst.varindex); \
749 #define SHOW_S1_LOCAL(iptr) \
750 if (stage >= SHOW_STACK) { \
751 printf("L%d ", iptr->s1.varindex); \
754 printf("JavaL%d ", iptr->s1.varindex); \
757 #define SHOW_DST_LOCAL(iptr) \
758 if (stage >= SHOW_STACK) { \
759 printf("=> L%d ", iptr->dst.varindex); \
762 printf("=> JavaL%d ", iptr->dst.varindex); \
765 void show_allocation(s4 type, s4 flags, s4 regoff)
767 if (type == TYPE_RET) {
772 if (flags & INMEMORY) {
773 printf("M%02d", regoff);
777 #ifdef HAS_ADDRESS_REGISTER_FILE
778 if (type == TYPE_ADR) {
779 printf("R%02d", regoff);
784 if (IS_FLT_DBL_TYPE(type)) {
785 printf("F%02d", regoff);
789 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
790 if (IS_2_WORD_TYPE(type)) {
791 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
792 # if defined(ENABLE_INTRP)
794 printf("%3d/%3d", GET_LOW_REG(regoff),
795 GET_HIGH_REG(regoff));
798 printf("%3s/%3s", regs[GET_LOW_REG(regoff)],
799 regs[GET_HIGH_REG(regoff)]);
801 printf("%3d/%3d", GET_LOW_REG(regoff),
802 GET_HIGH_REG(regoff));
806 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
808 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
809 # if defined(ENABLE_INTRP)
811 printf("%3d", regoff);
814 printf("%3s", regs[regoff]);
816 printf("%3d", regoff);
820 void show_variable(jitdata *jd, s4 index, int stage)
822 show_variable_intern(jd, index, stage);
826 static void show_variable_intern(jitdata *jd, s4 index, int stage)
832 if (index < 0 || index >= jd->vartop) {
833 printf("<INVALID INDEX:%d>", index);
840 case TYPE_INT: type = 'i'; break;
841 case TYPE_LNG: type = 'l'; break;
842 case TYPE_FLT: type = 'f'; break;
843 case TYPE_DBL: type = 'd'; break;
844 case TYPE_ADR: type = 'a'; break;
845 case TYPE_RET: type = 'r'; break;
849 if (index < jd->localcount) {
851 if (v->flags & (PREALLOC | INOUT))
852 printf("<INVALID FLAGS!>");
855 if (v->flags & PREALLOC) {
857 if (v->flags & INOUT) {
858 /* PREALLOC is used to avoid allocation of TYPE_RET */
859 if (v->type == TYPE_RET)
862 printf("<INVALID FLAGS!>");
865 else if (v->flags & INOUT)
871 printf("%c%c%d", kind, type, index);
873 if (v->flags & SAVEDVAR)
876 if (stage >= SHOW_REGS || (v->flags & PREALLOC)) {
878 show_allocation(v->type, v->flags, v->vv.regoff);
882 if (v->type == TYPE_RET && (v->flags & PREALLOC)) {
883 printf("(L%03d)", v->vv.retaddr->nr);
887 static void show_variable_array_intern(jitdata *jd, s4 *vars, int n, int stage,
899 for (i=0; i<n; ++i) {
903 if (vars[i] == UNUSED)
905 else if (javalocals) {
906 nr = (UNUSED - vars[i]) - 1;
907 printf("ret(L%03d)", nr);
910 printf("<INVALID INDEX:%d>", vars[i]);
914 show_variable_intern(jd, vars[i], stage);
919 void show_variable_array(jitdata *jd, s4 *vars, int n, int stage)
921 show_variable_array_intern(jd, vars, n, stage, false);
924 void show_javalocals_array(jitdata *jd, s4 *vars, int n, int stage)
926 show_variable_array_intern(jd, vars, n, stage, true);
929 void show_icmd(jitdata *jd, instruction *iptr, bool deadcode, int stage)
932 branch_target_t *table;
933 lookup_target_t *lookup;
934 constant_FMIref *fmiref;
938 /* get the opcode and the condition */
942 printf("%s ", icmd_table[opcode].name);
944 if (stage < SHOW_PARSE)
950 /* Print the condition for conditional instructions. */
952 /* XXX print condition from flags */
954 if (iptr->flags.bits & INS_FLAG_UNRESOLVED)
955 printf("(UNRESOLVED) ");
965 case ICMD_ARRAYLENGTH:
1032 /* binary/const INT */
1033 case ICMD_IADDCONST:
1034 case ICMD_ISUBCONST:
1035 case ICMD_IMULCONST:
1039 case ICMD_IANDCONST:
1041 case ICMD_IXORCONST:
1042 case ICMD_ISHLCONST:
1043 case ICMD_ISHRCONST:
1044 case ICMD_IUSHRCONST:
1045 case ICMD_LSHLCONST:
1046 case ICMD_LSHRCONST:
1047 case ICMD_LUSHRCONST:
1049 SHOW_INT_CONST(iptr->sx.val.i);
1053 /* ?ASTORECONST (trinary/const INT) */
1054 case ICMD_IASTORECONST:
1055 case ICMD_BASTORECONST:
1056 case ICMD_CASTORECONST:
1057 case ICMD_SASTORECONST:
1060 SHOW_INT_CONST(iptr->sx.s23.s3.constval);
1065 SHOW_INT_CONST(iptr->sx.val.i);
1069 /* binary/const LNG */
1070 case ICMD_LADDCONST:
1071 case ICMD_LSUBCONST:
1072 case ICMD_LMULCONST:
1076 case ICMD_LANDCONST:
1078 case ICMD_LXORCONST:
1080 SHOW_LNG_CONST(iptr->sx.val.l);
1084 /* trinary/const LNG (<= pointer size) */
1085 case ICMD_LASTORECONST:
1088 SHOW_ADR_CONST(iptr->sx.s23.s3.constval);
1093 SHOW_LNG_CONST(iptr->sx.val.l);
1099 SHOW_FLT_CONST(iptr->sx.val.f);
1105 SHOW_DBL_CONST(iptr->sx.val.d);
1111 if (iptr->flags.bits & INS_FLAG_CLASS) {
1112 SHOW_ADR_CONST(iptr->sx.val.anyptr);
1113 SHOW_CLASSREF_OR_CLASSINFO(iptr->sx.val.c);
1115 else if (iptr->sx.val.anyptr == NULL) {
1119 SHOW_ADR_CONST(iptr->sx.val.anyptr);
1120 SHOW_STRING(iptr->sx.val.stringconst);
1125 case ICMD_AASTORECONST:
1128 printf("%p ", (void*) iptr->sx.s23.s3.constval);
1131 case ICMD_GETFIELD: /* 1 -> 1 */
1132 case ICMD_PUTFIELD: /* 2 -> 0 */
1133 case ICMD_PUTSTATIC: /* 1 -> 0 */
1134 case ICMD_GETSTATIC: /* 0 -> 1 */
1135 case ICMD_PUTSTATICCONST: /* 0 -> 0 */
1136 case ICMD_PUTFIELDCONST: /* 1 -> 0 */
1137 if (opcode != ICMD_GETSTATIC && opcode != ICMD_PUTSTATICCONST) {
1139 if (opcode == ICMD_PUTFIELD) {
1143 INSTRUCTION_GET_FIELDREF(iptr, fmiref);
1146 if (opcode == ICMD_GETSTATIC || opcode == ICMD_GETFIELD) {
1152 SHOW_S1_LOCAL(iptr);
1153 SHOW_INT_CONST(iptr->sx.val.i);
1154 SHOW_DST_LOCAL(iptr);
1184 SHOW_S1_LOCAL(iptr);
1185 if (stage >= SHOW_STACK) {
1186 printf(" ---> L%03d", iptr->dst.block->nr);
1195 SHOW_S1_LOCAL(iptr);
1205 SHOW_DST_LOCAL(iptr);
1206 if (stage >= SHOW_STACK && iptr->sx.s23.s3.javaindex != UNUSED)
1207 printf(" (javaindex %d)", iptr->sx.s23.s3.javaindex);
1208 if (iptr->flags.bits & INS_FLAG_RETADDR) {
1209 printf(" (retaddr L%03d)", (UNUSED - iptr->sx.s23.s2.retaddrnr) - 1);
1221 case ICMD_ANEWARRAY:
1225 case ICMD_MULTIANEWARRAY:
1226 if (stage >= SHOW_STACK) {
1227 argp = iptr->sx.s23.s2.args;
1228 i = iptr->s1.argcount;
1230 SHOW_VARIABLE(*(argp++));
1234 printf("argcount=%d ", iptr->s1.argcount);
1239 case ICMD_CHECKCAST:
1242 class_classref_or_classinfo_print(iptr->sx.s23.s3.c);
1246 case ICMD_INSTANCEOF:
1251 case ICMD_INLINE_START:
1252 case ICMD_INLINE_END:
1253 case ICMD_INLINE_BODY:
1254 #if defined(ENABLE_INLINING)
1256 insinfo_inline *ii = iptr->sx.s23.s3.inlineinfo;
1257 show_inline_info(jd, ii, opcode, stage);
1263 if (stage >= SHOW_STACK) {
1264 argp = iptr->sx.s23.s2.args;
1265 i = iptr->s1.argcount;
1267 if ((iptr->s1.argcount - 1 - i) == iptr->sx.s23.s3.bte->md->paramcount)
1268 printf(" pass-through: ");
1269 SHOW_VARIABLE(*(argp++));
1272 printf("%s ", iptr->sx.s23.s3.bte->cname);
1273 if (iptr->sx.s23.s3.bte->md->returntype.type != TYPE_VOID) {
1278 case ICMD_INVOKEVIRTUAL:
1279 case ICMD_INVOKESPECIAL:
1280 case ICMD_INVOKESTATIC:
1281 case ICMD_INVOKEINTERFACE:
1282 if (stage >= SHOW_STACK) {
1284 INSTRUCTION_GET_METHODDESC(iptr, md);
1285 argp = iptr->sx.s23.s2.args;
1286 i = iptr->s1.argcount;
1288 if ((iptr->s1.argcount - 1 - i) == md->paramcount)
1289 printf(" pass-through: ");
1290 SHOW_VARIABLE(*(argp++));
1293 INSTRUCTION_GET_METHODREF(iptr, fmiref);
1294 method_methodref_print(fmiref);
1295 if (fmiref->parseddesc.md->returntype.type != TYPE_VOID) {
1308 SHOW_INT_CONST(iptr->sx.val.i);
1309 SHOW_TARGET(iptr->dst);
1319 SHOW_LNG_CONST(iptr->sx.val.l);
1320 SHOW_TARGET(iptr->dst);
1324 SHOW_TARGET(iptr->dst);
1328 SHOW_TARGET(iptr->sx.s23.s3.jsrtarget);
1333 case ICMD_IFNONNULL:
1335 SHOW_TARGET(iptr->dst);
1338 case ICMD_IF_ICMPEQ:
1339 case ICMD_IF_ICMPNE:
1340 case ICMD_IF_ICMPLT:
1341 case ICMD_IF_ICMPGE:
1342 case ICMD_IF_ICMPGT:
1343 case ICMD_IF_ICMPLE:
1345 case ICMD_IF_LCMPEQ:
1346 case ICMD_IF_LCMPNE:
1347 case ICMD_IF_LCMPLT:
1348 case ICMD_IF_LCMPGE:
1349 case ICMD_IF_LCMPGT:
1350 case ICMD_IF_LCMPLE:
1352 case ICMD_IF_FCMPEQ:
1353 case ICMD_IF_FCMPNE:
1355 case ICMD_IF_FCMPL_LT:
1356 case ICMD_IF_FCMPL_GE:
1357 case ICMD_IF_FCMPL_GT:
1358 case ICMD_IF_FCMPL_LE:
1360 case ICMD_IF_FCMPG_LT:
1361 case ICMD_IF_FCMPG_GE:
1362 case ICMD_IF_FCMPG_GT:
1363 case ICMD_IF_FCMPG_LE:
1365 case ICMD_IF_DCMPEQ:
1366 case ICMD_IF_DCMPNE:
1368 case ICMD_IF_DCMPL_LT:
1369 case ICMD_IF_DCMPL_GE:
1370 case ICMD_IF_DCMPL_GT:
1371 case ICMD_IF_DCMPL_LE:
1373 case ICMD_IF_DCMPG_LT:
1374 case ICMD_IF_DCMPG_GE:
1375 case ICMD_IF_DCMPG_GT:
1376 case ICMD_IF_DCMPG_LE:
1378 case ICMD_IF_ACMPEQ:
1379 case ICMD_IF_ACMPNE:
1382 SHOW_TARGET(iptr->dst);
1385 case ICMD_TABLESWITCH:
1387 table = iptr->dst.table;
1389 i = iptr->sx.s23.s3.tablehigh - iptr->sx.s23.s2.tablelow + 1;
1391 printf("high=%d low=%d count=%d\n", iptr->sx.s23.s3.tablehigh, iptr->sx.s23.s2.tablelow, i);
1393 printf("\t\t%d --> ", (int) (table - iptr->dst.table));
1394 if (stage >= SHOW_STACK) {
1395 printf("L%03d\n", table->block->nr);
1398 printf("insindex %d (L%03d)\n", table->insindex, BLOCK_OF(table->insindex)->nr);
1405 case ICMD_LOOKUPSWITCH:
1408 printf("count=%d, default=", iptr->sx.s23.s2.lookupcount);
1409 if (stage >= SHOW_STACK) {
1410 printf("L%03d\n", iptr->sx.s23.s3.lookupdefault.block->nr);
1413 printf("insindex %d (L%03d)\n", iptr->sx.s23.s3.lookupdefault.insindex, BLOCK_OF(iptr->sx.s23.s3.lookupdefault.insindex)->nr);
1416 lookup = iptr->dst.lookup;
1417 i = iptr->sx.s23.s2.lookupcount;
1419 printf("\t\t%d --> ", lookup->value);
1420 if (stage >= SHOW_STACK) {
1421 printf("L%03d\n", lookup->target.block->nr);
1424 printf("insindex %d (L%03d)\n", lookup->target.insindex, BLOCK_OF(lookup->target.insindex)->nr);
1440 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1441 /* XXX this needs more work */
1443 unresolved_class_debug_dump(iptr->sx.s23.s2.uc, stdout);
1456 #endif /* !defined(NDEBUG) */
1460 * These are local overrides for various environment variables in Emacs.
1461 * Please do not remove this and leave it at the end of the file, where
1462 * Emacs will automagically detect them.
1463 * ---------------------------------------------------------------------
1466 * indent-tabs-mode: t
1470 * vim:noexpandtab:sw=4:ts=4: