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("Code length: %d\n", (jd->new_basicblocks[jd->new_basicblockcount].mpc -
350 jd->new_basicblocks[0].mpc));
351 printf("Max locals: %d\n", cd->maxlocals);
352 printf("Max stack: %d\n", cd->maxstack);
353 printf("Line number table length: %d\n", m->linenumbercount);
355 if (stage >= SHOW_PARSE) {
356 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
357 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
358 printf(" L%03d ... ", ex->start->debug_nr );
359 printf("L%03d = ", ex->end->debug_nr);
360 printf("L%03d", ex->handler->debug_nr);
361 printf(" (catchtype: ");
362 if (ex->catchtype.any)
363 if (IS_CLASSREF(ex->catchtype))
364 utf_display_printable_ascii_classname(ex->catchtype.ref->name);
366 utf_display_printable_ascii_classname(ex->catchtype.cls->name);
373 if (stage >= SHOW_PARSE && rd) {
374 printf("Local Table:\n");
375 for (i = 0; i < cd->maxlocals; i++) {
378 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
379 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
380 # if defined(ENABLE_INTRP)
383 if (rd->locals[i][j].type >= 0) {
384 printf(" (%s) ", jit_type[j]);
385 if (stage >= SHOW_REGS) {
386 if (rd->locals[i][j].flags & INMEMORY)
387 printf("m%2d", rd->locals[i][j].regoff);
388 # ifdef HAS_ADDRESS_REGISTER_FILE
389 else if (j == TYPE_ADR)
390 printf("r%02d", rd->locals[i][j].regoff);
392 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
393 printf("f%02d", rd->locals[i][j].regoff);
395 # if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
396 if (IS_2_WORD_TYPE(j))
398 regs[GET_LOW_REG(rd->locals[i][j].regoff)],
399 regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
402 printf("%3s", regs[rd->locals[i][j].regoff]);
406 # if defined(ENABLE_INTRP)
410 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
417 if (stage >= SHOW_STACK && rd) {
418 #if defined(ENABLE_LSRA)
421 #if defined(ENABLE_INTRP)
424 printf("Interface Table:\n");
425 for (i = 0; i < cd->maxstack; i++) {
426 if ((rd->interfaces[i][0].type >= 0) ||
427 (rd->interfaces[i][1].type >= 0) ||
428 (rd->interfaces[i][2].type >= 0) ||
429 (rd->interfaces[i][3].type >= 0) ||
430 (rd->interfaces[i][4].type >= 0)) {
433 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
434 # if defined(ENABLE_INTRP)
437 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
438 if (rd->interfaces[i][j].type >= 0) {
439 printf(" (%s) ", jit_type[j]);
440 if (stage >= SHOW_REGS) {
441 if (rd->interfaces[i][j].flags & SAVEDVAR) {
442 if (rd->interfaces[i][j].flags & INMEMORY)
443 printf("M%2d", rd->interfaces[i][j].regoff);
444 #ifdef HAS_ADDRESS_REGISTER_FILE
445 else if (j == TYPE_ADR)
446 printf("R%02d", rd->interfaces[i][j].regoff);
448 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
449 printf("F%02d", rd->interfaces[i][j].regoff);
451 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
452 if (IS_2_WORD_TYPE(j))
454 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
455 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
458 printf("%3s",regs[rd->interfaces[i][j].regoff]);
462 if (rd->interfaces[i][j].flags & INMEMORY)
463 printf("m%2d", rd->interfaces[i][j].regoff);
464 #ifdef HAS_ADDRESS_REGISTER_FILE
465 else if (j == TYPE_ADR)
466 printf("r%02d", rd->interfaces[i][j].regoff);
468 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
469 printf("f%02d", rd->interfaces[i][j].regoff);
471 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
472 if (IS_2_WORD_TYPE(j))
474 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
475 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
478 printf("%3s",regs[rd->interfaces[i][j].regoff]);
485 # if defined(ENABLE_INTRP)
488 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
494 #if defined(ENABLE_INTRP)
497 #if defined(ENABLE_LSRA)
500 } /* if >= SHOW_STACK */
502 if (code->rplpoints) {
503 printf("Replacement Points:\n");
504 replace_show_replacement_points(code);
508 #if defined(ENABLE_DISASSEMBLER)
509 /* show code before first basic block */
511 if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd)) {
512 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen);
514 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + jd->new_basicblocks[0].mpc);)
521 /* show code of all basic blocks */
523 for (bptr = jd->new_basicblocks; bptr != NULL; bptr = bptr->next)
524 new_show_basicblock(jd, bptr, stage);
526 #if defined(ENABLE_DISASSEMBLER)
527 /* show stubs code */
529 if (stage >= SHOW_CODE && opt_showdisassemble && opt_showexceptionstubs) {
530 printf("\nException stubs code:\n");
531 printf("Length: %d\n\n", (s4) (code->mcodelength -
532 ((ptrint) cd->dseglen +
533 jd->new_basicblocks[jd->new_basicblockcount].mpc)));
535 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen +
536 jd->new_basicblocks[jd->new_basicblockcount].mpc);
538 for (; (ptrint) u1ptr < ((ptrint) code->mcode + code->mcodelength);)
545 LOCK_MONITOR_EXIT(show_global_lock);
547 /* finally flush the output */
551 #endif /* !defined(NDEBUG) */
554 void show_method(jitdata *jd)
565 /* get required compiler data */
572 /* We need to enter a lock here, since the binutils disassembler
573 is not reentrant-able and we could not read functions printed
576 LOCK_MONITOR_ENTER(show_global_lock);
582 printf("\nBasic blocks: %d\n", m->basicblockcount);
583 printf("Code length: %d\n", (m->basicblocks[m->basicblockcount].mpc -
584 m->basicblocks[0].mpc));
585 printf("Max locals: %d\n", cd->maxlocals);
586 printf("Max stack: %d\n", cd->maxstack);
587 printf("Line number table length: %d\n", m->linenumbercount);
589 printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
590 for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
591 printf(" L%03d ... ", ex->start->debug_nr );
592 printf("L%03d = ", ex->end->debug_nr);
593 printf("L%03d", ex->handler->debug_nr);
594 printf(" (catchtype: ");
595 if (ex->catchtype.any)
596 if (IS_CLASSREF(ex->catchtype))
597 utf_display_printable_ascii_classname(ex->catchtype.ref->name);
599 utf_display_printable_ascii_classname(ex->catchtype.cls->name);
605 printf("Local Table:\n");
606 for (i = 0; i < cd->maxlocals; i++) {
609 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
610 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
611 # if defined(ENABLE_INTRP)
614 if (rd->locals[i][j].type >= 0) {
615 printf(" (%s) ", jit_type[j]);
616 if (rd->locals[i][j].flags & INMEMORY)
617 printf("m%2d", rd->locals[i][j].regoff);
618 # ifdef HAS_ADDRESS_REGISTER_FILE
619 else if (j == TYPE_ADR)
620 printf("r%02d", rd->locals[i][j].regoff);
622 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
623 printf("f%02d", rd->locals[i][j].regoff);
625 # if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
626 if (IS_2_WORD_TYPE(j))
628 regs[GET_LOW_REG(rd->locals[i][j].regoff)],
629 regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
632 printf("%3s", regs[rd->locals[i][j].regoff]);
635 # if defined(ENABLE_INTRP)
639 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
645 #if defined(ENABLE_LSRA)
648 #if defined(ENABLE_INTRP)
651 printf("Interface Table:\n");
652 for (i = 0; i < cd->maxstack; i++) {
653 if ((rd->interfaces[i][0].type >= 0) ||
654 (rd->interfaces[i][1].type >= 0) ||
655 (rd->interfaces[i][2].type >= 0) ||
656 (rd->interfaces[i][3].type >= 0) ||
657 (rd->interfaces[i][4].type >= 0)) {
660 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
661 # if defined(ENABLE_INTRP)
664 for (j = TYPE_INT; j <= TYPE_ADR; j++) {
665 if (rd->interfaces[i][j].type >= 0) {
666 printf(" (%s) ", jit_type[j]);
667 if (rd->interfaces[i][j].flags & SAVEDVAR) {
668 if (rd->interfaces[i][j].flags & INMEMORY)
669 printf("M%2d", rd->interfaces[i][j].regoff);
670 #ifdef HAS_ADDRESS_REGISTER_FILE
671 else if (j == TYPE_ADR)
672 printf("R%02d", rd->interfaces[i][j].regoff);
674 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
675 printf("F%02d", rd->interfaces[i][j].regoff);
677 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
678 if (IS_2_WORD_TYPE(j))
680 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
681 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
684 printf("%3s",regs[rd->interfaces[i][j].regoff]);
688 if (rd->interfaces[i][j].flags & INMEMORY)
689 printf("m%2d", rd->interfaces[i][j].regoff);
690 #ifdef HAS_ADDRESS_REGISTER_FILE
691 else if (j == TYPE_ADR)
692 printf("r%02d", rd->interfaces[i][j].regoff);
694 else if ((j == TYPE_FLT) || (j == TYPE_DBL))
695 printf("f%02d", rd->interfaces[i][j].regoff);
697 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
698 if (IS_2_WORD_TYPE(j))
700 regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
701 regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
704 printf("%3s",regs[rd->interfaces[i][j].regoff]);
710 # if defined(ENABLE_INTRP)
713 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
719 #if defined(ENABLE_INTRP)
722 #if defined(ENABLE_LSRA)
726 if (code->rplpoints) {
727 printf("Replacement Points:\n");
728 replace_show_replacement_points(code);
732 #if defined(ENABLE_DISASSEMBLER)
733 /* show code before first basic block */
735 if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd)) {
736 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen);
738 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + m->basicblocks[0].mpc);)
745 /* show code of all basic blocks */
747 for (bptr = m->basicblocks; bptr != NULL; bptr = bptr->next)
748 show_basicblock(jd, bptr);
750 #if defined(ENABLE_DISASSEMBLER)
751 /* show stubs code */
753 if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) && opt_showexceptionstubs) {
754 printf("\nException stubs code:\n");
755 printf("Code length: %d\n\n", (s4) (code->mcodelength -
756 ((ptrint) cd->dseglen +
757 m->basicblocks[m->basicblockcount].mpc)));
759 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen +
760 m->basicblocks[m->basicblockcount].mpc);
762 for (; (ptrint) u1ptr < ((ptrint) code->mcode + code->mcodelength);)
769 LOCK_MONITOR_EXIT(show_global_lock);
771 /* finally flush the output */
775 #endif /* !defined(NDEBUG) */
778 /* show_basicblock *************************************************************
780 Print the intermediate representation of a basic block.
782 NOTE: Currently this function may only be called after register allocation!
784 *******************************************************************************/
787 void new_show_basicblock(jitdata *jd, basicblock *bptr, int stage)
794 new_instruction *iptr;
797 /* get required compiler data */
803 if (bptr->flags != BBDELETED) {
804 deadcode = bptr->flags <= BBREACHED;
806 printf("======== %sL%03d ======== (flags: %d, bitflags: %01x, next: %d, type: ",
807 (bptr->bitflags & BBFLAG_REPLACEMENT) ? "<REPLACE> " : "",
808 bptr->debug_nr, bptr->flags, bptr->bitflags,
809 (bptr->next) ? (bptr->next->debug_nr) : -1);
811 switch (bptr->type) {
823 printf(", instruction count: %d, predecessors: %d):\n",
824 bptr->icount, bptr->pre_count);
826 iptr = /*XXX*/ (new_instruction *) bptr->iinstr;
828 for (i = 0; i < bptr->icount; i++, iptr++) {
829 printf("%4d: ", iptr->line);
831 new_show_icmd(jd, iptr, deadcode, stage);
835 #if defined(ENABLE_DISASSEMBLER)
836 if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) &&
839 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->mpc);
841 if (bptr->next != NULL) {
842 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->next->mpc);)
847 for (; u1ptr < (u1 *) ((ptrint) code->mcode + code->mcodelength);)
855 #endif /* !defined(NDEBUG) */
858 void show_basicblock(jitdata *jd, basicblock *bptr)
868 /* get required compiler data */
874 if (bptr->flags != BBDELETED) {
875 deadcode = bptr->flags <= BBREACHED;
880 for (j = cd->maxstack; j > 0; j--)
883 show_print_stack(cd, bptr->instack);
885 printf("] %sL%03d(flags: %d, bitflags: %01x, next: %d, type: ",
886 (bptr->bitflags & BBFLAG_REPLACEMENT) ? "<REPLACE> " : "",
887 bptr->debug_nr, bptr->flags, bptr->bitflags,
888 (bptr->next) ? (bptr->next->debug_nr) : -1);
890 switch (bptr->type) {
902 printf(", instruction count: %d, predecessors: %d):\n",
903 bptr->icount, bptr->pre_count);
907 for (i = 0; i < bptr->icount; i++, iptr++) {
911 for (j = cd->maxstack; j > 0; j--)
914 show_print_stack(cd, iptr->dst);
916 printf("] %5d (line: %5d) ", i, iptr->line);
918 show_icmd(iptr, deadcode);
922 #if defined(ENABLE_DISASSEMBLER)
923 if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) && (!deadcode)) {
925 u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->mpc);
927 if (bptr->next != NULL) {
928 for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->next->mpc);)
933 for (; u1ptr < (u1 *) ((ptrint) code->mcode + code->mcodelength);)
941 #endif /* !defined(NDEBUG) */
944 /* show_icmd *******************************************************************
946 Print the intermediate representation of an instruction.
948 NOTE: Currently this function may only be called after register allocation!
950 *******************************************************************************/
954 #define SHOW_TARGET(target) \
955 if (stage >= SHOW_STACK) { \
956 printf("--> L%03d ", (target).block->debug_nr); \
958 else if (stage >= SHOW_PARSE) { \
959 printf("--> insindex %d (L%03d) ", (target).insindex, \
960 jd->new_basicblocks[jd->new_basicblockindex[ \
961 (target).insindex]].debug_nr); \
964 printf("--> insindex %d ", (target).insindex); \
967 #define SHOW_INT_CONST(val) \
968 if (stage >= SHOW_PARSE) { \
969 printf("%ld ", (long) (val)); \
975 #define SHOW_LNG_CONST(val) \
976 if (stage >= SHOW_PARSE) { \
977 printf("%lld ", (long long)(val)); \
983 #define SHOW_FLT_CONST(val) \
984 if (stage >= SHOW_PARSE) { \
985 printf("%g ", (val)); \
991 #define SHOW_DBL_CONST(val) \
992 if (stage >= SHOW_PARSE) { \
993 printf("%g ", (val)); \
999 #define SHOW_INDEX(index) \
1000 if (stage >= SHOW_PARSE) { \
1001 printf("%d ", index); \
1007 #define SHOW_STRING(val) \
1008 if (stage >= SHOW_PARSE) { \
1010 utf_display_printable_ascii( \
1011 javastring_toutf((java_lang_String *)(val), false)); \
1015 printf("string "); \
1018 #define SHOW_CLASSREF_OR_CLASSINFO(c) \
1019 if (stage >= SHOW_PARSE) { \
1020 if (IS_CLASSREF(c)) \
1021 class_classref_print(c.ref); \
1023 class_print(c.cls); \
1030 #define SHOW_FIELD(fmiref) \
1031 if (stage >= SHOW_PARSE) { \
1032 field_fieldref_print(fmiref); \
1039 #define SHOW_STACKVAR(sp) \
1040 new_show_stackvar(jd, (sp), stage)
1042 #define SHOW_S1(iptr) \
1043 if (stage >= SHOW_STACK) { \
1044 SHOW_STACKVAR(iptr->s1.var); \
1047 #define SHOW_S2(iptr) \
1048 if (stage >= SHOW_STACK) { \
1049 SHOW_STACKVAR(iptr->sx.s23.s2.var); \
1052 #define SHOW_S3(iptr) \
1053 if (stage >= SHOW_STACK) { \
1054 SHOW_STACKVAR(iptr->sx.s23.s3.var); \
1057 #define SHOW_DST(iptr) \
1058 if (stage >= SHOW_STACK) { \
1060 SHOW_STACKVAR(iptr->dst.var); \
1063 #define SHOW_S1_LOCAL(iptr) \
1064 if (stage >= SHOW_STACK) { \
1065 printf("L%d ", iptr->s1.localindex); \
1068 #define SHOW_DST_LOCAL(iptr) \
1069 if (stage >= SHOW_STACK) { \
1070 printf("=> L%d ", iptr->dst.localindex); \
1073 static void new_show_stackvar(jitdata *jd, stackptr sp, int stage)
1078 case TYPE_INT: type = 'i'; break;
1079 case TYPE_LNG: type = 'l'; break;
1080 case TYPE_FLT: type = 'f'; break;
1081 case TYPE_DBL: type = 'd'; break;
1082 case TYPE_ADR: type = 'a'; break;
1083 default: type = '?';
1085 printf("S%c%d", type, (int) (sp - jd->new_stack));
1087 if (stage >= SHOW_REGS) {
1090 if (sp->flags & SAVEDVAR) {
1091 switch (sp->varkind) {
1093 if (sp->flags & INMEMORY)
1094 printf("M%02d", sp->regoff);
1095 #ifdef HAS_ADDRESS_REGISTER_FILE
1096 else if (sp->type == TYPE_ADR)
1097 printf("R%02d", sp->regoff);
1099 else if (IS_FLT_DBL_TYPE(sp->type))
1100 printf("F%02d", sp->regoff);
1102 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
1103 if (IS_2_WORD_TYPE(sp->type)) {
1104 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1105 # if defined(ENABLE_INTRP)
1107 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1108 GET_HIGH_REG(sp->regoff));
1111 printf("%3s/%3s", regs[GET_LOW_REG(sp->regoff)],
1112 regs[GET_HIGH_REG(sp->regoff)]);
1114 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1115 GET_HIGH_REG(sp->regoff));
1119 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
1121 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1122 # if defined(ENABLE_INTRP)
1124 printf("%3d", sp->regoff);
1127 printf("%3s", regs[sp->regoff]);
1129 printf("%3d", sp->regoff);
1135 printf("I%02d", sp->varnum);
1138 printf("L%02d", sp->varnum);
1141 if (sp->varnum == -1) {
1143 /* varkind ARGVAR "misused for this special case */
1146 else /* "normal" Argvar */
1147 printf("A%02d", sp->varnum);
1150 printf("!xx {kind=%d, num=%d}", sp->varkind, sp->varnum);
1153 else { /* not SAVEDVAR */
1154 switch (sp->varkind) {
1156 if (sp->flags & INMEMORY)
1157 printf("m%02d", sp->regoff);
1158 #ifdef HAS_ADDRESS_REGISTER_FILE
1159 else if (sp->type == TYPE_ADR)
1160 printf("r%02d", sp->regoff);
1162 else if (IS_FLT_DBL_TYPE(sp->type))
1163 printf("f%02d", sp->regoff);
1165 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
1166 if (IS_2_WORD_TYPE(sp->type)) {
1167 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1168 # if defined(ENABLE_INTRP)
1170 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1171 GET_HIGH_REG(sp->regoff));
1174 printf("%3s/%3s", regs[GET_LOW_REG(sp->regoff)],
1175 regs[GET_HIGH_REG(sp->regoff)]);
1177 printf("%3d/%3d", GET_LOW_REG(sp->regoff),
1178 GET_HIGH_REG(sp->regoff));
1182 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
1184 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
1185 # if defined(ENABLE_INTRP)
1187 printf("%3d", sp->regoff);
1190 printf("%3s", regs[sp->regoff]);
1192 printf("%3d", sp->regoff);
1198 printf("i%02d", sp->varnum);
1201 printf("l%02d", sp->varnum);
1204 if (sp->varnum == -1) {
1206 /* varkind ARGVAR "misused for this special case */
1209 else /* "normal" Argvar */
1210 printf("a%02d", sp->varnum);
1213 printf("?xx {kind=%d, num=%d}", sp->varkind, sp->varnum);
1222 void new_show_icmd(jitdata *jd, new_instruction *iptr, bool deadcode, int stage)
1225 branch_target_t *table;
1226 lookup_target_t *lookup;
1227 constant_FMIref *fmiref;
1231 /* get the opcode and the condition */
1235 printf("%s ", icmd_names[opcode]);
1237 if (stage < SHOW_PARSE)
1243 /* Print the condition for conditional instructions. */
1245 /* XXX print condition from flags */
1247 if (iptr->flags.bits & INS_FLAG_UNRESOLVED)
1248 printf("(UNRESOLVED) ");
1253 case ICMD_CHECKNULL:
1254 case ICMD_CHECKNULL_POP:
1259 case ICMD_ARRAYLENGTH:
1278 case ICMD_INT2SHORT:
1326 /* binary/const INT */
1327 case ICMD_IADDCONST:
1328 case ICMD_ISUBCONST:
1329 case ICMD_IMULCONST:
1333 case ICMD_IANDCONST:
1335 case ICMD_IXORCONST:
1336 case ICMD_ISHLCONST:
1337 case ICMD_ISHRCONST:
1338 case ICMD_IUSHRCONST:
1339 case ICMD_LSHLCONST:
1340 case ICMD_LSHRCONST:
1341 case ICMD_LUSHRCONST:
1343 SHOW_INT_CONST(iptr->sx.val.i);
1347 /* ?ASTORECONST (trinary/const INT) */
1348 case ICMD_IASTORECONST:
1349 case ICMD_BASTORECONST:
1350 case ICMD_CASTORECONST:
1351 case ICMD_SASTORECONST:
1354 SHOW_INT_CONST(iptr->sx.s23.s3.constval);
1359 SHOW_INT_CONST(iptr->sx.val.i);
1363 case ICMD_IFEQ_ICONST:
1364 case ICMD_IFNE_ICONST:
1365 case ICMD_IFLT_ICONST:
1366 case ICMD_IFGE_ICONST:
1367 case ICMD_IFGT_ICONST:
1368 case ICMD_IFLE_ICONST:
1371 case ICMD_ELSE_ICONST:
1374 /* binary/const LNG */
1375 case ICMD_LADDCONST:
1376 case ICMD_LSUBCONST:
1377 case ICMD_LMULCONST:
1381 case ICMD_LANDCONST:
1383 case ICMD_LXORCONST:
1385 SHOW_LNG_CONST(iptr->sx.val.l);
1389 /* trinary/const LNG (<= pointer size) */
1390 case ICMD_LASTORECONST:
1393 SHOW_LNG_CONST(iptr->sx.s23.s3.constval);
1398 SHOW_LNG_CONST(iptr->sx.val.l);
1404 SHOW_FLT_CONST(iptr->sx.val.f);
1410 SHOW_DBL_CONST(iptr->sx.val.d);
1416 if (iptr->flags.bits & INS_FLAG_CLASS) {
1417 SHOW_CLASSREF_OR_CLASSINFO(iptr->sx.val.c);
1419 else if (iptr->sx.val.anyptr == NULL) {
1423 SHOW_STRING(iptr->sx.val.stringconst);
1428 case ICMD_AASTORECONST:
1431 printf("%p ", (void*) iptr->sx.s23.s3.constval);
1434 case ICMD_GETFIELD: /* 1 -> 1 */
1435 case ICMD_PUTFIELD: /* 2 -> 0 */
1436 case ICMD_PUTSTATIC: /* 1 -> 0 */
1437 case ICMD_GETSTATIC: /* 0 -> 1 */
1438 case ICMD_PUTSTATICCONST: /* 0 -> 0 */
1439 case ICMD_PUTFIELDCONST: /* 1 -> 0 */
1440 if (opcode != ICMD_GETSTATIC && opcode != ICMD_PUTSTATICCONST) {
1442 if (opcode == ICMD_PUTFIELD) {
1446 NEW_INSTRUCTION_GET_FIELDREF(iptr, fmiref);
1449 if (opcode == ICMD_GETSTATIC || opcode == ICMD_GETFIELD) {
1455 SHOW_S1_LOCAL(iptr);
1456 SHOW_INT_CONST(iptr->sx.val.i);
1457 SHOW_DST_LOCAL(iptr);
1487 SHOW_S1_LOCAL(iptr);
1495 SHOW_S1_LOCAL(iptr);
1505 SHOW_DST_LOCAL(iptr);
1516 case ICMD_ANEWARRAY:
1520 case ICMD_MULTIANEWARRAY:
1521 if (stage >= SHOW_STACK) {
1522 argp = iptr->sx.s23.s2.args;
1523 i = iptr->s1.argcount;
1525 SHOW_STACKVAR(*(argp++));
1529 printf("argcount=%d ", iptr->s1.argcount);
1534 case ICMD_CHECKCAST:
1539 case ICMD_INSTANCEOF:
1544 case ICMD_INLINE_START:
1545 case ICMD_INLINE_END:
1549 if (stage >= SHOW_STACK) {
1550 argp = iptr->sx.s23.s2.args;
1551 i = iptr->s1.argcount;
1553 SHOW_STACKVAR(*(argp++));
1556 printf("%s ", iptr->sx.s23.s3.bte->name);
1557 if (iptr->sx.s23.s3.bte->md->returntype.type != TYPE_VOID) {
1562 case ICMD_INVOKEVIRTUAL:
1563 case ICMD_INVOKESPECIAL:
1564 case ICMD_INVOKESTATIC:
1565 case ICMD_INVOKEINTERFACE:
1566 if (stage >= SHOW_STACK) {
1567 argp = iptr->sx.s23.s2.args;
1568 i = iptr->s1.argcount;
1570 SHOW_STACKVAR(*(argp++));
1573 NEW_INSTRUCTION_GET_METHODREF(iptr, fmiref);
1574 method_methodref_print(fmiref);
1575 if (fmiref->parseddesc.md->returntype.type != TYPE_VOID) {
1587 SHOW_TARGET(iptr->dst);
1597 SHOW_TARGET(iptr->dst);
1601 case ICMD_INLINE_GOTO:
1602 SHOW_TARGET(iptr->dst);
1606 SHOW_TARGET(iptr->sx.s23.s3.jsrtarget);
1611 case ICMD_IFNONNULL:
1613 SHOW_TARGET(iptr->dst);
1616 case ICMD_IF_ICMPEQ:
1617 case ICMD_IF_ICMPNE:
1618 case ICMD_IF_ICMPLT:
1619 case ICMD_IF_ICMPGE:
1620 case ICMD_IF_ICMPGT:
1621 case ICMD_IF_ICMPLE:
1623 case ICMD_IF_LCMPEQ:
1624 case ICMD_IF_LCMPNE:
1625 case ICMD_IF_LCMPLT:
1626 case ICMD_IF_LCMPGE:
1627 case ICMD_IF_LCMPGT:
1628 case ICMD_IF_LCMPLE:
1630 case ICMD_IF_FCMPEQ:
1631 case ICMD_IF_FCMPNE:
1633 case ICMD_IF_FCMPL_LT:
1634 case ICMD_IF_FCMPL_GE:
1635 case ICMD_IF_FCMPL_GT:
1636 case ICMD_IF_FCMPL_LE:
1638 case ICMD_IF_FCMPG_LT:
1639 case ICMD_IF_FCMPG_GE:
1640 case ICMD_IF_FCMPG_GT:
1641 case ICMD_IF_FCMPG_LE:
1643 case ICMD_IF_DCMPEQ:
1644 case ICMD_IF_DCMPNE:
1646 case ICMD_IF_DCMPL_LT:
1647 case ICMD_IF_DCMPL_GE:
1648 case ICMD_IF_DCMPL_GT:
1649 case ICMD_IF_DCMPL_LE:
1651 case ICMD_IF_DCMPG_LT:
1652 case ICMD_IF_DCMPG_GE:
1653 case ICMD_IF_DCMPG_GT:
1654 case ICMD_IF_DCMPG_LE:
1656 case ICMD_IF_ACMPEQ:
1657 case ICMD_IF_ACMPNE:
1660 SHOW_TARGET(iptr->dst);
1663 case ICMD_TABLESWITCH:
1667 case ICMD_LOOKUPSWITCH:
1685 if (stage >= SHOW_STACK) {
1686 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1687 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1689 SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
1690 SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
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]);
1701 SHOW_STACKVAR(iptr->dst.dupslots[2+2]);
1706 if (stage >= SHOW_STACK) {
1707 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1708 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1709 SHOW_STACKVAR(iptr->dst.dupslots[2]);
1711 SHOW_STACKVAR(iptr->dst.dupslots[3+0]);
1712 SHOW_STACKVAR(iptr->dst.dupslots[3+1]);
1713 SHOW_STACKVAR(iptr->dst.dupslots[3+2]);
1714 SHOW_STACKVAR(iptr->dst.dupslots[3+3]);
1715 SHOW_STACKVAR(iptr->dst.dupslots[3+4]);
1720 if (stage >= SHOW_STACK) {
1721 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1722 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1723 SHOW_STACKVAR(iptr->dst.dupslots[2]);
1725 SHOW_STACKVAR(iptr->dst.dupslots[3+0]);
1726 SHOW_STACKVAR(iptr->dst.dupslots[3+1]);
1727 SHOW_STACKVAR(iptr->dst.dupslots[3+2]);
1728 SHOW_STACKVAR(iptr->dst.dupslots[3+3]);
1733 if (stage >= SHOW_STACK) {
1734 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1735 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1736 SHOW_STACKVAR(iptr->dst.dupslots[2]);
1737 SHOW_STACKVAR(iptr->dst.dupslots[4]);
1739 SHOW_STACKVAR(iptr->dst.dupslots[4+0]);
1740 SHOW_STACKVAR(iptr->dst.dupslots[4+1]);
1741 SHOW_STACKVAR(iptr->dst.dupslots[4+2]);
1742 SHOW_STACKVAR(iptr->dst.dupslots[4+3]);
1743 SHOW_STACKVAR(iptr->dst.dupslots[4+4]);
1744 SHOW_STACKVAR(iptr->dst.dupslots[4+5]);
1749 if (stage >= SHOW_STACK) {
1750 SHOW_STACKVAR(iptr->dst.dupslots[0]);
1751 SHOW_STACKVAR(iptr->dst.dupslots[1]);
1753 SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
1754 SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
1760 #endif /* !defined(NDEBUG) */
1762 #if !defined(NDEBUG)
1763 void show_icmd(instruction *iptr, bool deadcode)
1774 constant_classref *cr;
1775 unresolved_field *uf;
1778 /* get the opcode and the condition */
1780 opcode = iptr->opc & ICMD_OPCODE_MASK;
1781 condition = (iptr->opc & ICMD_CONDITION_MASK) >> 8;
1783 /* Print the condition for conditional instructions. */
1786 printf(" (condition: %s)", icmd_names[condition]);
1789 printf("%s", icmd_names[iptr->opc]);
1791 switch (iptr->opc) {
1792 case ICMD_IADDCONST:
1793 case ICMD_ISUBCONST:
1794 case ICMD_IMULCONST:
1798 case ICMD_IANDCONST:
1800 case ICMD_IXORCONST:
1801 case ICMD_ISHLCONST:
1802 case ICMD_ISHRCONST:
1803 case ICMD_IUSHRCONST:
1804 case ICMD_LSHLCONST:
1805 case ICMD_LSHRCONST:
1806 case ICMD_LUSHRCONST:
1808 case ICMD_IASTORECONST:
1809 case ICMD_BASTORECONST:
1810 case ICMD_CASTORECONST:
1811 case ICMD_SASTORECONST:
1812 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
1815 case ICMD_IFEQ_ICONST:
1816 case ICMD_IFNE_ICONST:
1817 case ICMD_IFLT_ICONST:
1818 case ICMD_IFGE_ICONST:
1819 case ICMD_IFGT_ICONST:
1820 case ICMD_IFLE_ICONST:
1821 printf(" %d, %d (0x%08x)", iptr[1].op1, iptr->val.i, iptr->val.i);
1824 case ICMD_ELSE_ICONST:
1825 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
1828 case ICMD_LADDCONST:
1829 case ICMD_LSUBCONST:
1830 case ICMD_LMULCONST:
1834 case ICMD_LANDCONST:
1836 case ICMD_LXORCONST:
1838 case ICMD_LASTORECONST:
1839 #if SIZEOF_VOID_P == 4
1840 printf(" %lld (0x%016llx)", iptr->val.l, iptr->val.l);
1842 printf(" %ld (0x%016lx)", iptr->val.l, iptr->val.l);
1847 printf(" %f (0x%08x)", iptr->val.f, iptr->val.i);
1851 #if SIZEOF_VOID_P == 4
1852 printf(" %g (0x%016llx)", iptr->val.d, iptr->val.l);
1854 printf(" %g (0x%016lx)", iptr->val.d, iptr->val.l);
1859 case ICMD_AASTORECONST:
1860 /* check if this is a constant string or a class reference */
1862 if (ICMD_ACONST_IS_CLASS(iptr)) {
1863 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1864 printf(" (NOT RESOLVED) classref = ");
1865 class_classref_print(ICMD_ACONST_UNRESOLVED_CLASSREF(iptr));
1868 printf(" class = ");
1869 class_print(ICMD_ACONST_RESOLVED_CLASSINFO(iptr));
1873 printf(" %p", iptr->val.a);
1876 printf(", String = \"");
1877 utf_display_printable_ascii(javastring_toutf(iptr->val.a, false));
1885 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1886 uf = INSTRUCTION_UNRESOLVED_FIELD(iptr);
1887 printf(" (NOT RESOLVED) ");
1889 field_fieldref_print(uf->fieldref);
1892 f = INSTRUCTION_RESOLVED_FIELDINFO(iptr);
1893 printf(" %d, ", f->offset);
1899 case ICMD_PUTSTATIC:
1900 case ICMD_GETSTATIC:
1901 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
1902 uf = INSTRUCTION_UNRESOLVED_FIELD(iptr);
1903 printf(" (NOT RESOLVED) ");
1905 field_fieldref_print(uf->fieldref);
1908 f = INSTRUCTION_RESOLVED_FIELDINFO(iptr);
1909 if (!CLASS_IS_OR_ALMOST_INITIALIZED(f->class))
1910 printf(" (NOT INITIALIZED) ");
1918 case ICMD_PUTSTATICCONST:
1919 case ICMD_PUTFIELDCONST:
1920 switch (iptr[1].op1) {
1922 printf(" %d (0x%08x),", iptr->val.i, iptr->val.i);
1925 #if SIZEOF_VOID_P == 4
1926 printf(" %lld (0x%016llx),", iptr->val.l, iptr->val.l);
1928 printf(" %ld (0x%016lx),", iptr->val.l, iptr->val.l);
1932 printf(" %p,", iptr->val.a);
1935 printf(" %g (0x%08x),", iptr->val.f, iptr->val.i);
1938 #if SIZEOF_VOID_P == 4
1939 printf(" %g (0x%016llx),", iptr->val.d, iptr->val.l);
1941 printf(" %g (0x%016lx),", iptr->val.d, iptr->val.l);
1946 if (INSTRUCTION_IS_UNRESOLVED(iptr + 1)) {
1947 uf = INSTRUCTION_UNRESOLVED_FIELD(iptr + 1);
1948 printf(" (NOT RESOLVED) ");
1949 field_fieldref_print(uf->fieldref);
1952 f = INSTRUCTION_RESOLVED_FIELDINFO(iptr + 1);
1953 if ((iptr->opc == ICMD_PUTSTATICCONST) &&
1954 !CLASS_IS_OR_ALMOST_INITIALIZED(f->class))
1955 printf(" (NOT INITIALIZED), ");
1957 printf(" %d, ", f->offset);
1963 printf(" %d + %d", iptr->op1, iptr->val.i);
1998 printf(" %d", iptr->op1);
2004 utf_display_printable_ascii_classname(c->name);
2008 switch (iptr->op1) {
2036 case ICMD_ANEWARRAY:
2040 utf_display_printable_ascii_classname(c->name);
2044 case ICMD_MULTIANEWARRAY:
2049 printf(" (NOT RESOLVED) %d ", iptr->op1);
2050 utf_display_printable_ascii(cr->name);
2053 printf(" %d ", iptr->op1);
2054 utf_display_printable_ascii_classname(c->name);
2058 case ICMD_CHECKCAST:
2059 case ICMD_INSTANCEOF:
2064 if (c->flags & ACC_INTERFACE)
2065 printf(" (INTERFACE) ");
2067 printf(" (CLASS,%3d) ", c->vftbl->diffval);
2069 printf(" (NOT RESOLVED) ");
2070 utf_display_printable_ascii_classname(cr->name);
2073 case ICMD_INLINE_START:
2074 case ICMD_INLINE_END:
2076 insinfo_inline *insinfo = (insinfo_inline *) iptr->target;
2078 method_print(insinfo->method);
2083 printf(" %s", ((builtintable_entry *) iptr->val.a)->name);
2086 case ICMD_INVOKEVIRTUAL:
2087 case ICMD_INVOKESPECIAL:
2088 case ICMD_INVOKESTATIC:
2089 case ICMD_INVOKEINTERFACE:
2091 constant_FMIref *mref;
2093 if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
2094 printf(" (NOT RESOLVED) ");
2095 mref = INSTRUCTION_UNRESOLVED_METHOD(iptr)->methodref;
2099 mref = INSTRUCTION_RESOLVED_FMIREF(iptr);
2101 method_methodref_print(mref);
2111 printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
2113 /* if ((iptr->opc & ICMD_CONDITION_MASK) == 0) { */
2114 if (deadcode || !iptr->target)
2115 printf(" op1=%d", iptr->op1);
2117 printf(" L%03d (%p)", ((basicblock *) iptr->target)->debug_nr, iptr->target);
2127 #if SIZEOF_VOID_P == 4
2128 printf(" %lld (%016llx)", iptr->val.l, iptr->val.l);
2130 printf(" %ld (%016lx)", iptr->val.l, iptr->val.l);
2133 /* if ((iptr->opc & ICMD_CONDITION_MASK) == 0) { */
2134 if (deadcode || !iptr->target)
2135 printf(" op1=%d", iptr->op1);
2137 printf(" L%03d", ((basicblock *) iptr->target)->debug_nr);
2143 case ICMD_INLINE_GOTO:
2144 if (deadcode || !iptr->target)
2145 printf(" op1=%d", iptr->op1);
2147 printf(" L%03d (%p)", ((basicblock *) iptr->target)->debug_nr,iptr->target);
2151 case ICMD_IFNONNULL:
2152 case ICMD_IF_ICMPEQ:
2153 case ICMD_IF_ICMPNE:
2154 case ICMD_IF_ICMPLT:
2155 case ICMD_IF_ICMPGE:
2156 case ICMD_IF_ICMPGT:
2157 case ICMD_IF_ICMPLE:
2159 case ICMD_IF_LCMPEQ:
2160 case ICMD_IF_LCMPNE:
2161 case ICMD_IF_LCMPLT:
2162 case ICMD_IF_LCMPGE:
2163 case ICMD_IF_LCMPGT:
2164 case ICMD_IF_LCMPLE:
2166 case ICMD_IF_FCMPEQ:
2167 case ICMD_IF_FCMPNE:
2169 case ICMD_IF_FCMPL_LT:
2170 case ICMD_IF_FCMPL_GE:
2171 case ICMD_IF_FCMPL_GT:
2172 case ICMD_IF_FCMPL_LE:
2174 case ICMD_IF_FCMPG_LT:
2175 case ICMD_IF_FCMPG_GE:
2176 case ICMD_IF_FCMPG_GT:
2177 case ICMD_IF_FCMPG_LE:
2179 case ICMD_IF_DCMPEQ:
2180 case ICMD_IF_DCMPNE:
2182 case ICMD_IF_DCMPL_LT:
2183 case ICMD_IF_DCMPL_GE:
2184 case ICMD_IF_DCMPL_GT:
2185 case ICMD_IF_DCMPL_LE:
2187 case ICMD_IF_DCMPG_LT:
2188 case ICMD_IF_DCMPG_GE:
2189 case ICMD_IF_DCMPG_GT:
2190 case ICMD_IF_DCMPG_LE:
2192 case ICMD_IF_ACMPEQ:
2193 case ICMD_IF_ACMPNE:
2194 /* if (!(iptr->opc & ICMD_CONDITION_MASK)) { */
2195 if (deadcode || !iptr->target)
2196 printf(" op1=%d", iptr->op1);
2198 printf(" L%03d (%p)", ((basicblock *) iptr->target)->debug_nr,iptr->target);
2202 case ICMD_TABLESWITCH:
2203 s4ptr = (s4*)iptr->val.a;
2205 if (deadcode || !iptr->target) {
2206 printf(" %d;", *s4ptr);
2209 tptr = (void **) iptr->target;
2210 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
2214 s4ptr++; /* skip default */
2215 j = *s4ptr++; /* low */
2216 j = *s4ptr++ - j; /* high */
2218 if (deadcode || !*tptr)
2219 printf(" %d", *s4ptr++);
2221 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
2228 case ICMD_LOOKUPSWITCH:
2229 s4ptr = (s4*)iptr->val.a;
2231 if (deadcode || !iptr->target) {
2232 printf(" %d;", *s4ptr);
2235 tptr = (void **) iptr->target;
2236 printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
2239 s4ptr++; /* default */
2240 j = *s4ptr++; /* count */
2243 if (deadcode || !*tptr) {
2244 s4ptr++; /* skip value */
2245 printf(" %d",*s4ptr++);
2248 printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
2256 printf(" (NOT RESOLVED) Class = \"");
2257 utf_display_printable_ascii(((unresolved_class *) iptr->val.a)->classref->name);
2262 #endif /* !defined(NDEBUG) */
2265 * These are local overrides for various environment variables in Emacs.
2266 * Please do not remove this and leave it at the end of the file, where
2267 * Emacs will automagically detect them.
2268 * ---------------------------------------------------------------------
2271 * indent-tabs-mode: t
2275 * vim:noexpandtab:sw=4:ts=4: