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)
326 basicblock *lastbptr;
331 /* get required compiler data */
338 /* We need to enter a lock here, since the binutils disassembler
339 is not reentrant-able and we could not read functions printed
342 LOCK_MONITOR_ENTER(show_global_lock);
344 /* get the last basic block */
346 for (lastbptr = jd->new_basicblocks; lastbptr != NULL; lastbptr = lastbptr->next);
352 printf("\n(NEW INSTRUCTION FORMAT)\n");
353 printf("\nBasic blocks: %d\n", jd->new_basicblockcount);
354 printf("Code length: %d\n", (lastbptr->mpc - jd->new_basicblocks[0].mpc));
355 printf("Data length: %d\n", cd->dseglen);
356 printf("Stub length: %d\n", (s4) (code->mcodelength -
357 ((ptrint) cd->dseglen + lastbptr->mpc)));
358 printf("Max locals: %d\n", cd->maxlocals);
359 printf("Max stack: %d\n", cd->maxstack);
360 printf("Line number table length: %d\n", m->linenumbercount);
362 if (stage >= SHOW_PARSE) {
363 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
364 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
365 printf(" L%03d ... ", ex->start->nr );
366 printf("L%03d = ", ex->end->nr);
367 printf("L%03d", ex->handler->nr);
368 printf(" (catchtype: ");
369 if (ex->catchtype.any)
370 if (IS_CLASSREF(ex->catchtype))
371 utf_display_printable_ascii_classname(ex->catchtype.ref->name);
373 utf_display_printable_ascii_classname(ex->catchtype.cls->name);
380 if (stage >= SHOW_PARSE && rd) {
381 printf("Local Table:\n");
382 for (i = 0; i < cd->maxlocals; i++) {
385 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
386 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
387 # if defined(ENABLE_INTRP)
390 if (rd->locals[i][j].type >= 0) {
391 printf(" (%s) ", jit_type[j]);
392 if (stage >= SHOW_REGS) {
393 if (rd->locals[i][j].flags & INMEMORY)
394 printf("m%2d", rd->locals[i][j].regoff);
395 # ifdef HAS_ADDRESS_REGISTER_FILE
396 else if (j == TYPE_ADR)
397 printf("r%02d", rd->locals[i][j].regoff);
399 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
400 printf("f%02d", rd->locals[i][j].regoff);
402 # if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
403 if (IS_2_WORD_TYPE(j))
405 regs[GET_LOW_REG(rd->locals[i][j].regoff)],
406 regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
409 printf("%3s", regs[rd->locals[i][j].regoff]);
413 # if defined(ENABLE_INTRP)
417 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
424 if (stage >= SHOW_STACK && rd) {
425 #if defined(ENABLE_LSRA) || defined(ENABLE_SSA)
428 #if defined(ENABLE_INTRP)
431 printf("Interface Table:\n");
432 for (i = 0; i < cd->maxstack; i++) {
433 if ((rd->interfaces[i][0].type >= 0) ||
434 (rd->interfaces[i][1].type >= 0) ||
435 (rd->interfaces[i][2].type >= 0) ||
436 (rd->interfaces[i][3].type >= 0) ||
437 (rd->interfaces[i][4].type >= 0)) {
440 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
441 # if defined(ENABLE_INTRP)
444 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
445 if (rd->interfaces[i][j].type >= 0) {
446 printf(" (%s) ", jit_type[j]);
447 if (stage >= SHOW_REGS) {
448 if (rd->interfaces[i][j].flags & SAVEDVAR) {
449 if (rd->interfaces[i][j].flags & INMEMORY)
450 printf("M%2d", rd->interfaces[i][j].regoff);
451 #ifdef HAS_ADDRESS_REGISTER_FILE
452 else if (j == TYPE_ADR)
453 printf("R%02d", rd->interfaces[i][j].regoff);
455 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
456 printf("F%02d", rd->interfaces[i][j].regoff);
458 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
459 if (IS_2_WORD_TYPE(j))
461 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
462 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
465 printf("%3s",regs[rd->interfaces[i][j].regoff]);
469 if (rd->interfaces[i][j].flags & INMEMORY)
470 printf("m%2d", rd->interfaces[i][j].regoff);
471 #ifdef HAS_ADDRESS_REGISTER_FILE
472 else if (j == TYPE_ADR)
473 printf("r%02d", rd->interfaces[i][j].regoff);
475 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
476 printf("f%02d", rd->interfaces[i][j].regoff);
478 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
479 if (IS_2_WORD_TYPE(j))
481 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
482 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
485 printf("%3s",regs[rd->interfaces[i][j].regoff]);
492 # if defined(ENABLE_INTRP)
495 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
501 #if defined(ENABLE_INTRP)
504 #if defined(ENABLE_LSRA) || defined(ENABLE_SSA)
507 } /* if >= SHOW_STACK */
509 if (code->rplpoints) {
510 printf("Replacement Points:\n");
511 replace_show_replacement_points(code);
515 #if defined(ENABLE_DISASSEMBLER)
516 /* show code before first basic block */
518 if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd)) {
519 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen);
521 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + jd->new_basicblocks[0].mpc);)
528 /* show code of all basic blocks */
530 for (bptr = jd->new_basicblocks; bptr != NULL; bptr = bptr->next)
531 new_show_basicblock(jd, bptr, stage);
533 #if defined(ENABLE_DISASSEMBLER)
534 /* show stubs code */
536 if (stage >= SHOW_CODE && opt_showdisassemble && opt_showexceptionstubs) {
537 printf("\nStubs code:\n");
538 printf("Length: %d\n\n", (s4) (code->mcodelength -
539 ((ptrint) cd->dseglen + lastbptr->mpc)));
541 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen + lastbptr->mpc);
543 for (; (ptrint) u1ptr < ((ptrint) code->mcode + code->mcodelength);)
550 LOCK_MONITOR_EXIT(show_global_lock);
552 /* finally flush the output */
556 #endif /* !defined(NDEBUG) */
559 void show_method(jitdata *jd)
566 basicblock *lastbptr;
571 /* get required compiler data */
578 /* We need to enter a lock here, since the binutils disassembler
579 is not reentrant-able and we could not read functions printed
582 LOCK_MONITOR_ENTER(show_global_lock);
584 /* get the last basic block */
586 for (bptr = m->basicblocks; bptr != NULL; bptr = bptr->next)
593 printf("\nBasic blocks: %d\n", m->basicblockcount);
594 printf("Code length: %d\n", (lastbptr->mpc - m->basicblocks[0].mpc));
595 printf("Data length: %d\n", cd->dseglen);
596 printf("Stub length: %d\n", (s4) (code->mcodelength -
597 ((ptrint) cd->dseglen + lastbptr->mpc)));
598 printf("Max locals: %d\n", cd->maxlocals);
599 printf("Max stack: %d\n", cd->maxstack);
600 printf("Line number table length: %d\n", m->linenumbercount);
602 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
603 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
604 printf(" L%03d ... ", ex->start->nr );
605 printf("L%03d = ", ex->end->nr);
606 printf("L%03d", ex->handler->nr);
607 printf(" (catchtype: ");
608 if (ex->catchtype.any)
609 if (IS_CLASSREF(ex->catchtype))
610 utf_display_printable_ascii_classname(ex->catchtype.ref->name);
612 utf_display_printable_ascii_classname(ex->catchtype.cls->name);
618 printf("Local Table:\n");
619 for (i = 0; i < cd->maxlocals; i++) {
622 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
623 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
624 # if defined(ENABLE_INTRP)
627 if (rd->locals[i][j].type >= 0) {
628 printf(" (%s) ", jit_type[j]);
629 if (rd->locals[i][j].flags & INMEMORY)
630 printf("m%2d", rd->locals[i][j].regoff);
631 # ifdef HAS_ADDRESS_REGISTER_FILE
632 else if (j == TYPE_ADR)
633 printf("r%02d", rd->locals[i][j].regoff);
635 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
636 printf("f%02d", rd->locals[i][j].regoff);
638 # if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
639 if (IS_2_WORD_TYPE(j))
641 regs[GET_LOW_REG(rd->locals[i][j].regoff)],
642 regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
645 printf("%3s", regs[rd->locals[i][j].regoff]);
648 # if defined(ENABLE_INTRP)
652 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
658 #if defined(ENABLE_LSRA) || defined(ENABLE_SSA)
661 #if defined(ENABLE_INTRP)
664 printf("Interface Table:\n");
665 for (i = 0; i < cd->maxstack; i++) {
666 if ((rd->interfaces[i][0].type >= 0) ||
667 (rd->interfaces[i][1].type >= 0) ||
668 (rd->interfaces[i][2].type >= 0) ||
669 (rd->interfaces[i][3].type >= 0) ||
670 (rd->interfaces[i][4].type >= 0)) {
673 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
674 # if defined(ENABLE_INTRP)
677 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
678 if (rd->interfaces[i][j].type >= 0) {
679 printf(" (%s) ", jit_type[j]);
680 if (rd->interfaces[i][j].flags & SAVEDVAR) {
681 if (rd->interfaces[i][j].flags & INMEMORY)
682 printf("M%2d", rd->interfaces[i][j].regoff);
683 #ifdef HAS_ADDRESS_REGISTER_FILE
684 else if (j == TYPE_ADR)
685 printf("R%02d", rd->interfaces[i][j].regoff);
687 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
688 printf("F%02d", rd->interfaces[i][j].regoff);
690 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
691 if (IS_2_WORD_TYPE(j))
693 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
694 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
697 printf("%3s",regs[rd->interfaces[i][j].regoff]);
701 if (rd->interfaces[i][j].flags & INMEMORY)
702 printf("m%2d", rd->interfaces[i][j].regoff);
703 #ifdef HAS_ADDRESS_REGISTER_FILE
704 else if (j == TYPE_ADR)
705 printf("r%02d", rd->interfaces[i][j].regoff);
707 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
708 printf("f%02d", rd->interfaces[i][j].regoff);
710 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
711 if (IS_2_WORD_TYPE(j))
713 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
714 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
717 printf("%3s",regs[rd->interfaces[i][j].regoff]);
723 # if defined(ENABLE_INTRP)
726 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
732 #if defined(ENABLE_INTRP)
735 #if defined(ENABLE_LSRA) || defined(ENABLE_SSA)
739 if (code->rplpoints) {
740 printf("Replacement Points:\n");
741 replace_show_replacement_points(code);
745 #if defined(ENABLE_DISASSEMBLER)
746 /* show code before first basic block */
748 if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd)) {
749 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen);
751 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + m->basicblocks[0].mpc);)
758 /* show code of all basic blocks */
760 for (bptr = m->basicblocks; bptr != NULL; bptr = bptr->next)
761 show_basicblock(jd, bptr);
763 #if defined(ENABLE_DISASSEMBLER)
764 /* show stubs code */
766 if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) && opt_showexceptionstubs) {
767 printf("\nStubs code:\n");
768 printf("Length: %d\n\n", (s4) (code->mcodelength -
769 ((ptrint) cd->dseglen + lastbptr->mpc)));
771 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen + lastbptr->mpc);
773 for (; (ptrint) u1ptr < ((ptrint) code->mcode + code->mcodelength);)
780 LOCK_MONITOR_EXIT(show_global_lock);
782 /* finally flush the output */
786 #endif /* !defined(NDEBUG) */
789 /* show_basicblock *************************************************************
791 Print the intermediate representation of a basic block.
793 NOTE: Currently this function may only be called after register allocation!
795 *******************************************************************************/
798 void new_show_basicblock(jitdata *jd, basicblock *bptr, int stage)
805 new_instruction *iptr;
808 /* get required compiler data */
814 if (bptr->flags != BBDELETED) {
815 deadcode = bptr->flags <= BBREACHED;
817 printf("======== %sL%03d ======== (flags: %d, bitflags: %01x, next: %d, type: ",
818 (bptr->bitflags & BBFLAG_REPLACEMENT) ? "<REPLACE> " : "",
819 bptr->nr, bptr->flags, bptr->bitflags,
820 (bptr->next) ? (bptr->next->nr) : -1);
822 switch (bptr->type) {
834 printf(", instruction count: %d, predecessors: %d [ ",
835 bptr->icount, bptr->predecessorcount);
837 for (i = 0; i < bptr->predecessorcount; i++)
838 printf("%d ", bptr->predecessors[i]->nr);
842 iptr = /*XXX*/ (new_instruction *) bptr->iinstr;
844 for (i = 0; i < bptr->icount; i++, iptr++) {
845 printf("%4d: ", iptr->line);
847 new_show_icmd(jd, iptr, deadcode, stage);
851 #if defined(ENABLE_DISASSEMBLER)
852 if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) &&
855 u1ptr = (u1 *) (code->mcode + cd->dseglen + bptr->mpc);
857 if (bptr->next != NULL) {
858 for (; u1ptr < (u1 *) (code->mcode + cd->dseglen + bptr->next->mpc);)
863 for (; u1ptr < (u1 *) (code->mcode + code->mcodelength);)
871 #endif /* !defined(NDEBUG) */
874 void show_basicblock(jitdata *jd, basicblock *bptr)
884 /* get required compiler data */
890 if (bptr->flags != BBDELETED) {
891 deadcode = bptr->flags <= BBREACHED;
896 for (j = cd->maxstack; j > 0; j--)
899 show_print_stack(cd, bptr->instack);
901 printf("] %sL%03d(flags: %d, bitflags: %01x, next: %d, type: ",
902 (bptr->bitflags & BBFLAG_REPLACEMENT) ? "<REPLACE> " : "",
903 bptr->nr, bptr->flags, bptr->bitflags,
904 (bptr->next) ? (bptr->next->nr) : -1);
906 switch (bptr->type) {
918 printf(", instruction count: %d, predecessors: %d [ ",
919 bptr->icount, bptr->predecessorcount);
921 for (i = 0; i < bptr->predecessorcount; i++)
922 printf("%d ", bptr->predecessors[i]->nr);
928 for (i = 0; i < bptr->icount; i++, iptr++) {
932 for (j = cd->maxstack; j > 0; j--)
935 show_print_stack(cd, iptr->dst);
937 printf("] %5d (line: %5d) ", i, iptr->line);
939 show_icmd(iptr, deadcode);
943 #if defined(ENABLE_DISASSEMBLER)
944 if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) && (!deadcode)) {
946 u1ptr = (u1 *) (code->mcode + cd->dseglen + bptr->mpc);
948 if (bptr->next != NULL) {
949 for (; u1ptr < (u1 *) (code->mcode + cd->dseglen + bptr->next->mpc);)
954 for (; u1ptr < (u1 *) (code->mcode + code->mcodelength);)
962 #endif /* !defined(NDEBUG) */
965 /* show_icmd *******************************************************************
967 Print the intermediate representation of an instruction.
969 NOTE: Currently this function may only be called after register allocation!
971 *******************************************************************************/
975 #define SHOW_TARGET(target) \
976 if (stage >= SHOW_STACK) { \
977 printf("--> L%03d ", (target).block->nr); \
979 else if (stage >= SHOW_PARSE) { \
980 printf("--> insindex %d (L%03d) ", (target).insindex, \
981 jd->new_basicblocks[jd->new_basicblockindex[ \
982 (target).insindex]].nr); \
985 printf("--> insindex %d ", (target).insindex); \
988 #define SHOW_INT_CONST(val) \
989 if (stage >= SHOW_PARSE) { \
990 printf("%ld ", (long) (val)); \
996 #define SHOW_LNG_CONST(val) \
997 if (stage >= SHOW_PARSE) { \
998 printf("%lld ", (long long)(val)); \
1001 printf("lconst "); \
1004 #define SHOW_FLT_CONST(val) \
1005 if (stage >= SHOW_PARSE) { \
1006 printf("%g ", (val)); \
1009 printf("fconst "); \
1012 #define SHOW_DBL_CONST(val) \
1013 if (stage >= SHOW_PARSE) { \
1014 printf("%g ", (val)); \
1017 printf("dconst "); \
1020 #define SHOW_INDEX(index) \
1021 if (stage >= SHOW_PARSE) { \
1022 printf("%d ", index); \
1028 #define SHOW_STRING(val) \
1029 if (stage >= SHOW_PARSE) { \
1031 utf_display_printable_ascii( \
1032 javastring_toutf((java_lang_String *)(val), false)); \
1036 printf("string "); \
1039 #define SHOW_CLASSREF_OR_CLASSINFO(c) \
1040 if (stage >= SHOW_PARSE) { \
1041 if (IS_CLASSREF(c)) \
1042 class_classref_print(c.ref); \
1044 class_print(c.cls); \
1051 #define SHOW_FIELD(fmiref) \
1052 if (stage >= SHOW_PARSE) { \
1053 field_fieldref_print(fmiref); \
1060 #define SHOW_STACKVAR(sp) \
1061 new_show_stackvar(jd, (sp), stage)
1063 #define SHOW_S1(iptr) \
1064 if (stage >= SHOW_STACK) { \
1065 SHOW_STACKVAR(iptr->s1.var); \
1068 #define SHOW_S2(iptr) \
1069 if (stage >= SHOW_STACK) { \
1070 SHOW_STACKVAR(iptr->sx.s23.s2.var); \
1073 #define SHOW_S3(iptr) \
1074 if (stage >= SHOW_STACK) { \
1075 SHOW_STACKVAR(iptr->sx.s23.s3.var); \
1078 #define SHOW_DST(iptr) \
1079 if (stage >= SHOW_STACK) { \
1081 SHOW_STACKVAR(iptr->dst.var); \
1084 #define SHOW_S1_LOCAL(iptr) \
1085 if (stage >= SHOW_STACK) { \
1086 printf("L%d ", iptr->s1.localindex); \
1089 #define SHOW_DST_LOCAL(iptr) \
1090 if (stage >= SHOW_STACK) { \
1091 printf("=> L%d ", iptr->dst.localindex); \
1094 static void new_show_stackvar(jitdata *jd, stackptr sp, int stage)
1099 case TYPE_INT: type = 'i'; break;
1100 case TYPE_LNG: type = 'l'; break;
1101 case TYPE_FLT: type = 'f'; break;
1102 case TYPE_DBL: type = 'd'; break;
1103 case TYPE_ADR: type = 'a'; break;
1104 default: type = '?';
1106 printf("S%c%d", type, (int) (sp - jd->new_stack));
1108 if (stage >= SHOW_REGS) {
1111 if (sp->flags & SAVEDVAR) {
1112 switch (sp->varkind) {
1114 if (sp->flags & INMEMORY)
1115 printf("M%02d", sp->regoff);
1116 #ifdef HAS_ADDRESS_REGISTER_FILE
1117 else if (sp->type == TYPE_ADR)
1118 printf("R%02d", sp->regoff);
1120 else if (IS_FLT_DBL_TYPE(sp->type))
1121 printf("F%02d", sp->regoff);
1123 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
1124 if (IS_2_WORD_TYPE(sp->type)) {
1125 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1126 # if defined(ENABLE_INTRP)
1128 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1129 GET_HIGH_REG(sp->regoff));
1132 printf("%3s/%3s", regs[GET_LOW_REG(sp->regoff)],
1133 regs[GET_HIGH_REG(sp->regoff)]);
1135 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1136 GET_HIGH_REG(sp->regoff));
1140 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
1142 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1143 # if defined(ENABLE_INTRP)
1145 printf("%3d", sp->regoff);
1148 printf("%3s", regs[sp->regoff]);
1150 printf("%3d", sp->regoff);
1156 printf("I%02d", sp->varnum);
1159 printf("L%02d", sp->varnum);
1162 if (sp->varnum == -1) {
1164 /* varkind ARGVAR "misused for this special case */
1167 else /* "normal" Argvar */
1168 printf("A%02d", sp->varnum);
1171 printf("!xx {kind=%d, num=%d}", sp->varkind, sp->varnum);
1174 else { /* not SAVEDVAR */
1175 switch (sp->varkind) {
1177 if (sp->flags & INMEMORY)
1178 printf("m%02d", sp->regoff);
1179 #ifdef HAS_ADDRESS_REGISTER_FILE
1180 else if (sp->type == TYPE_ADR)
1181 printf("r%02d", sp->regoff);
1183 else if (IS_FLT_DBL_TYPE(sp->type))
1184 printf("f%02d", sp->regoff);
1186 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
1187 if (IS_2_WORD_TYPE(sp->type)) {
1188 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1189 # if defined(ENABLE_INTRP)
1191 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1192 GET_HIGH_REG(sp->regoff));
1195 printf("%3s/%3s", regs[GET_LOW_REG(sp->regoff)],
1196 regs[GET_HIGH_REG(sp->regoff)]);
1198 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1199 GET_HIGH_REG(sp->regoff));
1203 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
1205 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1206 # if defined(ENABLE_INTRP)
1208 printf("%3d", sp->regoff);
1211 printf("%3s", regs[sp->regoff]);
1213 printf("%3d", sp->regoff);
1219 printf("i%02d", sp->varnum);
1222 printf("l%02d", sp->varnum);
1225 if (sp->varnum == -1) {
1227 /* varkind ARGVAR "misused for this special case */
1230 else /* "normal" Argvar */
1231 printf("a%02d", sp->varnum);
1234 printf("?xx {kind=%d, num=%d}", sp->varkind, sp->varnum);
1243 void new_show_icmd(jitdata *jd, new_instruction *iptr, bool deadcode, int stage)
1246 branch_target_t *table;
1247 lookup_target_t *lookup;
1248 constant_FMIref *fmiref;
1252 /* get the opcode and the condition */
1256 printf("%s ", icmd_names[opcode]);
1258 if (stage < SHOW_PARSE)
1264 /* Print the condition for conditional instructions. */
1266 /* XXX print condition from flags */
1268 if (iptr->flags.bits & INS_FLAG_UNRESOLVED)
1269 printf("(UNRESOLVED) ");
1274 case ICMD_CHECKNULL:
1275 case ICMD_CHECKNULL_POP:
1280 case ICMD_ARRAYLENGTH:
1299 case ICMD_INT2SHORT:
1347 /* binary/const INT */
1348 case ICMD_IADDCONST:
1349 case ICMD_ISUBCONST:
1350 case ICMD_IMULCONST:
1354 case ICMD_IANDCONST:
1356 case ICMD_IXORCONST:
1357 case ICMD_ISHLCONST:
1358 case ICMD_ISHRCONST:
1359 case ICMD_IUSHRCONST:
1360 case ICMD_LSHLCONST:
1361 case ICMD_LSHRCONST:
1362 case ICMD_LUSHRCONST:
1364 SHOW_INT_CONST(iptr->sx.val.i);
1368 /* ?ASTORECONST (trinary/const INT) */
1369 case ICMD_IASTORECONST:
1370 case ICMD_BASTORECONST:
1371 case ICMD_CASTORECONST:
1372 case ICMD_SASTORECONST:
1375 SHOW_INT_CONST(iptr->sx.s23.s3.constval);
1380 SHOW_INT_CONST(iptr->sx.val.i);
1384 /* binary/const LNG */
1385 case ICMD_LADDCONST:
1386 case ICMD_LSUBCONST:
1387 case ICMD_LMULCONST:
1391 case ICMD_LANDCONST:
1393 case ICMD_LXORCONST:
1395 SHOW_LNG_CONST(iptr->sx.val.l);
1399 /* trinary/const LNG (<= pointer size) */
1400 case ICMD_LASTORECONST:
1403 SHOW_LNG_CONST(iptr->sx.s23.s3.constval);
1408 SHOW_LNG_CONST(iptr->sx.val.l);
1414 SHOW_FLT_CONST(iptr->sx.val.f);
1420 SHOW_DBL_CONST(iptr->sx.val.d);
1426 if (iptr->flags.bits & INS_FLAG_CLASS) {
1427 SHOW_CLASSREF_OR_CLASSINFO(iptr->sx.val.c);
1429 else if (iptr->sx.val.anyptr == NULL) {
1433 SHOW_STRING(iptr->sx.val.stringconst);
1438 case ICMD_AASTORECONST:
1441 printf("%p ", (void*) iptr->sx.s23.s3.constval);
1444 case ICMD_GETFIELD: /* 1 -> 1 */
1445 case ICMD_PUTFIELD: /* 2 -> 0 */
1446 case ICMD_PUTSTATIC: /* 1 -> 0 */
1447 case ICMD_GETSTATIC: /* 0 -> 1 */
1448 case ICMD_PUTSTATICCONST: /* 0 -> 0 */
1449 case ICMD_PUTFIELDCONST: /* 1 -> 0 */
1450 if (opcode != ICMD_GETSTATIC && opcode != ICMD_PUTSTATICCONST) {
1452 if (opcode == ICMD_PUTFIELD) {
1456 NEW_INSTRUCTION_GET_FIELDREF(iptr, fmiref);
1459 if (opcode == ICMD_GETSTATIC || opcode == ICMD_GETFIELD) {
1465 SHOW_S1_LOCAL(iptr);
1466 SHOW_INT_CONST(iptr->sx.val.i);
1467 SHOW_DST_LOCAL(iptr);
1497 SHOW_S1_LOCAL(iptr);
1505 SHOW_S1_LOCAL(iptr);
1515 SHOW_DST_LOCAL(iptr);
1526 case ICMD_ANEWARRAY:
1530 case ICMD_MULTIANEWARRAY:
1531 if (stage >= SHOW_STACK) {
1532 argp = iptr->sx.s23.s2.args;
1533 i = iptr->s1.argcount;
1535 SHOW_STACKVAR(*(argp++));
1539 printf("argcount=%d ", iptr->s1.argcount);
1544 case ICMD_CHECKCAST:
1549 case ICMD_INSTANCEOF:
1554 case ICMD_INLINE_START:
1555 case ICMD_INLINE_END:
1559 if (stage >= SHOW_STACK) {
1560 argp = iptr->sx.s23.s2.args;
1561 i = iptr->s1.argcount;
1563 SHOW_STACKVAR(*(argp++));
1566 printf("%s ", iptr->sx.s23.s3.bte->cname);
1567 if (iptr->sx.s23.s3.bte->md->returntype.type != TYPE_VOID) {
1572 case ICMD_INVOKEVIRTUAL:
1573 case ICMD_INVOKESPECIAL:
1574 case ICMD_INVOKESTATIC:
1575 case ICMD_INVOKEINTERFACE:
1576 if (stage >= SHOW_STACK) {
1577 argp = iptr->sx.s23.s2.args;
1578 i = iptr->s1.argcount;
1580 SHOW_STACKVAR(*(argp++));
1583 NEW_INSTRUCTION_GET_METHODREF(iptr, fmiref);
1584 method_methodref_print(fmiref);
1585 if (fmiref->parseddesc.md->returntype.type != TYPE_VOID) {
1597 SHOW_TARGET(iptr->dst);
1607 SHOW_TARGET(iptr->dst);
1611 case ICMD_INLINE_GOTO:
1612 SHOW_TARGET(iptr->dst);
1616 SHOW_TARGET(iptr->sx.s23.s3.jsrtarget);
1621 case ICMD_IFNONNULL:
1623 SHOW_TARGET(iptr->dst);
1626 case ICMD_IF_ICMPEQ:
1627 case ICMD_IF_ICMPNE:
1628 case ICMD_IF_ICMPLT:
1629 case ICMD_IF_ICMPGE:
1630 case ICMD_IF_ICMPGT:
1631 case ICMD_IF_ICMPLE:
1633 case ICMD_IF_LCMPEQ:
1634 case ICMD_IF_LCMPNE:
1635 case ICMD_IF_LCMPLT:
1636 case ICMD_IF_LCMPGE:
1637 case ICMD_IF_LCMPGT:
1638 case ICMD_IF_LCMPLE:
1640 case ICMD_IF_FCMPEQ:
1641 case ICMD_IF_FCMPNE:
1643 case ICMD_IF_FCMPL_LT:
1644 case ICMD_IF_FCMPL_GE:
1645 case ICMD_IF_FCMPL_GT:
1646 case ICMD_IF_FCMPL_LE:
1648 case ICMD_IF_FCMPG_LT:
1649 case ICMD_IF_FCMPG_GE:
1650 case ICMD_IF_FCMPG_GT:
1651 case ICMD_IF_FCMPG_LE:
1653 case ICMD_IF_DCMPEQ:
1654 case ICMD_IF_DCMPNE:
1656 case ICMD_IF_DCMPL_LT:
1657 case ICMD_IF_DCMPL_GE:
1658 case ICMD_IF_DCMPL_GT:
1659 case ICMD_IF_DCMPL_LE:
1661 case ICMD_IF_DCMPG_LT:
1662 case ICMD_IF_DCMPG_GE:
1663 case ICMD_IF_DCMPG_GT:
1664 case ICMD_IF_DCMPG_LE:
1666 case ICMD_IF_ACMPEQ:
1667 case ICMD_IF_ACMPNE:
1670 SHOW_TARGET(iptr->dst);
1673 case ICMD_TABLESWITCH:
1677 case ICMD_LOOKUPSWITCH:
1695 if (stage >= SHOW_STACK) {
1696 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1697 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1699 SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
1700 SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
1705 if (stage >= SHOW_STACK) {
1706 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1707 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1709 SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
1710 SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
1711 SHOW_STACKVAR(iptr->dst.dupslots[2+2]);
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]);
1725 SHOW_STACKVAR(iptr->dst.dupslots[3+4]);
1730 if (stage >= SHOW_STACK) {
1731 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1732 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1733 SHOW_STACKVAR(iptr->dst.dupslots[2]);
1735 SHOW_STACKVAR(iptr->dst.dupslots[3+0]);
1736 SHOW_STACKVAR(iptr->dst.dupslots[3+1]);
1737 SHOW_STACKVAR(iptr->dst.dupslots[3+2]);
1738 SHOW_STACKVAR(iptr->dst.dupslots[3+3]);
1743 if (stage >= SHOW_STACK) {
1744 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1745 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1746 SHOW_STACKVAR(iptr->dst.dupslots[2]);
1747 SHOW_STACKVAR(iptr->dst.dupslots[4]);
1749 SHOW_STACKVAR(iptr->dst.dupslots[4+0]);
1750 SHOW_STACKVAR(iptr->dst.dupslots[4+1]);
1751 SHOW_STACKVAR(iptr->dst.dupslots[4+2]);
1752 SHOW_STACKVAR(iptr->dst.dupslots[4+3]);
1753 SHOW_STACKVAR(iptr->dst.dupslots[4+4]);
1754 SHOW_STACKVAR(iptr->dst.dupslots[4+5]);
1759 if (stage >= SHOW_STACK) {
1760 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1761 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1763 SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
1764 SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
1770 #endif /* !defined(NDEBUG) */
1772 #if !defined(NDEBUG)
1773 void show_icmd(instruction *iptr, bool deadcode)
1784 constant_classref *cr;
1785 unresolved_field *uf;
1788 /* get the opcode and the condition */
1790 opcode = iptr->opc & ICMD_OPCODE_MASK;
1791 condition = (iptr->opc & ICMD_CONDITION_MASK) >> 8;
1793 /* Print the condition for conditional instructions. */
1796 printf(" (condition: %s)", icmd_names[condition]);
1799 printf("%s", icmd_names[iptr->opc]);
1801 switch (iptr->opc) {
1802 case ICMD_IADDCONST:
1803 case ICMD_ISUBCONST:
1804 case ICMD_IMULCONST:
1808 case ICMD_IANDCONST:
1810 case ICMD_IXORCONST:
1811 case ICMD_ISHLCONST:
1812 case ICMD_ISHRCONST:
1813 case ICMD_IUSHRCONST:
1814 case ICMD_LSHLCONST:
1815 case ICMD_LSHRCONST:
1816 case ICMD_LUSHRCONST:
1818 case ICMD_IASTORECONST:
1819 case ICMD_BASTORECONST:
1820 case ICMD_CASTORECONST:
1821 case ICMD_SASTORECONST:
1822 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
1825 case ICMD_LADDCONST:
1826 case ICMD_LSUBCONST:
1827 case ICMD_LMULCONST:
1831 case ICMD_LANDCONST:
1833 case ICMD_LXORCONST:
1835 case ICMD_LASTORECONST:
1836 #if SIZEOF_VOID_P == 4
1837 printf(" %lld (0x%016llx)", iptr->val.l, iptr->val.l);
1839 printf(" %ld (0x%016lx)", iptr->val.l, iptr->val.l);
1844 printf(" %f (0x%08x)", iptr->val.f, iptr->val.i);
1848 #if SIZEOF_VOID_P == 4
1849 printf(" %g (0x%016llx)", iptr->val.d, iptr->val.l);
1851 printf(" %g (0x%016lx)", iptr->val.d, iptr->val.l);
1856 case ICMD_AASTORECONST:
1857 /* check if this is a constant string or a class reference */
1859 if (ICMD_ACONST_IS_CLASS(iptr)) {
1860 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1861 printf(" (NOT RESOLVED) classref = ");
1862 class_classref_print(ICMD_ACONST_UNRESOLVED_CLASSREF(iptr));
1865 printf(" class = ");
1866 class_print(ICMD_ACONST_RESOLVED_CLASSINFO(iptr));
1870 printf(" %p", iptr->val.a);
1873 printf(", String = \"");
1874 utf_display_printable_ascii(javastring_toutf(iptr->val.a, false));
1882 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1883 uf = INSTRUCTION_UNRESOLVED_FIELD(iptr);
1884 printf(" (NOT RESOLVED) ");
1886 field_fieldref_print(uf->fieldref);
1889 f = INSTRUCTION_RESOLVED_FIELDINFO(iptr);
1890 printf(" %d, ", f->offset);
1896 case ICMD_PUTSTATIC:
1897 case ICMD_GETSTATIC:
1898 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1899 uf = INSTRUCTION_UNRESOLVED_FIELD(iptr);
1900 printf(" (NOT RESOLVED) ");
1902 field_fieldref_print(uf->fieldref);
1905 f = INSTRUCTION_RESOLVED_FIELDINFO(iptr);
1906 if (!CLASS_IS_OR_ALMOST_INITIALIZED(f->class))
1907 printf(" (NOT INITIALIZED) ");
1915 case ICMD_PUTSTATICCONST:
1916 case ICMD_PUTFIELDCONST:
1917 switch (iptr[1].op1) {
1919 printf(" %d (0x%08x),", iptr->val.i, iptr->val.i);
1922 #if SIZEOF_VOID_P == 4
1923 printf(" %lld (0x%016llx),", iptr->val.l, iptr->val.l);
1925 printf(" %ld (0x%016lx),", iptr->val.l, iptr->val.l);
1929 printf(" %p,", iptr->val.a);
1932 printf(" %g (0x%08x),", iptr->val.f, iptr->val.i);
1935 #if SIZEOF_VOID_P == 4
1936 printf(" %g (0x%016llx),", iptr->val.d, iptr->val.l);
1938 printf(" %g (0x%016lx),", iptr->val.d, iptr->val.l);
1943 if (INSTRUCTION_IS_UNRESOLVED(iptr + 1)) {
1944 uf = INSTRUCTION_UNRESOLVED_FIELD(iptr + 1);
1945 printf(" (NOT RESOLVED) ");
1946 field_fieldref_print(uf->fieldref);
1949 f = INSTRUCTION_RESOLVED_FIELDINFO(iptr + 1);
1950 if ((iptr->opc == ICMD_PUTSTATICCONST) &&
1951 !CLASS_IS_OR_ALMOST_INITIALIZED(f->class))
1952 printf(" (NOT INITIALIZED), ");
1954 printf(" %d, ", f->offset);
1960 #if defined(ENABLE_SSA)
1961 printf(" %d + %d -> %d", iptr->op1, iptr->val._i.i, iptr->val._i.op1_t);
1963 printf(" %d + %d", iptr->op1, iptr->val.i);
1999 printf(" %d", iptr->op1);
2005 utf_display_printable_ascii_classname(c->name);
2009 switch (iptr->op1) {
2037 case ICMD_ANEWARRAY:
2041 utf_display_printable_ascii_classname(c->name);
2045 case ICMD_MULTIANEWARRAY:
2050 printf(" (NOT RESOLVED) %d ", iptr->op1);
2051 utf_display_printable_ascii(cr->name);
2054 printf(" %d ", iptr->op1);
2055 utf_display_printable_ascii_classname(c->name);
2059 case ICMD_CHECKCAST:
2060 case ICMD_INSTANCEOF:
2065 if (c->flags & ACC_INTERFACE)
2066 printf(" (INTERFACE) ");
2068 printf(" (CLASS,%3d) ", c->vftbl->diffval);
2070 printf(" (NOT RESOLVED) ");
2071 utf_display_printable_ascii_classname(cr->name);
2074 case ICMD_INLINE_START:
2075 case ICMD_INLINE_END:
2077 insinfo_inline *insinfo = (insinfo_inline *) iptr->target;
2079 method_print(insinfo->method);
2084 printf(" %s", ((builtintable_entry *) iptr->val.a)->cname);
2087 case ICMD_INVOKEVIRTUAL:
2088 case ICMD_INVOKESPECIAL:
2089 case ICMD_INVOKESTATIC:
2090 case ICMD_INVOKEINTERFACE:
2092 constant_FMIref *mref;
2094 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
2095 printf(" (NOT RESOLVED) ");
2096 mref = INSTRUCTION_UNRESOLVED_METHOD(iptr)->methodref;
2100 mref = INSTRUCTION_RESOLVED_FMIREF(iptr);
2102 method_methodref_print(mref);
2112 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
2114 /* if ((iptr->opc & ICMD_CONDITION_MASK) == 0) { */
2115 if (deadcode || !iptr->target)
2116 printf(" op1=%d", iptr->op1);
2118 printf(" L%03d (%p)", ((basicblock *) iptr->target)->nr, iptr->target);
2128 #if SIZEOF_VOID_P == 4
2129 printf(" %lld (%016llx)", iptr->val.l, iptr->val.l);
2131 printf(" %ld (%016lx)", iptr->val.l, iptr->val.l);
2134 /* if ((iptr->opc & ICMD_CONDITION_MASK) == 0) { */
2135 if (deadcode || !iptr->target)
2136 printf(" op1=%d", iptr->op1);
2138 printf(" L%03d", ((basicblock *) iptr->target)->nr);
2144 case ICMD_INLINE_GOTO:
2145 if (deadcode || !iptr->target)
2146 printf(" op1=%d", iptr->op1);
2148 printf(" L%03d (%p)", ((basicblock *) iptr->target)->nr,iptr->target);
2152 case ICMD_IFNONNULL:
2153 case ICMD_IF_ICMPEQ:
2154 case ICMD_IF_ICMPNE:
2155 case ICMD_IF_ICMPLT:
2156 case ICMD_IF_ICMPGE:
2157 case ICMD_IF_ICMPGT:
2158 case ICMD_IF_ICMPLE:
2160 case ICMD_IF_LCMPEQ:
2161 case ICMD_IF_LCMPNE:
2162 case ICMD_IF_LCMPLT:
2163 case ICMD_IF_LCMPGE:
2164 case ICMD_IF_LCMPGT:
2165 case ICMD_IF_LCMPLE:
2167 case ICMD_IF_FCMPEQ:
2168 case ICMD_IF_FCMPNE:
2170 case ICMD_IF_FCMPL_LT:
2171 case ICMD_IF_FCMPL_GE:
2172 case ICMD_IF_FCMPL_GT:
2173 case ICMD_IF_FCMPL_LE:
2175 case ICMD_IF_FCMPG_LT:
2176 case ICMD_IF_FCMPG_GE:
2177 case ICMD_IF_FCMPG_GT:
2178 case ICMD_IF_FCMPG_LE:
2180 case ICMD_IF_DCMPEQ:
2181 case ICMD_IF_DCMPNE:
2183 case ICMD_IF_DCMPL_LT:
2184 case ICMD_IF_DCMPL_GE:
2185 case ICMD_IF_DCMPL_GT:
2186 case ICMD_IF_DCMPL_LE:
2188 case ICMD_IF_DCMPG_LT:
2189 case ICMD_IF_DCMPG_GE:
2190 case ICMD_IF_DCMPG_GT:
2191 case ICMD_IF_DCMPG_LE:
2193 case ICMD_IF_ACMPEQ:
2194 case ICMD_IF_ACMPNE:
2195 /* if (!(iptr->opc & ICMD_CONDITION_MASK)) { */
2196 if (deadcode || !iptr->target)
2197 printf(" op1=%d", iptr->op1);
2199 printf(" L%03d (%p)", ((basicblock *) iptr->target)->nr,iptr->target);
2203 case ICMD_TABLESWITCH:
2204 s4ptr = (s4*)iptr->val.a;
2206 if (deadcode || !iptr->target) {
2207 printf(" %d;", *s4ptr);
2210 tptr = (void **) iptr->target;
2211 printf(" L%03d;", ((basicblock *) *tptr)->nr);
2215 s4ptr++; /* skip default */
2216 j = *s4ptr++; /* low */
2217 j = *s4ptr++ - j; /* high */
2219 if (deadcode || !*tptr)
2220 printf(" %d", *s4ptr++);
2222 printf(" L%03d", ((basicblock *) *tptr)->nr);
2229 case ICMD_LOOKUPSWITCH:
2230 s4ptr = (s4*)iptr->val.a;
2232 if (deadcode || !iptr->target) {
2233 printf(" %d;", *s4ptr);
2236 tptr = (void **) iptr->target;
2237 printf(" L%03d;", ((basicblock *) *tptr)->nr);
2240 s4ptr++; /* default */
2241 j = *s4ptr++; /* count */
2244 if (deadcode || !*tptr) {
2245 s4ptr++; /* skip value */
2246 printf(" %d",*s4ptr++);
2249 printf(" L%03d", ((basicblock *) *tptr)->nr);
2257 printf(" (NOT RESOLVED) Class = \"");
2258 utf_display_printable_ascii(((unresolved_class *) iptr->val.a)->classref->name);
2263 #endif /* !defined(NDEBUG) */
2266 * These are local overrides for various environment variables in Emacs.
2267 * Please do not remove this and leave it at the end of the file, where
2268 * Emacs will automagically detect them.
2269 * ---------------------------------------------------------------------
2272 * indent-tabs-mode: t
2276 * vim:noexpandtab:sw=4:ts=4: