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
29 Changes: Edwin Steiner
43 #include "mm/memory.h"
44 #include "vm/global.h"
45 #include "vm/options.h"
46 #include "vm/builtin.h"
47 #include "vm/stringlocal.h"
48 #include "vm/jit/jit.h"
49 #include "vm/jit/show.h"
50 #include "vm/jit/disass.h"
52 #if defined(ENABLE_THREADS)
53 #include "threads/native/lock.h"
56 /* global variables ***********************************************************/
58 #if defined(ENABLE_THREADS) && !defined(NDEBUG)
59 static java_objectheader *show_global_lock;
63 /* show_init *******************************************************************
65 Initialized the show subsystem (called by jit_init).
67 *******************************************************************************/
72 #if defined(ENABLE_THREADS)
73 /* initialize the show lock */
75 show_global_lock = NEW(java_objectheader);
77 lock_init_object_lock(show_global_lock);
87 /* show_print_stack ************************************************************
89 Print the stack representation starting with the given top stackptr.
91 NOTE: Currently this function may only be called after register allocation!
93 *******************************************************************************/
96 static void show_print_stack(codegendata *cd, stackptr s)
108 j = cd->maxstack - i;
114 if (s->flags & SAVEDVAR)
115 switch (s->varkind) {
117 if (s->flags & INMEMORY)
118 printf(" M%02d", s->regoff);
119 #ifdef HAS_ADDRESS_REGISTER_FILE
120 else if (s->type == TYPE_ADR)
121 printf(" R%02d", s->regoff);
123 else if (IS_FLT_DBL_TYPE(s->type))
124 printf(" F%02d", s->regoff);
126 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
127 if (IS_2_WORD_TYPE(s->type)) {
128 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
129 # if defined(ENABLE_INTRP)
131 printf(" %3d/%3d", GET_LOW_REG(s->regoff),
132 GET_HIGH_REG(s->regoff));
135 printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
136 regs[GET_HIGH_REG(s->regoff)]);
138 printf(" %3d/%3d", GET_LOW_REG(s->regoff),
139 GET_HIGH_REG(s->regoff));
143 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
145 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
146 # if defined(ENABLE_INTRP)
148 printf(" %3d", s->regoff);
151 printf(" %3s", regs[s->regoff]);
153 printf(" %3d", s->regoff);
159 printf(" I%02d", s->varnum);
162 printf(" L%02d", s->varnum);
165 if (s->varnum == -1) {
167 /* varkind ARGVAR "misused for this special case */
170 else /* "normal" Argvar */
171 printf(" A%02d", s->varnum);
177 switch (s->varkind) {
179 if (s->flags & INMEMORY)
180 printf(" m%02d", s->regoff);
181 #ifdef HAS_ADDRESS_REGISTER_FILE
182 else if (s->type == TYPE_ADR)
183 printf(" r%02d", s->regoff);
185 else if (IS_FLT_DBL_TYPE(s->type))
186 printf(" f%02d", s->regoff);
188 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
189 if (IS_2_WORD_TYPE(s->type)) {
190 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
191 # if defined(ENABLE_INTRP)
193 printf(" %3d/%3d", GET_LOW_REG(s->regoff),
194 GET_HIGH_REG(s->regoff));
197 printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
198 regs[GET_HIGH_REG(s->regoff)]);
200 printf(" %3d/%3d", GET_LOW_REG(s->regoff),
201 GET_HIGH_REG(s->regoff));
205 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
207 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
208 # if defined(ENABLE_INTRP)
210 printf(" %3d", s->regoff);
213 printf(" %3s", regs[s->regoff]);
215 printf(" %3d", s->regoff);
221 printf(" i%02d", s->varnum);
224 printf(" l%02d", s->varnum);
227 if (s->varnum == -1) {
229 /* varkind ARGVAR "misused for this special case */
232 else /* "normal" Argvar */
233 printf(" a%02d", s->varnum);
241 #endif /* !defined(NDEBUG) */
245 static void print_reg(stackptr s) {
247 if (s->flags & SAVEDVAR)
248 switch (s->varkind) {
250 if (s->flags & INMEMORY)
251 printf(" tm%02d", s->regoff);
253 printf(" tr%02d", s->regoff);
256 printf(" s %02d", s->varnum);
259 printf(" l %02d", s->varnum);
262 printf(" a %02d", s->varnum);
265 printf(" ! %02d", s->varnum);
268 switch (s->varkind) {
270 if (s->flags & INMEMORY)
271 printf(" Tm%02d", s->regoff);
273 printf(" Tr%02d", s->regoff);
276 printf(" S %02d", s->varnum);
279 printf(" L %02d", s->varnum);
282 printf(" A %02d", s->varnum);
285 printf(" ? %02d", s->varnum);
296 static char *jit_type[] = {
306 /* show_method *****************************************************************
308 Print the intermediate representation of a method.
310 NOTE: Currently this function may only be called after register allocation!
312 *******************************************************************************/
315 void new_show_method(jitdata *jd, int stage)
326 /* get required compiler data */
333 #if defined(ENABLE_THREADS)
334 /* We need to enter a lock here, since the binutils disassembler
335 is not reentrant-able and we could not read functions printed
338 builtin_monitorenter(show_global_lock);
345 printf("\n(NEW INSTRUCTION FORMAT)\n");
346 printf("\nBasic blocks: %d\n", jd->new_basicblockcount);
347 printf("Max locals: %d\n", cd->maxlocals);
348 printf("Max stack: %d\n", cd->maxstack);
349 printf("Line number table length: %d\n", m->linenumbercount);
351 if (stage >= SHOW_PARSE) {
352 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
353 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
354 printf(" L%03d ... ", ex->start->debug_nr );
355 printf("L%03d = ", ex->end->debug_nr);
356 printf("L%03d", ex->handler->debug_nr);
357 printf(" (catchtype: ");
358 if (ex->catchtype.any)
359 if (IS_CLASSREF(ex->catchtype))
360 utf_display_printable_ascii_classname(ex->catchtype.ref->name);
362 utf_display_printable_ascii_classname(ex->catchtype.cls->name);
369 if (stage >= SHOW_PARSE && rd) {
370 printf("Local Table:\n");
371 for (i = 0; i < cd->maxlocals; i++) {
374 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
375 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
376 # if defined(ENABLE_INTRP)
379 if (rd->locals[i][j].type >= 0) {
380 printf(" (%s) ", jit_type[j]);
381 if (stage >= SHOW_REGS) {
382 if (rd->locals[i][j].flags & INMEMORY)
383 printf("m%2d", rd->locals[i][j].regoff);
384 # ifdef HAS_ADDRESS_REGISTER_FILE
385 else if (j == TYPE_ADR)
386 printf("r%02d", rd->locals[i][j].regoff);
388 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
389 printf("f%02d", rd->locals[i][j].regoff);
391 # if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
392 if (IS_2_WORD_TYPE(j))
394 regs[GET_LOW_REG(rd->locals[i][j].regoff)],
395 regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
398 printf("%3s", regs[rd->locals[i][j].regoff]);
402 # if defined(ENABLE_INTRP)
406 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
413 if (stage >= SHOW_STACK && rd) {
414 #if defined(ENABLE_LSRA)
417 #if defined(ENABLE_INTRP)
420 printf("Interface Table:\n");
421 for (i = 0; i < cd->maxstack; i++) {
422 if ((rd->interfaces[i][0].type >= 0) ||
423 (rd->interfaces[i][1].type >= 0) ||
424 (rd->interfaces[i][2].type >= 0) ||
425 (rd->interfaces[i][3].type >= 0) ||
426 (rd->interfaces[i][4].type >= 0)) {
429 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
430 # if defined(ENABLE_INTRP)
433 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
434 if (rd->interfaces[i][j].type >= 0) {
435 printf(" (%s) ", jit_type[j]);
436 if (stage >= SHOW_REGS) {
437 if (rd->interfaces[i][j].flags & SAVEDVAR) {
438 if (rd->interfaces[i][j].flags & INMEMORY)
439 printf("M%2d", rd->interfaces[i][j].regoff);
440 #ifdef HAS_ADDRESS_REGISTER_FILE
441 else if (j == TYPE_ADR)
442 printf("R%02d", rd->interfaces[i][j].regoff);
444 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
445 printf("F%02d", rd->interfaces[i][j].regoff);
447 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
448 if (IS_2_WORD_TYPE(j))
450 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
451 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
454 printf("%3s",regs[rd->interfaces[i][j].regoff]);
458 if (rd->interfaces[i][j].flags & INMEMORY)
459 printf("m%2d", rd->interfaces[i][j].regoff);
460 #ifdef HAS_ADDRESS_REGISTER_FILE
461 else if (j == TYPE_ADR)
462 printf("r%02d", rd->interfaces[i][j].regoff);
464 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
465 printf("f%02d", rd->interfaces[i][j].regoff);
467 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
468 if (IS_2_WORD_TYPE(j))
470 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
471 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
474 printf("%3s",regs[rd->interfaces[i][j].regoff]);
481 # if defined(ENABLE_INTRP)
484 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
490 #if defined(ENABLE_INTRP)
493 #if defined(ENABLE_LSRA)
496 } /* if >= SHOW_STACK */
498 if (code->rplpoints) {
499 printf("Replacement Points:\n");
500 replace_show_replacement_points(code);
504 #if defined(ENABLE_DISASSEMBLER)
505 /* show code before first basic block */
507 if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd)) {
508 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen);
510 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + jd->new_basicblocks[0].mpc);)
517 /* show code of all basic blocks */
519 for (bptr = jd->new_basicblocks; bptr != NULL; bptr = bptr->next)
520 new_show_basicblock(jd, bptr, stage);
522 #if defined(ENABLE_DISASSEMBLER)
523 /* show stubs code */
525 if (stage >= SHOW_CODE && opt_showdisassemble && opt_showexceptionstubs) {
526 printf("\nException stubs code:\n");
527 printf("Length: %d\n\n", (s4) (code->mcodelength -
528 ((ptrint) cd->dseglen +
529 jd->new_basicblocks[jd->new_basicblockcount].mpc)));
531 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen +
532 jd->new_basicblocks[jd->new_basicblockcount].mpc);
534 for (; (ptrint) u1ptr < ((ptrint) code->mcode + code->mcodelength);)
541 #if defined(ENABLE_THREADS)
542 builtin_monitorexit(show_global_lock);
545 /* finally flush the output */
549 #endif /* !defined(NDEBUG) */
552 void show_method(jitdata *jd)
563 /* get required compiler data */
570 #if defined(ENABLE_THREADS)
571 /* We need to enter a lock here, since the binutils disassembler
572 is not reentrant-able and we could not read functions printed
575 builtin_monitorenter(show_global_lock);
582 printf("\nBasic blocks: %d\n", m->basicblockcount);
583 printf("Max locals: %d\n", cd->maxlocals);
584 printf("Max stack: %d\n", cd->maxstack);
585 printf("Line number table length: %d\n", m->linenumbercount);
587 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
588 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
589 printf(" L%03d ... ", ex->start->debug_nr );
590 printf("L%03d = ", ex->end->debug_nr);
591 printf("L%03d", ex->handler->debug_nr);
592 printf(" (catchtype: ");
593 if (ex->catchtype.any)
594 if (IS_CLASSREF(ex->catchtype))
595 utf_display_printable_ascii_classname(ex->catchtype.ref->name);
597 utf_display_printable_ascii_classname(ex->catchtype.cls->name);
603 printf("Local Table:\n");
604 for (i = 0; i < cd->maxlocals; i++) {
607 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
608 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
609 # if defined(ENABLE_INTRP)
612 if (rd->locals[i][j].type >= 0) {
613 printf(" (%s) ", jit_type[j]);
614 if (rd->locals[i][j].flags & INMEMORY)
615 printf("m%2d", rd->locals[i][j].regoff);
616 # ifdef HAS_ADDRESS_REGISTER_FILE
617 else if (j == TYPE_ADR)
618 printf("r%02d", rd->locals[i][j].regoff);
620 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
621 printf("f%02d", rd->locals[i][j].regoff);
623 # if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
624 if (IS_2_WORD_TYPE(j))
626 regs[GET_LOW_REG(rd->locals[i][j].regoff)],
627 regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
630 printf("%3s", regs[rd->locals[i][j].regoff]);
633 # if defined(ENABLE_INTRP)
637 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
643 #if defined(ENABLE_LSRA)
646 #if defined(ENABLE_INTRP)
649 printf("Interface Table:\n");
650 for (i = 0; i < cd->maxstack; i++) {
651 if ((rd->interfaces[i][0].type >= 0) ||
652 (rd->interfaces[i][1].type >= 0) ||
653 (rd->interfaces[i][2].type >= 0) ||
654 (rd->interfaces[i][3].type >= 0) ||
655 (rd->interfaces[i][4].type >= 0)) {
658 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
659 # if defined(ENABLE_INTRP)
662 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
663 if (rd->interfaces[i][j].type >= 0) {
664 printf(" (%s) ", jit_type[j]);
665 if (rd->interfaces[i][j].flags & SAVEDVAR) {
666 if (rd->interfaces[i][j].flags & INMEMORY)
667 printf("M%2d", rd->interfaces[i][j].regoff);
668 #ifdef HAS_ADDRESS_REGISTER_FILE
669 else if (j == TYPE_ADR)
670 printf("R%02d", rd->interfaces[i][j].regoff);
672 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
673 printf("F%02d", rd->interfaces[i][j].regoff);
675 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
676 if (IS_2_WORD_TYPE(j))
678 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
679 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
682 printf("%3s",regs[rd->interfaces[i][j].regoff]);
686 if (rd->interfaces[i][j].flags & INMEMORY)
687 printf("m%2d", rd->interfaces[i][j].regoff);
688 #ifdef HAS_ADDRESS_REGISTER_FILE
689 else if (j == TYPE_ADR)
690 printf("r%02d", rd->interfaces[i][j].regoff);
692 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
693 printf("f%02d", rd->interfaces[i][j].regoff);
695 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
696 if (IS_2_WORD_TYPE(j))
698 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
699 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
702 printf("%3s",regs[rd->interfaces[i][j].regoff]);
708 # if defined(ENABLE_INTRP)
711 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
717 #if defined(ENABLE_INTRP)
720 #if defined(ENABLE_LSRA)
724 if (code->rplpoints) {
725 printf("Replacement Points:\n");
726 replace_show_replacement_points(code);
730 #if defined(ENABLE_DISASSEMBLER)
731 /* show code before first basic block */
733 if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd)) {
734 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen);
736 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + m->basicblocks[0].mpc);)
743 /* show code of all basic blocks */
745 for (bptr = m->basicblocks; bptr != NULL; bptr = bptr->next)
746 show_basicblock(jd, bptr);
748 #if defined(ENABLE_DISASSEMBLER)
749 /* show stubs code */
751 if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) && opt_showexceptionstubs) {
752 printf("\nException stubs code:\n");
753 printf("Length: %d\n\n", (s4) (code->mcodelength -
754 ((ptrint) cd->dseglen +
755 m->basicblocks[m->basicblockcount].mpc)));
757 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen +
758 m->basicblocks[m->basicblockcount].mpc);
760 for (; (ptrint) u1ptr < ((ptrint) code->mcode + code->mcodelength);)
767 #if defined(ENABLE_THREADS)
768 builtin_monitorexit(show_global_lock);
771 /* finally flush the output */
775 #endif /* !defined(NDEBUG) */
778 /* show_basicblock *************************************************************
780 Print the intermediate representation of a basic block.
782 NOTE: Currently this function may only be called after register allocation!
784 *******************************************************************************/
787 void new_show_basicblock(jitdata *jd, basicblock *bptr, int stage)
794 new_instruction *iptr;
797 /* get required compiler data */
803 if (bptr->flags != BBDELETED) {
804 deadcode = bptr->flags <= BBREACHED;
806 printf("======== %sL%03d ======== (flags: %d, bitflags: %01x, next: %d, type: ",
807 (bptr->bitflags & BBFLAG_REPLACEMENT) ? "<REPLACE> " : "",
808 bptr->debug_nr, bptr->flags, bptr->bitflags,
809 (bptr->next) ? (bptr->next->debug_nr) : -1);
811 switch (bptr->type) {
823 printf(", instruction count: %d, predecessors: %d):\n",
824 bptr->icount, bptr->pre_count);
826 iptr = /*XXX*/ (new_instruction *) bptr->iinstr;
828 for (i = 0; i < bptr->icount; i++, iptr++) {
829 printf("%4d: ", iptr->line);
831 new_show_icmd(jd, iptr, deadcode, stage);
835 #if defined(ENABLE_DISASSEMBLER)
836 if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) &&
839 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->mpc);
841 if (bptr->next != NULL) {
842 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->next->mpc);)
847 for (; u1ptr < (u1 *) ((ptrint) code->mcode + code->mcodelength);)
855 #endif /* !defined(NDEBUG) */
858 void show_basicblock(jitdata *jd, basicblock *bptr)
868 /* get required compiler data */
874 if (bptr->flags != BBDELETED) {
875 deadcode = bptr->flags <= BBREACHED;
880 for (j = cd->maxstack; j > 0; j--)
883 show_print_stack(cd, bptr->instack);
885 printf("] %sL%03d(flags: %d, bitflags: %01x, next: %d, type: ",
886 (bptr->bitflags & BBFLAG_REPLACEMENT) ? "<REPLACE> " : "",
887 bptr->debug_nr, bptr->flags, bptr->bitflags,
888 (bptr->next) ? (bptr->next->debug_nr) : -1);
890 switch (bptr->type) {
902 printf(", instruction count: %d, predecessors: %d):\n",
903 bptr->icount, bptr->pre_count);
907 for (i = 0; i < bptr->icount; i++, iptr++) {
911 for (j = cd->maxstack; j > 0; j--)
914 show_print_stack(cd, iptr->dst);
916 printf("] %5d (line: %5d) ", i, iptr->line);
918 show_icmd(iptr, deadcode);
922 #if defined(ENABLE_DISASSEMBLER)
923 if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) && (!deadcode)) {
925 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->mpc);
927 if (bptr->next != NULL) {
928 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->next->mpc);)
933 for (; u1ptr < (u1 *) ((ptrint) code->mcode + code->mcodelength);)
941 #endif /* !defined(NDEBUG) */
944 /* show_icmd *******************************************************************
946 Print the intermediate representation of an instruction.
948 NOTE: Currently this function may only be called after register allocation!
950 *******************************************************************************/
954 #define SHOW_TARGET(target) \
955 if (stage >= SHOW_STACK) { \
956 printf("--> L%03d ", (target).block->debug_nr); \
958 else if (stage >= SHOW_PARSE) { \
959 printf("--> insindex %d (L%03d) ", (target).insindex, \
960 jd->new_basicblocks[jd->new_basicblockindex[ \
961 (target).insindex]].debug_nr); \
964 printf("--> insindex %d ", (target).insindex); \
967 #define SHOW_INT_CONST(val) \
968 if (stage >= SHOW_PARSE) { \
969 printf("%ld ", (long) (val)); \
975 #define SHOW_LNG_CONST(val) \
976 if (stage >= SHOW_PARSE) { \
977 printf("%lld ", (long long)(val)); \
983 #define SHOW_FLT_CONST(val) \
984 if (stage >= SHOW_PARSE) { \
985 printf("%g ", (val)); \
991 #define SHOW_DBL_CONST(val) \
992 if (stage >= SHOW_PARSE) { \
993 printf("%g ", (val)); \
999 #define SHOW_INDEX(index) \
1000 if (stage >= SHOW_PARSE) { \
1001 printf("%d ", index); \
1007 #define SHOW_STRING(val) \
1008 if (stage >= SHOW_PARSE) { \
1010 utf_display_printable_ascii( \
1011 javastring_toutf((java_lang_String *)(val), false)); \
1015 printf("string "); \
1018 #define SHOW_CLASSREF_OR_CLASSINFO(c) \
1019 if (stage >= SHOW_PARSE) { \
1020 if (IS_CLASSREF(c)) \
1021 class_classref_print(c.ref); \
1023 class_print(c.cls); \
1030 #define SHOW_FIELD(fmiref) \
1031 if (stage >= SHOW_PARSE) { \
1032 field_fieldref_print(fmiref); \
1039 #define SHOW_STACKVAR(sp) \
1040 new_show_stackvar(jd, (sp), stage)
1042 #define SHOW_S1(iptr) \
1043 if (stage >= SHOW_STACK) { \
1044 SHOW_STACKVAR(iptr->s1.var); \
1047 #define SHOW_S2(iptr) \
1048 if (stage >= SHOW_STACK) { \
1049 SHOW_STACKVAR(iptr->sx.s23.s2.var); \
1052 #define SHOW_S3(iptr) \
1053 if (stage >= SHOW_STACK) { \
1054 SHOW_STACKVAR(iptr->sx.s23.s3.var); \
1057 #define SHOW_DST(iptr) \
1058 if (stage >= SHOW_STACK) { \
1060 SHOW_STACKVAR(iptr->dst.var); \
1063 #define SHOW_S1_LOCAL(iptr) \
1064 if (stage >= SHOW_STACK) { \
1065 printf("L%d ", iptr->s1.localindex); \
1068 #define SHOW_DST_LOCAL(iptr) \
1069 if (stage >= SHOW_STACK) { \
1070 printf("=> L%d ", iptr->dst.localindex); \
1073 static void new_show_stackvar(jitdata *jd, stackptr sp, int stage)
1078 case TYPE_INT: type = 'i'; break;
1079 case TYPE_LNG: type = 'l'; break;
1080 case TYPE_FLT: type = 'f'; break;
1081 case TYPE_DBL: type = 'd'; break;
1082 case TYPE_ADR: type = 'a'; break;
1083 default: type = '?';
1085 printf("S%c%d", type, (int) (sp - jd->new_stack));
1087 if (stage >= SHOW_REGS) {
1090 if (sp->flags & SAVEDVAR) {
1091 switch (sp->varkind) {
1093 if (sp->flags & INMEMORY)
1094 printf("M%02d", sp->regoff);
1095 #ifdef HAS_ADDRESS_REGISTER_FILE
1096 else if (sp->type == TYPE_ADR)
1097 printf("R%02d", sp->regoff);
1099 else if (IS_FLT_DBL_TYPE(sp->type))
1100 printf("F%02d", sp->regoff);
1102 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
1103 if (IS_2_WORD_TYPE(sp->type)) {
1104 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1105 # if defined(ENABLE_INTRP)
1107 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1108 GET_HIGH_REG(sp->regoff));
1111 printf("%3s/%3s", regs[GET_LOW_REG(sp->regoff)],
1112 regs[GET_HIGH_REG(sp->regoff)]);
1114 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1115 GET_HIGH_REG(sp->regoff));
1119 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
1121 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1122 # if defined(ENABLE_INTRP)
1124 printf("%3d", sp->regoff);
1127 printf("%3s", regs[sp->regoff]);
1129 printf("%3d", sp->regoff);
1135 printf("I%02d", sp->varnum);
1138 printf("L%02d", sp->varnum);
1141 if (sp->varnum == -1) {
1143 /* varkind ARGVAR "misused for this special case */
1146 else /* "normal" Argvar */
1147 printf("A%02d", sp->varnum);
1153 else { /* not SAVEDVAR */
1154 switch (sp->varkind) {
1156 if (sp->flags & INMEMORY)
1157 printf("m%02d", sp->regoff);
1158 #ifdef HAS_ADDRESS_REGISTER_FILE
1159 else if (sp->type == TYPE_ADR)
1160 printf("r%02d", sp->regoff);
1162 else if (IS_FLT_DBL_TYPE(sp->type))
1163 printf("f%02d", sp->regoff);
1165 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
1166 if (IS_2_WORD_TYPE(sp->type)) {
1167 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1168 # if defined(ENABLE_INTRP)
1170 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1171 GET_HIGH_REG(sp->regoff));
1174 printf("%3s/%3s", regs[GET_LOW_REG(sp->regoff)],
1175 regs[GET_HIGH_REG(sp->regoff)]);
1177 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1178 GET_HIGH_REG(sp->regoff));
1182 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
1184 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1185 # if defined(ENABLE_INTRP)
1187 printf("%3d", sp->regoff);
1190 printf("%3s", regs[sp->regoff]);
1192 printf("%3d", sp->regoff);
1198 printf("i%02d", sp->varnum);
1201 printf("l%02d", sp->varnum);
1204 if (sp->varnum == -1) {
1206 /* varkind ARGVAR "misused for this special case */
1209 else /* "normal" Argvar */
1210 printf("a%02d", sp->varnum);
1222 void new_show_icmd(jitdata *jd, new_instruction *iptr, bool deadcode, int stage)
1225 branch_target_t *table;
1226 lookup_target_t *lookup;
1227 constant_FMIref *fmiref;
1231 /* get the opcode and the condition */
1235 printf("%s ", icmd_names[opcode]);
1237 if (stage < SHOW_PARSE)
1243 /* Print the condition for conditional instructions. */
1245 /* XXX print condition from flags */
1250 case ICMD_CHECKNULL:
1251 case ICMD_CHECKNULL_POP:
1256 case ICMD_ARRAYLENGTH:
1275 case ICMD_INT2SHORT:
1323 /* binary/const INT */
1324 case ICMD_IADDCONST:
1325 case ICMD_ISUBCONST:
1326 case ICMD_IMULCONST:
1330 case ICMD_IANDCONST:
1332 case ICMD_IXORCONST:
1333 case ICMD_ISHLCONST:
1334 case ICMD_ISHRCONST:
1335 case ICMD_IUSHRCONST:
1336 case ICMD_LSHLCONST:
1337 case ICMD_LSHRCONST:
1338 case ICMD_LUSHRCONST:
1340 SHOW_INT_CONST(iptr->sx.val.i);
1345 case ICMD_IASTORECONST:
1346 case ICMD_BASTORECONST:
1347 case ICMD_CASTORECONST:
1348 case ICMD_SASTORECONST:
1351 SHOW_INT_CONST(iptr->sx.s23.s3.constval);
1356 SHOW_INT_CONST(iptr->sx.val.i);
1360 case ICMD_IFEQ_ICONST:
1361 case ICMD_IFNE_ICONST:
1362 case ICMD_IFLT_ICONST:
1363 case ICMD_IFGE_ICONST:
1364 case ICMD_IFGT_ICONST:
1365 case ICMD_IFLE_ICONST:
1368 case ICMD_ELSE_ICONST:
1371 /* binary/const LNG */
1372 case ICMD_LADDCONST:
1373 case ICMD_LSUBCONST:
1374 case ICMD_LMULCONST:
1378 case ICMD_LANDCONST:
1380 case ICMD_LXORCONST:
1381 case ICMD_LASTORECONST:
1383 SHOW_LNG_CONST(iptr->sx.val.l);
1389 SHOW_LNG_CONST(iptr->sx.val.l);
1395 SHOW_FLT_CONST(iptr->sx.val.f);
1401 SHOW_DBL_CONST(iptr->sx.val.d);
1407 if (iptr->flags.bits & INS_FLAG_CLASS) {
1408 SHOW_CLASSREF_OR_CLASSINFO(iptr->sx.val.c);
1410 else if (iptr->sx.val.anyptr == NULL) {
1414 SHOW_STRING(iptr->sx.val.stringconst);
1419 case ICMD_AASTORECONST:
1422 printf("%p ", (void*) iptr->sx.s23.s3.constval);
1425 case ICMD_GETFIELD: /* 1 -> 1 */
1426 case ICMD_PUTFIELD: /* 2 -> 0 */
1427 case ICMD_PUTSTATIC: /* 1 -> 0 */
1428 case ICMD_GETSTATIC: /* 0 -> 1 */
1429 case ICMD_PUTSTATICCONST: /* 0 -> 0 */
1430 case ICMD_PUTFIELDCONST: /* 1 -> 0 */
1431 if (opcode != ICMD_GETSTATIC && opcode != ICMD_PUTSTATICCONST) {
1433 if (opcode == ICMD_PUTFIELD) {
1437 if (iptr->flags.bits & INS_FLAG_UNRESOLVED)
1438 printf("(UNRESOLVED) ");
1439 NEW_INSTRUCTION_GET_FIELDREF(iptr, fmiref);
1442 if (opcode == ICMD_GETSTATIC || opcode == ICMD_GETFIELD) {
1448 SHOW_S1_LOCAL(iptr);
1449 SHOW_INT_CONST(iptr->sx.val.i);
1450 SHOW_DST_LOCAL(iptr);
1480 SHOW_S1_LOCAL(iptr);
1488 SHOW_S1_LOCAL(iptr);
1498 SHOW_DST_LOCAL(iptr);
1509 case ICMD_ANEWARRAY:
1513 case ICMD_MULTIANEWARRAY:
1514 if (stage >= SHOW_STACK) {
1515 argp = iptr->sx.s23.s2.args;
1516 i = iptr->s1.argcount;
1518 SHOW_STACKVAR(*(argp++));
1522 printf("argcount=%d ", iptr->s1.argcount);
1527 case ICMD_CHECKCAST:
1532 case ICMD_INSTANCEOF:
1537 case ICMD_INLINE_START:
1538 case ICMD_INLINE_END:
1542 if (stage >= SHOW_STACK) {
1543 argp = iptr->sx.s23.s2.args;
1544 i = iptr->s1.argcount;
1546 SHOW_STACKVAR(*(argp++));
1549 printf("%s ", iptr->sx.s23.s3.bte->name);
1550 if (iptr->sx.s23.s3.bte->md->returntype.type != TYPE_VOID) {
1555 case ICMD_INVOKEVIRTUAL:
1556 case ICMD_INVOKESPECIAL:
1557 case ICMD_INVOKESTATIC:
1558 case ICMD_INVOKEINTERFACE:
1559 if (stage >= SHOW_STACK) {
1560 argp = iptr->sx.s23.s2.args;
1561 i = iptr->s1.argcount;
1563 SHOW_STACKVAR(*(argp++));
1566 if (iptr->flags.bits & INS_FLAG_UNRESOLVED) {
1567 printf("(UNRESOLVED) ");
1569 NEW_INSTRUCTION_GET_METHODREF(iptr, fmiref);
1570 method_methodref_print(fmiref);
1571 if (fmiref->parseddesc.md->returntype.type != TYPE_VOID) {
1583 SHOW_TARGET(iptr->dst);
1593 SHOW_TARGET(iptr->dst);
1597 case ICMD_INLINE_GOTO:
1598 SHOW_TARGET(iptr->dst);
1602 SHOW_TARGET(iptr->sx.s23.s3.jsrtarget);
1607 case ICMD_IFNONNULL:
1609 SHOW_TARGET(iptr->dst);
1612 case ICMD_IF_ICMPEQ:
1613 case ICMD_IF_ICMPNE:
1614 case ICMD_IF_ICMPLT:
1615 case ICMD_IF_ICMPGE:
1616 case ICMD_IF_ICMPGT:
1617 case ICMD_IF_ICMPLE:
1619 case ICMD_IF_LCMPEQ:
1620 case ICMD_IF_LCMPNE:
1621 case ICMD_IF_LCMPLT:
1622 case ICMD_IF_LCMPGE:
1623 case ICMD_IF_LCMPGT:
1624 case ICMD_IF_LCMPLE:
1626 case ICMD_IF_FCMPEQ:
1627 case ICMD_IF_FCMPNE:
1629 case ICMD_IF_FCMPL_LT:
1630 case ICMD_IF_FCMPL_GE:
1631 case ICMD_IF_FCMPL_GT:
1632 case ICMD_IF_FCMPL_LE:
1634 case ICMD_IF_FCMPG_LT:
1635 case ICMD_IF_FCMPG_GE:
1636 case ICMD_IF_FCMPG_GT:
1637 case ICMD_IF_FCMPG_LE:
1639 case ICMD_IF_DCMPEQ:
1640 case ICMD_IF_DCMPNE:
1642 case ICMD_IF_DCMPL_LT:
1643 case ICMD_IF_DCMPL_GE:
1644 case ICMD_IF_DCMPL_GT:
1645 case ICMD_IF_DCMPL_LE:
1647 case ICMD_IF_DCMPG_LT:
1648 case ICMD_IF_DCMPG_GE:
1649 case ICMD_IF_DCMPG_GT:
1650 case ICMD_IF_DCMPG_LE:
1652 case ICMD_IF_ACMPEQ:
1653 case ICMD_IF_ACMPNE:
1656 SHOW_TARGET(iptr->dst);
1659 case ICMD_TABLESWITCH:
1663 case ICMD_LOOKUPSWITCH:
1681 if (stage >= SHOW_STACK) {
1682 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1683 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1685 SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
1686 SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
1691 if (stage >= SHOW_STACK) {
1692 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1693 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1695 SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
1696 SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
1697 SHOW_STACKVAR(iptr->dst.dupslots[2+2]);
1702 if (stage >= SHOW_STACK) {
1703 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1704 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1705 SHOW_STACKVAR(iptr->dst.dupslots[2]);
1707 SHOW_STACKVAR(iptr->dst.dupslots[3+0]);
1708 SHOW_STACKVAR(iptr->dst.dupslots[3+1]);
1709 SHOW_STACKVAR(iptr->dst.dupslots[3+2]);
1710 SHOW_STACKVAR(iptr->dst.dupslots[3+3]);
1711 SHOW_STACKVAR(iptr->dst.dupslots[3+4]);
1716 if (stage >= SHOW_STACK) {
1717 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1718 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1719 SHOW_STACKVAR(iptr->dst.dupslots[2]);
1721 SHOW_STACKVAR(iptr->dst.dupslots[3+0]);
1722 SHOW_STACKVAR(iptr->dst.dupslots[3+1]);
1723 SHOW_STACKVAR(iptr->dst.dupslots[3+2]);
1724 SHOW_STACKVAR(iptr->dst.dupslots[3+3]);
1729 if (stage >= SHOW_STACK) {
1730 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1731 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1732 SHOW_STACKVAR(iptr->dst.dupslots[2]);
1733 SHOW_STACKVAR(iptr->dst.dupslots[4]);
1735 SHOW_STACKVAR(iptr->dst.dupslots[4+0]);
1736 SHOW_STACKVAR(iptr->dst.dupslots[4+1]);
1737 SHOW_STACKVAR(iptr->dst.dupslots[4+2]);
1738 SHOW_STACKVAR(iptr->dst.dupslots[4+3]);
1739 SHOW_STACKVAR(iptr->dst.dupslots[4+4]);
1740 SHOW_STACKVAR(iptr->dst.dupslots[4+5]);
1745 if (stage >= SHOW_STACK) {
1746 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1747 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1749 SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
1750 SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
1756 #endif /* !defined(NDEBUG) */
1758 #if !defined(NDEBUG)
1759 void show_icmd(instruction *iptr, bool deadcode)
1768 constant_classref *cr;
1769 unresolved_field *uf;
1771 /* get the opcode and the condition */
1773 opcode = iptr->opc & ICMD_OPCODE_MASK;
1774 condition = (iptr->opc & ICMD_CONDITION_MASK) >> 8;
1776 printf("%s", icmd_names[opcode]);
1778 /* Print the condition for conditional instructions. */
1781 printf(" (condition: %s)", icmd_names[condition]);
1784 case ICMD_IADDCONST:
1785 case ICMD_ISUBCONST:
1786 case ICMD_IMULCONST:
1790 case ICMD_IANDCONST:
1792 case ICMD_IXORCONST:
1793 case ICMD_ISHLCONST:
1794 case ICMD_ISHRCONST:
1795 case ICMD_IUSHRCONST:
1796 case ICMD_LSHLCONST:
1797 case ICMD_LSHRCONST:
1798 case ICMD_LUSHRCONST:
1800 case ICMD_IASTORECONST:
1801 case ICMD_BASTORECONST:
1802 case ICMD_CASTORECONST:
1803 case ICMD_SASTORECONST:
1804 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
1807 case ICMD_IFEQ_ICONST:
1808 case ICMD_IFNE_ICONST:
1809 case ICMD_IFLT_ICONST:
1810 case ICMD_IFGE_ICONST:
1811 case ICMD_IFGT_ICONST:
1812 case ICMD_IFLE_ICONST:
1813 printf(" %d, %d (0x%08x)", iptr[1].op1, iptr->val.i, iptr->val.i);
1816 case ICMD_ELSE_ICONST:
1817 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
1820 case ICMD_LADDCONST:
1821 case ICMD_LSUBCONST:
1822 case ICMD_LMULCONST:
1826 case ICMD_LANDCONST:
1828 case ICMD_LXORCONST:
1830 case ICMD_LASTORECONST:
1831 #if SIZEOF_VOID_P == 4
1832 printf(" %lld (0x%016llx)", iptr->val.l, iptr->val.l);
1834 printf(" %ld (0x%016lx)", iptr->val.l, iptr->val.l);
1839 printf(" %f (0x%08x)", iptr->val.f, iptr->val.i);
1843 #if SIZEOF_VOID_P == 4
1844 printf(" %g (0x%016llx)", iptr->val.d, iptr->val.l);
1846 printf(" %g (0x%016lx)", iptr->val.d, iptr->val.l);
1851 case ICMD_AASTORECONST:
1852 /* check if this is a constant string or a class reference */
1854 if (ICMD_ACONST_IS_CLASS(iptr)) {
1855 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1856 printf(" (NOT RESOLVED) classref = ");
1857 class_classref_print(ICMD_ACONST_UNRESOLVED_CLASSREF(iptr));
1860 printf(" class = ");
1861 class_print(ICMD_ACONST_RESOLVED_CLASSINFO(iptr));
1865 printf(" %p", iptr->val.a);
1868 printf(", String = \"");
1869 utf_display_printable_ascii(javastring_toutf(iptr->val.a, false));
1877 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1878 uf = INSTRUCTION_UNRESOLVED_FIELD(iptr);
1879 printf(" (NOT RESOLVED) ");
1881 field_fieldref_print(uf->fieldref);
1884 f = INSTRUCTION_RESOLVED_FIELDINFO(iptr);
1885 printf(" %d, ", f->offset);
1891 case ICMD_PUTSTATIC:
1892 case ICMD_GETSTATIC:
1893 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1894 uf = INSTRUCTION_UNRESOLVED_FIELD(iptr);
1895 printf(" (NOT RESOLVED) ");
1897 field_fieldref_print(uf->fieldref);
1900 f = INSTRUCTION_RESOLVED_FIELDINFO(iptr);
1901 if (!CLASS_IS_OR_ALMOST_INITIALIZED(f->class))
1902 printf(" (NOT INITIALIZED) ");
1910 case ICMD_PUTSTATICCONST:
1911 case ICMD_PUTFIELDCONST:
1912 switch (iptr[1].op1) {
1914 printf(" %d (0x%08x),", iptr->val.i, iptr->val.i);
1917 #if SIZEOF_VOID_P == 4
1918 printf(" %lld (0x%016llx),", iptr->val.l, iptr->val.l);
1920 printf(" %ld (0x%016lx),", iptr->val.l, iptr->val.l);
1924 printf(" %p,", iptr->val.a);
1927 printf(" %g (0x%08x),", iptr->val.f, iptr->val.i);
1930 #if SIZEOF_VOID_P == 4
1931 printf(" %g (0x%016llx),", iptr->val.d, iptr->val.l);
1933 printf(" %g (0x%016lx),", iptr->val.d, iptr->val.l);
1938 if (INSTRUCTION_IS_UNRESOLVED(iptr + 1)) {
1939 uf = INSTRUCTION_UNRESOLVED_FIELD(iptr + 1);
1940 printf(" (NOT RESOLVED) ");
1941 field_fieldref_print(uf->fieldref);
1944 f = INSTRUCTION_RESOLVED_FIELDINFO(iptr + 1);
1945 if ((iptr->opc == ICMD_PUTSTATICCONST) &&
1946 !CLASS_IS_OR_ALMOST_INITIALIZED(f->class))
1947 printf(" (NOT INITIALIZED), ");
1949 printf(" %d, ", f->offset);
1955 printf(" %d + %d", iptr->op1, iptr->val.i);
1990 printf(" %d", iptr->op1);
1996 utf_display_printable_ascii_classname(c->name);
2000 switch (iptr->op1) {
2028 case ICMD_ANEWARRAY:
2032 utf_display_printable_ascii_classname(c->name);
2036 case ICMD_MULTIANEWARRAY:
2041 printf(" (NOT RESOLVED) %d ", iptr->op1);
2042 utf_display_printable_ascii(cr->name);
2045 printf(" %d ", iptr->op1);
2046 utf_display_printable_ascii_classname(c->name);
2050 case ICMD_CHECKCAST:
2051 case ICMD_INSTANCEOF:
2056 if (c->flags & ACC_INTERFACE)
2057 printf(" (INTERFACE) ");
2059 printf(" (CLASS,%3d) ", c->vftbl->diffval);
2061 printf(" (NOT RESOLVED) ");
2062 utf_display_printable_ascii_classname(cr->name);
2065 case ICMD_INLINE_START:
2066 case ICMD_INLINE_END:
2068 insinfo_inline *insinfo = (insinfo_inline *) iptr->target;
2070 method_print(insinfo->method);
2075 printf(" %s", ((builtintable_entry *) iptr->val.a)->name);
2078 case ICMD_INVOKEVIRTUAL:
2079 case ICMD_INVOKESPECIAL:
2080 case ICMD_INVOKESTATIC:
2081 case ICMD_INVOKEINTERFACE:
2083 constant_FMIref *mref;
2085 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
2086 printf(" (NOT RESOLVED) ");
2087 mref = INSTRUCTION_UNRESOLVED_METHOD(iptr)->methodref;
2091 mref = INSTRUCTION_RESOLVED_FMIREF(iptr);
2093 method_methodref_print(mref);
2103 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
2105 if ((iptr->opc & ICMD_CONDITION_MASK) == 0) {
2106 if (deadcode || !iptr->target)
2107 printf(" op1=%d", iptr->op1);
2109 printf(" L%03d (%p)", ((basicblock *) iptr->target)->debug_nr, iptr->target);
2119 #if SIZEOF_VOID_P == 4
2120 printf(" %lld (%016llx)", iptr->val.l, iptr->val.l);
2122 printf(" %ld (%016lx)", iptr->val.l, iptr->val.l);
2125 if ((iptr->opc & ICMD_CONDITION_MASK) == 0) {
2126 if (deadcode || !iptr->target)
2127 printf(" op1=%d", iptr->op1);
2129 printf(" L%03d", ((basicblock *) iptr->target)->debug_nr);
2135 case ICMD_INLINE_GOTO:
2136 if (deadcode || !iptr->target)
2137 printf(" op1=%d", iptr->op1);
2139 printf(" L%03d (%p)", ((basicblock *) iptr->target)->debug_nr,iptr->target);
2143 case ICMD_IFNONNULL:
2144 case ICMD_IF_ICMPEQ:
2145 case ICMD_IF_ICMPNE:
2146 case ICMD_IF_ICMPLT:
2147 case ICMD_IF_ICMPGE:
2148 case ICMD_IF_ICMPGT:
2149 case ICMD_IF_ICMPLE:
2151 case ICMD_IF_LCMPEQ:
2152 case ICMD_IF_LCMPNE:
2153 case ICMD_IF_LCMPLT:
2154 case ICMD_IF_LCMPGE:
2155 case ICMD_IF_LCMPGT:
2156 case ICMD_IF_LCMPLE:
2158 case ICMD_IF_FCMPEQ:
2159 case ICMD_IF_FCMPNE:
2161 case ICMD_IF_FCMPL_LT:
2162 case ICMD_IF_FCMPL_GE:
2163 case ICMD_IF_FCMPL_GT:
2164 case ICMD_IF_FCMPL_LE:
2166 case ICMD_IF_FCMPG_LT:
2167 case ICMD_IF_FCMPG_GE:
2168 case ICMD_IF_FCMPG_GT:
2169 case ICMD_IF_FCMPG_LE:
2171 case ICMD_IF_DCMPEQ:
2172 case ICMD_IF_DCMPNE:
2174 case ICMD_IF_DCMPL_LT:
2175 case ICMD_IF_DCMPL_GE:
2176 case ICMD_IF_DCMPL_GT:
2177 case ICMD_IF_DCMPL_LE:
2179 case ICMD_IF_DCMPG_LT:
2180 case ICMD_IF_DCMPG_GE:
2181 case ICMD_IF_DCMPG_GT:
2182 case ICMD_IF_DCMPG_LE:
2184 case ICMD_IF_ACMPEQ:
2185 case ICMD_IF_ACMPNE:
2186 if (!(iptr->opc & ICMD_CONDITION_MASK)) {
2187 if (deadcode || !iptr->target)
2188 printf(" op1=%d", iptr->op1);
2190 printf(" L%03d (%p)", ((basicblock *) iptr->target)->debug_nr,iptr->target);
2194 case ICMD_TABLESWITCH:
2195 s4ptr = (s4*)iptr->val.a;
2197 if (deadcode || !iptr->target) {
2198 printf(" %d;", *s4ptr);
2201 tptr = (void **) iptr->target;
2202 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
2206 s4ptr++; /* skip default */
2207 j = *s4ptr++; /* low */
2208 j = *s4ptr++ - j; /* high */
2210 if (deadcode || !*tptr)
2211 printf(" %d", *s4ptr++);
2213 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
2220 case ICMD_LOOKUPSWITCH:
2221 s4ptr = (s4*)iptr->val.a;
2223 if (deadcode || !iptr->target) {
2224 printf(" %d;", *s4ptr);
2227 tptr = (void **) iptr->target;
2228 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
2231 s4ptr++; /* default */
2232 j = *s4ptr++; /* count */
2235 if (deadcode || !*tptr) {
2236 s4ptr++; /* skip value */
2237 printf(" %d",*s4ptr++);
2240 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
2248 printf(" (NOT RESOLVED) Class = \"");
2249 utf_display_printable_ascii(((unresolved_class *) iptr->val.a)->classref->name);
2254 #endif /* !defined(NDEBUG) */
2257 * These are local overrides for various environment variables in Emacs.
2258 * Please do not remove this and leave it at the end of the file, where
2259 * Emacs will automagically detect them.
2260 * ---------------------------------------------------------------------
2263 * indent-tabs-mode: t
2267 * vim:noexpandtab:sw=4:ts=4: