* Merged with df1b780317c3.
[cacao.git] / src / vm / jit / show.c
index a12bd96a5c2e864497dfbb138bf7c4d06260955d..0a51a665ec8d3f442808c7a33b5b7ccced3da06d 100644 (file)
@@ -1,9 +1,7 @@
 /* src/vm/jit/show.c - showing the intermediate representation
 
-   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
-   C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
-   E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
-   J. Wenninger, Institut f. Computersprachen - TU Wien
+   Copyright (C) 1996-2005, 2006, 2007, 2008
+   CACAOVM - Verein zu Foerderung der freien virtuellen Machine CACAO
 
    This file is part of CACAO.
 
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Contact: cacao@cacaojvm.org
-
-   Authors: Andreas Krall
-
-   Changes: Edwin Steiner
-            Christian Thalinger
-            Christian Ullrich
-
-   $Id$
-
 */
 
 
 #include "config.h"
-#include "vm/types.h"
 
 #include <assert.h>
+#include <stdint.h>
+
+#include "vm/types.h"
 
 #include "mm/memory.h"
 
-#if defined(ENABLE_THREADS)
-# include "threads/native/lock.h"
-#else
-# include "threads/none/lock.h"
-#endif
+#include "threads/lock-common.h"
 
 #include "vm/global.h"
-#include "vm/options.h"
 #include "vm/builtin.h"
 #include "vm/stringlocal.h"
+#include "vm/vm.h"
+
+#include "vm/jit/abi.h"
 #include "vm/jit/jit.h"
 #include "vm/jit/show.h"
 #include "vm/jit/disass.h"
-
+#include "vm/jit/stack.h"
+#include "vm/jit/parse.h"
+
+#include "vmcore/options.h"
+
+#if defined(ENABLE_DEBUG_FILTER)
+#      include <sys/types.h>
+#      include <regex.h>
+#      if defined(ENABLE_THREADS)
+#              include "threads/native/threads.h"
+#      else
+#              include "threads/none/threads.h"
+#      endif
+#endif
 
 /* global variables ***********************************************************/
 
 #if defined(ENABLE_THREADS) && !defined(NDEBUG)
-static java_objectheader *show_global_lock;
+static java_object_t *show_global_lock;
+#endif
+
+
+/* prototypes *****************************************************************/
+
+#if !defined(NDEBUG)
+static void show_variable_intern(jitdata *jd, s4 index, int stage);
 #endif
 
 
@@ -76,233 +84,44 @@ bool show_init(void)
 #if defined(ENABLE_THREADS)
        /* initialize the show lock */
 
-       show_global_lock = NEW(java_objectheader);
-
-       lock_init_object_lock(show_global_lock);
-#endif
-
-       /* everything's ok */
+       show_global_lock = NEW(java_object_t);
 
-       return true;
-}
+       LOCK_INIT_OBJECT_LOCK(show_global_lock);
 #endif
 
-
-/* show_print_stack ************************************************************
-
-   Print the stack representation starting with the given top stackptr.
-
-   NOTE: Currently this function may only be called after register allocation!
-
-*******************************************************************************/
-
-#if !defined(NDEBUG)
-static void show_print_stack(codegendata *cd, stackptr s)
-{
-       int i, j;
-       stackptr t;
-
-       i = cd->maxstack;
-       t = s;
-       
-       while (t) {
-               i--;
-               t = t->prev;
-       }
-       j = cd->maxstack - i;
-       while (--i >= 0)
-               printf("    ");
-
-       while (s) {
-               j--;
-               if (s->flags & SAVEDVAR)
-                       switch (s->varkind) {
-                       case TEMPVAR:
-                               if (s->flags & INMEMORY)
-                                       printf(" M%02d", s->regoff);
-#ifdef HAS_ADDRESS_REGISTER_FILE
-                               else if (s->type == TYPE_ADR)
-                                       printf(" R%02d", s->regoff);
-#endif
-                               else if (IS_FLT_DBL_TYPE(s->type))
-                                       printf(" F%02d", s->regoff);
-                               else {
-#if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
-                                       if (IS_2_WORD_TYPE(s->type)) {
-# if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
-#  if defined(ENABLE_INTRP)
-                                               if (opt_intrp)
-                                                       printf(" %3d/%3d", GET_LOW_REG(s->regoff),
-                                                                  GET_HIGH_REG(s->regoff));
-                                               else
-#  endif
-                                                       printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
-                                                                  regs[GET_HIGH_REG(s->regoff)]);
-# else
-                                               printf(" %3d/%3d", GET_LOW_REG(s->regoff),
-                                                          GET_HIGH_REG(s->regoff));
-# endif
-                                       } 
-                                       else 
-#endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
-                                               {
-#if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
-# if defined(ENABLE_INTRP)
-                                                       if (opt_intrp)
-                                                               printf(" %3d", s->regoff);
-                                                       else
-# endif
-                                                               printf(" %3s", regs[s->regoff]);
-#else
-                                                       printf(" %3d", s->regoff);
-#endif
-                                               }
-                               }
-                               break;
-                       case STACKVAR:
-                               printf(" I%02d", s->varnum);
-                               break;
-                       case LOCALVAR:
-                               printf(" L%02d", s->varnum);
-                               break;
-                       case ARGVAR:
-                               if (s->varnum == -1) {
-                                       /* Return Value                                  */
-                                       /* varkind ARGVAR "misused for this special case */
-                                       printf("  V0");
-                               } 
-                               else /* "normal" Argvar */
-                                       printf(" A%02d", s->varnum);
-                               break;
-                       default:
-                               printf(" !%02d", j);
-                       }
-               else
-                       switch (s->varkind) {
-                       case TEMPVAR:
-                               if (s->flags & INMEMORY)
-                                       printf(" m%02d", s->regoff);
-#ifdef HAS_ADDRESS_REGISTER_FILE
-                               else if (s->type == TYPE_ADR)
-                                       printf(" r%02d", s->regoff);
-#endif
-                               else if (IS_FLT_DBL_TYPE(s->type))
-                                       printf(" f%02d", s->regoff);
-                               else {
-#if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
-                                       if (IS_2_WORD_TYPE(s->type)) {
-# if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
-#  if defined(ENABLE_INTRP)
-                                               if (opt_intrp)
-                                                       printf(" %3d/%3d", GET_LOW_REG(s->regoff),
-                                                                  GET_HIGH_REG(s->regoff));
-                                               else
-#  endif
-                                                       printf(" %3s/%3s", regs[GET_LOW_REG(s->regoff)],
-                                                                  regs[GET_HIGH_REG(s->regoff)]);
-# else
-                                               printf(" %3d/%3d", GET_LOW_REG(s->regoff),
-                                                          GET_HIGH_REG(s->regoff));
-# endif
-                                       } 
-                                       else
-#endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
-                                               {
-#if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
-# if defined(ENABLE_INTRP)
-                                                       if (opt_intrp)
-                                                               printf(" %3d", s->regoff);
-                                                       else
-# endif
-                                                               printf(" %3s", regs[s->regoff]);
-#else
-                                                       printf(" %3d", s->regoff);
+#if defined(ENABLE_DEBUG_FILTER)
+       show_filters_init();
 #endif
-                                               }
-                               }
-                               break;
-                       case STACKVAR:
-                               printf(" i%02d", s->varnum);
-                               break;
-                       case LOCALVAR:
-                               printf(" l%02d", s->varnum);
-                               break;
-                       case ARGVAR:
-                               if (s->varnum == -1) {
-                                       /* Return Value                                  */
-                                       /* varkind ARGVAR "misused for this special case */
-                                       printf("  v0");
-                               } 
-                               else /* "normal" Argvar */
-                               printf(" a%02d", s->varnum);
-                               break;
-                       default:
-                               printf(" ?%02d", j);
-                       }
-               s = s->prev;
-       }
-}
-#endif /* !defined(NDEBUG) */
 
+       /* everything's ok */
 
-#if 0
-static void print_reg(stackptr s) {
-       if (s) {
-               if (s->flags & SAVEDVAR)
-                       switch (s->varkind) {
-                       case TEMPVAR:
-                               if (s->flags & INMEMORY)
-                                       printf(" tm%02d", s->regoff);
-                               else
-                                       printf(" tr%02d", s->regoff);
-                               break;
-                       case STACKVAR:
-                               printf(" s %02d", s->varnum);
-                               break;
-                       case LOCALVAR:
-                               printf(" l %02d", s->varnum);
-                               break;
-                       case ARGVAR:
-                               printf(" a %02d", s->varnum);
-                               break;
-                       default:
-                               printf(" ! %02d", s->varnum);
-                       }
-               else
-                       switch (s->varkind) {
-                       case TEMPVAR:
-                               if (s->flags & INMEMORY)
-                                       printf(" Tm%02d", s->regoff);
-                               else
-                                       printf(" Tr%02d", s->regoff);
-                               break;
-                       case STACKVAR:
-                               printf(" S %02d", s->varnum);
-                               break;
-                       case LOCALVAR:
-                               printf(" L %02d", s->varnum);
-                               break;
-                       case ARGVAR:
-                               printf(" A %02d", s->varnum);
-                               break;
-                       default:
-                               printf(" ? %02d", s->varnum);
-                       }
-       }
-       else
-               printf("     ");
-               
+       return true;
 }
 #endif
 
 
 #if !defined(NDEBUG)
-static char *jit_type[] = {
-       "int",
-       "lng",
-       "flt",
-       "dbl",
-       "adr"
+char *show_jit_type_names[] = {
+       "INT",
+       "LNG",
+       "FLT",
+       "DBL",
+       "ADR",
+       "??5",
+       "??6",
+       "??7",
+       "RET"
+};
+char show_jit_type_letters[] = {
+       'I',
+       'L',
+       'F',
+       'D',
+       'A',
+       '5',
+       '6',
+       '7',
+       'R'
 };
 #endif
 
@@ -316,23 +135,27 @@ static char *jit_type[] = {
 *******************************************************************************/
 
 #if !defined(NDEBUG)
-void new_show_method(jitdata *jd, int stage)
+void show_method(jitdata *jd, int stage)
 {
        methodinfo     *m;
        codeinfo       *code;
        codegendata    *cd;
        registerdata   *rd;
        basicblock     *bptr;
-       exceptiontable *ex;
+       basicblock     *lastbptr;
+       exception_entry *ex;
        s4              i, j;
-       u1             *u1ptr;
+       int             irstage;
+#if defined(ENABLE_DISASSEMBLER)
+       u1             *pc;
+#endif
 
        /* get required compiler data */
 
        m    = jd->m;
        code = jd->code;
        cd   = jd->cd;
-       rd   = jd->new_rd;
+       rd   = jd->rd;
 
        /* We need to enter a lock here, since the binutils disassembler
           is not reentrant-able and we could not read functions printed
@@ -340,177 +163,208 @@ void new_show_method(jitdata *jd, int stage)
 
        LOCK_MONITOR_ENTER(show_global_lock);
 
+#if defined(ENABLE_INTRP)
+       if (opt_intrp)
+               irstage = SHOW_PARSE;
+       else
+#endif
+               irstage = stage;
+
+       /* get the last basic block */
+
+       for (lastbptr = jd->basicblocks; lastbptr->next != NULL; lastbptr = lastbptr->next);
+
        printf("\n");
 
        method_println(m);
 
-       printf("\n(NEW INSTRUCTION FORMAT)\n");
-       printf("\nBasic blocks: %d\n", jd->new_basicblockcount);
-       printf("Max locals:   %d\n", cd->maxlocals);
-       printf("Max stack:    %d\n", cd->maxstack);
-       printf("Line number table length: %d\n", m->linenumbercount);
+       if (code_is_leafmethod(code))
+               printf("LEAFMETHOD\n");
+
+       printf("\nBasic blocks: %d\n", jd->basicblockcount);
+       if (stage >= SHOW_CODE) {
+               printf("Code length:  %d\n", (lastbptr->mpc - jd->basicblocks[0].mpc));
+               printf("Data length:  %d\n", cd->dseglen);
+               printf("Stub length:  %d\n", (s4) (code->mcodelength -
+                                                                                  ((ptrint) cd->dseglen + lastbptr->mpc)));
+       }
+       printf("Variables:       %d (%d used)\n", jd->varcount, jd->vartop);
+       if (stage >= SHOW_STACK)
+               printf("Max interfaces:  %d\n", jd->maxinterfaces);
+       printf("Max locals:      %d\n", jd->maxlocals);
+       printf("Max stack:       %d\n", m->maxstack);
+       printf("Linenumbers:     %d\n", m->linenumbercount);
+       printf("Branch to entry: %s\n", (jd->branchtoentry) ? "yes" : "no");
+       printf("Branch to end:   %s\n", (jd->branchtoend) ? "yes" : "no");
+       if (stage >= SHOW_STACK) {
+               printf("Number of RETURNs: %d", jd->returncount);
+               if (jd->returncount == 1)
+                       printf(" (block L%03d)", jd->returnblock->nr);
+               printf("\n");
+       }
 
        if (stage >= SHOW_PARSE) {
-               printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
-               for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
-                       printf("    L%03d ... ", ex->start->debug_nr );
-                       printf("L%03d  = ", ex->end->debug_nr);
-                       printf("L%03d", ex->handler->debug_nr);
+               printf("Exceptions (Number: %d):\n", jd->exceptiontablelength);
+               for (ex = jd->exceptiontable; ex != NULL; ex = ex->down) {
+                       printf("    L%03d ... ", ex->start->nr );
+                       printf("L%03d  = ", ex->end->nr);
+                       printf("L%03d", ex->handler->nr);
                        printf("  (catchtype: ");
                        if (ex->catchtype.any)
                                if (IS_CLASSREF(ex->catchtype))
-                                       utf_display_printable_ascii_classname(ex->catchtype.ref->name);
+                                       class_classref_print(ex->catchtype.ref);
                                else
-                                       utf_display_printable_ascii_classname(ex->catchtype.cls->name);
+                                       class_print(ex->catchtype.cls);
                        else
                                printf("ANY");
                        printf(")\n");
                }
        }
        
-       if (stage >= SHOW_PARSE && rd) {
-       printf("Local Table:\n");
-       for (i = 0; i < cd->maxlocals; i++) {
-               printf("   %3d: ", i);
+       if (irstage >= SHOW_PARSE && rd && jd->localcount > 0) {
+               printf("Local Table:\n");
+               for (i = 0; i < jd->localcount; i++) {
+                       printf("   %3d: ", i);
 
 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
-               for (j = TYPE_INT; j <= TYPE_ADR; j++) {
 # if defined(ENABLE_INTRP)
                        if (!opt_intrp) {
 # endif
-                               if (rd->locals[i][j].type >= 0) {
-                                       printf("   (%s) ", jit_type[j]);
-                                       if (stage >= SHOW_REGS) {
-                                               if (rd->locals[i][j].flags & INMEMORY)
-                                                       printf("m%2d", rd->locals[i][j].regoff);
-# ifdef HAS_ADDRESS_REGISTER_FILE
-                                               else if (j == TYPE_ADR)
-                                                       printf("r%02d", rd->locals[i][j].regoff);
-# endif
-                                               else if ((j == TYPE_FLT) || (j == TYPE_DBL))
-                                                       printf("f%02d", rd->locals[i][j].regoff);
-                                               else {
-# if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
-                                                       if (IS_2_WORD_TYPE(j))
-                                                               printf(" %3s/%3s",
-                                                                          regs[GET_LOW_REG(rd->locals[i][j].regoff)],
-                                                                          regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
-                                                       else
-# endif
-                                                               printf("%3s", regs[rd->locals[i][j].regoff]);
-                                               }
-                                       }
-                               }
+                               printf("   (%s) ", show_jit_type_names[VAR(i)->type]);
+                               if (irstage >= SHOW_REGS)
+                                       show_allocation(VAR(i)->type, VAR(i)->flags, VAR(i)->vv.regoff);
+                               printf("\n");
 # if defined(ENABLE_INTRP)
                        }
 # endif
-               }
 #endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
-
+               }
                printf("\n");
        }
-       printf("\n");
+
+       if (jd->maxlocals > 0 && jd->local_map != NULL) {
+               printf("Local Map:\n");
+               printf("    index ");
+               for (j = 0; j < jd->maxlocals; j++) {
+                       printf(" [%2d]", j);
+               }
+               printf("\n");
+               for (i = 0; i < 5; i++) {
+                       printf("    %5s ",show_jit_type_names[i]);
+                       for (j = 0; j < jd->maxlocals; j++) {
+                               if (jd->local_map[j*5+i] == UNUSED)
+                                       printf("  -- ");
+                               else
+                                       printf("%4i ",jd->local_map[j*5+i]);
+                       }
+                       printf("\n");
+               }
+               printf("\n");
        }
 
-       if (stage >= SHOW_STACK && rd) {
-#if defined(ENABLE_LSRA)
-       if (!opt_lsra) {
-#endif
-#if defined(ENABLE_INTRP)
-               if (!opt_intrp) {
-#endif
-       printf("Interface Table:\n");
-       for (i = 0; i < cd->maxstack; i++) {
-               if ((rd->interfaces[i][0].type >= 0) ||
-                       (rd->interfaces[i][1].type >= 0) ||
-                   (rd->interfaces[i][2].type >= 0) ||
-                       (rd->interfaces[i][3].type >= 0) ||
-                   (rd->interfaces[i][4].type >= 0)) {
-                       printf("   %3d: ", i);
+       if (jd->maxinterfaces > 0 && jd->interface_map && irstage >= SHOW_STACK) {
+               bool exist = false;
+               interface_info *mapptr = jd->interface_map;
+               
+               /* look if there exist any INOUTS */
+               for (i = 0; (i < (5 * jd->maxinterfaces)) && !exist; i++, mapptr++)
+                       exist = (mapptr->flags != UNUSED);
+
+               if (exist) {
+                       printf("Interface Table: (In/Outvars)\n");
+                       printf("    depth ");
+                       for (j = 0; j < jd->maxinterfaces; j++) {
+                               printf("      [%2d]", j);
+                       }
+                       printf("\n");
 
-#if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
-# if defined(ENABLE_INTRP)
-                       if (!opt_intrp) {
-# endif
-                               for (j = TYPE_INT; j <= TYPE_ADR; j++) {
-                                       if (rd->interfaces[i][j].type >= 0) {
-                                               printf("   (%s) ", jit_type[j]);
-                                               if (stage >= SHOW_REGS) {
-                                                       if (rd->interfaces[i][j].flags & SAVEDVAR) {
-                                                               if (rd->interfaces[i][j].flags & INMEMORY)
-                                                                       printf("M%2d", rd->interfaces[i][j].regoff);
-#ifdef HAS_ADDRESS_REGISTER_FILE
-                                                               else if (j == TYPE_ADR)
-                                                                       printf("R%02d", rd->interfaces[i][j].regoff);
-#endif
-                                                               else if ((j == TYPE_FLT) || (j == TYPE_DBL))
-                                                                       printf("F%02d", rd->interfaces[i][j].regoff);
-                                                               else {
-#if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
-                                                                       if (IS_2_WORD_TYPE(j))
-                                                                               printf(" %3s/%3s",
-                                                                                          regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
-                                                                                          regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
-                                                                       else
-#endif
-                                                                               printf("%3s",regs[rd->interfaces[i][j].regoff]);
-                                                               }
+                       for (i = 0; i < 5; i++) {
+                               printf("    %5s      ",show_jit_type_names[i]);
+                               for (j = 0; j < jd->maxinterfaces; j++) {
+                                       s4 flags  = jd->interface_map[j*5+i].flags;
+                                       s4 regoff = jd->interface_map[j*5+i].regoff;
+                                       if (flags == UNUSED)
+                                               printf("  --      ");
+                                       else {
+                                               int ch;
+
+                                               if (irstage >= SHOW_REGS) {
+                                                       if (flags & SAVEDVAR) {
+                                                               if (flags & INMEMORY)
+                                                                       ch = 'M';
+                                                               else
+                                                                       ch = 'R';
                                                        }
                                                        else {
-                                                               if (rd->interfaces[i][j].flags & INMEMORY)
-                                                                       printf("m%2d", rd->interfaces[i][j].regoff);
-#ifdef HAS_ADDRESS_REGISTER_FILE
-                                                               else if (j == TYPE_ADR)
-                                                                       printf("r%02d", rd->interfaces[i][j].regoff);
-#endif
-                                                               else if ((j == TYPE_FLT) || (j == TYPE_DBL))
-                                                                       printf("f%02d", rd->interfaces[i][j].regoff);
-                                                               else {
-#if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
-                                                                       if (IS_2_WORD_TYPE(j))
-                                                                               printf(" %3s/%3s",
-                                                                                          regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
-                                                                                          regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
-                                                                       else
-#endif
-                                                                               printf("%3s",regs[rd->interfaces[i][j].regoff]);
-                                                               }
+                                                               if (flags & INMEMORY)
+                                                                       ch = 'm';
+                                                               else
+                                                                       ch = 'r';
                                                        }
+                                                       printf("%c%03d(", ch, regoff);
+                                                       show_allocation(i, flags, regoff);
+                                                       printf(") ");
+                                               }
+                                               else {
+                                                       if (flags & SAVEDVAR)
+                                                               printf("  I       ");
+                                                       else
+                                                               printf("  i       ");
                                                }
                                        }
                                }
                                printf("\n");
-# if defined(ENABLE_INTRP)
                        }
-# endif
-#endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
-
+                       printf("\n");
                }
        }
-       printf("\n");
 
-#if defined(ENABLE_INTRP)
+       if (rd->memuse && irstage >= SHOW_REGS) {
+               int max;
+
+               max = rd->memuse;
+               printf("Stack slots: (memuse=%d", rd->memuse);
+               if (irstage >= SHOW_CODE) {
+                       printf(", stackframesize=%d", cd->stackframesize);
+                       max = cd->stackframesize;
                }
+               printf(")\n");
+               for (i = 0; i < max; ++i) {
+#if defined(HAS_4BYTE_STACKSLOT)
+                       printf("    M%02d = 0x%02x(sp): ", i, i * 4);
+#else
+                       printf("    M%02d = 0x%02x(sp): ", i, i * 8);
 #endif
-#if defined(ENABLE_LSRA)
-       }
-#endif
-       } /* if >= SHOW_STACK */
+                       for (j = 0; j < jd->vartop; ++j) {
+                               varinfo *v = VAR(j);
+                               if ((v->flags & INMEMORY) && (v->vv.regoff == i)) {
+                                       show_variable(jd, j, irstage);
+                                       putchar(' ');
+                               }
+                       }
 
+                       printf("\n");
+
+               }
+               printf("\n");
+       }
+
+#if defined(ENABLE_REPLACEMENT)
        if (code->rplpoints) {
                printf("Replacement Points:\n");
                replace_show_replacement_points(code);
                printf("\n");
        }
+#endif /* defined(ENABLE_REPLACEMENT) */
 
 #if defined(ENABLE_DISASSEMBLER)
        /* show code before first basic block */
 
        if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd)) {
-               u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen);
+               pc = (u1 *) ((ptrint) code->mcode + cd->dseglen);
 
-               for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + jd->new_basicblocks[0].mpc);)
-                       DISASSINSTR(u1ptr);
+               for (; pc < (u1 *) ((ptrint) code->mcode + cd->dseglen + jd->basicblocks[0].mpc);)
+                       DISASSINSTR(pc);
 
                printf("\n");
        }
@@ -518,23 +372,21 @@ void new_show_method(jitdata *jd, int stage)
 
        /* show code of all basic blocks */
 
-       for (bptr = jd->new_basicblocks; bptr != NULL; bptr = bptr->next)
-               new_show_basicblock(jd, bptr, stage);
+       for (bptr = jd->basicblocks; bptr != NULL; bptr = bptr->next)
+               show_basicblock(jd, bptr, stage);
 
-#if defined(ENABLE_DISASSEMBLER)
-       /* show stubs code */
+#if 0 && defined(ENABLE_DISASSEMBLER)
+       /* show code after last basic block */
 
-       if (stage >= SHOW_CODE && opt_showdisassemble && opt_showexceptionstubs) {
-               printf("\nException stubs code:\n");
+       if (stage >= SHOW_CODE && opt_showdisassemble) {
+               printf("\nStubs code:\n");
                printf("Length: %d\n\n", (s4) (code->mcodelength -
-                                                                          ((ptrint) cd->dseglen +
-                                                                               jd->new_basicblocks[jd->new_basicblockcount].mpc)));
+                                                                          ((ptrint) cd->dseglen + lastbptr->mpc)));
 
-               u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen +
-                                               jd->new_basicblocks[jd->new_basicblockcount].mpc);
+               pc = (u1 *) ((ptrint) code->mcode + cd->dseglen + lastbptr->mpc);
 
-               for (; (ptrint) u1ptr < ((ptrint) code->mcode + code->mcodelength);)
-                       DISASSINSTR(u1ptr);
+               for (; (ptrint) pc < ((ptrint) code->mcode + code->mcodelength);)
+                       DISASSINSTR(pc);
 
                printf("\n");
        }
@@ -548,386 +400,203 @@ void new_show_method(jitdata *jd, int stage)
 }
 #endif /* !defined(NDEBUG) */
 
+
+#if !defined(NDEBUG) && defined(ENABLE_INLINING)
+static void show_inline_info(jitdata *jd, insinfo_inline *ii, s4 opcode, s4 stage)
+{
+       s4 *jl;
+       s4 n;
+
+       printf("(pt %d+%d+%d st ", 
+                       ii->throughcount - (ii->stackvarscount - ii->paramcount),
+                       ii->stackvarscount - ii->paramcount,
+                       ii->paramcount);
+       show_variable_array(jd, ii->stackvars, ii->stackvarscount, stage);
+
+       if (opcode == ICMD_INLINE_START || opcode == ICMD_INLINE_END) {
+               printf(" jl ");
+               jl = (opcode == ICMD_INLINE_START) ? ii->javalocals_start : ii->javalocals_end;
+               n = (opcode == ICMD_INLINE_START) ? ii->method->maxlocals : ii->outer->maxlocals;
+               show_javalocals_array(jd, jl, n, stage);
+       }
+
+       printf(") ");
+
+#if 0
+       printf("(");
+       method_print(ii->outer);
+       printf(" ==> ");
+#endif
+
+       method_print(ii->method);
+}
+#endif /* !defined(NDEBUG) && defined(ENABLE_INLINING) */
+
+
+/* show_basicblock *************************************************************
+
+   Print the intermediate representation of a basic block.
+
+   NOTE: Currently this function may only be called after register allocation!
+
+*******************************************************************************/
+
 #if !defined(NDEBUG)
-void show_method(jitdata *jd)
+void show_basicblock(jitdata *jd, basicblock *bptr, int stage)
 {
-       methodinfo     *m;
-       codeinfo       *code;
-       codegendata    *cd;
-       registerdata   *rd;
-       basicblock     *bptr;
-       exceptiontable *ex;
-       s4              i, j;
-       u1             *u1ptr;
+       codeinfo    *code;
+       codegendata *cd;
+       s4           i;
+       bool         deadcode;
+       instruction *iptr;
+       int          irstage;
+#if defined(ENABLE_DISASSEMBLER)
+       methodinfo  *m;                     /* this is only a dummy               */
+       void        *pc;
+       s4           linenumber;
+       s4           currentlinenumber;
+#endif
 
        /* get required compiler data */
 
-       m    = jd->m;
        code = jd->code;
        cd   = jd->cd;
-       rd   = jd->rd;
 
-       /* We need to enter a lock here, since the binutils disassembler
-          is not reentrant-able and we could not read functions printed
-          at the same time. */
+       if (bptr->flags != BBDELETED) {
+#if defined(ENABLE_INTRP)
+               if (opt_intrp) {
+                       deadcode = false;
+                       irstage = SHOW_PARSE;
+               }
+               else
+#endif
+               {
+                       deadcode = (bptr->flags < BBREACHED);
+                       irstage = stage;
+               }
 
-       LOCK_MONITOR_ENTER(show_global_lock);
+               printf("======== %sL%03d ======== %s(flags: %d, bitflags: %01x, next: %d, type: ",
+#if defined(ENABLE_REPLACEMENT)
+                               (bptr->bitflags & BBFLAG_REPLACEMENT) ? "<REPLACE> " : 
+#endif
+                                                                                                               "",
+                          bptr->nr, 
+                          (deadcode && stage >= SHOW_STACK) ? "DEADCODE! " : "",
+                          bptr->flags, bptr->bitflags, 
+                          (bptr->next) ? (bptr->next->nr) : -1);
 
-       printf("\n");
+               switch (bptr->type) {
+               case BBTYPE_STD:
+                       printf("STD");
+                       break;
+               case BBTYPE_EXH:
+                       printf("EXH");
+                       break;
+               case BBTYPE_SBR:
+                       printf("SBR");
+                       break;
+               }
 
-       method_println(m);
+               printf(", icount: %d", bptr->icount);
 
-       printf("\nBasic blocks: %d\n", m->basicblockcount);
-       printf("Max locals:   %d\n", cd->maxlocals);
-       printf("Max stack:    %d\n", cd->maxstack);
-       printf("Line number table length: %d\n", m->linenumbercount);
-
-       printf("Exceptions (Number: %d):\n", cd->exceptiontablelength);
-       for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
-               printf("    L%03d ... ", ex->start->debug_nr );
-               printf("L%03d  = ", ex->end->debug_nr);
-               printf("L%03d", ex->handler->debug_nr);
-               printf("  (catchtype: ");
-               if (ex->catchtype.any)
-                       if (IS_CLASSREF(ex->catchtype))
-                               utf_display_printable_ascii_classname(ex->catchtype.ref->name);
-                       else
-                               utf_display_printable_ascii_classname(ex->catchtype.cls->name);
-               else
-                       printf("ANY");
-               printf(")\n");
-       }
-       
-       printf("Local Table:\n");
-       for (i = 0; i < cd->maxlocals; i++) {
-               printf("   %3d: ", i);
+               if (irstage >= SHOW_CFG) {
+                       printf(", preds: %d [ ", bptr->predecessorcount);
 
-#if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
-               for (j = TYPE_INT; j <= TYPE_ADR; j++) {
-# if defined(ENABLE_INTRP)
-                       if (!opt_intrp) {
-# endif
-                               if (rd->locals[i][j].type >= 0) {
-                                       printf("   (%s) ", jit_type[j]);
-                                       if (rd->locals[i][j].flags & INMEMORY)
-                                               printf("m%2d", rd->locals[i][j].regoff);
-# ifdef HAS_ADDRESS_REGISTER_FILE
-                                       else if (j == TYPE_ADR)
-                                               printf("r%02d", rd->locals[i][j].regoff);
-# endif
-                                       else if ((j == TYPE_FLT) || (j == TYPE_DBL))
-                                               printf("f%02d", rd->locals[i][j].regoff);
-                                       else {
-# if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
-                                               if (IS_2_WORD_TYPE(j))
-                                                       printf(" %3s/%3s",
-                                                                  regs[GET_LOW_REG(rd->locals[i][j].regoff)],
-                                                                  regs[GET_HIGH_REG(rd->locals[i][j].regoff)]);
-                                               else
-# endif
-                                                       printf("%3s", regs[rd->locals[i][j].regoff]);
-                                       }
-                               }
-# if defined(ENABLE_INTRP)
+                       for (i = 0; i < bptr->predecessorcount; i++)
+                               printf("%d ", bptr->predecessors[i]->nr);
+
+                       printf("]");
+               }
+
+               printf("):");
+
+               if (bptr->original)
+                       printf(" (clone of L%03d)", bptr->original->nr);
+               else {
+                       basicblock *b = bptr->copied_to;
+                       if (b) {
+                               printf(" (copied to ");
+                               for (; b; b = b->copied_to)
+                                       printf("L%03d ", b->nr);
+                               printf(")");
                        }
-# endif
                }
-#endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
 
                printf("\n");
-       }
-       printf("\n");
 
-#if defined(ENABLE_LSRA)
-       if (!opt_lsra) {
-#endif
-#if defined(ENABLE_INTRP)
-               if (!opt_intrp) {
-#endif
-       printf("Interface Table:\n");
-       for (i = 0; i < cd->maxstack; i++) {
-               if ((rd->interfaces[i][0].type >= 0) ||
-                       (rd->interfaces[i][1].type >= 0) ||
-                   (rd->interfaces[i][2].type >= 0) ||
-                       (rd->interfaces[i][3].type >= 0) ||
-                   (rd->interfaces[i][4].type >= 0)) {
-                       printf("   %3d: ", i);
+               if (irstage >= SHOW_CFG) {
+                       printf("succs: %d [ ", bptr->successorcount);
 
-#if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
-# if defined(ENABLE_INTRP)
-                       if (!opt_intrp) {
-# endif
-                               for (j = TYPE_INT; j <= TYPE_ADR; j++) {
-                                       if (rd->interfaces[i][j].type >= 0) {
-                                               printf("   (%s) ", jit_type[j]);
-                                               if (rd->interfaces[i][j].flags & SAVEDVAR) {
-                                                       if (rd->interfaces[i][j].flags & INMEMORY)
-                                                               printf("M%2d", rd->interfaces[i][j].regoff);
-#ifdef HAS_ADDRESS_REGISTER_FILE
-                                                       else if (j == TYPE_ADR)
-                                                               printf("R%02d", rd->interfaces[i][j].regoff);
-#endif
-                                                       else if ((j == TYPE_FLT) || (j == TYPE_DBL))
-                                                               printf("F%02d", rd->interfaces[i][j].regoff);
-                                                       else {
-#if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
-                                                               if (IS_2_WORD_TYPE(j))
-                                                                       printf(" %3s/%3s",
-                                                                                  regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
-                                                                                  regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
-                                                               else
-#endif
-                                                                       printf("%3s",regs[rd->interfaces[i][j].regoff]);
-                                                       }
-                                               }
-                                               else {
-                                                       if (rd->interfaces[i][j].flags & INMEMORY)
-                                                               printf("m%2d", rd->interfaces[i][j].regoff);
-#ifdef HAS_ADDRESS_REGISTER_FILE
-                                                       else if (j == TYPE_ADR)
-                                                               printf("r%02d", rd->interfaces[i][j].regoff);
-#endif
-                                                       else if ((j == TYPE_FLT) || (j == TYPE_DBL))
-                                                               printf("f%02d", rd->interfaces[i][j].regoff);
-                                                       else {
-#if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
-                                                               if (IS_2_WORD_TYPE(j))
-                                                                       printf(" %3s/%3s",
-                                                                                  regs[GET_LOW_REG(rd->interfaces[i][j].regoff)],
-                                                                                  regs[GET_HIGH_REG(rd->interfaces[i][j].regoff)]);
-                                                               else
-#endif
-                                                                       printf("%3s",regs[rd->interfaces[i][j].regoff]);
-                                                       }
-                                               }
-                                       }
-                               }
-                               printf("\n");
-# if defined(ENABLE_INTRP)
-                       }
-# endif
-#endif /* defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER) */
-
-               }
-       }
-       printf("\n");
-
-#if defined(ENABLE_INTRP)
-               }
-#endif
-#if defined(ENABLE_LSRA)
-       }
-#endif
-
-       if (code->rplpoints) {
-               printf("Replacement Points:\n");
-               replace_show_replacement_points(code);
-               printf("\n");
-       }
-
-#if defined(ENABLE_DISASSEMBLER)
-       /* show code before first basic block */
-
-       if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd)) {
-               u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen);
-
-               for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + m->basicblocks[0].mpc);)
-                       DISASSINSTR(u1ptr);
-
-               printf("\n");
-       }
-#endif
-
-       /* show code of all basic blocks */
-
-       for (bptr = m->basicblocks; bptr != NULL; bptr = bptr->next)
-               show_basicblock(jd, bptr);
-
-#if defined(ENABLE_DISASSEMBLER)
-       /* show stubs code */
-
-       if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) && opt_showexceptionstubs) {
-               printf("\nException stubs code:\n");
-               printf("Length: %d\n\n", (s4) (code->mcodelength -
-                                                                          ((ptrint) cd->dseglen +
-                                                                               m->basicblocks[m->basicblockcount].mpc)));
-
-               u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen +
-                                               m->basicblocks[m->basicblockcount].mpc);
-
-               for (; (ptrint) u1ptr < ((ptrint) code->mcode + code->mcodelength);)
-                       DISASSINSTR(u1ptr);
-
-               printf("\n");
-       }
-#endif
-
-       LOCK_MONITOR_EXIT(show_global_lock);
-
-       /* finally flush the output */
-
-       fflush(stdout);
-}
-#endif /* !defined(NDEBUG) */
-
-
-/* show_basicblock *************************************************************
-
-   Print the intermediate representation of a basic block.
-
-   NOTE: Currently this function may only be called after register allocation!
-
-*******************************************************************************/
-
-#if !defined(NDEBUG)
-void new_show_basicblock(jitdata *jd, basicblock *bptr, int stage)
-{
-       methodinfo  *m;
-       codeinfo    *code;
-       codegendata *cd;
-       s4           i;
-       bool         deadcode;
-       new_instruction *iptr;
-       u1          *u1ptr;
-
-       /* get required compiler data */
-
-       m    = jd->m;
-       code = jd->code;
-       cd   = jd->cd;
-
-       if (bptr->flags != BBDELETED) {
-               deadcode = bptr->flags <= BBREACHED;
-
-               printf("======== %sL%03d ======== (flags: %d, bitflags: %01x, next: %d, type: ",
-                               (bptr->bitflags & BBFLAG_REPLACEMENT) ? "<REPLACE> " : "",
-                          bptr->debug_nr, bptr->flags, bptr->bitflags, 
-                          (bptr->next) ? (bptr->next->debug_nr) : -1);
+                       for (i = 0; i < bptr->successorcount; i++)
+                               printf("%d ", bptr->successors[i]->nr);
 
-               switch (bptr->type) {
-               case BBTYPE_STD:
-                       printf("STD");
-                       break;
-               case BBTYPE_EXH:
-                       printf("EXH");
-                       break;
-               case BBTYPE_SBR:
-                       printf("SBR");
-                       break;
+                       printf("]\n");
                }
 
-               printf(", instruction count: %d, predecessors: %d):\n",
-                          bptr->icount, bptr->pre_count);
-
-               iptr = /*XXX*/ (new_instruction *) bptr->iinstr;
-
-               for (i = 0; i < bptr->icount; i++, iptr++) {
-                       printf("%4d:  ", iptr->line);
-
-                       new_show_icmd(jd, iptr, deadcode, stage);
+               if (irstage >= SHOW_STACK) {
+                       printf("IN:  ");
+                       show_variable_array(jd, bptr->invars, bptr->indepth, irstage);
+                       printf(" javalocals: ");
+                       show_javalocals_array(jd, bptr->javalocals, bptr->method->maxlocals, irstage);
                        printf("\n");
                }
 
-#if defined(ENABLE_DISASSEMBLER)
-               if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) &&
-                       (!deadcode)) {
-                       printf("\n");
-                       u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->mpc);
-
-                       if (bptr->next != NULL) {
-                               for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->next->mpc);)
-                                       DISASSINSTR(u1ptr);
-
-                       } 
-                       else {
-                               for (; u1ptr < (u1 *) ((ptrint) code->mcode + code->mcodelength);)
-                                       DISASSINSTR(u1ptr); 
-                       }
+#if defined(ENABLE_INLINING)
+               if (bptr->inlineinfo) {
+                       printf("inlineinfo: ");
+                       show_inline_info(jd, bptr->inlineinfo, -1, irstage);
                        printf("\n");
                }
-#endif
-       }
-}
-#endif /* !defined(NDEBUG) */
-
-#if !defined(NDEBUG)
-void show_basicblock(jitdata *jd, basicblock *bptr)
-{
-       methodinfo  *m;
-       codeinfo    *code;
-       codegendata *cd;
-       s4           i, j;
-       bool         deadcode;
-       instruction *iptr;
-       u1          *u1ptr;
-
-       /* get required compiler data */
-
-       m    = jd->m;
-       code = jd->code;
-       cd   = jd->cd;
-
-       if (bptr->flags != BBDELETED) {
-               deadcode = bptr->flags <= BBREACHED;
-
-               printf("[");
-
-               if (deadcode)
-                       for (j = cd->maxstack; j > 0; j--)
-                               printf(" ?  ");
-               else
-                       show_print_stack(cd, bptr->instack);
-
-               printf("] %sL%03d(flags: %d, bitflags: %01x, next: %d, type: ",
-                               (bptr->bitflags & BBFLAG_REPLACEMENT) ? "<REPLACE> " : "",
-                          bptr->debug_nr, bptr->flags, bptr->bitflags, 
-                          (bptr->next) ? (bptr->next->debug_nr) : -1);
-
-               switch (bptr->type) {
-               case BBTYPE_STD:
-                       printf("STD");
-                       break;
-               case BBTYPE_EXH:
-                       printf("EXH");
-                       break;
-               case BBTYPE_SBR:
-                       printf("SBR");
-                       break;
-               }
-
-               printf(", instruction count: %d, predecessors: %d):\n",
-                          bptr->icount, bptr->pre_count);
+#endif /* defined(ENABLE_INLINING) */
 
                iptr = bptr->iinstr;
 
                for (i = 0; i < bptr->icount; i++, iptr++) {
-                       printf("[");
-
-                       if (deadcode)
-                               for (j = cd->maxstack; j > 0; j--)
-                                       printf(" ?  ");
-                       else
-                               show_print_stack(cd, iptr->dst);
+                       printf("%4d:%4d:  ", iptr->line, iptr->flags.bits >> INS_FLAG_ID_SHIFT);
 
-                       printf("] %5d (line: %5d)  ", i, iptr->line);
+                       show_icmd(jd, iptr, deadcode, irstage);
+                       printf("\n");
+               }
 
-                       show_icmd(iptr, deadcode);
+               if (irstage >= SHOW_STACK) {
+                       printf("OUT: ");
+                       show_variable_array(jd, bptr->outvars, bptr->outdepth, irstage);
                        printf("\n");
                }
 
 #if defined(ENABLE_DISASSEMBLER)
-               if (JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) && (!deadcode)) {
+               if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) &&
+                       (!deadcode)) 
+               {
                        printf("\n");
-                       u1ptr = (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->mpc);
+                       pc         = (void *) (code->mcode + cd->dseglen + bptr->mpc);
+                       linenumber = 0;
 
                        if (bptr->next != NULL) {
-                               for (; u1ptr < (u1 *) ((ptrint) code->mcode + cd->dseglen + bptr->next->mpc);)
-                                       DISASSINSTR(u1ptr);
+                               for (; pc < (void *) (code->mcode + cd->dseglen + bptr->next->mpc);) {
+                                       currentlinenumber =
+                                               linenumbertable_linenumber_for_pc(&m, code, pc);
 
-                       } 
+                                       if (currentlinenumber != linenumber) {
+                                               linenumber = currentlinenumber;
+                                               printf("%4d:\n", linenumber);
+                                       }
+
+                                       DISASSINSTR(pc);
+                               }
+                       }
                        else {
-                               for (; u1ptr < (u1 *) ((ptrint) code->mcode + code->mcodelength);)
-                                       DISASSINSTR(u1ptr); 
+                               for (; pc < (void *) (code->mcode + code->mcodelength);) {
+                                       currentlinenumber =
+                                               linenumbertable_linenumber_for_pc(&m, code, pc);
+
+                                       if (currentlinenumber != linenumber) {
+                                               linenumber = currentlinenumber;
+                                               printf("%4d:\n", linenumber);
+                                       }
+
+                                       DISASSINSTR(pc);
+                               }
                        }
                        printf("\n");
                }
@@ -948,13 +617,8 @@ void show_basicblock(jitdata *jd, basicblock *bptr)
 #if !defined(NDEBUG)
 
 #define SHOW_TARGET(target)                                          \
-        if (stage >= SHOW_STACK) {                                   \
-            printf("--> L%03d ", (target).block->debug_nr);          \
-        }                                                            \
-        else if (stage >= SHOW_PARSE) {                              \
-            printf("--> insindex %d (L%03d) ", (target).insindex,    \
-                jd->new_basicblocks[jd->new_basicblockindex[         \
-                (target).insindex]].debug_nr);                       \
+        if (stage >= SHOW_PARSE) {                                   \
+            printf("--> L%03d ", (target).block->nr);                \
         }                                                            \
         else {                                                       \
             printf("--> insindex %d ", (target).insindex);           \
@@ -962,35 +626,69 @@ void show_basicblock(jitdata *jd, basicblock *bptr)
 
 #define SHOW_INT_CONST(val)                                          \
         if (stage >= SHOW_PARSE) {                                   \
-            printf("%ld ", (long) (val));                            \
+            printf("%d (0x%08x) ", (int32_t) (val), (int32_t) (val)); \
         }                                                            \
         else {                                                       \
             printf("iconst ");                                       \
         }
 
+#if SIZEOF_VOID_P == 4
 #define SHOW_LNG_CONST(val)                                          \
-        if (stage >= SHOW_PARSE) {                                   \
-            printf("%lld ", (long long)(val));                       \
-        }                                                            \
-        else {                                                       \
-            printf("lconst ");                                       \
-        }
+        if (stage >= SHOW_PARSE)                                     \
+            printf("%lld (0x%016llx) ", (val), (val));               \
+        else                                                         \
+            printf("lconst ");
+#else
+#define SHOW_LNG_CONST(val)                                          \
+        if (stage >= SHOW_PARSE)                                     \
+            printf("%ld (0x%016lx) ", (val), (val));                 \
+        else                                                         \
+            printf("lconst ");
+#endif
+
+#if SIZEOF_VOID_P == 4
+#define SHOW_ADR_CONST(val)                                          \
+        if (stage >= SHOW_PARSE)                                     \
+            printf("0x%08x ", (ptrint) (val));                       \
+        else                                                         \
+            printf("aconst ");
+#else
+#define SHOW_ADR_CONST(val)                                          \
+        if (stage >= SHOW_PARSE)                                     \
+            printf("0x%016lx ", (ptrint) (val));                     \
+        else                                                         \
+            printf("aconst ");
+#endif
 
 #define SHOW_FLT_CONST(val)                                          \
         if (stage >= SHOW_PARSE) {                                   \
-            printf("%g ", (val));                                    \
+            imm_union v;                                             \
+            v.f = (val);                                             \
+            printf("%g (0x%08x) ", (val), v.i);                      \
         }                                                            \
         else {                                                       \
             printf("fconst ");                                       \
         }
 
+#if SIZEOF_VOID_P == 4
 #define SHOW_DBL_CONST(val)                                          \
         if (stage >= SHOW_PARSE) {                                   \
-            printf("%g ", (val));                                    \
+            imm_union v;                                             \
+            v.d = (val);                                             \
+            printf("%g (0x%016llx) ", (val), v.l);                   \
         }                                                            \
-        else {                                                       \
-            printf("dconst ");                                       \
-        }
+        else                                                         \
+            printf("dconst ");
+#else
+#define SHOW_DBL_CONST(val)                                          \
+        if (stage >= SHOW_PARSE) {                                   \
+            imm_union v;                                             \
+            v.d = (val);                                             \
+            printf("%g (0x%016lx) ", (val), v.l);                    \
+        }                                                            \
+        else                                                         \
+            printf("dconst ");
+#endif
 
 #define SHOW_INDEX(index)                                            \
         if (stage >= SHOW_PARSE) {                                   \
@@ -1004,7 +702,7 @@ void show_basicblock(jitdata *jd, basicblock *bptr)
         if (stage >= SHOW_PARSE) {                                   \
             putchar('"');                                            \
             utf_display_printable_ascii(                             \
-                javastring_toutf((java_lang_String *)(val), false)); \
+               javastring_toutf((java_handle_t *)(val), false));     \
             printf("\" ");                                           \
         }                                                            \
         else {                                                       \
@@ -1032,203 +730,224 @@ void show_basicblock(jitdata *jd, basicblock *bptr)
             printf("field ");                                        \
         }
 
-#define SHOW_STACKVAR(sp)                                            \
-        new_show_stackvar(jd, (sp), stage)
+#define SHOW_VARIABLE(v)                                             \
+    show_variable(jd, (v), stage)
 
 #define SHOW_S1(iptr)                                                \
         if (stage >= SHOW_STACK) {                                   \
-            SHOW_STACKVAR(iptr->s1.var);                             \
+            SHOW_VARIABLE(iptr->s1.varindex);                        \
         }
 
 #define SHOW_S2(iptr)                                                \
         if (stage >= SHOW_STACK) {                                   \
-            SHOW_STACKVAR(iptr->sx.s23.s2.var);                      \
+            SHOW_VARIABLE(iptr->sx.s23.s2.varindex);                 \
         }
 
 #define SHOW_S3(iptr)                                                \
-        if (stage >= SHOW_STACK) {                                   \
-            SHOW_STACKVAR(iptr->sx.s23.s3.var);                      \
-        }
+    if (stage >= SHOW_STACK) {                                       \
+        SHOW_VARIABLE(iptr->sx.s23.s3.varindex);                     \
+    }
 
 #define SHOW_DST(iptr)                                               \
-        if (stage >= SHOW_STACK) {                                   \
-            printf("=> ");                                           \
-            SHOW_STACKVAR(iptr->dst.var);                            \
-        }
+    if (stage >= SHOW_STACK) {                                       \
+        printf("=> ");                                               \
+        SHOW_VARIABLE(iptr->dst.varindex);                           \
+    }
 
 #define SHOW_S1_LOCAL(iptr)                                          \
-        if (stage >= SHOW_STACK) {                                   \
-            printf("L%d ", iptr->s1.localindex);                     \
-        }
+    if (stage >= SHOW_STACK) {                                       \
+        printf("L%d ", iptr->s1.varindex);                           \
+    }                                                                \
+    else {                                                           \
+        printf("JavaL%d ", iptr->s1.varindex);                       \
+    }
 
 #define SHOW_DST_LOCAL(iptr)                                         \
-        if (stage >= SHOW_STACK) {                                   \
-            printf("=> L%d ", iptr->dst.localindex);                 \
-        }
-
-static void new_show_stackvar(jitdata *jd, stackptr sp, int stage)
+    if (stage >= SHOW_STACK) {                                       \
+        printf("=> L%d ", iptr->dst.varindex);                       \
+    }                                                                \
+    else {                                                           \
+        printf("=> JavaL%d ", iptr->dst.varindex);                   \
+    }
+
+void show_allocation(s4 type, s4 flags, s4 regoff)
 {
-       char type;
-
-       switch (sp->type) {
-               case TYPE_INT: type = 'i'; break;
-               case TYPE_LNG: type = 'l'; break;
-               case TYPE_FLT: type = 'f'; break;
-               case TYPE_DBL: type = 'd'; break;
-               case TYPE_ADR: type = 'a'; break;
-               default:       type = '?';
+       if (type == TYPE_RET) {
+               printf("N/A");
+               return;
        }
-       printf("S%c%d", type, (int) (sp - jd->new_stack));
 
-       if (stage >= SHOW_REGS) {
-               putchar('(');
+       if (flags & INMEMORY) {
+               printf("M%02d", regoff);
+               return;
+       }
 
-               if (sp->flags & SAVEDVAR) {
-                       switch (sp->varkind) {
-                       case TEMPVAR:
-                               if (sp->flags & INMEMORY)
-                                       printf("M%02d", sp->regoff);
-#ifdef HAS_ADDRESS_REGISTER_FILE
-                               else if (sp->type == TYPE_ADR)
-                                       printf("R%02d", sp->regoff);
-#endif
-                               else if (IS_FLT_DBL_TYPE(sp->type))
-                                       printf("F%02d", sp->regoff);
-                               else {
-#if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
-                                       if (IS_2_WORD_TYPE(sp->type)) {
-# if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
-#  if defined(ENABLE_INTRP)
-                                               if (opt_intrp)
-                                                       printf("%3d/%3d", GET_LOW_REG(sp->regoff),
-                                                                  GET_HIGH_REG(sp->regoff));
-                                               else
-#  endif
-                                                       printf("%3s/%3s", regs[GET_LOW_REG(sp->regoff)],
-                                                                  regs[GET_HIGH_REG(sp->regoff)]);
-# else
-                                               printf("%3d/%3d", GET_LOW_REG(sp->regoff),
-                                                          GET_HIGH_REG(sp->regoff));
-# endif
-                                       } 
-                                       else 
-#endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
-                                               {
-#if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
-# if defined(ENABLE_INTRP)
-                                                       if (opt_intrp)
-                                                               printf("%3d", sp->regoff);
-                                                       else
-# endif
-                                                               printf("%3s", regs[sp->regoff]);
-#else
-                                                       printf("%3d", sp->regoff);
-#endif
-                                               }
-                               }
-                               break;
-                       case STACKVAR:
-                               printf("I%02d", sp->varnum);
-                               break;
-                       case LOCALVAR:
-                               printf("L%02d", sp->varnum);
-                               break;
-                       case ARGVAR:
-                               if (sp->varnum == -1) {
-                                       /* Return Value                                  */
-                                       /* varkind ARGVAR "misused for this special case */
-                                       printf(" V0");
-                               } 
-                               else /* "normal" Argvar */
-                                       printf("A%02d", sp->varnum);
-                               break;
-                       default:
-                               printf("!xx {kind=%d, num=%d}", sp->varkind, sp->varnum);
-                       }
-               }
-               else { /* not SAVEDVAR */
-                       switch (sp->varkind) {
-                       case TEMPVAR:
-                               if (sp->flags & INMEMORY)
-                                       printf("m%02d", sp->regoff);
 #ifdef HAS_ADDRESS_REGISTER_FILE
-                               else if (sp->type == TYPE_ADR)
-                                       printf("r%02d", sp->regoff);
+       if (type == TYPE_ADR) {
+               printf("R%02d", regoff);
+               return;
+       }
 #endif
-                               else if (IS_FLT_DBL_TYPE(sp->type))
-                                       printf("f%02d", sp->regoff);
-                               else {
+
+       if (IS_FLT_DBL_TYPE(type)) {
+               printf("F%02d", regoff);
+               return;
+       }
+
 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
-                                       if (IS_2_WORD_TYPE(sp->type)) {
+       if (IS_2_WORD_TYPE(type)) {
 # if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
 #  if defined(ENABLE_INTRP)
-                                               if (opt_intrp)
-                                                       printf("%3d/%3d", GET_LOW_REG(sp->regoff),
-                                                                  GET_HIGH_REG(sp->regoff));
-                                               else
+               if (opt_intrp)
+                       printf("%3d/%3d", GET_LOW_REG(regoff),
+                                       GET_HIGH_REG(regoff));
+               else
 #  endif
-                                                       printf("%3s/%3s", regs[GET_LOW_REG(sp->regoff)],
-                                                                  regs[GET_HIGH_REG(sp->regoff)]);
+                       printf("%3s/%3s", abi_registers_integer_name[GET_LOW_REG(regoff)],
+                                  abi_registers_integer_name[GET_HIGH_REG(regoff)]);
 # else
-                                               printf("%3d/%3d", GET_LOW_REG(sp->regoff),
-                                                          GET_HIGH_REG(sp->regoff));
+               printf("%3d/%3d", GET_LOW_REG(regoff),
+                          GET_HIGH_REG(regoff));
 # endif
-                                       } 
-                                       else
+               return;
+       } 
 #endif /* defined(SUPPORT_COMBINE_INTEGER_REGISTERS) */
-                                               {
+
 #if defined(ENABLE_JIT) && defined(ENABLE_DISASSEMBLER)
 # if defined(ENABLE_INTRP)
-                                                       if (opt_intrp)
-                                                               printf("%3d", sp->regoff);
-                                                       else
+       if (opt_intrp)
+               printf("%3d", regoff);
+       else
 # endif
-                                                               printf("%3s", regs[sp->regoff]);
+               printf("%3s", abi_registers_integer_name[regoff]);
 #else
-                                                       printf("%3d", sp->regoff);
+       printf("%3d", regoff);
 #endif
-                                               }
-                               }
-                               break;
-                       case STACKVAR:
-                               printf("i%02d", sp->varnum);
-                               break;
-                       case LOCALVAR:
-                               printf("l%02d", sp->varnum);
-                               break;
-                       case ARGVAR:
-                               if (sp->varnum == -1) {
-                                       /* Return Value                                  */
-                                       /* varkind ARGVAR "misused for this special case */
-                                       printf(" v0");
-                               } 
-                               else /* "normal" Argvar */
-                               printf("a%02d", sp->varnum);
-                               break;
-                       default:
-                               printf("?xx {kind=%d, num=%d}", sp->varkind, sp->varnum);
-                       }
-               }
+}
 
-               putchar(')');
-       }
+void show_variable(jitdata *jd, s4 index, int stage)
+{
+       show_variable_intern(jd, index, stage);
        putchar(' ');
 }
 
-void new_show_icmd(jitdata *jd, new_instruction *iptr, bool deadcode, int stage)
+static void show_variable_intern(jitdata *jd, s4 index, int stage)
 {
-       u2                 opcode;
-       branch_target_t   *table;
-       lookup_target_t   *lookup;
-       constant_FMIref   *fmiref;
-       stackptr          *argp;
-       s4                 i;
+       char type;
+       char kind;
+       varinfo *v;
+
+       if (index < 0 || index >= jd->vartop) {
+               printf("<INVALID INDEX:%d>", index);
+               return;
+       }
+
+       v = VAR(index);
+
+       switch (v->type) {
+               case TYPE_INT: type = 'i'; break;
+               case TYPE_LNG: type = 'l'; break;
+               case TYPE_FLT: type = 'f'; break;
+               case TYPE_DBL: type = 'd'; break;
+               case TYPE_ADR: type = 'a'; break;
+               case TYPE_RET: type = 'r'; break;
+               default:       type = '?';
+       }
+
+       if (index < jd->localcount) {
+               kind = 'L';
+               if (v->flags & (PREALLOC | INOUT))
+                               printf("<INVALID FLAGS!>");
+       }
+       else {
+               if (v->flags & PREALLOC) {
+                       kind = 'A';
+                       if (v->flags & INOUT) {
+                               /* PREALLOC is used to avoid allocation of TYPE_RET */
+                               if (v->type == TYPE_RET)
+                                       kind = 'i';
+                               else
+                                       printf("<INVALID FLAGS!>");
+                       }
+               }
+               else if (v->flags & INOUT)
+                       kind = 'I';
+               else
+                       kind = 'T';
+       }
+
+       printf("%c%c%d", kind, type, index);
+
+       if (v->flags & SAVEDVAR)
+               putchar('!');
+
+       if (stage >= SHOW_REGS || (v->flags & PREALLOC)) {
+               putchar('(');
+               show_allocation(v->type, v->flags, v->vv.regoff);
+               putchar(')');
+       }
+
+       if (v->type == TYPE_RET && (v->flags & PREALLOC)) {
+               printf("(L%03d)", v->vv.retaddr->nr);
+       }
+}
+
+static void show_variable_array_intern(jitdata *jd, s4 *vars, int n, int stage,
+                                                                          bool javalocals)
+{
+       int i;
+       int nr;
+
+       if (vars == NULL) {
+               printf("<null>");
+               return;
+       }
+
+       printf("[");
+       for (i=0; i<n; ++i) {
+               if (i)
+                       putchar(' ');
+               if (vars[i] < 0) {
+                       if (vars[i] == UNUSED)
+                               putchar('-');
+                       else if (javalocals) {
+                               nr = RETADDR_FROM_JAVALOCAL(vars[i]);
+                               printf("ret(L%03d)", nr);
+                       }
+                       else {
+                               printf("<INVALID INDEX:%d>", vars[i]);
+                       }
+               }
+               else
+                       show_variable_intern(jd, vars[i], stage);
+       }
+       printf("]");
+}
+
+void show_variable_array(jitdata *jd, s4 *vars, int n, int stage)
+{
+       show_variable_array_intern(jd, vars, n, stage, false);
+}
+
+void show_javalocals_array(jitdata *jd, s4 *vars, int n, int stage)
+{
+       show_variable_array_intern(jd, vars, n, stage, true);
+}
+
+void show_icmd(jitdata *jd, instruction *iptr, bool deadcode, int stage)
+{
+       u2                 opcode;
+       branch_target_t   *table;
+       lookup_target_t   *lookup;
+       constant_FMIref   *fmiref;
+       s4                *argp;
+       s4                 i;
 
        /* get the opcode and the condition */
 
        opcode    =  iptr->opc;
 
-       printf("%s ", icmd_names[opcode]);
+       printf("%s ", icmd_table[opcode].name);
 
        if (stage < SHOW_PARSE)
                return;
@@ -1247,7 +966,6 @@ void new_show_icmd(jitdata *jd, new_instruction *iptr, bool deadcode, int stage)
 
        case ICMD_POP:
        case ICMD_CHECKNULL:
-       case ICMD_CHECKNULL_POP:
                SHOW_S1(iptr);
                break;
 
@@ -1356,17 +1074,6 @@ void new_show_icmd(jitdata *jd, new_instruction *iptr, bool deadcode, int stage)
                SHOW_DST(iptr);
                break;
 
-       case ICMD_IFEQ_ICONST:
-       case ICMD_IFNE_ICONST:
-       case ICMD_IFLT_ICONST:
-       case ICMD_IFGE_ICONST:
-       case ICMD_IFGT_ICONST:
-       case ICMD_IFLE_ICONST:
-               break;
-
-       case ICMD_ELSE_ICONST:
-               break;
-
                /* binary/const LNG */
        case ICMD_LADDCONST:
        case ICMD_LSUBCONST:
@@ -1378,7 +1085,7 @@ void new_show_icmd(jitdata *jd, new_instruction *iptr, bool deadcode, int stage)
        case ICMD_LORCONST:
        case ICMD_LXORCONST:
                SHOW_S1(iptr);
-               SHOW_LNG_CONST(iptr->sx.val.l); 
+               SHOW_LNG_CONST(iptr->sx.val.l);
                SHOW_DST(iptr);
                break;
 
@@ -1386,7 +1093,7 @@ void new_show_icmd(jitdata *jd, new_instruction *iptr, bool deadcode, int stage)
        case ICMD_LASTORECONST:
                SHOW_S1(iptr);
                SHOW_S2(iptr);
-               SHOW_LNG_CONST(iptr->sx.s23.s3.constval);
+               SHOW_ADR_CONST(iptr->sx.s23.s3.constval);
                break;
 
                /* const LNG */
@@ -1403,560 +1110,56 @@ void new_show_icmd(jitdata *jd, new_instruction *iptr, bool deadcode, int stage)
 
                /* const DBL */
        case ICMD_DCONST:
-               SHOW_DBL_CONST(iptr->sx.val.d); 
-               SHOW_DST(iptr);
-               break;
-
-               /* const ADR */
-       case ICMD_ACONST:
-               if (iptr->flags.bits & INS_FLAG_CLASS) {
-                       SHOW_CLASSREF_OR_CLASSINFO(iptr->sx.val.c);
-               }
-               else if (iptr->sx.val.anyptr == NULL) {
-                       printf("NULL ");
-               }
-               else {
-                       SHOW_STRING(iptr->sx.val.stringconst);
-               }
-               SHOW_DST(iptr);
-               break;
-
-       case ICMD_AASTORECONST:
-               SHOW_S1(iptr);
-               SHOW_S2(iptr);
-               printf("%p ", (void*) iptr->sx.s23.s3.constval);
-               break;
-
-       case ICMD_GETFIELD:        /* 1 -> 1 */
-       case ICMD_PUTFIELD:        /* 2 -> 0 */
-       case ICMD_PUTSTATIC:       /* 1 -> 0 */
-       case ICMD_GETSTATIC:       /* 0 -> 1 */
-       case ICMD_PUTSTATICCONST:  /* 0 -> 0 */
-       case ICMD_PUTFIELDCONST:   /* 1 -> 0 */
-               if (opcode != ICMD_GETSTATIC && opcode != ICMD_PUTSTATICCONST) {
-                       SHOW_S1(iptr);
-                       if (opcode == ICMD_PUTFIELD) {
-                               SHOW_S2(iptr);
-                       }
-               }
-               NEW_INSTRUCTION_GET_FIELDREF(iptr, fmiref);
-               SHOW_FIELD(fmiref);
-
-               if (opcode == ICMD_GETSTATIC || opcode == ICMD_GETFIELD) {
-                       SHOW_DST(iptr);
-               }
-               break;
-
-       case ICMD_IINC:
-               SHOW_S1_LOCAL(iptr);
-               SHOW_INT_CONST(iptr->sx.val.i);
-               SHOW_DST_LOCAL(iptr);
-               break;
-
-       case ICMD_IASTORE:
-       case ICMD_SASTORE:
-       case ICMD_BASTORE:
-       case ICMD_CASTORE:
-       case ICMD_LASTORE:
-       case ICMD_DASTORE:
-       case ICMD_FASTORE:
-       case ICMD_AASTORE:
-               SHOW_S1(iptr);
-               SHOW_S2(iptr);
-               SHOW_S3(iptr);
-               break;
-
-       case ICMD_IALOAD:
-       case ICMD_SALOAD:
-       case ICMD_BALOAD:
-       case ICMD_CALOAD:
-       case ICMD_LALOAD:
-       case ICMD_DALOAD:
-       case ICMD_FALOAD:
-       case ICMD_AALOAD:
-               SHOW_S1(iptr);
-               SHOW_S2(iptr);
-               SHOW_DST(iptr);
-               break;
-
-       case ICMD_RET:
-               SHOW_S1_LOCAL(iptr);
-               break;
-
-       case ICMD_ILOAD:
-       case ICMD_LLOAD:
-       case ICMD_FLOAD:
-       case ICMD_DLOAD:
-       case ICMD_ALOAD:
-               SHOW_S1_LOCAL(iptr);
-               SHOW_DST(iptr);
-               break;
-
-       case ICMD_ISTORE:
-       case ICMD_LSTORE:
-       case ICMD_FSTORE:
-       case ICMD_DSTORE:
-       case ICMD_ASTORE:
-               SHOW_S1(iptr);
-               SHOW_DST_LOCAL(iptr);
-               break;
-
-       case ICMD_NEW:
-               SHOW_DST(iptr);
-               break;
-
-       case ICMD_NEWARRAY:
-               SHOW_DST(iptr);
-               break;
-
-       case ICMD_ANEWARRAY:
-               SHOW_DST(iptr);
-               break;
-
-       case ICMD_MULTIANEWARRAY:
-               if (stage >= SHOW_STACK) {
-                       argp = iptr->sx.s23.s2.args;
-                       i = iptr->s1.argcount;
-                       while (i--) {
-                               SHOW_STACKVAR(*(argp++));
-                       }
-               }
-               else {
-                       printf("argcount=%d ", iptr->s1.argcount);
-               }
-               SHOW_DST(iptr);
-               break;
-
-       case ICMD_CHECKCAST:
-               SHOW_S1(iptr);
-               SHOW_DST(iptr);
-               break;
-
-       case ICMD_INSTANCEOF:
-               SHOW_S1(iptr);
-               SHOW_DST(iptr);
-               break;
-
-       case ICMD_INLINE_START:
-       case ICMD_INLINE_END:
-               break;
-
-       case ICMD_BUILTIN:
-               if (stage >= SHOW_STACK) {
-                       argp = iptr->sx.s23.s2.args;
-                       i = iptr->s1.argcount;
-                       while (i--) {
-                               SHOW_STACKVAR(*(argp++));
-                       }
-               }
-               printf("%s ", iptr->sx.s23.s3.bte->name);
-               if (iptr->sx.s23.s3.bte->md->returntype.type != TYPE_VOID) {
-                       SHOW_DST(iptr);
-               }
-               break;
-
-       case ICMD_INVOKEVIRTUAL:
-       case ICMD_INVOKESPECIAL:
-       case ICMD_INVOKESTATIC:
-       case ICMD_INVOKEINTERFACE:
-               if (stage >= SHOW_STACK) {
-                       argp = iptr->sx.s23.s2.args;
-                       i = iptr->s1.argcount;
-                       while (i--) {
-                               SHOW_STACKVAR(*(argp++));
-                       }
-               }
-               NEW_INSTRUCTION_GET_METHODREF(iptr, fmiref);
-               method_methodref_print(fmiref);
-               if (fmiref->parseddesc.md->returntype.type != TYPE_VOID) {
-                       SHOW_DST(iptr);
-               }
-               break;
-
-       case ICMD_IFEQ:
-       case ICMD_IFNE:
-       case ICMD_IFLT:
-       case ICMD_IFGE:
-       case ICMD_IFGT:
-       case ICMD_IFLE:
-               SHOW_S1(iptr);
-               SHOW_TARGET(iptr->dst);
-               break;
-
-       case ICMD_IF_LEQ:
-       case ICMD_IF_LNE:
-       case ICMD_IF_LLT:
-       case ICMD_IF_LGE:
-       case ICMD_IF_LGT:
-       case ICMD_IF_LLE:
-               SHOW_S1(iptr);
-               SHOW_TARGET(iptr->dst);
-               break;
-
-       case ICMD_GOTO:
-       case ICMD_INLINE_GOTO:
-               SHOW_TARGET(iptr->dst);
-               break;
-
-       case ICMD_JSR:
-               SHOW_TARGET(iptr->sx.s23.s3.jsrtarget);
-               SHOW_DST(iptr);
-               break;
-
-       case ICMD_IFNULL:
-       case ICMD_IFNONNULL:
-               SHOW_S1(iptr);
-               SHOW_TARGET(iptr->dst);
-               break;
-
-       case ICMD_IF_ICMPEQ:
-       case ICMD_IF_ICMPNE:
-       case ICMD_IF_ICMPLT:
-       case ICMD_IF_ICMPGE:
-       case ICMD_IF_ICMPGT:
-       case ICMD_IF_ICMPLE:
-
-       case ICMD_IF_LCMPEQ:
-       case ICMD_IF_LCMPNE:
-       case ICMD_IF_LCMPLT:
-       case ICMD_IF_LCMPGE:
-       case ICMD_IF_LCMPGT:
-       case ICMD_IF_LCMPLE:
-
-       case ICMD_IF_FCMPEQ:
-       case ICMD_IF_FCMPNE:
-
-       case ICMD_IF_FCMPL_LT:
-       case ICMD_IF_FCMPL_GE:
-       case ICMD_IF_FCMPL_GT:
-       case ICMD_IF_FCMPL_LE:
-
-       case ICMD_IF_FCMPG_LT:
-       case ICMD_IF_FCMPG_GE:
-       case ICMD_IF_FCMPG_GT:
-       case ICMD_IF_FCMPG_LE:
-
-       case ICMD_IF_DCMPEQ:
-       case ICMD_IF_DCMPNE:
-
-       case ICMD_IF_DCMPL_LT:
-       case ICMD_IF_DCMPL_GE:
-       case ICMD_IF_DCMPL_GT:
-       case ICMD_IF_DCMPL_LE:
-
-       case ICMD_IF_DCMPG_LT:
-       case ICMD_IF_DCMPG_GE:
-       case ICMD_IF_DCMPG_GT:
-       case ICMD_IF_DCMPG_LE:
-
-       case ICMD_IF_ACMPEQ:
-       case ICMD_IF_ACMPNE:
-               SHOW_S1(iptr);
-               SHOW_S2(iptr);
-               SHOW_TARGET(iptr->dst);
-               break;
-
-       case ICMD_TABLESWITCH:
-               SHOW_S1(iptr);
-               break;
-
-       case ICMD_LOOKUPSWITCH:
-               SHOW_S1(iptr);
-               break;
-
-       case ICMD_ARETURN:
-               SHOW_S1(iptr);
-               break;
-
-       case ICMD_ATHROW:
-               SHOW_S1(iptr);
-               break;
-
-       case ICMD_DUP:
-               SHOW_S1(iptr);
-               SHOW_DST(iptr);
-               break;
-
-       case ICMD_DUP2:
-               if (stage >= SHOW_STACK) {
-                       SHOW_STACKVAR(iptr->dst.dupslots[0]);
-                       SHOW_STACKVAR(iptr->dst.dupslots[1]);
-                       printf("=> ");
-                       SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
-                       SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
-               }
-               break;
-
-       case ICMD_DUP_X1:
-               if (stage >= SHOW_STACK) {
-                       SHOW_STACKVAR(iptr->dst.dupslots[0]);
-                       SHOW_STACKVAR(iptr->dst.dupslots[1]);
-                       printf("=> ");
-                       SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
-                       SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
-                       SHOW_STACKVAR(iptr->dst.dupslots[2+2]);
-               }
-               break;
-
-       case ICMD_DUP2_X1:
-               if (stage >= SHOW_STACK) {
-                       SHOW_STACKVAR(iptr->dst.dupslots[0]);
-                       SHOW_STACKVAR(iptr->dst.dupslots[1]);
-                       SHOW_STACKVAR(iptr->dst.dupslots[2]);
-                       printf("=> ");
-                       SHOW_STACKVAR(iptr->dst.dupslots[3+0]);
-                       SHOW_STACKVAR(iptr->dst.dupslots[3+1]);
-                       SHOW_STACKVAR(iptr->dst.dupslots[3+2]);
-                       SHOW_STACKVAR(iptr->dst.dupslots[3+3]);
-                       SHOW_STACKVAR(iptr->dst.dupslots[3+4]);
-               }
-               break;
-
-       case ICMD_DUP_X2:
-               if (stage >= SHOW_STACK) {
-                       SHOW_STACKVAR(iptr->dst.dupslots[0]);
-                       SHOW_STACKVAR(iptr->dst.dupslots[1]);
-                       SHOW_STACKVAR(iptr->dst.dupslots[2]);
-                       printf("=> ");
-                       SHOW_STACKVAR(iptr->dst.dupslots[3+0]);
-                       SHOW_STACKVAR(iptr->dst.dupslots[3+1]);
-                       SHOW_STACKVAR(iptr->dst.dupslots[3+2]);
-                       SHOW_STACKVAR(iptr->dst.dupslots[3+3]);
-               }
-               break;
-
-       case ICMD_DUP2_X2:
-               if (stage >= SHOW_STACK) {
-                       SHOW_STACKVAR(iptr->dst.dupslots[0]);
-                       SHOW_STACKVAR(iptr->dst.dupslots[1]);
-                       SHOW_STACKVAR(iptr->dst.dupslots[2]);
-                       SHOW_STACKVAR(iptr->dst.dupslots[4]);
-                       printf("=> ");
-                       SHOW_STACKVAR(iptr->dst.dupslots[4+0]);
-                       SHOW_STACKVAR(iptr->dst.dupslots[4+1]);
-                       SHOW_STACKVAR(iptr->dst.dupslots[4+2]);
-                       SHOW_STACKVAR(iptr->dst.dupslots[4+3]);
-                       SHOW_STACKVAR(iptr->dst.dupslots[4+4]);
-                       SHOW_STACKVAR(iptr->dst.dupslots[4+5]);
-               }
-               break;
-
-       case ICMD_SWAP:
-               if (stage >= SHOW_STACK) {
-                       SHOW_STACKVAR(iptr->dst.dupslots[0]);
-                       SHOW_STACKVAR(iptr->dst.dupslots[1]);
-                       printf("=> ");
-                       SHOW_STACKVAR(iptr->dst.dupslots[2+0]);
-                       SHOW_STACKVAR(iptr->dst.dupslots[2+1]);
-               }
-               break;
-
-       }
-}
-#endif /* !defined(NDEBUG) */
-
-#if !defined(NDEBUG)
-void show_icmd(instruction *iptr, bool deadcode)
-{
-#if 0
-       u2                 opcode;
-       u2                 condition;
-#endif
-       int j;
-       s4  *s4ptr;
-       void **tptr = NULL;
-       classinfo         *c;
-       fieldinfo         *f;
-       constant_classref *cr;
-       unresolved_field  *uf;
-
-#if 0
-       /* get the opcode and the condition */
-
-       opcode    =  iptr->opc & ICMD_OPCODE_MASK;
-       condition = (iptr->opc & ICMD_CONDITION_MASK) >> 8;
-
-       /* Print the condition for conditional instructions. */
-
-       if (condition != 0)
-               printf(" (condition: %s)", icmd_names[condition]);
-#endif
-
-       printf("%s", icmd_names[iptr->opc]);
-
-       switch (iptr->opc) {
-       case ICMD_IADDCONST:
-       case ICMD_ISUBCONST:
-       case ICMD_IMULCONST:
-       case ICMD_IMULPOW2:
-       case ICMD_IDIVPOW2:
-       case ICMD_IREMPOW2:
-       case ICMD_IANDCONST:
-       case ICMD_IORCONST:
-       case ICMD_IXORCONST:
-       case ICMD_ISHLCONST:
-       case ICMD_ISHRCONST:
-       case ICMD_IUSHRCONST:
-       case ICMD_LSHLCONST:
-       case ICMD_LSHRCONST:
-       case ICMD_LUSHRCONST:
-       case ICMD_ICONST:
-       case ICMD_IASTORECONST:
-       case ICMD_BASTORECONST:
-       case ICMD_CASTORECONST:
-       case ICMD_SASTORECONST:
-               printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
-               break;
-
-       case ICMD_IFEQ_ICONST:
-       case ICMD_IFNE_ICONST:
-       case ICMD_IFLT_ICONST:
-       case ICMD_IFGE_ICONST:
-       case ICMD_IFGT_ICONST:
-       case ICMD_IFLE_ICONST:
-               printf(" %d, %d (0x%08x)", iptr[1].op1, iptr->val.i, iptr->val.i);
-               break;
-
-       case ICMD_ELSE_ICONST:
-               printf("    %d (0x%08x)", iptr->val.i, iptr->val.i);
-               break;
-
-       case ICMD_LADDCONST:
-       case ICMD_LSUBCONST:
-       case ICMD_LMULCONST:
-       case ICMD_LMULPOW2:
-       case ICMD_LDIVPOW2:
-       case ICMD_LREMPOW2:
-       case ICMD_LANDCONST:
-       case ICMD_LORCONST:
-       case ICMD_LXORCONST:
-       case ICMD_LCONST:
-       case ICMD_LASTORECONST:
-#if SIZEOF_VOID_P == 4
-               printf(" %lld (0x%016llx)", iptr->val.l, iptr->val.l);
-#else
-               printf(" %ld (0x%016lx)", iptr->val.l, iptr->val.l);
-#endif
-               break;
-
-       case ICMD_FCONST:
-               printf(" %f (0x%08x)", iptr->val.f, iptr->val.i);
-               break;
-
-       case ICMD_DCONST:
-#if SIZEOF_VOID_P == 4
-               printf(" %g (0x%016llx)", iptr->val.d, iptr->val.l);
-#else
-               printf(" %g (0x%016lx)", iptr->val.d, iptr->val.l);
-#endif
+               SHOW_DBL_CONST(iptr->sx.val.d); 
+               SHOW_DST(iptr);
                break;
 
+               /* const ADR */
        case ICMD_ACONST:
-       case ICMD_AASTORECONST:
-               /* check if this is a constant string or a class reference */
-
-               if (ICMD_ACONST_IS_CLASS(iptr)) {
-                       if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
-                               printf(" (NOT RESOLVED) classref = ");
-                               class_classref_print(ICMD_ACONST_UNRESOLVED_CLASSREF(iptr));
-                       }
-                       else {
-                               printf(" class = ");
-                               class_print(ICMD_ACONST_RESOLVED_CLASSINFO(iptr));
-                       }
-               }
-               else {
-                       printf(" %p", iptr->val.a);
-
-                       if (iptr->val.a) {
-                               printf(", String = \"");
-                               utf_display_printable_ascii(javastring_toutf(iptr->val.a, false));
-                               printf("\"");
-                       }
+               if (iptr->flags.bits & INS_FLAG_CLASS) {
+                       SHOW_ADR_CONST(iptr->sx.val.anyptr);
+                       SHOW_CLASSREF_OR_CLASSINFO(iptr->sx.val.c);
                }
-               break;
-
-       case ICMD_GETFIELD:
-       case ICMD_PUTFIELD:
-               if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
-                       uf = INSTRUCTION_UNRESOLVED_FIELD(iptr);
-                       printf(" (NOT RESOLVED) ");
-
-                       field_fieldref_print(uf->fieldref);
+               else if (iptr->sx.val.anyptr == NULL) {
+                       printf("NULL ");
                }
                else {
-                       f = INSTRUCTION_RESOLVED_FIELDINFO(iptr);
-                       printf(" %d, ", f->offset);
-
-                       field_print(f);
+                       SHOW_ADR_CONST(iptr->sx.val.anyptr);
+                       SHOW_STRING(iptr->sx.val.stringconst);
                }
+               SHOW_DST(iptr);
                break;
 
-       case ICMD_PUTSTATIC:
-       case ICMD_GETSTATIC:
-               if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
-                       uf = INSTRUCTION_UNRESOLVED_FIELD(iptr);
-                       printf(" (NOT RESOLVED) ");
-
-                       field_fieldref_print(uf->fieldref);
-               }
-               else {
-                       f = INSTRUCTION_RESOLVED_FIELDINFO(iptr);
-                       if (!CLASS_IS_OR_ALMOST_INITIALIZED(f->class))
-                               printf(" (NOT INITIALIZED) ");
-                       else
-                               printf(" ");
-
-                       field_print(f);
-               }
+       case ICMD_AASTORECONST:
+               SHOW_S1(iptr);
+               SHOW_S2(iptr);
+               printf("%p ", (void*) iptr->sx.s23.s3.constval);
                break;
 
-       case ICMD_PUTSTATICCONST:
-       case ICMD_PUTFIELDCONST:
-               switch (iptr[1].op1) {
-               case TYPE_INT:
-                       printf(" %d (0x%08x),", iptr->val.i, iptr->val.i);
-                       break;
-               case TYPE_LNG:
-#if SIZEOF_VOID_P == 4
-                       printf(" %lld (0x%016llx),", iptr->val.l, iptr->val.l);
-#else
-                       printf(" %ld (0x%016lx),", iptr->val.l, iptr->val.l);
-#endif
-                       break;
-               case TYPE_ADR:
-                       printf(" %p,", iptr->val.a);
-                       break;
-               case TYPE_FLT:
-                       printf(" %g (0x%08x),", iptr->val.f, iptr->val.i);
-                       break;
-               case TYPE_DBL:
-#if SIZEOF_VOID_P == 4
-                       printf(" %g (0x%016llx),", iptr->val.d, iptr->val.l);
-#else
-                       printf(" %g (0x%016lx),", iptr->val.d, iptr->val.l);
-#endif
-                       break;
+       case ICMD_GETFIELD:        /* 1 -> 1 */
+       case ICMD_PUTFIELD:        /* 2 -> 0 */
+       case ICMD_PUTSTATIC:       /* 1 -> 0 */
+       case ICMD_GETSTATIC:       /* 0 -> 1 */
+       case ICMD_PUTSTATICCONST:  /* 0 -> 0 */
+       case ICMD_PUTFIELDCONST:   /* 1 -> 0 */
+               if (opcode != ICMD_GETSTATIC && opcode != ICMD_PUTSTATICCONST) {
+                       SHOW_S1(iptr);
+                       if (opcode == ICMD_PUTFIELD) {
+                               SHOW_S2(iptr);
+                       }
                }
+               INSTRUCTION_GET_FIELDREF(iptr, fmiref);
+               SHOW_FIELD(fmiref);
 
-               if (INSTRUCTION_IS_UNRESOLVED(iptr + 1)) {
-                       uf = INSTRUCTION_UNRESOLVED_FIELD(iptr + 1);
-                       printf(" (NOT RESOLVED) ");
-                       field_fieldref_print(uf->fieldref);
-               }
-               else {
-                       f = INSTRUCTION_RESOLVED_FIELDINFO(iptr + 1);
-                       if ((iptr->opc == ICMD_PUTSTATICCONST) &&
-                               !CLASS_IS_OR_ALMOST_INITIALIZED(f->class))
-                               printf(" (NOT INITIALIZED), ");
-                       else
-                               printf(" %d, ", f->offset);
-                       field_print(f);
+               if (opcode == ICMD_GETSTATIC || opcode == ICMD_GETFIELD) {
+                       SHOW_DST(iptr);
                }
                break;
 
        case ICMD_IINC:
-               printf(" %d + %d", iptr->op1, iptr->val.i);
+               SHOW_S1_LOCAL(iptr);
+               SHOW_INT_CONST(iptr->sx.val.i);
+               SHOW_DST_LOCAL(iptr);
                break;
 
        case ICMD_IASTORE:
@@ -1967,6 +1170,10 @@ void show_icmd(instruction *iptr, bool deadcode)
        case ICMD_DASTORE:
        case ICMD_FASTORE:
        case ICMD_AASTORE:
+               SHOW_S1(iptr);
+               SHOW_S2(iptr);
+               SHOW_S3(iptr);
+               break;
 
        case ICMD_IALOAD:
        case ICMD_SALOAD:
@@ -1976,125 +1183,128 @@ void show_icmd(instruction *iptr, bool deadcode)
        case ICMD_DALOAD:
        case ICMD_FALOAD:
        case ICMD_AALOAD:
-               if (iptr->op1 != 0)
-                       printf("(opt.)");
+               SHOW_S1(iptr);
+               SHOW_S2(iptr);
+               SHOW_DST(iptr);
                break;
 
        case ICMD_RET:
+               SHOW_S1_LOCAL(iptr);
+               if (stage >= SHOW_STACK) {
+                       printf(" ---> L%03d", iptr->dst.block->nr);
+               }
+               break;
+
        case ICMD_ILOAD:
        case ICMD_LLOAD:
        case ICMD_FLOAD:
        case ICMD_DLOAD:
        case ICMD_ALOAD:
+               SHOW_S1_LOCAL(iptr);
+               SHOW_DST(iptr);
+               break;
+
        case ICMD_ISTORE:
        case ICMD_LSTORE:
        case ICMD_FSTORE:
        case ICMD_DSTORE:
        case ICMD_ASTORE:
-               printf(" %d", iptr->op1);
+               SHOW_S1(iptr);
+               SHOW_DST_LOCAL(iptr);
+               if (stage >= SHOW_STACK && iptr->sx.s23.s3.javaindex != UNUSED)
+                       printf(" (javaindex %d)", iptr->sx.s23.s3.javaindex);
+               if (iptr->flags.bits & INS_FLAG_RETADDR) {
+                       printf(" (retaddr L%03d)", RETADDR_FROM_JAVALOCAL(iptr->sx.s23.s2.retaddrnr));
+               }
                break;
 
        case ICMD_NEW:
-               c = iptr->val.a;
-               printf(" ");
-               utf_display_printable_ascii_classname(c->name);
+               SHOW_DST(iptr);
                break;
 
        case ICMD_NEWARRAY:
-               switch (iptr->op1) {
-               case 4:
-                       printf(" boolean");
-                       break;
-               case 5:
-                       printf(" char");
-                       break;
-               case 6:
-                       printf(" float");
-                       break;
-               case 7:
-                       printf(" double");
-                       break;
-               case 8:
-                       printf(" byte");
-                       break;
-               case 9:
-                       printf(" short");
-                       break;
-               case 10:
-                       printf(" int");
-                       break;
-               case 11:
-                       printf(" long");
-                       break;
-               }
+               SHOW_DST(iptr);
                break;
 
        case ICMD_ANEWARRAY:
-               if (iptr->op1) {
-                       c = iptr->val.a;
-                       printf(" ");
-                       utf_display_printable_ascii_classname(c->name);
-               }
+               SHOW_DST(iptr);
                break;
 
        case ICMD_MULTIANEWARRAY:
-               c  = iptr->val.a;
-               cr = iptr->target;
-
-               if (c == NULL) {
-                       printf(" (NOT RESOLVED) %d ", iptr->op1);
-                       utf_display_printable_ascii(cr->name);
-               } 
+               if (stage >= SHOW_STACK) {
+                       argp = iptr->sx.s23.s2.args;
+                       i = iptr->s1.argcount;
+                       while (i--) {
+                               SHOW_VARIABLE(*(argp++));
+                       }
+               }
                else {
-                       printf(" %d ", iptr->op1);
-                       utf_display_printable_ascii_classname(c->name);
+                       printf("argcount=%d ", iptr->s1.argcount);
                }
+               class_classref_or_classinfo_print(iptr->sx.s23.s3.c);
+               putchar(' ');
+               SHOW_DST(iptr);
                break;
 
        case ICMD_CHECKCAST:
-       case ICMD_INSTANCEOF:
-               c  = iptr->val.a;
-               cr = iptr->target;
+               SHOW_S1(iptr);
+               class_classref_or_classinfo_print(iptr->sx.s23.s3.c);
+               putchar(' ');
+               SHOW_DST(iptr);
+               break;
 
-               if (c) {
-                       if (c->flags & ACC_INTERFACE)
-                               printf(" (INTERFACE) ");
-                       else
-                               printf(" (CLASS,%3d) ", c->vftbl->diffval);
-               } else
-                       printf(" (NOT RESOLVED) ");
-               utf_display_printable_ascii_classname(cr->name);
+       case ICMD_INSTANCEOF:
+               SHOW_S1(iptr);
+               SHOW_DST(iptr);
                break;
 
        case ICMD_INLINE_START:
        case ICMD_INLINE_END:
+       case ICMD_INLINE_BODY:
+#if defined(ENABLE_INLINING)
                {
-                       insinfo_inline *insinfo = (insinfo_inline *) iptr->target;
-                       printf(" ");
-                       method_print(insinfo->method);
+                       insinfo_inline *ii = iptr->sx.s23.s3.inlineinfo;
+                       show_inline_info(jd, ii, opcode, stage);
                }
+#endif
                break;
 
        case ICMD_BUILTIN:
-               printf(" %s", ((builtintable_entry *) iptr->val.a)->name);
+               if (stage >= SHOW_STACK) {
+                       argp = iptr->sx.s23.s2.args;
+                       i = iptr->s1.argcount;
+                       while (i--) {
+                               if ((iptr->s1.argcount - 1 - i) == iptr->sx.s23.s3.bte->md->paramcount)
+                                       printf(" pass-through: ");
+                               SHOW_VARIABLE(*(argp++));
+                       }
+               }
+               printf("%s ", iptr->sx.s23.s3.bte->cname);
+               if (iptr->sx.s23.s3.bte->md->returntype.type != TYPE_VOID) {
+                       SHOW_DST(iptr);
+               }
                break;
 
        case ICMD_INVOKEVIRTUAL:
        case ICMD_INVOKESPECIAL:
        case ICMD_INVOKESTATIC:
        case ICMD_INVOKEINTERFACE:
-               {
-                       constant_FMIref *mref;
-                       
-                       if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
-                               printf(" (NOT RESOLVED) ");
-                               mref = INSTRUCTION_UNRESOLVED_METHOD(iptr)->methodref;
-                       }
-                       else {
-                               printf(" ");
-                               mref = INSTRUCTION_RESOLVED_FMIREF(iptr);
+               if (stage >= SHOW_STACK) {
+                       methoddesc *md;
+                       INSTRUCTION_GET_METHODDESC(iptr, md);
+                       argp = iptr->sx.s23.s2.args;
+                       i = iptr->s1.argcount;
+                       while (i--) {
+                               if ((iptr->s1.argcount - 1 - i) == md->paramcount)
+                                       printf(" pass-through: ");
+                               SHOW_VARIABLE(*(argp++));
                        }
-                       method_methodref_print(mref);
+               }
+               INSTRUCTION_GET_METHODREF(iptr, fmiref);
+               method_methodref_print(fmiref);
+               if (fmiref->parseddesc.md->returntype.type != TYPE_VOID) {
+                       putchar(' ');
+                       SHOW_DST(iptr);
                }
                break;
 
@@ -2104,14 +1314,9 @@ void show_icmd(instruction *iptr, bool deadcode)
        case ICMD_IFGE:
        case ICMD_IFGT:
        case ICMD_IFLE:
-               printf(" %d (0x%08x)", iptr->val.i, iptr->val.i);
-
-/*             if ((iptr->opc & ICMD_CONDITION_MASK) == 0) { */
-                       if (deadcode || !iptr->target)
-                               printf(" op1=%d", iptr->op1);
-                       else
-                               printf(" L%03d (%p)", ((basicblock *) iptr->target)->debug_nr, iptr->target);
-/*             } */
+               SHOW_S1(iptr);
+               SHOW_INT_CONST(iptr->sx.val.i); 
+               SHOW_TARGET(iptr->dst);
                break;
 
        case ICMD_IF_LEQ:
@@ -2120,31 +1325,26 @@ void show_icmd(instruction *iptr, bool deadcode)
        case ICMD_IF_LGE:
        case ICMD_IF_LGT:
        case ICMD_IF_LLE:
-#if SIZEOF_VOID_P == 4
-               printf(" %lld (%016llx)", iptr->val.l, iptr->val.l);
-#else
-               printf(" %ld (%016lx)", iptr->val.l, iptr->val.l);
-#endif
+               SHOW_S1(iptr);
+               SHOW_LNG_CONST(iptr->sx.val.l); 
+               SHOW_TARGET(iptr->dst);
+               break;
 
-/*             if ((iptr->opc & ICMD_CONDITION_MASK) == 0) { */
-                       if (deadcode || !iptr->target)
-                               printf(" op1=%d", iptr->op1);
-                       else
-                               printf(" L%03d", ((basicblock *) iptr->target)->debug_nr);
-/*             } */
+       case ICMD_GOTO:
+               SHOW_TARGET(iptr->dst);
                break;
 
        case ICMD_JSR:
-       case ICMD_GOTO:
-       case ICMD_INLINE_GOTO:
-               if (deadcode || !iptr->target)
-                       printf(" op1=%d", iptr->op1);
-               else
-                       printf(" L%03d (%p)", ((basicblock *) iptr->target)->debug_nr,iptr->target);
+               SHOW_TARGET(iptr->sx.s23.s3.jsrtarget);
+               SHOW_DST(iptr);
                break;
 
        case ICMD_IFNULL:
        case ICMD_IFNONNULL:
+               SHOW_S1(iptr);
+               SHOW_TARGET(iptr->dst);
+               break;
+
        case ICMD_IF_ICMPEQ:
        case ICMD_IF_ICMPNE:
        case ICMD_IF_ICMPLT:
@@ -2159,103 +1359,289 @@ void show_icmd(instruction *iptr, bool deadcode)
        case ICMD_IF_LCMPGT:
        case ICMD_IF_LCMPLE:
 
-       case ICMD_IF_FCMPEQ:
-       case ICMD_IF_FCMPNE:
+       case ICMD_IF_ACMPEQ:
+       case ICMD_IF_ACMPNE:
+               SHOW_S1(iptr);
+               SHOW_S2(iptr);
+               SHOW_TARGET(iptr->dst);
+               break;
 
-       case ICMD_IF_FCMPL_LT:
-       case ICMD_IF_FCMPL_GE:
-       case ICMD_IF_FCMPL_GT:
-       case ICMD_IF_FCMPL_LE:
+       case ICMD_TABLESWITCH:
+               SHOW_S1(iptr);
+               table = iptr->dst.table;
 
-       case ICMD_IF_FCMPG_LT:
-       case ICMD_IF_FCMPG_GE:
-       case ICMD_IF_FCMPG_GT:
-       case ICMD_IF_FCMPG_LE:
+               i = iptr->sx.s23.s3.tablehigh - iptr->sx.s23.s2.tablelow + 1;
 
-       case ICMD_IF_DCMPEQ:
-       case ICMD_IF_DCMPNE:
+               printf("high=%d low=%d count=%d\n", iptr->sx.s23.s3.tablehigh, iptr->sx.s23.s2.tablelow, i);
+               while (--i >= 0) {
+                       printf("\t\t%d --> ", (int) (table - iptr->dst.table));
+                       printf("L%03d\n", table->block->nr);
+                       table++;
+               }
 
-       case ICMD_IF_DCMPL_LT:
-       case ICMD_IF_DCMPL_GE:
-       case ICMD_IF_DCMPL_GT:
-       case ICMD_IF_DCMPL_LE:
+               break;
 
-       case ICMD_IF_DCMPG_LT:
-       case ICMD_IF_DCMPG_GE:
-       case ICMD_IF_DCMPG_GT:
-       case ICMD_IF_DCMPG_LE:
+       case ICMD_LOOKUPSWITCH:
+               SHOW_S1(iptr);
 
-       case ICMD_IF_ACMPEQ:
-       case ICMD_IF_ACMPNE:
-/*             if (!(iptr->opc & ICMD_CONDITION_MASK)) { */
-                       if (deadcode || !iptr->target)
-                               printf(" op1=%d", iptr->op1);
-                       else
-                               printf(" L%03d (%p)", ((basicblock *) iptr->target)->debug_nr,iptr->target);
-/*             } */
+               printf("count=%d, default=L%03d\n",
+                          iptr->sx.s23.s2.lookupcount,
+                          iptr->sx.s23.s3.lookupdefault.block->nr);
+
+               lookup = iptr->dst.lookup;
+               i = iptr->sx.s23.s2.lookupcount;
+
+               while (--i >= 0) {
+                       printf("\t\t%d --> L%03d\n",
+                                  lookup->value,
+                                  lookup->target.block->nr);
+                       lookup++;
+               }
                break;
 
-       case ICMD_TABLESWITCH:
-               s4ptr = (s4*)iptr->val.a;
+       case ICMD_FRETURN:
+       case ICMD_IRETURN:
+       case ICMD_DRETURN:
+       case ICMD_LRETURN:
+               SHOW_S1(iptr);
+               break;
 
-               if (deadcode || !iptr->target) {
-                       printf(" %d;", *s4ptr);
+       case ICMD_ARETURN:
+       case ICMD_ATHROW:
+               SHOW_S1(iptr);
+               if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
+                       /* XXX this needs more work */
+#if 0
+                       unresolved_class_debug_dump(iptr->sx.s23.s2.uc, stdout);
+#endif
                }
-               else {
-                       tptr = (void **) iptr->target;
-                       printf(" L%03d;", ((basicblock *) *tptr)->debug_nr); 
-                       tptr++;
+               break;
+
+       case ICMD_COPY:
+       case ICMD_MOVE:
+               SHOW_S1(iptr);
+               SHOW_DST(iptr);
+               break;
+       }
+       fflush(stdout);
+}
+#endif /* !defined(NDEBUG) */
+
+/* Debug output filtering */
+
+#if defined(ENABLE_DEBUG_FILTER)
+
+#if !defined(ENABLE_THREADS)
+u2 _no_threads_filterverbosecallctr[2] = { 0, 0 };
+#endif
+
+struct show_filter {
+       /* Boolean indicating if filter is enabled. */
+       u1 enabled;
+       /* Regular expression the method name is matched against */
+       regex_t regex;
+       /* Flag set on m->filtermatches if regex matches */
+       u1 flag;
+};
+
+typedef struct show_filter show_filter_t;
+
+#define SHOW_FILTERS_SIZE 3
+
+/* Array of filters applyed on a method */
+static struct show_filter show_filters[SHOW_FILTERS_SIZE];
+
+static void show_filter_init(show_filter_t *cf, const char *str, u1 flag, u1 default_flag, const char *description) {
+       int err;
+       char err_buf[128];
+
+       if (str) {
+               err = regcomp(&cf->regex, str, REG_EXTENDED | REG_NOSUB);
+               if (err != 0) {
+                       regerror(err, &cf->regex, err_buf, sizeof(err_buf));
+                       vm_abort(
+                               "Invalid value given for %s: `%s' (%s).", 
+                               description, str, err_buf
+                       );
                }
+               cf->flag = flag;
+               cf->enabled = 1;
+       } else {
+               cf->flag = default_flag;
+               cf->enabled = 0;
+       }
+}
 
-               s4ptr++;         /* skip default */
-               j = *s4ptr++;                               /* low     */
-               j = *s4ptr++ - j;                           /* high    */
-               while (j >= 0) {
-                       if (deadcode || !*tptr)
-                               printf(" %d", *s4ptr++);
-                       else {
-                               printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
-                               tptr++;
+void show_filters_init(void) {
+
+       show_filter_init(
+               show_filters + 0,
+               opt_filter_verbosecall_include,
+               SHOW_FILTER_FLAG_VERBOSECALL_INCLUDE,
+               SHOW_FILTER_FLAG_VERBOSECALL_INCLUDE,
+               "verbose call include filter"
+       );
+
+       show_filter_init(
+               show_filters + 1,
+               opt_filter_verbosecall_exclude,
+               SHOW_FILTER_FLAG_VERBOSECALL_EXCLUDE,
+               0,
+               "verbose call exclude filter"
+       );
+
+       show_filter_init(
+               show_filters + 2,
+               opt_filter_show_method,
+               SHOW_FILTER_FLAG_SHOW_METHOD,
+               SHOW_FILTER_FLAG_SHOW_METHOD,
+               "show method filter"
+       );
+}
+
+/*
+ (Pseudo)State machine:
+
+ States are INITIAL, INCLUDE1, INCLUDE2, ..., EXCLUDE1, ..., EXCLUDE2, ...
+
+                                                        Enter              Enter
+ Enter                                                  Include            Include
+ Exclude                                                  | |                | |
+  | |    Enter              Enter              Enter      | |     Enter      | |
+  | |    Include            Include            Exclude    | |     Exclude    | |
+  | v   --------->        ---------->        ---------->  | v   ---------->  | v
+INITIAL           INCLUDE1           INCLUDE2           EXCLUDE1           EXCLUDE2
+  | ^   <---------        <----------        <----------  | ^   <----------  | ^
+  | |    Exit               Exit               Exit       | |     Exit       | |
+  | |    Include            Include            Exclude    | |     Exclude    | |
+  | |                                                     | |                | |
+ Exit                                                    Exit               Exit
+ Exclude                                                 Include            Include
+
+  Verbose call scope is active if we are in a INCLUDE state.
+
+  State encoding:
+
+  INITIAL: ctr[0] == 0, ctr[1] == 0
+  INCLUDEN: ctr[1] == N, ctr[1] == 0
+  EXCLUDEN: ctr[1] == N
+*/
+
+void show_filters_apply(methodinfo *m) {
+       int i;
+       int res;
+       char *method_name;
+       s4 len;
+       int32_t dumpmarker;
+
+       /* compose full name of method */
+
+       len = 
+               utf_bytes(m->class->name) +
+               1 +
+               utf_bytes(m->name) +
+               utf_bytes(m->descriptor) +
+               1;
+
+       DMARKER;
+
+       method_name = DMNEW(char, len);
+
+       utf_cat_classname(method_name, m->class->name);
+       strcat(method_name, ".");
+       utf_cat(method_name, m->name);
+       utf_cat(method_name, m->descriptor);
+
+       /* reset all flags */
+
+       m->filtermatches = 0;
+
+       for (i = 0; i < SHOW_FILTERS_SIZE; ++i) {
+               if (show_filters[i].enabled) {
+
+                       res = regexec(&show_filters[i].regex, method_name, 0, NULL, 0);
+
+                       if (res == 0) {
+                               m->filtermatches |= show_filters[i].flag;
                        }
-                       j--;
+               } else {
+                       /* Default is to show all */
+                       m->filtermatches |= show_filters[i].flag;
                }
-               break;
+       }
 
-       case ICMD_LOOKUPSWITCH:
-               s4ptr = (s4*)iptr->val.a;
+       /* release memory */
+
+       DRELEASE; 
+}
 
-               if (deadcode || !iptr->target) {
-                       printf(" %d;", *s4ptr);
+#define STATE_IS_INITIAL() ((FILTERVERBOSECALLCTR[0] == 0) && (FILTERVERBOSECALLCTR[1] == 0))
+#define STATE_IS_INCLUDE() ((FILTERVERBOSECALLCTR[0] > 0) && (FILTERVERBOSECALLCTR[1] == 0))
+#define STATE_IS_EXCLUDE() (FILTERVERBOSECALLCTR[1] > 0)
+#define EVENT_INCLUDE() (m->filtermatches & SHOW_FILTER_FLAG_VERBOSECALL_INCLUDE)
+#define EVENT_EXCLUDE() (m->filtermatches & SHOW_FILTER_FLAG_VERBOSECALL_EXCLUDE)
+#define TRANSITION_NEXT_INCLUDE() ++FILTERVERBOSECALLCTR[0]
+#define TRANSITION_PREV_INCLUDE() --FILTERVERBOSECALLCTR[0]
+#define TRANSITION_NEXT_EXCLUDE() ++FILTERVERBOSECALLCTR[1]
+#define TRANSITION_PREV_EXCLUDE() --FILTERVERBOSECALLCTR[1]
+
+#if 0
+void dump_state() {
+       if (STATE_IS_INITIAL()) printf("<INITIAL>\n");
+       else if (STATE_IS_INCLUDE()) printf("<INCLUDE %hd>\n", FILTERVERBOSECALLCTR[0]);
+       else if (STATE_IS_EXCLUDE()) printf("<EXCLUDE %hd>\n", FILTERVERBOSECALLCTR[1]);
+}
+#endif
+
+int show_filters_test_verbosecall_enter(methodinfo *m) {
+
+       int force_show = 0;
+
+       if (STATE_IS_INITIAL()) {
+               if (EVENT_INCLUDE()) {
+                       TRANSITION_NEXT_INCLUDE();
                }
-               else {
-                       tptr = (void **) iptr->target;
-                       printf(" L%03d;", ((basicblock *) *tptr)->debug_nr);
-                       tptr++;
+       } else if (STATE_IS_INCLUDE()) {
+               if (EVENT_EXCLUDE()) {
+                       TRANSITION_NEXT_EXCLUDE();
+                       /* just entered exclude, show this method */
+                       force_show = 1;
+               } else if (EVENT_INCLUDE()) {
+                       TRANSITION_NEXT_INCLUDE();
                }
-               s4ptr++;                                         /* default */
-               j = *s4ptr++;                                    /* count   */
+       } else if (STATE_IS_EXCLUDE()) {
+               if (EVENT_EXCLUDE()) {
+                       TRANSITION_NEXT_EXCLUDE();
+               }
+       }
+
+       return STATE_IS_INCLUDE() || force_show;
+}
 
-               while (--j >= 0) {
-                       if (deadcode || !*tptr) {
-                               s4ptr++; /* skip value */
-                               printf(" %d",*s4ptr++);
+int show_filters_test_verbosecall_exit(methodinfo *m) {
+
+       int force_show = 0;
+
+       if (m) {
+               if (STATE_IS_INCLUDE()) {
+                       if (EVENT_INCLUDE()) {
+                               TRANSITION_PREV_INCLUDE();
+                               /* just entered initial, show this method */
+                               if (STATE_IS_INITIAL()) force_show = 1;
                        }
-                       else {
-                               printf(" L%03d", ((basicblock *) *tptr)->debug_nr);
-                               tptr++;
+           } else if (STATE_IS_EXCLUDE()) {
+                       if (EVENT_EXCLUDE()) {
+                               TRANSITION_PREV_EXCLUDE();
                        }
                }
-               break;
-
-       case ICMD_ARETURN:
-               if (iptr->val.a) {
-                       printf(" (NOT RESOLVED) Class = \"");
-                       utf_display_printable_ascii(((unresolved_class *) iptr->val.a)->classref->name);
-                       printf("\"");
-               }
        }
+
+       return STATE_IS_INCLUDE() || force_show;
 }
-#endif /* !defined(NDEBUG) */
+
+#endif
+
 
 /*
  * These are local overrides for various environment variables in Emacs.