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 */
1246 case ICMD_CHECKNULL:
1247 case ICMD_CHECKNULL_POP:
1252 case ICMD_ARRAYLENGTH:
1271 case ICMD_INT2SHORT:
1319 /* binary/const INT */
1320 case ICMD_IADDCONST:
1321 case ICMD_ISUBCONST:
1322 case ICMD_IMULCONST:
1326 case ICMD_IANDCONST:
1328 case ICMD_IXORCONST:
1329 case ICMD_ISHLCONST:
1330 case ICMD_ISHRCONST:
1331 case ICMD_IUSHRCONST:
1332 case ICMD_LSHLCONST:
1333 case ICMD_LSHRCONST:
1334 case ICMD_LUSHRCONST:
1336 SHOW_INT_CONST(iptr->sx.val.i);
1341 case ICMD_IASTORECONST:
1342 case ICMD_BASTORECONST:
1343 case ICMD_CASTORECONST:
1344 case ICMD_SASTORECONST:
1347 SHOW_INT_CONST(iptr->sx.s23.s3.constval);
1352 SHOW_INT_CONST(iptr->sx.val.i);
1356 case ICMD_IFEQ_ICONST:
1357 case ICMD_IFNE_ICONST:
1358 case ICMD_IFLT_ICONST:
1359 case ICMD_IFGE_ICONST:
1360 case ICMD_IFGT_ICONST:
1361 case ICMD_IFLE_ICONST:
1364 case ICMD_ELSE_ICONST:
1367 /* binary/const LNG */
1368 case ICMD_LADDCONST:
1369 case ICMD_LSUBCONST:
1370 case ICMD_LMULCONST:
1374 case ICMD_LANDCONST:
1376 case ICMD_LXORCONST:
1377 case ICMD_LASTORECONST:
1379 SHOW_LNG_CONST(iptr->sx.val.l);
1385 SHOW_LNG_CONST(iptr->sx.val.l);
1391 SHOW_FLT_CONST(iptr->sx.val.f);
1397 SHOW_DBL_CONST(iptr->sx.val.d);
1403 if (iptr->flags.bits & INS_FLAG_CLASS) {
1404 SHOW_CLASSREF_OR_CLASSINFO(iptr->sx.val.c);
1406 else if (iptr->sx.val.anyptr == NULL) {
1410 SHOW_STRING(iptr->sx.val.stringconst);
1415 case ICMD_AASTORECONST:
1418 printf("%p ", (void*) iptr->sx.s23.s3.constval);
1421 case ICMD_GETFIELD: /* 1 -> 1 */
1422 case ICMD_PUTFIELD: /* 2 -> 0 */
1423 case ICMD_PUTSTATIC: /* 1 -> 0 */
1424 case ICMD_GETSTATIC: /* 0 -> 1 */
1425 case ICMD_PUTSTATICCONST: /* 0 -> 0 */
1426 case ICMD_PUTFIELDCONST: /* 1 -> 0 */
1427 if (opcode != ICMD_GETSTATIC && opcode != ICMD_PUTSTATICCONST) {
1429 if (opcode == ICMD_PUTFIELD) {
1433 if (iptr->flags.bits & INS_FLAG_UNRESOLVED)
1434 printf("(UNRESOLVED) ");
1435 NEW_INSTRUCTION_GET_FIELDREF(iptr, fmiref);
1438 if (opcode == ICMD_GETSTATIC || opcode == ICMD_GETFIELD) {
1444 SHOW_S1_LOCAL(iptr);
1445 SHOW_INT_CONST(iptr->sx.val.i);
1446 SHOW_DST_LOCAL(iptr);
1476 SHOW_S1_LOCAL(iptr);
1484 SHOW_S1_LOCAL(iptr);
1494 SHOW_DST_LOCAL(iptr);
1505 case ICMD_ANEWARRAY:
1509 case ICMD_MULTIANEWARRAY:
1510 if (stage >= SHOW_STACK) {
1511 argp = iptr->sx.s23.s2.args;
1512 i = iptr->s1.argcount;
1514 SHOW_STACKVAR(*(argp++));
1518 printf("argcount=%d ", iptr->s1.argcount);
1523 case ICMD_CHECKCAST:
1528 case ICMD_INSTANCEOF:
1533 case ICMD_INLINE_START:
1534 case ICMD_INLINE_END:
1538 if (stage >= SHOW_STACK) {
1539 argp = iptr->sx.s23.s2.args;
1540 i = iptr->s1.argcount;
1542 SHOW_STACKVAR(*(argp++));
1545 printf("%s ", iptr->sx.s23.s3.bte->name);
1546 if (iptr->sx.s23.s3.bte->md->returntype.type != TYPE_VOID) {
1551 case ICMD_INVOKEVIRTUAL:
1552 case ICMD_INVOKESPECIAL:
1553 case ICMD_INVOKESTATIC:
1554 case ICMD_INVOKEINTERFACE:
1555 if (stage >= SHOW_STACK) {
1556 argp = iptr->sx.s23.s2.args;
1557 i = iptr->s1.argcount;
1559 SHOW_STACKVAR(*(argp++));
1562 if (iptr->flags.bits & INS_FLAG_UNRESOLVED) {
1563 printf("(UNRESOLVED) ");
1565 NEW_INSTRUCTION_GET_METHODREF(iptr, fmiref);
1566 method_methodref_print(fmiref);
1567 if (fmiref->parseddesc.md->returntype.type != TYPE_VOID) {
1579 SHOW_TARGET(iptr->dst);
1589 SHOW_TARGET(iptr->dst);
1593 case ICMD_INLINE_GOTO:
1594 SHOW_TARGET(iptr->dst);
1598 SHOW_TARGET(iptr->sx.s23.s3.jsrtarget);
1603 case ICMD_IFNONNULL:
1605 SHOW_TARGET(iptr->dst);
1608 case ICMD_IF_ICMPEQ:
1609 case ICMD_IF_ICMPNE:
1610 case ICMD_IF_ICMPLT:
1611 case ICMD_IF_ICMPGE:
1612 case ICMD_IF_ICMPGT:
1613 case ICMD_IF_ICMPLE:
1615 case ICMD_IF_LCMPEQ:
1616 case ICMD_IF_LCMPNE:
1617 case ICMD_IF_LCMPLT:
1618 case ICMD_IF_LCMPGE:
1619 case ICMD_IF_LCMPGT:
1620 case ICMD_IF_LCMPLE:
1622 case ICMD_IF_FCMPEQ:
1623 case ICMD_IF_FCMPNE:
1625 case ICMD_IF_FCMPL_LT:
1626 case ICMD_IF_FCMPL_GE:
1627 case ICMD_IF_FCMPL_GT:
1628 case ICMD_IF_FCMPL_LE:
1630 case ICMD_IF_FCMPG_LT:
1631 case ICMD_IF_FCMPG_GE:
1632 case ICMD_IF_FCMPG_GT:
1633 case ICMD_IF_FCMPG_LE:
1635 case ICMD_IF_DCMPEQ:
1636 case ICMD_IF_DCMPNE:
1638 case ICMD_IF_DCMPL_LT:
1639 case ICMD_IF_DCMPL_GE:
1640 case ICMD_IF_DCMPL_GT:
1641 case ICMD_IF_DCMPL_LE:
1643 case ICMD_IF_DCMPG_LT:
1644 case ICMD_IF_DCMPG_GE:
1645 case ICMD_IF_DCMPG_GT:
1646 case ICMD_IF_DCMPG_LE:
1648 case ICMD_IF_ACMPEQ:
1649 case ICMD_IF_ACMPNE:
1652 SHOW_TARGET(iptr->dst);
1655 case ICMD_TABLESWITCH:
1659 case ICMD_LOOKUPSWITCH:
1677 if (stage >= SHOW_STACK) {
1678 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1679 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1681 SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
1682 SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
1687 if (stage >= SHOW_STACK) {
1688 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1689 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1691 SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
1692 SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
1693 SHOW_STACKVAR(iptr->dst.dupslots[2+2]);
1698 if (stage >= SHOW_STACK) {
1699 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1700 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1701 SHOW_STACKVAR(iptr->dst.dupslots[2]);
1703 SHOW_STACKVAR(iptr->dst.dupslots[3+0]);
1704 SHOW_STACKVAR(iptr->dst.dupslots[3+1]);
1705 SHOW_STACKVAR(iptr->dst.dupslots[3+2]);
1706 SHOW_STACKVAR(iptr->dst.dupslots[3+3]);
1707 SHOW_STACKVAR(iptr->dst.dupslots[3+4]);
1712 if (stage >= SHOW_STACK) {
1713 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1714 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1715 SHOW_STACKVAR(iptr->dst.dupslots[2]);
1717 SHOW_STACKVAR(iptr->dst.dupslots[3+0]);
1718 SHOW_STACKVAR(iptr->dst.dupslots[3+1]);
1719 SHOW_STACKVAR(iptr->dst.dupslots[3+2]);
1720 SHOW_STACKVAR(iptr->dst.dupslots[3+3]);
1725 if (stage >= SHOW_STACK) {
1726 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1727 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1728 SHOW_STACKVAR(iptr->dst.dupslots[2]);
1729 SHOW_STACKVAR(iptr->dst.dupslots[4]);
1731 SHOW_STACKVAR(iptr->dst.dupslots[4+0]);
1732 SHOW_STACKVAR(iptr->dst.dupslots[4+1]);
1733 SHOW_STACKVAR(iptr->dst.dupslots[4+2]);
1734 SHOW_STACKVAR(iptr->dst.dupslots[4+3]);
1735 SHOW_STACKVAR(iptr->dst.dupslots[4+4]);
1736 SHOW_STACKVAR(iptr->dst.dupslots[4+5]);
1741 if (stage >= SHOW_STACK) {
1742 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1743 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1745 SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
1746 SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
1752 #endif /* !defined(NDEBUG) */
1754 #if !defined(NDEBUG)
1755 void show_icmd(instruction *iptr, bool deadcode)
1766 constant_classref *cr;
1767 unresolved_field *uf;
1770 /* get the opcode and the condition */
1772 opcode = iptr->opc & ICMD_OPCODE_MASK;
1773 condition = (iptr->opc & ICMD_CONDITION_MASK) >> 8;
1775 /* Print the condition for conditional instructions. */
1778 printf(" (condition: %s)", icmd_names[condition]);
1781 printf("%s", icmd_names[iptr->opc]);
1783 switch (iptr->opc) {
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: