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"
45 #if defined(ENABLE_THREADS)
46 # include "threads/native/lock.h"
48 # include "threads/none/lock.h"
51 #include "vm/global.h"
52 #include "vm/options.h"
53 #include "vm/builtin.h"
54 #include "vm/stringlocal.h"
55 #include "vm/jit/jit.h"
56 #include "vm/jit/show.h"
57 #include "vm/jit/disass.h"
60 /* global variables ***********************************************************/
62 #if defined(ENABLE_THREADS) && !defined(NDEBUG)
63 static java_objectheader *show_global_lock;
67 /* show_init *******************************************************************
69 Initialized the show subsystem (called by jit_init).
71 *******************************************************************************/
76 #if defined(ENABLE_THREADS)
77 /* initialize the show lock */
79 show_global_lock = NEW(java_objectheader);
81 lock_init_object_lock(show_global_lock);
91 /* show_print_stack ************************************************************
93 Print the stack representation starting with the given top stackptr.
95 NOTE: Currently this function may only be called after register allocation!
97 *******************************************************************************/
100 static void show_print_stack(codegendata *cd, stackptr s)
112 j = cd->maxstack - i;
118 if (s->flags & SAVEDVAR)
119 switch (s->varkind) {
121 if (s->flags & INMEMORY)
122 printf(" M%02d", s->regoff);
123 #ifdef HAS_ADDRESS_REGISTER_FILE
124 else if (s->type == TYPE_ADR)
125 printf(" R%02d", s->regoff);
127 else if (IS_FLT_DBL_TYPE(s->type))
128 printf(" F%02d", s->regoff);
130 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
131 if (IS_2_WORD_TYPE(s->type)) {
132 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
133 # if defined(ENABLE_INTRP)
135 printf(" %3d/%3d", GET_LOW_REG(s->regoff),
136 GET_HIGH_REG(s->regoff));
139 printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
140 regs[GET_HIGH_REG(s->regoff)]);
142 printf(" %3d/%3d", GET_LOW_REG(s->regoff),
143 GET_HIGH_REG(s->regoff));
147 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
149 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
150 # if defined(ENABLE_INTRP)
152 printf(" %3d", s->regoff);
155 printf(" %3s", regs[s->regoff]);
157 printf(" %3d", s->regoff);
163 printf(" I%02d", s->varnum);
166 printf(" L%02d", s->varnum);
169 if (s->varnum == -1) {
171 /* varkind ARGVAR "misused for this special case */
174 else /* "normal" Argvar */
175 printf(" A%02d", s->varnum);
181 switch (s->varkind) {
183 if (s->flags & INMEMORY)
184 printf(" m%02d", s->regoff);
185 #ifdef HAS_ADDRESS_REGISTER_FILE
186 else if (s->type == TYPE_ADR)
187 printf(" r%02d", s->regoff);
189 else if (IS_FLT_DBL_TYPE(s->type))
190 printf(" f%02d", s->regoff);
192 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
193 if (IS_2_WORD_TYPE(s->type)) {
194 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
195 # if defined(ENABLE_INTRP)
197 printf(" %3d/%3d", GET_LOW_REG(s->regoff),
198 GET_HIGH_REG(s->regoff));
201 printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
202 regs[GET_HIGH_REG(s->regoff)]);
204 printf(" %3d/%3d", GET_LOW_REG(s->regoff),
205 GET_HIGH_REG(s->regoff));
209 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
211 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
212 # if defined(ENABLE_INTRP)
214 printf(" %3d", s->regoff);
217 printf(" %3s", regs[s->regoff]);
219 printf(" %3d", s->regoff);
225 printf(" i%02d", s->varnum);
228 printf(" l%02d", s->varnum);
231 if (s->varnum == -1) {
233 /* varkind ARGVAR "misused for this special case */
236 else /* "normal" Argvar */
237 printf(" a%02d", s->varnum);
245 #endif /* !defined(NDEBUG) */
249 static void print_reg(stackptr s) {
251 if (s->flags & SAVEDVAR)
252 switch (s->varkind) {
254 if (s->flags & INMEMORY)
255 printf(" tm%02d", s->regoff);
257 printf(" tr%02d", s->regoff);
260 printf(" s %02d", s->varnum);
263 printf(" l %02d", s->varnum);
266 printf(" a %02d", s->varnum);
269 printf(" ! %02d", s->varnum);
272 switch (s->varkind) {
274 if (s->flags & INMEMORY)
275 printf(" Tm%02d", s->regoff);
277 printf(" Tr%02d", s->regoff);
280 printf(" S %02d", s->varnum);
283 printf(" L %02d", s->varnum);
286 printf(" A %02d", s->varnum);
289 printf(" ? %02d", s->varnum);
300 static char *jit_type[] = {
310 /* show_method *****************************************************************
312 Print the intermediate representation of a method.
314 NOTE: Currently this function may only be called after register allocation!
316 *******************************************************************************/
319 void new_show_method(jitdata *jd, int stage)
330 /* get required compiler data */
337 /* We need to enter a lock here, since the binutils disassembler
338 is not reentrant-able and we could not read functions printed
341 LOCK_MONITOR_ENTER(show_global_lock);
347 printf("\n(NEW INSTRUCTION FORMAT)\n");
348 printf("\nBasic blocks: %d\n", jd->new_basicblockcount);
349 printf("Max locals: %d\n", cd->maxlocals);
350 printf("Max stack: %d\n", cd->maxstack);
351 printf("Line number table length: %d\n", m->linenumbercount);
353 if (stage >= SHOW_PARSE) {
354 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
355 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
356 printf(" L%03d ... ", ex->start->debug_nr );
357 printf("L%03d = ", ex->end->debug_nr);
358 printf("L%03d", ex->handler->debug_nr);
359 printf(" (catchtype: ");
360 if (ex->catchtype.any)
361 if (IS_CLASSREF(ex->catchtype))
362 utf_display_printable_ascii_classname(ex->catchtype.ref->name);
364 utf_display_printable_ascii_classname(ex->catchtype.cls->name);
371 if (stage >= SHOW_PARSE && rd) {
372 printf("Local Table:\n");
373 for (i = 0; i < cd->maxlocals; i++) {
376 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
377 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
378 # if defined(ENABLE_INTRP)
381 if (rd->locals[i][j].type >= 0) {
382 printf(" (%s) ", jit_type[j]);
383 if (stage >= SHOW_REGS) {
384 if (rd->locals[i][j].flags & INMEMORY)
385 printf("m%2d", rd->locals[i][j].regoff);
386 # ifdef HAS_ADDRESS_REGISTER_FILE
387 else if (j == TYPE_ADR)
388 printf("r%02d", rd->locals[i][j].regoff);
390 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
391 printf("f%02d", rd->locals[i][j].regoff);
393 # if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
394 if (IS_2_WORD_TYPE(j))
396 regs[GET_LOW_REG(rd->locals[i][j].regoff)],
397 regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
400 printf("%3s", regs[rd->locals[i][j].regoff]);
404 # if defined(ENABLE_INTRP)
408 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
415 if (stage >= SHOW_STACK && rd) {
416 #if defined(ENABLE_LSRA)
419 #if defined(ENABLE_INTRP)
422 printf("Interface Table:\n");
423 for (i = 0; i < cd->maxstack; i++) {
424 if ((rd->interfaces[i][0].type >= 0) ||
425 (rd->interfaces[i][1].type >= 0) ||
426 (rd->interfaces[i][2].type >= 0) ||
427 (rd->interfaces[i][3].type >= 0) ||
428 (rd->interfaces[i][4].type >= 0)) {
431 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
432 # if defined(ENABLE_INTRP)
435 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
436 if (rd->interfaces[i][j].type >= 0) {
437 printf(" (%s) ", jit_type[j]);
438 if (stage >= SHOW_REGS) {
439 if (rd->interfaces[i][j].flags & SAVEDVAR) {
440 if (rd->interfaces[i][j].flags & INMEMORY)
441 printf("M%2d", rd->interfaces[i][j].regoff);
442 #ifdef HAS_ADDRESS_REGISTER_FILE
443 else if (j == TYPE_ADR)
444 printf("R%02d", rd->interfaces[i][j].regoff);
446 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
447 printf("F%02d", rd->interfaces[i][j].regoff);
449 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
450 if (IS_2_WORD_TYPE(j))
452 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
453 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
456 printf("%3s",regs[rd->interfaces[i][j].regoff]);
460 if (rd->interfaces[i][j].flags & INMEMORY)
461 printf("m%2d", rd->interfaces[i][j].regoff);
462 #ifdef HAS_ADDRESS_REGISTER_FILE
463 else if (j == TYPE_ADR)
464 printf("r%02d", rd->interfaces[i][j].regoff);
466 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
467 printf("f%02d", rd->interfaces[i][j].regoff);
469 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
470 if (IS_2_WORD_TYPE(j))
472 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
473 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
476 printf("%3s",regs[rd->interfaces[i][j].regoff]);
483 # if defined(ENABLE_INTRP)
486 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
492 #if defined(ENABLE_INTRP)
495 #if defined(ENABLE_LSRA)
498 } /* if >= SHOW_STACK */
500 if (code->rplpoints) {
501 printf("Replacement Points:\n");
502 replace_show_replacement_points(code);
506 #if defined(ENABLE_DISASSEMBLER)
507 /* show code before first basic block */
509 if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd)) {
510 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen);
512 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + jd->new_basicblocks[0].mpc);)
519 /* show code of all basic blocks */
521 for (bptr = jd->new_basicblocks; bptr != NULL; bptr = bptr->next)
522 new_show_basicblock(jd, bptr, stage);
524 #if defined(ENABLE_DISASSEMBLER)
525 /* show stubs code */
527 if (stage >= SHOW_CODE && opt_showdisassemble && opt_showexceptionstubs) {
528 printf("\nException stubs code:\n");
529 printf("Length: %d\n\n", (s4) (code->mcodelength -
530 ((ptrint) cd->dseglen +
531 jd->new_basicblocks[jd->new_basicblockcount].mpc)));
533 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen +
534 jd->new_basicblocks[jd->new_basicblockcount].mpc);
536 for (; (ptrint) u1ptr < ((ptrint) code->mcode + code->mcodelength);)
543 LOCK_MONITOR_EXIT(show_global_lock);
545 /* finally flush the output */
549 #endif /* !defined(NDEBUG) */
552 void show_method(jitdata *jd)
563 /* get required compiler data */
570 /* We need to enter a lock here, since the binutils disassembler
571 is not reentrant-able and we could not read functions printed
574 LOCK_MONITOR_ENTER(show_global_lock);
580 printf("\nBasic blocks: %d\n", m->basicblockcount);
581 printf("Max locals: %d\n", cd->maxlocals);
582 printf("Max stack: %d\n", cd->maxstack);
583 printf("Line number table length: %d\n", m->linenumbercount);
585 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
586 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
587 printf(" L%03d ... ", ex->start->debug_nr );
588 printf("L%03d = ", ex->end->debug_nr);
589 printf("L%03d", ex->handler->debug_nr);
590 printf(" (catchtype: ");
591 if (ex->catchtype.any)
592 if (IS_CLASSREF(ex->catchtype))
593 utf_display_printable_ascii_classname(ex->catchtype.ref->name);
595 utf_display_printable_ascii_classname(ex->catchtype.cls->name);
601 printf("Local Table:\n");
602 for (i = 0; i < cd->maxlocals; i++) {
605 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
606 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
607 # if defined(ENABLE_INTRP)
610 if (rd->locals[i][j].type >= 0) {
611 printf(" (%s) ", jit_type[j]);
612 if (rd->locals[i][j].flags & INMEMORY)
613 printf("m%2d", rd->locals[i][j].regoff);
614 # ifdef HAS_ADDRESS_REGISTER_FILE
615 else if (j == TYPE_ADR)
616 printf("r%02d", rd->locals[i][j].regoff);
618 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
619 printf("f%02d", rd->locals[i][j].regoff);
621 # if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
622 if (IS_2_WORD_TYPE(j))
624 regs[GET_LOW_REG(rd->locals[i][j].regoff)],
625 regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
628 printf("%3s", regs[rd->locals[i][j].regoff]);
631 # if defined(ENABLE_INTRP)
635 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
641 #if defined(ENABLE_LSRA)
644 #if defined(ENABLE_INTRP)
647 printf("Interface Table:\n");
648 for (i = 0; i < cd->maxstack; i++) {
649 if ((rd->interfaces[i][0].type >= 0) ||
650 (rd->interfaces[i][1].type >= 0) ||
651 (rd->interfaces[i][2].type >= 0) ||
652 (rd->interfaces[i][3].type >= 0) ||
653 (rd->interfaces[i][4].type >= 0)) {
656 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
657 # if defined(ENABLE_INTRP)
660 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
661 if (rd->interfaces[i][j].type >= 0) {
662 printf(" (%s) ", jit_type[j]);
663 if (rd->interfaces[i][j].flags & SAVEDVAR) {
664 if (rd->interfaces[i][j].flags & INMEMORY)
665 printf("M%2d", rd->interfaces[i][j].regoff);
666 #ifdef HAS_ADDRESS_REGISTER_FILE
667 else if (j == TYPE_ADR)
668 printf("R%02d", rd->interfaces[i][j].regoff);
670 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
671 printf("F%02d", rd->interfaces[i][j].regoff);
673 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
674 if (IS_2_WORD_TYPE(j))
676 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
677 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
680 printf("%3s",regs[rd->interfaces[i][j].regoff]);
684 if (rd->interfaces[i][j].flags & INMEMORY)
685 printf("m%2d", rd->interfaces[i][j].regoff);
686 #ifdef HAS_ADDRESS_REGISTER_FILE
687 else if (j == TYPE_ADR)
688 printf("r%02d", rd->interfaces[i][j].regoff);
690 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
691 printf("f%02d", rd->interfaces[i][j].regoff);
693 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
694 if (IS_2_WORD_TYPE(j))
696 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
697 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
700 printf("%3s",regs[rd->interfaces[i][j].regoff]);
706 # if defined(ENABLE_INTRP)
709 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
715 #if defined(ENABLE_INTRP)
718 #if defined(ENABLE_LSRA)
722 if (code->rplpoints) {
723 printf("Replacement Points:\n");
724 replace_show_replacement_points(code);
728 #if defined(ENABLE_DISASSEMBLER)
729 /* show code before first basic block */
731 if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd)) {
732 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen);
734 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + m->basicblocks[0].mpc);)
741 /* show code of all basic blocks */
743 for (bptr = m->basicblocks; bptr != NULL; bptr = bptr->next)
744 show_basicblock(jd, bptr);
746 #if defined(ENABLE_DISASSEMBLER)
747 /* show stubs code */
749 if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) && opt_showexceptionstubs) {
750 printf("\nException stubs code:\n");
751 printf("Length: %d\n\n", (s4) (code->mcodelength -
752 ((ptrint) cd->dseglen +
753 m->basicblocks[m->basicblockcount].mpc)));
755 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen +
756 m->basicblocks[m->basicblockcount].mpc);
758 for (; (ptrint) u1ptr < ((ptrint) code->mcode + code->mcodelength);)
765 LOCK_MONITOR_EXIT(show_global_lock);
767 /* finally flush the output */
771 #endif /* !defined(NDEBUG) */
774 /* show_basicblock *************************************************************
776 Print the intermediate representation of a basic block.
778 NOTE: Currently this function may only be called after register allocation!
780 *******************************************************************************/
783 void new_show_basicblock(jitdata *jd, basicblock *bptr, int stage)
790 new_instruction *iptr;
793 /* get required compiler data */
799 if (bptr->flags != BBDELETED) {
800 deadcode = bptr->flags <= BBREACHED;
802 printf("======== %sL%03d ======== (flags: %d, bitflags: %01x, next: %d, type: ",
803 (bptr->bitflags & BBFLAG_REPLACEMENT) ? "<REPLACE> " : "",
804 bptr->debug_nr, bptr->flags, bptr->bitflags,
805 (bptr->next) ? (bptr->next->debug_nr) : -1);
807 switch (bptr->type) {
819 printf(", instruction count: %d, predecessors: %d):\n",
820 bptr->icount, bptr->pre_count);
822 iptr = /*XXX*/ (new_instruction *) bptr->iinstr;
824 for (i = 0; i < bptr->icount; i++, iptr++) {
825 printf("%4d: ", iptr->line);
827 new_show_icmd(jd, iptr, deadcode, stage);
831 #if defined(ENABLE_DISASSEMBLER)
832 if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) &&
835 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->mpc);
837 if (bptr->next != NULL) {
838 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->next->mpc);)
843 for (; u1ptr < (u1 *) ((ptrint) code->mcode + code->mcodelength);)
851 #endif /* !defined(NDEBUG) */
854 void show_basicblock(jitdata *jd, basicblock *bptr)
864 /* get required compiler data */
870 if (bptr->flags != BBDELETED) {
871 deadcode = bptr->flags <= BBREACHED;
876 for (j = cd->maxstack; j > 0; j--)
879 show_print_stack(cd, bptr->instack);
881 printf("] %sL%03d(flags: %d, bitflags: %01x, next: %d, type: ",
882 (bptr->bitflags & BBFLAG_REPLACEMENT) ? "<REPLACE> " : "",
883 bptr->debug_nr, bptr->flags, bptr->bitflags,
884 (bptr->next) ? (bptr->next->debug_nr) : -1);
886 switch (bptr->type) {
898 printf(", instruction count: %d, predecessors: %d):\n",
899 bptr->icount, bptr->pre_count);
903 for (i = 0; i < bptr->icount; i++, iptr++) {
907 for (j = cd->maxstack; j > 0; j--)
910 show_print_stack(cd, iptr->dst);
912 printf("] %5d (line: %5d) ", i, iptr->line);
914 show_icmd(iptr, deadcode);
918 #if defined(ENABLE_DISASSEMBLER)
919 if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) && (!deadcode)) {
921 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->mpc);
923 if (bptr->next != NULL) {
924 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->next->mpc);)
929 for (; u1ptr < (u1 *) ((ptrint) code->mcode + code->mcodelength);)
937 #endif /* !defined(NDEBUG) */
940 /* show_icmd *******************************************************************
942 Print the intermediate representation of an instruction.
944 NOTE: Currently this function may only be called after register allocation!
946 *******************************************************************************/
950 #define SHOW_TARGET(target) \
951 if (stage >= SHOW_STACK) { \
952 printf("--> L%03d ", (target).block->debug_nr); \
954 else if (stage >= SHOW_PARSE) { \
955 printf("--> insindex %d (L%03d) ", (target).insindex, \
956 jd->new_basicblocks[jd->new_basicblockindex[ \
957 (target).insindex]].debug_nr); \
960 printf("--> insindex %d ", (target).insindex); \
963 #define SHOW_INT_CONST(val) \
964 if (stage >= SHOW_PARSE) { \
965 printf("%ld ", (long) (val)); \
971 #define SHOW_LNG_CONST(val) \
972 if (stage >= SHOW_PARSE) { \
973 printf("%lld ", (long long)(val)); \
979 #define SHOW_FLT_CONST(val) \
980 if (stage >= SHOW_PARSE) { \
981 printf("%g ", (val)); \
987 #define SHOW_DBL_CONST(val) \
988 if (stage >= SHOW_PARSE) { \
989 printf("%g ", (val)); \
995 #define SHOW_INDEX(index) \
996 if (stage >= SHOW_PARSE) { \
997 printf("%d ", index); \
1003 #define SHOW_STRING(val) \
1004 if (stage >= SHOW_PARSE) { \
1006 utf_display_printable_ascii( \
1007 javastring_toutf((java_lang_String *)(val), false)); \
1011 printf("string "); \
1014 #define SHOW_CLASSREF_OR_CLASSINFO(c) \
1015 if (stage >= SHOW_PARSE) { \
1016 if (IS_CLASSREF(c)) \
1017 class_classref_print(c.ref); \
1019 class_print(c.cls); \
1026 #define SHOW_FIELD(fmiref) \
1027 if (stage >= SHOW_PARSE) { \
1028 field_fieldref_print(fmiref); \
1035 #define SHOW_STACKVAR(sp) \
1036 new_show_stackvar(jd, (sp), stage)
1038 #define SHOW_S1(iptr) \
1039 if (stage >= SHOW_STACK) { \
1040 SHOW_STACKVAR(iptr->s1.var); \
1043 #define SHOW_S2(iptr) \
1044 if (stage >= SHOW_STACK) { \
1045 SHOW_STACKVAR(iptr->sx.s23.s2.var); \
1048 #define SHOW_S3(iptr) \
1049 if (stage >= SHOW_STACK) { \
1050 SHOW_STACKVAR(iptr->sx.s23.s3.var); \
1053 #define SHOW_DST(iptr) \
1054 if (stage >= SHOW_STACK) { \
1056 SHOW_STACKVAR(iptr->dst.var); \
1059 #define SHOW_S1_LOCAL(iptr) \
1060 if (stage >= SHOW_STACK) { \
1061 printf("L%d ", iptr->s1.localindex); \
1064 #define SHOW_DST_LOCAL(iptr) \
1065 if (stage >= SHOW_STACK) { \
1066 printf("=> L%d ", iptr->dst.localindex); \
1069 static void new_show_stackvar(jitdata *jd, stackptr sp, int stage)
1074 case TYPE_INT: type = 'i'; break;
1075 case TYPE_LNG: type = 'l'; break;
1076 case TYPE_FLT: type = 'f'; break;
1077 case TYPE_DBL: type = 'd'; break;
1078 case TYPE_ADR: type = 'a'; break;
1079 default: type = '?';
1081 printf("S%c%d", type, (int) (sp - jd->new_stack));
1083 if (stage >= SHOW_REGS) {
1086 if (sp->flags & SAVEDVAR) {
1087 switch (sp->varkind) {
1089 if (sp->flags & INMEMORY)
1090 printf("M%02d", sp->regoff);
1091 #ifdef HAS_ADDRESS_REGISTER_FILE
1092 else if (sp->type == TYPE_ADR)
1093 printf("R%02d", sp->regoff);
1095 else if (IS_FLT_DBL_TYPE(sp->type))
1096 printf("F%02d", sp->regoff);
1098 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
1099 if (IS_2_WORD_TYPE(sp->type)) {
1100 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1101 # if defined(ENABLE_INTRP)
1103 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1104 GET_HIGH_REG(sp->regoff));
1107 printf("%3s/%3s", regs[GET_LOW_REG(sp->regoff)],
1108 regs[GET_HIGH_REG(sp->regoff)]);
1110 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1111 GET_HIGH_REG(sp->regoff));
1115 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
1117 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1118 # if defined(ENABLE_INTRP)
1120 printf("%3d", sp->regoff);
1123 printf("%3s", regs[sp->regoff]);
1125 printf("%3d", sp->regoff);
1131 printf("I%02d", sp->varnum);
1134 printf("L%02d", sp->varnum);
1137 if (sp->varnum == -1) {
1139 /* varkind ARGVAR "misused for this special case */
1142 else /* "normal" Argvar */
1143 printf("A%02d", sp->varnum);
1146 printf("!xx {kind=%d, num=%d}", sp->varkind, sp->varnum);
1149 else { /* not SAVEDVAR */
1150 switch (sp->varkind) {
1152 if (sp->flags & INMEMORY)
1153 printf("m%02d", sp->regoff);
1154 #ifdef HAS_ADDRESS_REGISTER_FILE
1155 else if (sp->type == TYPE_ADR)
1156 printf("r%02d", sp->regoff);
1158 else if (IS_FLT_DBL_TYPE(sp->type))
1159 printf("f%02d", sp->regoff);
1161 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
1162 if (IS_2_WORD_TYPE(sp->type)) {
1163 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1164 # if defined(ENABLE_INTRP)
1166 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1167 GET_HIGH_REG(sp->regoff));
1170 printf("%3s/%3s", regs[GET_LOW_REG(sp->regoff)],
1171 regs[GET_HIGH_REG(sp->regoff)]);
1173 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1174 GET_HIGH_REG(sp->regoff));
1178 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
1180 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1181 # if defined(ENABLE_INTRP)
1183 printf("%3d", sp->regoff);
1186 printf("%3s", regs[sp->regoff]);
1188 printf("%3d", sp->regoff);
1194 printf("i%02d", sp->varnum);
1197 printf("l%02d", sp->varnum);
1200 if (sp->varnum == -1) {
1202 /* varkind ARGVAR "misused for this special case */
1205 else /* "normal" Argvar */
1206 printf("a%02d", sp->varnum);
1209 printf("?xx {kind=%d, num=%d}", sp->varkind, sp->varnum);
1218 void new_show_icmd(jitdata *jd, new_instruction *iptr, bool deadcode, int stage)
1221 branch_target_t *table;
1222 lookup_target_t *lookup;
1223 constant_FMIref *fmiref;
1227 /* get the opcode and the condition */
1231 printf("%s ", icmd_names[opcode]);
1233 if (stage < SHOW_PARSE)
1239 /* Print the condition for conditional instructions. */
1241 /* XXX print condition from flags */
1243 if (iptr->flags.bits & INS_FLAG_UNRESOLVED)
1244 printf("(UNRESOLVED) ");
1249 case ICMD_CHECKNULL:
1250 case ICMD_CHECKNULL_POP:
1255 case ICMD_ARRAYLENGTH:
1274 case ICMD_INT2SHORT:
1322 /* binary/const INT */
1323 case ICMD_IADDCONST:
1324 case ICMD_ISUBCONST:
1325 case ICMD_IMULCONST:
1329 case ICMD_IANDCONST:
1331 case ICMD_IXORCONST:
1332 case ICMD_ISHLCONST:
1333 case ICMD_ISHRCONST:
1334 case ICMD_IUSHRCONST:
1335 case ICMD_LSHLCONST:
1336 case ICMD_LSHRCONST:
1337 case ICMD_LUSHRCONST:
1339 SHOW_INT_CONST(iptr->sx.val.i);
1343 /* ?ASTORECONST (trinary/const INT) */
1344 case ICMD_IASTORECONST:
1345 case ICMD_BASTORECONST:
1346 case ICMD_CASTORECONST:
1347 case ICMD_SASTORECONST:
1350 SHOW_INT_CONST(iptr->sx.s23.s3.constval);
1355 SHOW_INT_CONST(iptr->sx.val.i);
1359 case ICMD_IFEQ_ICONST:
1360 case ICMD_IFNE_ICONST:
1361 case ICMD_IFLT_ICONST:
1362 case ICMD_IFGE_ICONST:
1363 case ICMD_IFGT_ICONST:
1364 case ICMD_IFLE_ICONST:
1367 case ICMD_ELSE_ICONST:
1370 /* binary/const LNG */
1371 case ICMD_LADDCONST:
1372 case ICMD_LSUBCONST:
1373 case ICMD_LMULCONST:
1377 case ICMD_LANDCONST:
1379 case ICMD_LXORCONST:
1381 SHOW_LNG_CONST(iptr->sx.val.l);
1385 /* trinary/const LNG (<= pointer size) */
1386 case ICMD_LASTORECONST:
1389 SHOW_LNG_CONST(iptr->sx.s23.s3.constval);
1394 SHOW_LNG_CONST(iptr->sx.val.l);
1400 SHOW_FLT_CONST(iptr->sx.val.f);
1406 SHOW_DBL_CONST(iptr->sx.val.d);
1412 if (iptr->flags.bits & INS_FLAG_CLASS) {
1413 SHOW_CLASSREF_OR_CLASSINFO(iptr->sx.val.c);
1415 else if (iptr->sx.val.anyptr == NULL) {
1419 SHOW_STRING(iptr->sx.val.stringconst);
1424 case ICMD_AASTORECONST:
1427 printf("%p ", (void*) iptr->sx.s23.s3.constval);
1430 case ICMD_GETFIELD: /* 1 -> 1 */
1431 case ICMD_PUTFIELD: /* 2 -> 0 */
1432 case ICMD_PUTSTATIC: /* 1 -> 0 */
1433 case ICMD_GETSTATIC: /* 0 -> 1 */
1434 case ICMD_PUTSTATICCONST: /* 0 -> 0 */
1435 case ICMD_PUTFIELDCONST: /* 1 -> 0 */
1436 if (opcode != ICMD_GETSTATIC && opcode != ICMD_PUTSTATICCONST) {
1438 if (opcode == ICMD_PUTFIELD) {
1442 NEW_INSTRUCTION_GET_FIELDREF(iptr, fmiref);
1445 if (opcode == ICMD_GETSTATIC || opcode == ICMD_GETFIELD) {
1451 SHOW_S1_LOCAL(iptr);
1452 SHOW_INT_CONST(iptr->sx.val.i);
1453 SHOW_DST_LOCAL(iptr);
1483 SHOW_S1_LOCAL(iptr);
1491 SHOW_S1_LOCAL(iptr);
1501 SHOW_DST_LOCAL(iptr);
1512 case ICMD_ANEWARRAY:
1516 case ICMD_MULTIANEWARRAY:
1517 if (stage >= SHOW_STACK) {
1518 argp = iptr->sx.s23.s2.args;
1519 i = iptr->s1.argcount;
1521 SHOW_STACKVAR(*(argp++));
1525 printf("argcount=%d ", iptr->s1.argcount);
1530 case ICMD_CHECKCAST:
1535 case ICMD_INSTANCEOF:
1540 case ICMD_INLINE_START:
1541 case ICMD_INLINE_END:
1545 if (stage >= SHOW_STACK) {
1546 argp = iptr->sx.s23.s2.args;
1547 i = iptr->s1.argcount;
1549 SHOW_STACKVAR(*(argp++));
1552 printf("%s ", iptr->sx.s23.s3.bte->name);
1553 if (iptr->sx.s23.s3.bte->md->returntype.type != TYPE_VOID) {
1558 case ICMD_INVOKEVIRTUAL:
1559 case ICMD_INVOKESPECIAL:
1560 case ICMD_INVOKESTATIC:
1561 case ICMD_INVOKEINTERFACE:
1562 if (stage >= SHOW_STACK) {
1563 argp = iptr->sx.s23.s2.args;
1564 i = iptr->s1.argcount;
1566 SHOW_STACKVAR(*(argp++));
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)
1770 constant_classref *cr;
1771 unresolved_field *uf;
1774 /* get the opcode and the condition */
1776 opcode = iptr->opc & ICMD_OPCODE_MASK;
1777 condition = (iptr->opc & ICMD_CONDITION_MASK) >> 8;
1779 /* Print the condition for conditional instructions. */
1782 printf(" (condition: %s)", icmd_names[condition]);
1785 printf("%s", icmd_names[iptr->opc]);
1787 switch (iptr->opc) {
1788 case ICMD_IADDCONST:
1789 case ICMD_ISUBCONST:
1790 case ICMD_IMULCONST:
1794 case ICMD_IANDCONST:
1796 case ICMD_IXORCONST:
1797 case ICMD_ISHLCONST:
1798 case ICMD_ISHRCONST:
1799 case ICMD_IUSHRCONST:
1800 case ICMD_LSHLCONST:
1801 case ICMD_LSHRCONST:
1802 case ICMD_LUSHRCONST:
1804 case ICMD_IASTORECONST:
1805 case ICMD_BASTORECONST:
1806 case ICMD_CASTORECONST:
1807 case ICMD_SASTORECONST:
1808 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
1811 case ICMD_IFEQ_ICONST:
1812 case ICMD_IFNE_ICONST:
1813 case ICMD_IFLT_ICONST:
1814 case ICMD_IFGE_ICONST:
1815 case ICMD_IFGT_ICONST:
1816 case ICMD_IFLE_ICONST:
1817 printf(" %d, %d (0x%08x)", iptr[1].op1, iptr->val.i, iptr->val.i);
1820 case ICMD_ELSE_ICONST:
1821 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
1824 case ICMD_LADDCONST:
1825 case ICMD_LSUBCONST:
1826 case ICMD_LMULCONST:
1830 case ICMD_LANDCONST:
1832 case ICMD_LXORCONST:
1834 case ICMD_LASTORECONST:
1835 #if SIZEOF_VOID_P == 4
1836 printf(" %lld (0x%016llx)", iptr->val.l, iptr->val.l);
1838 printf(" %ld (0x%016lx)", iptr->val.l, iptr->val.l);
1843 printf(" %f (0x%08x)", iptr->val.f, iptr->val.i);
1847 #if SIZEOF_VOID_P == 4
1848 printf(" %g (0x%016llx)", iptr->val.d, iptr->val.l);
1850 printf(" %g (0x%016lx)", iptr->val.d, iptr->val.l);
1855 case ICMD_AASTORECONST:
1856 /* check if this is a constant string or a class reference */
1858 if (ICMD_ACONST_IS_CLASS(iptr)) {
1859 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1860 printf(" (NOT RESOLVED) classref = ");
1861 class_classref_print(ICMD_ACONST_UNRESOLVED_CLASSREF(iptr));
1864 printf(" class = ");
1865 class_print(ICMD_ACONST_RESOLVED_CLASSINFO(iptr));
1869 printf(" %p", iptr->val.a);
1872 printf(", String = \"");
1873 utf_display_printable_ascii(javastring_toutf(iptr->val.a, false));
1881 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1882 uf = INSTRUCTION_UNRESOLVED_FIELD(iptr);
1883 printf(" (NOT RESOLVED) ");
1885 field_fieldref_print(uf->fieldref);
1888 f = INSTRUCTION_RESOLVED_FIELDINFO(iptr);
1889 printf(" %d, ", f->offset);
1895 case ICMD_PUTSTATIC:
1896 case ICMD_GETSTATIC:
1897 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1898 uf = INSTRUCTION_UNRESOLVED_FIELD(iptr);
1899 printf(" (NOT RESOLVED) ");
1901 field_fieldref_print(uf->fieldref);
1904 f = INSTRUCTION_RESOLVED_FIELDINFO(iptr);
1905 if (!CLASS_IS_OR_ALMOST_INITIALIZED(f->class))
1906 printf(" (NOT INITIALIZED) ");
1914 case ICMD_PUTSTATICCONST:
1915 case ICMD_PUTFIELDCONST:
1916 switch (iptr[1].op1) {
1918 printf(" %d (0x%08x),", iptr->val.i, iptr->val.i);
1921 #if SIZEOF_VOID_P == 4
1922 printf(" %lld (0x%016llx),", iptr->val.l, iptr->val.l);
1924 printf(" %ld (0x%016lx),", iptr->val.l, iptr->val.l);
1928 printf(" %p,", iptr->val.a);
1931 printf(" %g (0x%08x),", iptr->val.f, iptr->val.i);
1934 #if SIZEOF_VOID_P == 4
1935 printf(" %g (0x%016llx),", iptr->val.d, iptr->val.l);
1937 printf(" %g (0x%016lx),", iptr->val.d, iptr->val.l);
1942 if (INSTRUCTION_IS_UNRESOLVED(iptr + 1)) {
1943 uf = INSTRUCTION_UNRESOLVED_FIELD(iptr + 1);
1944 printf(" (NOT RESOLVED) ");
1945 field_fieldref_print(uf->fieldref);
1948 f = INSTRUCTION_RESOLVED_FIELDINFO(iptr + 1);
1949 if ((iptr->opc == ICMD_PUTSTATICCONST) &&
1950 !CLASS_IS_OR_ALMOST_INITIALIZED(f->class))
1951 printf(" (NOT INITIALIZED), ");
1953 printf(" %d, ", f->offset);
1959 printf(" %d + %d", iptr->op1, iptr->val.i);
1994 printf(" %d", iptr->op1);
2000 utf_display_printable_ascii_classname(c->name);
2004 switch (iptr->op1) {
2032 case ICMD_ANEWARRAY:
2036 utf_display_printable_ascii_classname(c->name);
2040 case ICMD_MULTIANEWARRAY:
2045 printf(" (NOT RESOLVED) %d ", iptr->op1);
2046 utf_display_printable_ascii(cr->name);
2049 printf(" %d ", iptr->op1);
2050 utf_display_printable_ascii_classname(c->name);
2054 case ICMD_CHECKCAST:
2055 case ICMD_INSTANCEOF:
2060 if (c->flags & ACC_INTERFACE)
2061 printf(" (INTERFACE) ");
2063 printf(" (CLASS,%3d) ", c->vftbl->diffval);
2065 printf(" (NOT RESOLVED) ");
2066 utf_display_printable_ascii_classname(cr->name);
2069 case ICMD_INLINE_START:
2070 case ICMD_INLINE_END:
2072 insinfo_inline *insinfo = (insinfo_inline *) iptr->target;
2074 method_print(insinfo->method);
2079 printf(" %s", ((builtintable_entry *) iptr->val.a)->name);
2082 case ICMD_INVOKEVIRTUAL:
2083 case ICMD_INVOKESPECIAL:
2084 case ICMD_INVOKESTATIC:
2085 case ICMD_INVOKEINTERFACE:
2087 constant_FMIref *mref;
2089 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
2090 printf(" (NOT RESOLVED) ");
2091 mref = INSTRUCTION_UNRESOLVED_METHOD(iptr)->methodref;
2095 mref = INSTRUCTION_RESOLVED_FMIREF(iptr);
2097 method_methodref_print(mref);
2107 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
2109 /* if ((iptr->opc & ICMD_CONDITION_MASK) == 0) { */
2110 if (deadcode || !iptr->target)
2111 printf(" op1=%d", iptr->op1);
2113 printf(" L%03d (%p)", ((basicblock *) iptr->target)->debug_nr, iptr->target);
2123 #if SIZEOF_VOID_P == 4
2124 printf(" %lld (%016llx)", iptr->val.l, iptr->val.l);
2126 printf(" %ld (%016lx)", iptr->val.l, iptr->val.l);
2129 /* if ((iptr->opc & ICMD_CONDITION_MASK) == 0) { */
2130 if (deadcode || !iptr->target)
2131 printf(" op1=%d", iptr->op1);
2133 printf(" L%03d", ((basicblock *) iptr->target)->debug_nr);
2139 case ICMD_INLINE_GOTO:
2140 if (deadcode || !iptr->target)
2141 printf(" op1=%d", iptr->op1);
2143 printf(" L%03d (%p)", ((basicblock *) iptr->target)->debug_nr,iptr->target);
2147 case ICMD_IFNONNULL:
2148 case ICMD_IF_ICMPEQ:
2149 case ICMD_IF_ICMPNE:
2150 case ICMD_IF_ICMPLT:
2151 case ICMD_IF_ICMPGE:
2152 case ICMD_IF_ICMPGT:
2153 case ICMD_IF_ICMPLE:
2155 case ICMD_IF_LCMPEQ:
2156 case ICMD_IF_LCMPNE:
2157 case ICMD_IF_LCMPLT:
2158 case ICMD_IF_LCMPGE:
2159 case ICMD_IF_LCMPGT:
2160 case ICMD_IF_LCMPLE:
2162 case ICMD_IF_FCMPEQ:
2163 case ICMD_IF_FCMPNE:
2165 case ICMD_IF_FCMPL_LT:
2166 case ICMD_IF_FCMPL_GE:
2167 case ICMD_IF_FCMPL_GT:
2168 case ICMD_IF_FCMPL_LE:
2170 case ICMD_IF_FCMPG_LT:
2171 case ICMD_IF_FCMPG_GE:
2172 case ICMD_IF_FCMPG_GT:
2173 case ICMD_IF_FCMPG_LE:
2175 case ICMD_IF_DCMPEQ:
2176 case ICMD_IF_DCMPNE:
2178 case ICMD_IF_DCMPL_LT:
2179 case ICMD_IF_DCMPL_GE:
2180 case ICMD_IF_DCMPL_GT:
2181 case ICMD_IF_DCMPL_LE:
2183 case ICMD_IF_DCMPG_LT:
2184 case ICMD_IF_DCMPG_GE:
2185 case ICMD_IF_DCMPG_GT:
2186 case ICMD_IF_DCMPG_LE:
2188 case ICMD_IF_ACMPEQ:
2189 case ICMD_IF_ACMPNE:
2190 /* if (!(iptr->opc & ICMD_CONDITION_MASK)) { */
2191 if (deadcode || !iptr->target)
2192 printf(" op1=%d", iptr->op1);
2194 printf(" L%03d (%p)", ((basicblock *) iptr->target)->debug_nr,iptr->target);
2198 case ICMD_TABLESWITCH:
2199 s4ptr = (s4*)iptr->val.a;
2201 if (deadcode || !iptr->target) {
2202 printf(" %d;", *s4ptr);
2205 tptr = (void **) iptr->target;
2206 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
2210 s4ptr++; /* skip default */
2211 j = *s4ptr++; /* low */
2212 j = *s4ptr++ - j; /* high */
2214 if (deadcode || !*tptr)
2215 printf(" %d", *s4ptr++);
2217 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
2224 case ICMD_LOOKUPSWITCH:
2225 s4ptr = (s4*)iptr->val.a;
2227 if (deadcode || !iptr->target) {
2228 printf(" %d;", *s4ptr);
2231 tptr = (void **) iptr->target;
2232 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
2235 s4ptr++; /* default */
2236 j = *s4ptr++; /* count */
2239 if (deadcode || !*tptr) {
2240 s4ptr++; /* skip value */
2241 printf(" %d",*s4ptr++);
2244 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
2252 printf(" (NOT RESOLVED) Class = \"");
2253 utf_display_printable_ascii(((unresolved_class *) iptr->val.a)->classref->name);
2258 #endif /* !defined(NDEBUG) */
2261 * These are local overrides for various environment variables in Emacs.
2262 * Please do not remove this and leave it at the end of the file, where
2263 * Emacs will automagically detect them.
2264 * ---------------------------------------------------------------------
2267 * indent-tabs-mode: t
2271 * vim:noexpandtab:sw=4:ts=4: