OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-dev/] [fsf-gcc-snapshot-1-mar-12/] [or1k-gcc/] [libjava/] [interpret-run.cc] - Diff between revs 753 and 783

Only display areas with differences | Details | Blame | View Log

Rev 753 Rev 783
// interpret-run.cc - Code to interpret bytecode
// interpret-run.cc - Code to interpret bytecode
 
 
/* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation
/* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation
 
 
   This file is part of libgcj.
   This file is part of libgcj.
 
 
This software is copyrighted work licensed under the terms of the
This software is copyrighted work licensed under the terms of the
Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
details.  */
details.  */
 
 
/* This file is meant only to be included in interpret.cc, it should not be
/* This file is meant only to be included in interpret.cc, it should not be
 * compiled directly.   */
 * compiled directly.   */
 
 
  using namespace java::lang::reflect;
  using namespace java::lang::reflect;
 
 
  pc_t pc = NULL;
  pc_t pc = NULL;
 
 
  // FRAME_DESC registers this particular invocation as the top-most
  // FRAME_DESC registers this particular invocation as the top-most
  // interpreter frame.  This lets the stack tracing code (for
  // interpreter frame.  This lets the stack tracing code (for
  // Throwable) print information about the method being interpreted
  // Throwable) print information about the method being interpreted
  // rather than about the interpreter itself.  FRAME_DESC has a
  // rather than about the interpreter itself.  FRAME_DESC has a
  // destructor so it cleans up automatically when the interpreter
  // destructor so it cleans up automatically when the interpreter
  // returns.
  // returns.
  java::lang::Thread *thread = java::lang::Thread::currentThread();
  java::lang::Thread *thread = java::lang::Thread::currentThread();
 
 
#ifdef __GCJ_DEBUG
#ifdef __GCJ_DEBUG
  _Jv_InterpFrame frame_desc (meth, thread, NULL, &pc);
  _Jv_InterpFrame frame_desc (meth, thread, NULL, &pc);
#else
#else
  _Jv_InterpFrame frame_desc (meth, thread);
  _Jv_InterpFrame frame_desc (meth, thread);
#endif
#endif
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
  ThreadCountAdjuster adj (meth, &frame_desc);
  ThreadCountAdjuster adj (meth, &frame_desc);
#endif // DIRECT_THREADED
#endif // DIRECT_THREADED
 
 
  _Jv_word stack[meth->max_stack];
  _Jv_word stack[meth->max_stack];
  _Jv_word *sp = stack;
  _Jv_word *sp = stack;
 
 
  _Jv_word locals[meth->max_locals];
  _Jv_word locals[meth->max_locals];
 
 
#ifdef __GCJ_DEBUG
#ifdef __GCJ_DEBUG
  // This is the information needed to get and set local variables with
  // This is the information needed to get and set local variables with
  // proper type checking.
  // proper type checking.
  frame_desc.locals = locals;
  frame_desc.locals = locals;
  char locals_type[meth->max_locals];
  char locals_type[meth->max_locals];
  frame_desc.locals_type = locals_type;
  frame_desc.locals_type = locals_type;
 
 
  // Set all slots as invalid until they are written to.
  // Set all slots as invalid until they are written to.
  memset (locals_type, 'x', meth->max_locals);
  memset (locals_type, 'x', meth->max_locals);
 
 
  // We need to set the local variable types for the method arguments since
  // We need to set the local variable types for the method arguments since
  // they are valid at invocation.
  // they are valid at invocation.
 
 
  _Jv_Method *method = meth->get_method ();
  _Jv_Method *method = meth->get_method ();
  int type_ctr = 0;
  int type_ctr = 0;
 
 
  // If the method is non-static, we need to set the type for the "this" pointer.
  // If the method is non-static, we need to set the type for the "this" pointer.
  if ((method->accflags & java::lang::reflect::Modifier::STATIC) == 0)
  if ((method->accflags & java::lang::reflect::Modifier::STATIC) == 0)
    {
    {
      if (args)
      if (args)
        {
        {
          // Set the "this" pointer for this frame.
          // Set the "this" pointer for this frame.
          _Jv_word *this_ptr = reinterpret_cast<_Jv_word *> (args);
          _Jv_word *this_ptr = reinterpret_cast<_Jv_word *> (args);
          frame_desc.obj_ptr = this_ptr[0].o;
          frame_desc.obj_ptr = this_ptr[0].o;
        }
        }
 
 
      frame_desc.locals_type[0] = 'o';
      frame_desc.locals_type[0] = 'o';
      type_ctr++;
      type_ctr++;
    }
    }
 
 
  // Now parse the method signature to set the types of the other arguments.  
  // Now parse the method signature to set the types of the other arguments.  
  int sig_len = method->signature->len ();
  int sig_len = method->signature->len ();
  char *signature = method->signature->chars ();
  char *signature = method->signature->chars ();
  for (int i = 1; signature[i] != ')' && i <= sig_len; i++)
  for (int i = 1; signature[i] != ')' && i <= sig_len; i++)
    {
    {
      if (signature[i] == 'Z' || signature[i] == 'B' || signature[i] == 'C'
      if (signature[i] == 'Z' || signature[i] == 'B' || signature[i] == 'C'
          || signature[i] == 'S' || signature[i] == 'I')
          || signature[i] == 'S' || signature[i] == 'I')
        {
        {
          frame_desc.locals_type[type_ctr] = 'i';
          frame_desc.locals_type[type_ctr] = 'i';
          type_ctr++;
          type_ctr++;
          continue;
          continue;
        }
        }
      else if (signature[i] == 'F')
      else if (signature[i] == 'F')
        {
        {
          frame_desc.locals_type[type_ctr] = 'f';
          frame_desc.locals_type[type_ctr] = 'f';
          type_ctr++;
          type_ctr++;
          continue;
          continue;
        }
        }
      else if (signature[i] == 'J')
      else if (signature[i] == 'J')
        {
        {
          frame_desc.locals_type[type_ctr] = 'l';
          frame_desc.locals_type[type_ctr] = 'l';
          frame_desc.locals_type[type_ctr+1] = 'x';
          frame_desc.locals_type[type_ctr+1] = 'x';
          type_ctr += 2;
          type_ctr += 2;
          continue;
          continue;
        }
        }
      else if (signature[i] == 'D')
      else if (signature[i] == 'D')
        {
        {
          frame_desc.locals_type[type_ctr] = 'd';
          frame_desc.locals_type[type_ctr] = 'd';
          frame_desc.locals_type[type_ctr+1] = 'x';
          frame_desc.locals_type[type_ctr+1] = 'x';
          type_ctr += 2;
          type_ctr += 2;
          continue;
          continue;
        }
        }
      else if (signature[i] == 'L')
      else if (signature[i] == 'L')
        {
        {
          frame_desc.locals_type[type_ctr] = 'o';
          frame_desc.locals_type[type_ctr] = 'o';
          type_ctr++;
          type_ctr++;
          while (signature[i] != ';')
          while (signature[i] != ';')
            i++;
            i++;
          continue;
          continue;
        }
        }
      else if (signature[i] == '[')
      else if (signature[i] == '[')
        {
        {
          frame_desc.locals_type[type_ctr] = 'o';
          frame_desc.locals_type[type_ctr] = 'o';
          type_ctr++;
          type_ctr++;
 
 
          // Ignore multi-dimensional arrays.
          // Ignore multi-dimensional arrays.
          while (signature[i] == '[')
          while (signature[i] == '[')
            i++;
            i++;
 
 
          // Check for an object array
          // Check for an object array
          if (signature[i] == 'L')
          if (signature[i] == 'L')
            {
            {
              while (signature[i] != ';')
              while (signature[i] != ';')
                i++;
                i++;
            }
            }
          continue;
          continue;
        }
        }
    }
    }
#endif /* __GCJ_DEBUG */
#endif /* __GCJ_DEBUG */
 
 
#define INSN_LABEL(op) &&insn_##op
#define INSN_LABEL(op) &&insn_##op
 
 
  static const void *const insn_target[] =
  static const void *const insn_target[] =
  {
  {
    INSN_LABEL(nop),
    INSN_LABEL(nop),
    INSN_LABEL(aconst_null),
    INSN_LABEL(aconst_null),
    INSN_LABEL(iconst_m1),
    INSN_LABEL(iconst_m1),
    INSN_LABEL(iconst_0),
    INSN_LABEL(iconst_0),
    INSN_LABEL(iconst_1),
    INSN_LABEL(iconst_1),
    INSN_LABEL(iconst_2),
    INSN_LABEL(iconst_2),
    INSN_LABEL(iconst_3),
    INSN_LABEL(iconst_3),
    INSN_LABEL(iconst_4),
    INSN_LABEL(iconst_4),
    INSN_LABEL(iconst_5),
    INSN_LABEL(iconst_5),
    INSN_LABEL(lconst_0),
    INSN_LABEL(lconst_0),
    INSN_LABEL(lconst_1),
    INSN_LABEL(lconst_1),
    INSN_LABEL(fconst_0),
    INSN_LABEL(fconst_0),
    INSN_LABEL(fconst_1),
    INSN_LABEL(fconst_1),
    INSN_LABEL(fconst_2),
    INSN_LABEL(fconst_2),
    INSN_LABEL(dconst_0),
    INSN_LABEL(dconst_0),
    INSN_LABEL(dconst_1),
    INSN_LABEL(dconst_1),
    INSN_LABEL(bipush),
    INSN_LABEL(bipush),
    INSN_LABEL(sipush),
    INSN_LABEL(sipush),
    INSN_LABEL(ldc),
    INSN_LABEL(ldc),
    INSN_LABEL(ldc_w),
    INSN_LABEL(ldc_w),
    INSN_LABEL(ldc2_w),
    INSN_LABEL(ldc2_w),
    INSN_LABEL(iload),
    INSN_LABEL(iload),
    INSN_LABEL(lload),
    INSN_LABEL(lload),
    INSN_LABEL(fload),
    INSN_LABEL(fload),
    INSN_LABEL(dload),
    INSN_LABEL(dload),
    INSN_LABEL(aload),
    INSN_LABEL(aload),
    INSN_LABEL(iload_0),
    INSN_LABEL(iload_0),
    INSN_LABEL(iload_1),
    INSN_LABEL(iload_1),
    INSN_LABEL(iload_2),
    INSN_LABEL(iload_2),
    INSN_LABEL(iload_3),
    INSN_LABEL(iload_3),
    INSN_LABEL(lload_0),
    INSN_LABEL(lload_0),
    INSN_LABEL(lload_1),
    INSN_LABEL(lload_1),
    INSN_LABEL(lload_2),
    INSN_LABEL(lload_2),
    INSN_LABEL(lload_3),
    INSN_LABEL(lload_3),
    INSN_LABEL(fload_0),
    INSN_LABEL(fload_0),
    INSN_LABEL(fload_1),
    INSN_LABEL(fload_1),
    INSN_LABEL(fload_2),
    INSN_LABEL(fload_2),
    INSN_LABEL(fload_3),
    INSN_LABEL(fload_3),
    INSN_LABEL(dload_0),
    INSN_LABEL(dload_0),
    INSN_LABEL(dload_1),
    INSN_LABEL(dload_1),
    INSN_LABEL(dload_2),
    INSN_LABEL(dload_2),
    INSN_LABEL(dload_3),
    INSN_LABEL(dload_3),
    INSN_LABEL(aload_0),
    INSN_LABEL(aload_0),
    INSN_LABEL(aload_1),
    INSN_LABEL(aload_1),
    INSN_LABEL(aload_2),
    INSN_LABEL(aload_2),
    INSN_LABEL(aload_3),
    INSN_LABEL(aload_3),
    INSN_LABEL(iaload),
    INSN_LABEL(iaload),
    INSN_LABEL(laload),
    INSN_LABEL(laload),
    INSN_LABEL(faload),
    INSN_LABEL(faload),
    INSN_LABEL(daload),
    INSN_LABEL(daload),
    INSN_LABEL(aaload),
    INSN_LABEL(aaload),
    INSN_LABEL(baload),
    INSN_LABEL(baload),
    INSN_LABEL(caload),
    INSN_LABEL(caload),
    INSN_LABEL(saload),
    INSN_LABEL(saload),
    INSN_LABEL(istore),
    INSN_LABEL(istore),
    INSN_LABEL(lstore),
    INSN_LABEL(lstore),
    INSN_LABEL(fstore),
    INSN_LABEL(fstore),
    INSN_LABEL(dstore),
    INSN_LABEL(dstore),
    INSN_LABEL(astore),
    INSN_LABEL(astore),
    INSN_LABEL(istore_0),
    INSN_LABEL(istore_0),
    INSN_LABEL(istore_1),
    INSN_LABEL(istore_1),
    INSN_LABEL(istore_2),
    INSN_LABEL(istore_2),
    INSN_LABEL(istore_3),
    INSN_LABEL(istore_3),
    INSN_LABEL(lstore_0),
    INSN_LABEL(lstore_0),
    INSN_LABEL(lstore_1),
    INSN_LABEL(lstore_1),
    INSN_LABEL(lstore_2),
    INSN_LABEL(lstore_2),
    INSN_LABEL(lstore_3),
    INSN_LABEL(lstore_3),
    INSN_LABEL(fstore_0),
    INSN_LABEL(fstore_0),
    INSN_LABEL(fstore_1),
    INSN_LABEL(fstore_1),
    INSN_LABEL(fstore_2),
    INSN_LABEL(fstore_2),
    INSN_LABEL(fstore_3),
    INSN_LABEL(fstore_3),
    INSN_LABEL(dstore_0),
    INSN_LABEL(dstore_0),
    INSN_LABEL(dstore_1),
    INSN_LABEL(dstore_1),
    INSN_LABEL(dstore_2),
    INSN_LABEL(dstore_2),
    INSN_LABEL(dstore_3),
    INSN_LABEL(dstore_3),
    INSN_LABEL(astore_0),
    INSN_LABEL(astore_0),
    INSN_LABEL(astore_1),
    INSN_LABEL(astore_1),
    INSN_LABEL(astore_2),
    INSN_LABEL(astore_2),
    INSN_LABEL(astore_3),
    INSN_LABEL(astore_3),
    INSN_LABEL(iastore),
    INSN_LABEL(iastore),
    INSN_LABEL(lastore),
    INSN_LABEL(lastore),
    INSN_LABEL(fastore),
    INSN_LABEL(fastore),
    INSN_LABEL(dastore),
    INSN_LABEL(dastore),
    INSN_LABEL(aastore),
    INSN_LABEL(aastore),
    INSN_LABEL(bastore),
    INSN_LABEL(bastore),
    INSN_LABEL(castore),
    INSN_LABEL(castore),
    INSN_LABEL(sastore),
    INSN_LABEL(sastore),
    INSN_LABEL(pop),
    INSN_LABEL(pop),
    INSN_LABEL(pop2),
    INSN_LABEL(pop2),
    INSN_LABEL(dup),
    INSN_LABEL(dup),
    INSN_LABEL(dup_x1),
    INSN_LABEL(dup_x1),
    INSN_LABEL(dup_x2),
    INSN_LABEL(dup_x2),
    INSN_LABEL(dup2),
    INSN_LABEL(dup2),
    INSN_LABEL(dup2_x1),
    INSN_LABEL(dup2_x1),
    INSN_LABEL(dup2_x2),
    INSN_LABEL(dup2_x2),
    INSN_LABEL(swap),
    INSN_LABEL(swap),
    INSN_LABEL(iadd),
    INSN_LABEL(iadd),
    INSN_LABEL(ladd),
    INSN_LABEL(ladd),
    INSN_LABEL(fadd),
    INSN_LABEL(fadd),
    INSN_LABEL(dadd),
    INSN_LABEL(dadd),
    INSN_LABEL(isub),
    INSN_LABEL(isub),
    INSN_LABEL(lsub),
    INSN_LABEL(lsub),
    INSN_LABEL(fsub),
    INSN_LABEL(fsub),
    INSN_LABEL(dsub),
    INSN_LABEL(dsub),
    INSN_LABEL(imul),
    INSN_LABEL(imul),
    INSN_LABEL(lmul),
    INSN_LABEL(lmul),
    INSN_LABEL(fmul),
    INSN_LABEL(fmul),
    INSN_LABEL(dmul),
    INSN_LABEL(dmul),
    INSN_LABEL(idiv),
    INSN_LABEL(idiv),
    INSN_LABEL(ldiv),
    INSN_LABEL(ldiv),
    INSN_LABEL(fdiv),
    INSN_LABEL(fdiv),
    INSN_LABEL(ddiv),
    INSN_LABEL(ddiv),
    INSN_LABEL(irem),
    INSN_LABEL(irem),
    INSN_LABEL(lrem),
    INSN_LABEL(lrem),
    INSN_LABEL(frem),
    INSN_LABEL(frem),
    INSN_LABEL(drem),
    INSN_LABEL(drem),
    INSN_LABEL(ineg),
    INSN_LABEL(ineg),
    INSN_LABEL(lneg),
    INSN_LABEL(lneg),
    INSN_LABEL(fneg),
    INSN_LABEL(fneg),
    INSN_LABEL(dneg),
    INSN_LABEL(dneg),
    INSN_LABEL(ishl),
    INSN_LABEL(ishl),
    INSN_LABEL(lshl),
    INSN_LABEL(lshl),
    INSN_LABEL(ishr),
    INSN_LABEL(ishr),
    INSN_LABEL(lshr),
    INSN_LABEL(lshr),
    INSN_LABEL(iushr),
    INSN_LABEL(iushr),
    INSN_LABEL(lushr),
    INSN_LABEL(lushr),
    INSN_LABEL(iand),
    INSN_LABEL(iand),
    INSN_LABEL(land),
    INSN_LABEL(land),
    INSN_LABEL(ior),
    INSN_LABEL(ior),
    INSN_LABEL(lor),
    INSN_LABEL(lor),
    INSN_LABEL(ixor),
    INSN_LABEL(ixor),
    INSN_LABEL(lxor),
    INSN_LABEL(lxor),
    INSN_LABEL(iinc),
    INSN_LABEL(iinc),
    INSN_LABEL(i2l),
    INSN_LABEL(i2l),
    INSN_LABEL(i2f),
    INSN_LABEL(i2f),
    INSN_LABEL(i2d),
    INSN_LABEL(i2d),
    INSN_LABEL(l2i),
    INSN_LABEL(l2i),
    INSN_LABEL(l2f),
    INSN_LABEL(l2f),
    INSN_LABEL(l2d),
    INSN_LABEL(l2d),
    INSN_LABEL(f2i),
    INSN_LABEL(f2i),
    INSN_LABEL(f2l),
    INSN_LABEL(f2l),
    INSN_LABEL(f2d),
    INSN_LABEL(f2d),
    INSN_LABEL(d2i),
    INSN_LABEL(d2i),
    INSN_LABEL(d2l),
    INSN_LABEL(d2l),
    INSN_LABEL(d2f),
    INSN_LABEL(d2f),
    INSN_LABEL(i2b),
    INSN_LABEL(i2b),
    INSN_LABEL(i2c),
    INSN_LABEL(i2c),
    INSN_LABEL(i2s),
    INSN_LABEL(i2s),
    INSN_LABEL(lcmp),
    INSN_LABEL(lcmp),
    INSN_LABEL(fcmpl),
    INSN_LABEL(fcmpl),
    INSN_LABEL(fcmpg),
    INSN_LABEL(fcmpg),
    INSN_LABEL(dcmpl),
    INSN_LABEL(dcmpl),
    INSN_LABEL(dcmpg),
    INSN_LABEL(dcmpg),
    INSN_LABEL(ifeq),
    INSN_LABEL(ifeq),
    INSN_LABEL(ifne),
    INSN_LABEL(ifne),
    INSN_LABEL(iflt),
    INSN_LABEL(iflt),
    INSN_LABEL(ifge),
    INSN_LABEL(ifge),
    INSN_LABEL(ifgt),
    INSN_LABEL(ifgt),
    INSN_LABEL(ifle),
    INSN_LABEL(ifle),
    INSN_LABEL(if_icmpeq),
    INSN_LABEL(if_icmpeq),
    INSN_LABEL(if_icmpne),
    INSN_LABEL(if_icmpne),
    INSN_LABEL(if_icmplt),
    INSN_LABEL(if_icmplt),
    INSN_LABEL(if_icmpge),
    INSN_LABEL(if_icmpge),
    INSN_LABEL(if_icmpgt),
    INSN_LABEL(if_icmpgt),
    INSN_LABEL(if_icmple),
    INSN_LABEL(if_icmple),
    INSN_LABEL(if_acmpeq),
    INSN_LABEL(if_acmpeq),
    INSN_LABEL(if_acmpne),
    INSN_LABEL(if_acmpne),
    INSN_LABEL(goto),
    INSN_LABEL(goto),
    INSN_LABEL(jsr),
    INSN_LABEL(jsr),
    INSN_LABEL(ret),
    INSN_LABEL(ret),
    INSN_LABEL(tableswitch),
    INSN_LABEL(tableswitch),
    INSN_LABEL(lookupswitch),
    INSN_LABEL(lookupswitch),
    INSN_LABEL(ireturn),
    INSN_LABEL(ireturn),
    INSN_LABEL(lreturn),
    INSN_LABEL(lreturn),
    INSN_LABEL(freturn),
    INSN_LABEL(freturn),
    INSN_LABEL(dreturn),
    INSN_LABEL(dreturn),
    INSN_LABEL(areturn),
    INSN_LABEL(areturn),
    INSN_LABEL(return),
    INSN_LABEL(return),
    INSN_LABEL(getstatic),
    INSN_LABEL(getstatic),
    INSN_LABEL(putstatic),
    INSN_LABEL(putstatic),
    INSN_LABEL(getfield),
    INSN_LABEL(getfield),
    INSN_LABEL(putfield),
    INSN_LABEL(putfield),
    INSN_LABEL(invokevirtual),
    INSN_LABEL(invokevirtual),
    INSN_LABEL(invokespecial),
    INSN_LABEL(invokespecial),
    INSN_LABEL(invokestatic),
    INSN_LABEL(invokestatic),
    INSN_LABEL(invokeinterface),
    INSN_LABEL(invokeinterface),
    INSN_LABEL(breakpoint),
    INSN_LABEL(breakpoint),
    INSN_LABEL(new),
    INSN_LABEL(new),
    INSN_LABEL(newarray),
    INSN_LABEL(newarray),
    INSN_LABEL(anewarray),
    INSN_LABEL(anewarray),
    INSN_LABEL(arraylength),
    INSN_LABEL(arraylength),
    INSN_LABEL(athrow),
    INSN_LABEL(athrow),
    INSN_LABEL(checkcast),
    INSN_LABEL(checkcast),
    INSN_LABEL(instanceof),
    INSN_LABEL(instanceof),
    INSN_LABEL(monitorenter),
    INSN_LABEL(monitorenter),
    INSN_LABEL(monitorexit),
    INSN_LABEL(monitorexit),
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
    0, // wide
    0, // wide
#else
#else
    INSN_LABEL(wide),
    INSN_LABEL(wide),
#endif
#endif
    INSN_LABEL(multianewarray),
    INSN_LABEL(multianewarray),
    INSN_LABEL(ifnull),
    INSN_LABEL(ifnull),
    INSN_LABEL(ifnonnull),
    INSN_LABEL(ifnonnull),
    INSN_LABEL(goto_w),
    INSN_LABEL(goto_w),
    INSN_LABEL(jsr_w),
    INSN_LABEL(jsr_w),
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
    INSN_LABEL (ldc_class)
    INSN_LABEL (ldc_class)
#else
#else
    0
    0
#endif
#endif
  };
  };
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
 
 
#ifdef __GCJ_DEBUG
#ifdef __GCJ_DEBUG
#undef NEXT_INSN
#undef NEXT_INSN
#define NEXT_INSN                                                       \
#define NEXT_INSN                                                       \
  do                                                                    \
  do                                                                    \
    {                                                                   \
    {                                                                   \
      pc_t insn = pc++;                                                 \
      pc_t insn = pc++;                                                 \
      if (JVMTI_REQUESTED_EVENT (SingleStep))                           \
      if (JVMTI_REQUESTED_EVENT (SingleStep))                           \
        {                                                               \
        {                                                               \
          JNIEnv *env = _Jv_GetCurrentJNIEnv ();                        \
          JNIEnv *env = _Jv_GetCurrentJNIEnv ();                        \
          jmethodID method = meth->self;                                \
          jmethodID method = meth->self;                                \
          jlocation loc = meth->insn_index (insn);                      \
          jlocation loc = meth->insn_index (insn);                      \
          _Jv_JVMTI_PostEvent (JVMTI_EVENT_SINGLE_STEP, thread,         \
          _Jv_JVMTI_PostEvent (JVMTI_EVENT_SINGLE_STEP, thread,         \
                               env, method, loc);                       \
                               env, method, loc);                       \
        }                                                               \
        }                                                               \
      goto *(insn->insn);                                               \
      goto *(insn->insn);                                               \
    }                                                                   \
    }                                                                   \
  while (0)
  while (0)
 
 
// We fail to rewrite a breakpoint if there is another thread
// We fail to rewrite a breakpoint if there is another thread
// currently executing this method.  This is a bug, but there's
// currently executing this method.  This is a bug, but there's
// nothing else we can do that doesn't cause a data race.
// nothing else we can do that doesn't cause a data race.
#undef REWRITE_INSN
#undef REWRITE_INSN
#define REWRITE_INSN(INSN,SLOT,VALUE)                                   \
#define REWRITE_INSN(INSN,SLOT,VALUE)                                   \
  do                                                                    \
  do                                                                    \
    {                                                                   \
    {                                                                   \
      _Jv_MutexLock (&rewrite_insn_mutex);                              \
      _Jv_MutexLock (&rewrite_insn_mutex);                              \
      if (meth->thread_count <= 1)                                      \
      if (meth->thread_count <= 1)                                      \
        {                                                               \
        {                                                               \
          if (pc[-2].insn == breakpoint_insn->insn)                     \
          if (pc[-2].insn == breakpoint_insn->insn)                     \
            {                                                           \
            {                                                           \
              using namespace ::gnu::gcj::jvmti;                        \
              using namespace ::gnu::gcj::jvmti;                        \
              jlocation location = meth->insn_index (pc - 2);           \
              jlocation location = meth->insn_index (pc - 2);           \
              _Jv_RewriteBreakpointInsn (meth->self, location, (pc_t) INSN); \
              _Jv_RewriteBreakpointInsn (meth->self, location, (pc_t) INSN); \
            }                                                           \
            }                                                           \
          else                                                          \
          else                                                          \
            pc[-2].insn = INSN;                                         \
            pc[-2].insn = INSN;                                         \
                                                                        \
                                                                        \
          pc[-1].SLOT = VALUE;                                          \
          pc[-1].SLOT = VALUE;                                          \
        }                                                               \
        }                                                               \
      _Jv_MutexUnlock (&rewrite_insn_mutex);                            \
      _Jv_MutexUnlock (&rewrite_insn_mutex);                            \
    }                                                                   \
    }                                                                   \
  while (0)
  while (0)
 
 
#undef INTERP_REPORT_EXCEPTION
#undef INTERP_REPORT_EXCEPTION
#define INTERP_REPORT_EXCEPTION(Jthrowable) REPORT_EXCEPTION (Jthrowable)
#define INTERP_REPORT_EXCEPTION(Jthrowable) REPORT_EXCEPTION (Jthrowable)
#else // !__GCJ_DEBUG
#else // !__GCJ_DEBUG
#undef NEXT_INSN
#undef NEXT_INSN
#define NEXT_INSN goto *((pc++)->insn)
#define NEXT_INSN goto *((pc++)->insn)
 
 
// Rewriting a multi-word instruction in the presence of multiple
// Rewriting a multi-word instruction in the presence of multiple
// threads is a data race if a thread reads part of an instruction
// threads is a data race if a thread reads part of an instruction
// while some other thread is rewriting that instruction.  We detect
// while some other thread is rewriting that instruction.  We detect
// more than one thread executing a method and don't rewrite the
// more than one thread executing a method and don't rewrite the
// instruction.  A thread entering a method blocks on
// instruction.  A thread entering a method blocks on
// rewrite_insn_mutex until the write is complete.
// rewrite_insn_mutex until the write is complete.
#define REWRITE_INSN(INSN,SLOT,VALUE)           \
#define REWRITE_INSN(INSN,SLOT,VALUE)           \
  do {                                          \
  do {                                          \
    _Jv_MutexLock (&rewrite_insn_mutex);        \
    _Jv_MutexLock (&rewrite_insn_mutex);        \
    if (meth->thread_count <= 1)                \
    if (meth->thread_count <= 1)                \
      {                                         \
      {                                         \
        pc[-2].insn = INSN;                     \
        pc[-2].insn = INSN;                     \
        pc[-1].SLOT = VALUE;                    \
        pc[-1].SLOT = VALUE;                    \
      }                                         \
      }                                         \
    _Jv_MutexUnlock (&rewrite_insn_mutex);      \
    _Jv_MutexUnlock (&rewrite_insn_mutex);      \
  }                                             \
  }                                             \
  while (0)
  while (0)
 
 
#undef INTERP_REPORT_EXCEPTION
#undef INTERP_REPORT_EXCEPTION
#define INTERP_REPORT_EXCEPTION(Jthrowable) /* not needed when not debugging */
#define INTERP_REPORT_EXCEPTION(Jthrowable) /* not needed when not debugging */
#endif // !__GCJ_DEBUG
#endif // !__GCJ_DEBUG
 
 
#define INTVAL() ((pc++)->int_val)
#define INTVAL() ((pc++)->int_val)
#define AVAL() ((pc++)->datum)
#define AVAL() ((pc++)->datum)
 
 
#define GET1S() INTVAL ()
#define GET1S() INTVAL ()
#define GET2S() INTVAL ()
#define GET2S() INTVAL ()
#define GET1U() INTVAL ()
#define GET1U() INTVAL ()
#define GET2U() INTVAL ()
#define GET2U() INTVAL ()
#define AVAL1U() AVAL ()
#define AVAL1U() AVAL ()
#define AVAL2U() AVAL ()
#define AVAL2U() AVAL ()
#define AVAL2UP() AVAL ()
#define AVAL2UP() AVAL ()
#define SKIP_GOTO ++pc
#define SKIP_GOTO ++pc
#define GOTO_VAL() (insn_slot *) pc->datum
#define GOTO_VAL() (insn_slot *) pc->datum
#define PCVAL(unionval) unionval.p
#define PCVAL(unionval) unionval.p
#define AMPAMP(label) &&label
#define AMPAMP(label) &&label
 
 
  // Compile if we must. NOTE: Double-check locking.
  // Compile if we must. NOTE: Double-check locking.
  if (meth->prepared == NULL)
  if (meth->prepared == NULL)
    {
    {
      _Jv_MutexLock (&compile_mutex);
      _Jv_MutexLock (&compile_mutex);
      if (meth->prepared == NULL)
      if (meth->prepared == NULL)
        meth->compile (insn_target);
        meth->compile (insn_target);
      _Jv_MutexUnlock (&compile_mutex);
      _Jv_MutexUnlock (&compile_mutex);
    }
    }
 
 
  // If we're only compiling, stop here
  // If we're only compiling, stop here
  if (args == NULL)
  if (args == NULL)
    return;
    return;
 
 
  pc = (insn_slot *) meth->prepared;
  pc = (insn_slot *) meth->prepared;
 
 
#else
#else
 
 
#ifdef __GCJ_DEBUG
#ifdef __GCJ_DEBUG
#define NEXT_INSN                                                       \
#define NEXT_INSN                                                       \
  do                                                                    \
  do                                                                    \
    {                                                                   \
    {                                                                   \
      if (JVMTI_REQUESTED_EVENT (SingleStep))                           \
      if (JVMTI_REQUESTED_EVENT (SingleStep))                           \
        {                                                               \
        {                                                               \
          JNIEnv *env = _Jv_GetCurrentJNIEnv ();                        \
          JNIEnv *env = _Jv_GetCurrentJNIEnv ();                        \
          jmethodID method = meth->self;                                \
          jmethodID method = meth->self;                                \
          jlocation loc = meth->insn_index (pc);                        \
          jlocation loc = meth->insn_index (pc);                        \
          _Jv_JVMTI_PostEvent (JVMTI_EVENT_SINGLE_STEP, thread,         \
          _Jv_JVMTI_PostEvent (JVMTI_EVENT_SINGLE_STEP, thread,         \
                               env, method, loc);                       \
                               env, method, loc);                       \
        }                                                               \
        }                                                               \
      goto *(insn_target[*pc++])
      goto *(insn_target[*pc++])
#else
#else
#define NEXT_INSN goto *(insn_target[*pc++])
#define NEXT_INSN goto *(insn_target[*pc++])
#endif
#endif
 
 
#define GET1S() get1s (pc++)
#define GET1S() get1s (pc++)
#define GET2S() (pc += 2, get2s (pc- 2))
#define GET2S() (pc += 2, get2s (pc- 2))
#define GET1U() get1u (pc++)
#define GET1U() get1u (pc++)
#define GET2U() (pc += 2, get2u (pc - 2))
#define GET2U() (pc += 2, get2u (pc - 2))
  // Note that these could be more efficient when not handling 'ldc
  // Note that these could be more efficient when not handling 'ldc
  // class'.
  // class'.
#define AVAL1U()                                                \
#define AVAL1U()                                                \
  ({ int index = get1u (pc++);                                  \
  ({ int index = get1u (pc++);                                  \
    _Jv_Linker::resolve_pool_entry (meth->defining_class, index).o; })
    _Jv_Linker::resolve_pool_entry (meth->defining_class, index).o; })
#define AVAL2U()                                                \
#define AVAL2U()                                                \
  ({ int index = get2u (pc); pc += 2;                           \
  ({ int index = get2u (pc); pc += 2;                           \
    _Jv_Linker::resolve_pool_entry (meth->defining_class, index).o; })
    _Jv_Linker::resolve_pool_entry (meth->defining_class, index).o; })
  // Note that we don't need to resolve the pool entry here as class
  // Note that we don't need to resolve the pool entry here as class
  // constants are never wide.
  // constants are never wide.
#define AVAL2UP() ({ int index = get2u (pc); pc += 2; &pool_data[index]; })
#define AVAL2UP() ({ int index = get2u (pc); pc += 2; &pool_data[index]; })
#define SKIP_GOTO pc += 2
#define SKIP_GOTO pc += 2
#define GOTO_VAL() pc - 1 + get2s (pc)
#define GOTO_VAL() pc - 1 + get2s (pc)
#define PCVAL(unionval) unionval.i
#define PCVAL(unionval) unionval.i
#define AMPAMP(label) NULL
#define AMPAMP(label) NULL
 
 
  pc = meth->bytecode ();
  pc = meth->bytecode ();
 
 
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
 
 
#define TAKE_GOTO pc = GOTO_VAL ()
#define TAKE_GOTO pc = GOTO_VAL ()
 
 
  /* Go straight at it!  the ffi raw format matches the internal
  /* Go straight at it!  the ffi raw format matches the internal
     stack representation exactly.  At least, that's the idea.
     stack representation exactly.  At least, that's the idea.
  */
  */
  memcpy ((void*) locals, (void*) args, meth->args_raw_size);
  memcpy ((void*) locals, (void*) args, meth->args_raw_size);
 
 
  _Jv_word *pool_data = meth->defining_class->constants.data;
  _Jv_word *pool_data = meth->defining_class->constants.data;
 
 
  /* These three are temporaries for common code used by several
  /* These three are temporaries for common code used by several
     instructions.  */
     instructions.  */
  void (*fun)();
  void (*fun)();
  _Jv_ResolvedMethod* rmeth;
  _Jv_ResolvedMethod* rmeth;
  int tmpval;
  int tmpval;
 
 
  try
  try
    {
    {
      // We keep nop around.  It is used if we're interpreting the
      // We keep nop around.  It is used if we're interpreting the
      // bytecodes and not doing direct threading.
      // bytecodes and not doing direct threading.
    insn_nop:
    insn_nop:
      NEXT_INSN;
      NEXT_INSN;
 
 
      /* The first few instructions here are ordered according to their
      /* The first few instructions here are ordered according to their
         frequency, in the hope that this will improve code locality a
         frequency, in the hope that this will improve code locality a
         little.  */
         little.  */
 
 
    insn_aload_0:               // 0x2a
    insn_aload_0:               // 0x2a
      LOADA (0);
      LOADA (0);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_iload:         // 0x15
    insn_iload:         // 0x15
      LOADI (GET1U ());
      LOADI (GET1U ());
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_iload_1:               // 0x1b
    insn_iload_1:               // 0x1b
      LOADI (1);
      LOADI (1);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_invokevirtual: // 0xb6
    insn_invokevirtual: // 0xb6
      {
      {
        SAVE_PC();
        SAVE_PC();
        int index = GET2U ();
        int index = GET2U ();
 
 
        /* _Jv_Linker::resolve_pool_entry returns immediately if the
        /* _Jv_Linker::resolve_pool_entry returns immediately if the
         * value already is resolved.  If we want to clutter up the
         * value already is resolved.  If we want to clutter up the
         * code here to gain a little performance, then we can check
         * code here to gain a little performance, then we can check
         * the corresponding bit JV_CONSTANT_ResolvedFlag in the tag
         * the corresponding bit JV_CONSTANT_ResolvedFlag in the tag
         * directly.  For now, I don't think it is worth it.  */
         * directly.  For now, I don't think it is worth it.  */
 
 
        rmeth = (_Jv_Linker::resolve_pool_entry (meth->defining_class,
        rmeth = (_Jv_Linker::resolve_pool_entry (meth->defining_class,
                                                   index)).rmethod;
                                                   index)).rmethod;
 
 
        sp -= rmeth->stack_item_count;
        sp -= rmeth->stack_item_count;
 
 
        if (rmeth->method->accflags & Modifier::FINAL)
        if (rmeth->method->accflags & Modifier::FINAL)
          {
          {
            // We can't rely on NULLCHECK working if the method is final.
            // We can't rely on NULLCHECK working if the method is final.
            if (! sp[0].o)
            if (! sp[0].o)
              throw_null_pointer_exception ();
              throw_null_pointer_exception ();
 
 
            // Final methods might not appear in the vtable.
            // Final methods might not appear in the vtable.
            fun = (void (*)()) rmeth->method->ncode;
            fun = (void (*)()) rmeth->method->ncode;
          }
          }
        else
        else
          {
          {
            NULLCHECK (sp[0].o);
            NULLCHECK (sp[0].o);
            jobject rcv = sp[0].o;
            jobject rcv = sp[0].o;
            _Jv_VTable *table = *(_Jv_VTable**) rcv;
            _Jv_VTable *table = *(_Jv_VTable**) rcv;
            fun = (void (*)()) table->get_method (rmeth->method->index);
            fun = (void (*)()) table->get_method (rmeth->method->index);
          }
          }
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
        // Rewrite instruction so that we use a faster pre-resolved
        // Rewrite instruction so that we use a faster pre-resolved
        // method.
        // method.
        REWRITE_INSN (&&invokevirtual_resolved, datum, rmeth);
        REWRITE_INSN (&&invokevirtual_resolved, datum, rmeth);
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
      }
      }
      goto perform_invoke;
      goto perform_invoke;
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
    invokevirtual_resolved:
    invokevirtual_resolved:
      {
      {
        SAVE_PC();
        SAVE_PC();
        rmeth = (_Jv_ResolvedMethod *) AVAL ();
        rmeth = (_Jv_ResolvedMethod *) AVAL ();
        sp -= rmeth->stack_item_count;
        sp -= rmeth->stack_item_count;
 
 
        if (rmeth->method->accflags & Modifier::FINAL)
        if (rmeth->method->accflags & Modifier::FINAL)
          {
          {
            // We can't rely on NULLCHECK working if the method is final.
            // We can't rely on NULLCHECK working if the method is final.
            if (! sp[0].o)
            if (! sp[0].o)
              throw_null_pointer_exception ();
              throw_null_pointer_exception ();
 
 
            // Final methods might not appear in the vtable.
            // Final methods might not appear in the vtable.
            fun = (void (*)()) rmeth->method->ncode;
            fun = (void (*)()) rmeth->method->ncode;
          }
          }
        else
        else
          {
          {
            NULLCHECK (sp[0].o);
            NULLCHECK (sp[0].o);
            jobject rcv = sp[0].o;
            jobject rcv = sp[0].o;
            _Jv_VTable *table = *(_Jv_VTable**) rcv;
            _Jv_VTable *table = *(_Jv_VTable**) rcv;
            fun = (void (*)()) table->get_method (rmeth->method->index);
            fun = (void (*)()) table->get_method (rmeth->method->index);
          }
          }
      }
      }
      goto perform_invoke;
      goto perform_invoke;
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
 
 
    perform_invoke:
    perform_invoke:
      {
      {
        /* here goes the magic again... */
        /* here goes the magic again... */
        ffi_cif *cif = &rmeth->cif;
        ffi_cif *cif = &rmeth->cif;
        INTERP_FFI_RAW_TYPE *raw = (INTERP_FFI_RAW_TYPE *) sp;
        INTERP_FFI_RAW_TYPE *raw = (INTERP_FFI_RAW_TYPE *) sp;
 
 
        _Jv_value rvalue;
        _Jv_value rvalue;
 
 
#if FFI_NATIVE_RAW_API
#if FFI_NATIVE_RAW_API
        /* We assume that this is only implemented if it's correct      */
        /* We assume that this is only implemented if it's correct      */
        /* to use it here.  On a 64 bit machine, it never is.           */
        /* to use it here.  On a 64 bit machine, it never is.           */
        ffi_raw_call (cif, fun, (void*)&rvalue, raw);
        ffi_raw_call (cif, fun, (void*)&rvalue, raw);
#else
#else
        ffi_java_raw_call (cif, fun, (void*)&rvalue, raw);
        ffi_java_raw_call (cif, fun, (void*)&rvalue, raw);
#endif
#endif
 
 
        int rtype = cif->rtype->type;
        int rtype = cif->rtype->type;
 
 
        /* the likelyhood of object, int, or void return is very high,
        /* the likelyhood of object, int, or void return is very high,
         * so those are checked before the switch */
         * so those are checked before the switch */
        if (rtype == FFI_TYPE_POINTER)
        if (rtype == FFI_TYPE_POINTER)
          {
          {
            PUSHA (rvalue.object_value);
            PUSHA (rvalue.object_value);
          }
          }
        else if (rtype == FFI_TYPE_SINT32)
        else if (rtype == FFI_TYPE_SINT32)
          {
          {
            PUSHI (rvalue.int_value);
            PUSHI (rvalue.int_value);
          }
          }
        else if (rtype == FFI_TYPE_VOID)
        else if (rtype == FFI_TYPE_VOID)
          {
          {
            /* skip */
            /* skip */
          }
          }
        else
        else
          {
          {
            switch (rtype)
            switch (rtype)
              {
              {
              case FFI_TYPE_SINT8:
              case FFI_TYPE_SINT8:
                PUSHI ((jbyte)(rvalue.int_value & 0xff));
                PUSHI ((jbyte)(rvalue.int_value & 0xff));
                break;
                break;
 
 
              case FFI_TYPE_SINT16:
              case FFI_TYPE_SINT16:
                PUSHI ((jshort)(rvalue.int_value & 0xffff));
                PUSHI ((jshort)(rvalue.int_value & 0xffff));
                break;
                break;
 
 
              case FFI_TYPE_UINT16:
              case FFI_TYPE_UINT16:
                PUSHI (rvalue.int_value & 0xffff);
                PUSHI (rvalue.int_value & 0xffff);
                break;
                break;
 
 
              case FFI_TYPE_FLOAT:
              case FFI_TYPE_FLOAT:
                PUSHF (rvalue.float_value);
                PUSHF (rvalue.float_value);
                break;
                break;
 
 
              case FFI_TYPE_DOUBLE:
              case FFI_TYPE_DOUBLE:
                PUSHD (rvalue.double_value);
                PUSHD (rvalue.double_value);
                break;
                break;
 
 
              case FFI_TYPE_SINT64:
              case FFI_TYPE_SINT64:
                PUSHL (rvalue.long_value);
                PUSHL (rvalue.long_value);
                break;
                break;
 
 
              default:
              default:
                throw_internal_error ("unknown return type in invokeXXX");
                throw_internal_error ("unknown return type in invokeXXX");
              }
              }
          }
          }
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_aconst_null:
    insn_aconst_null:
      PUSHA (NULL);
      PUSHA (NULL);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_iconst_m1:
    insn_iconst_m1:
      PUSHI (-1);
      PUSHI (-1);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_iconst_0:
    insn_iconst_0:
      PUSHI (0);
      PUSHI (0);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_iconst_1:
    insn_iconst_1:
      PUSHI (1);
      PUSHI (1);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_iconst_2:
    insn_iconst_2:
      PUSHI (2);
      PUSHI (2);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_iconst_3:
    insn_iconst_3:
      PUSHI (3);
      PUSHI (3);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_iconst_4:
    insn_iconst_4:
      PUSHI (4);
      PUSHI (4);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_iconst_5:
    insn_iconst_5:
      PUSHI (5);
      PUSHI (5);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_lconst_0:
    insn_lconst_0:
      PUSHL (0);
      PUSHL (0);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_lconst_1:
    insn_lconst_1:
      PUSHL (1);
      PUSHL (1);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_fconst_0:
    insn_fconst_0:
      PUSHF (0);
      PUSHF (0);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_fconst_1:
    insn_fconst_1:
      PUSHF (1);
      PUSHF (1);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_fconst_2:
    insn_fconst_2:
      PUSHF (2);
      PUSHF (2);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_dconst_0:
    insn_dconst_0:
      PUSHD (0);
      PUSHD (0);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_dconst_1:
    insn_dconst_1:
      PUSHD (1);
      PUSHD (1);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_bipush:
    insn_bipush:
      // For direct threaded, bipush and sipush are the same.
      // For direct threaded, bipush and sipush are the same.
#ifndef DIRECT_THREADED
#ifndef DIRECT_THREADED
      PUSHI (GET1S ());
      PUSHI (GET1S ());
      NEXT_INSN;
      NEXT_INSN;
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
    insn_sipush:
    insn_sipush:
      PUSHI (GET2S ());
      PUSHI (GET2S ());
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_ldc:
    insn_ldc:
      // For direct threaded, ldc and ldc_w are the same.
      // For direct threaded, ldc and ldc_w are the same.
#ifndef DIRECT_THREADED
#ifndef DIRECT_THREADED
      PUSHA ((jobject) AVAL1U ());
      PUSHA ((jobject) AVAL1U ());
      NEXT_INSN;
      NEXT_INSN;
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
    insn_ldc_w:
    insn_ldc_w:
      PUSHA ((jobject) AVAL2U ());
      PUSHA ((jobject) AVAL2U ());
      NEXT_INSN;
      NEXT_INSN;
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
      // For direct threaded we have a separate 'ldc class' operation.
      // For direct threaded we have a separate 'ldc class' operation.
    insn_ldc_class:
    insn_ldc_class:
      {
      {
        SAVE_PC();
        SAVE_PC();
        // We could rewrite the instruction at this point.
        // We could rewrite the instruction at this point.
        int index = INTVAL ();
        int index = INTVAL ();
        jobject k = (_Jv_Linker::resolve_pool_entry (meth->defining_class,
        jobject k = (_Jv_Linker::resolve_pool_entry (meth->defining_class,
                                                     index)).o;
                                                     index)).o;
        PUSHA (k);
        PUSHA (k);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
 
 
    insn_ldc2_w:
    insn_ldc2_w:
      {
      {
        void *where = AVAL2UP ();
        void *where = AVAL2UP ();
        memcpy (sp, where, 2*sizeof (_Jv_word));
        memcpy (sp, where, 2*sizeof (_Jv_word));
        sp += 2;
        sp += 2;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_lload:
    insn_lload:
      LOADL (GET1U ());
      LOADL (GET1U ());
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_fload:
    insn_fload:
      LOADF (GET1U ());
      LOADF (GET1U ());
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_dload:
    insn_dload:
      LOADD (GET1U ());
      LOADD (GET1U ());
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_aload:
    insn_aload:
      LOADA (GET1U ());
      LOADA (GET1U ());
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_iload_0:
    insn_iload_0:
      LOADI (0);
      LOADI (0);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_iload_2:
    insn_iload_2:
      LOADI (2);
      LOADI (2);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_iload_3:
    insn_iload_3:
      LOADI (3);
      LOADI (3);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_lload_0:
    insn_lload_0:
      LOADL (0);
      LOADL (0);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_lload_1:
    insn_lload_1:
      LOADL (1);
      LOADL (1);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_lload_2:
    insn_lload_2:
      LOADL (2);
      LOADL (2);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_lload_3:
    insn_lload_3:
      LOADL (3);
      LOADL (3);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_fload_0:
    insn_fload_0:
      LOADF (0);
      LOADF (0);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_fload_1:
    insn_fload_1:
      LOADF (1);
      LOADF (1);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_fload_2:
    insn_fload_2:
      LOADF (2);
      LOADF (2);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_fload_3:
    insn_fload_3:
      LOADF (3);
      LOADF (3);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_dload_0:
    insn_dload_0:
      LOADD (0);
      LOADD (0);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_dload_1:
    insn_dload_1:
      LOADD (1);
      LOADD (1);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_dload_2:
    insn_dload_2:
      LOADD (2);
      LOADD (2);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_dload_3:
    insn_dload_3:
      LOADD (3);
      LOADD (3);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_aload_1:
    insn_aload_1:
      LOADA(1);
      LOADA(1);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_aload_2:
    insn_aload_2:
      LOADA(2);
      LOADA(2);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_aload_3:
    insn_aload_3:
      LOADA(3);
      LOADA(3);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_iaload:
    insn_iaload:
      {
      {
        jint index = POPI();
        jint index = POPI();
        jintArray arr = (jintArray) POPA();
        jintArray arr = (jintArray) POPA();
        NULLARRAYCHECK (arr);
        NULLARRAYCHECK (arr);
        ARRAYBOUNDSCHECK (arr, index);
        ARRAYBOUNDSCHECK (arr, index);
        PUSHI( elements(arr)[index] );
        PUSHI( elements(arr)[index] );
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_laload:
    insn_laload:
      {
      {
        jint index = POPI();
        jint index = POPI();
        jlongArray arr = (jlongArray) POPA();
        jlongArray arr = (jlongArray) POPA();
        NULLARRAYCHECK (arr);
        NULLARRAYCHECK (arr);
        ARRAYBOUNDSCHECK (arr, index);
        ARRAYBOUNDSCHECK (arr, index);
        PUSHL( elements(arr)[index] );
        PUSHL( elements(arr)[index] );
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_faload:
    insn_faload:
      {
      {
        jint index = POPI();
        jint index = POPI();
        jfloatArray arr = (jfloatArray) POPA();
        jfloatArray arr = (jfloatArray) POPA();
        NULLARRAYCHECK (arr);
        NULLARRAYCHECK (arr);
        ARRAYBOUNDSCHECK (arr, index);
        ARRAYBOUNDSCHECK (arr, index);
        PUSHF( elements(arr)[index] );
        PUSHF( elements(arr)[index] );
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_daload:
    insn_daload:
      {
      {
        jint index = POPI();
        jint index = POPI();
        jdoubleArray arr = (jdoubleArray) POPA();
        jdoubleArray arr = (jdoubleArray) POPA();
        NULLARRAYCHECK (arr);
        NULLARRAYCHECK (arr);
        ARRAYBOUNDSCHECK (arr, index);
        ARRAYBOUNDSCHECK (arr, index);
        PUSHD( elements(arr)[index] );
        PUSHD( elements(arr)[index] );
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_aaload:
    insn_aaload:
      {
      {
        jint index = POPI();
        jint index = POPI();
        jobjectArray arr = (jobjectArray) POPA();
        jobjectArray arr = (jobjectArray) POPA();
        NULLARRAYCHECK (arr);
        NULLARRAYCHECK (arr);
        ARRAYBOUNDSCHECK (arr, index);
        ARRAYBOUNDSCHECK (arr, index);
        PUSHA( elements(arr)[index] );
        PUSHA( elements(arr)[index] );
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_baload:
    insn_baload:
      {
      {
        jint index = POPI();
        jint index = POPI();
        jbyteArray arr = (jbyteArray) POPA();
        jbyteArray arr = (jbyteArray) POPA();
        NULLARRAYCHECK (arr);
        NULLARRAYCHECK (arr);
        ARRAYBOUNDSCHECK (arr, index);
        ARRAYBOUNDSCHECK (arr, index);
        PUSHI( elements(arr)[index] );
        PUSHI( elements(arr)[index] );
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_caload:
    insn_caload:
      {
      {
        jint index = POPI();
        jint index = POPI();
        jcharArray arr = (jcharArray) POPA();
        jcharArray arr = (jcharArray) POPA();
        NULLARRAYCHECK (arr);
        NULLARRAYCHECK (arr);
        ARRAYBOUNDSCHECK (arr, index);
        ARRAYBOUNDSCHECK (arr, index);
        PUSHI( elements(arr)[index] );
        PUSHI( elements(arr)[index] );
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_saload:
    insn_saload:
      {
      {
        jint index = POPI();
        jint index = POPI();
        jshortArray arr = (jshortArray) POPA();
        jshortArray arr = (jshortArray) POPA();
        NULLARRAYCHECK (arr);
        NULLARRAYCHECK (arr);
        ARRAYBOUNDSCHECK (arr, index);
        ARRAYBOUNDSCHECK (arr, index);
        PUSHI( elements(arr)[index] );
        PUSHI( elements(arr)[index] );
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_istore:
    insn_istore:
      STOREI (GET1U ());
      STOREI (GET1U ());
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_lstore:
    insn_lstore:
      STOREL (GET1U ());
      STOREL (GET1U ());
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_fstore:
    insn_fstore:
      STOREF (GET1U ());
      STOREF (GET1U ());
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_dstore:
    insn_dstore:
      STORED (GET1U ());
      STORED (GET1U ());
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_astore:
    insn_astore:
      STOREA (GET1U ());
      STOREA (GET1U ());
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_istore_0:
    insn_istore_0:
      STOREI (0);
      STOREI (0);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_istore_1:
    insn_istore_1:
      STOREI (1);
      STOREI (1);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_istore_2:
    insn_istore_2:
      STOREI (2);
      STOREI (2);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_istore_3:
    insn_istore_3:
      STOREI (3);
      STOREI (3);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_lstore_0:
    insn_lstore_0:
      STOREL (0);
      STOREL (0);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_lstore_1:
    insn_lstore_1:
      STOREL (1);
      STOREL (1);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_lstore_2:
    insn_lstore_2:
      STOREL (2);
      STOREL (2);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_lstore_3:
    insn_lstore_3:
      STOREL (3);
      STOREL (3);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_fstore_0:
    insn_fstore_0:
      STOREF (0);
      STOREF (0);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_fstore_1:
    insn_fstore_1:
      STOREF (1);
      STOREF (1);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_fstore_2:
    insn_fstore_2:
      STOREF (2);
      STOREF (2);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_fstore_3:
    insn_fstore_3:
      STOREF (3);
      STOREF (3);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_dstore_0:
    insn_dstore_0:
      STORED (0);
      STORED (0);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_dstore_1:
    insn_dstore_1:
      STORED (1);
      STORED (1);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_dstore_2:
    insn_dstore_2:
      STORED (2);
      STORED (2);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_dstore_3:
    insn_dstore_3:
      STORED (3);
      STORED (3);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_astore_0:
    insn_astore_0:
      STOREA(0);
      STOREA(0);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_astore_1:
    insn_astore_1:
      STOREA(1);
      STOREA(1);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_astore_2:
    insn_astore_2:
      STOREA(2);
      STOREA(2);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_astore_3:
    insn_astore_3:
      STOREA(3);
      STOREA(3);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_iastore:
    insn_iastore:
      {
      {
        jint value = POPI();
        jint value = POPI();
        jint index  = POPI();
        jint index  = POPI();
        jintArray arr = (jintArray) POPA();
        jintArray arr = (jintArray) POPA();
        NULLARRAYCHECK (arr);
        NULLARRAYCHECK (arr);
        ARRAYBOUNDSCHECK (arr, index);
        ARRAYBOUNDSCHECK (arr, index);
        elements(arr)[index] = value;
        elements(arr)[index] = value;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_lastore:
    insn_lastore:
      {
      {
        jlong value = POPL();
        jlong value = POPL();
        jint index  = POPI();
        jint index  = POPI();
        jlongArray arr = (jlongArray) POPA();
        jlongArray arr = (jlongArray) POPA();
        NULLARRAYCHECK (arr);
        NULLARRAYCHECK (arr);
        ARRAYBOUNDSCHECK (arr, index);
        ARRAYBOUNDSCHECK (arr, index);
        elements(arr)[index] = value;
        elements(arr)[index] = value;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_fastore:
    insn_fastore:
      {
      {
        jfloat value = POPF();
        jfloat value = POPF();
        jint index  = POPI();
        jint index  = POPI();
        jfloatArray arr = (jfloatArray) POPA();
        jfloatArray arr = (jfloatArray) POPA();
        NULLARRAYCHECK (arr);
        NULLARRAYCHECK (arr);
        ARRAYBOUNDSCHECK (arr, index);
        ARRAYBOUNDSCHECK (arr, index);
        elements(arr)[index] = value;
        elements(arr)[index] = value;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_dastore:
    insn_dastore:
      {
      {
        jdouble value = POPD();
        jdouble value = POPD();
        jint index  = POPI();
        jint index  = POPI();
        jdoubleArray arr = (jdoubleArray) POPA();
        jdoubleArray arr = (jdoubleArray) POPA();
        NULLARRAYCHECK (arr);
        NULLARRAYCHECK (arr);
        ARRAYBOUNDSCHECK (arr, index);
        ARRAYBOUNDSCHECK (arr, index);
        elements(arr)[index] = value;
        elements(arr)[index] = value;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_aastore:
    insn_aastore:
      {
      {
        jobject value = POPA();
        jobject value = POPA();
        jint index  = POPI();
        jint index  = POPI();
        jobjectArray arr = (jobjectArray) POPA();
        jobjectArray arr = (jobjectArray) POPA();
        NULLARRAYCHECK (arr);
        NULLARRAYCHECK (arr);
        ARRAYBOUNDSCHECK (arr, index);
        ARRAYBOUNDSCHECK (arr, index);
        _Jv_CheckArrayStore (arr, value);
        _Jv_CheckArrayStore (arr, value);
        elements(arr)[index] = value;
        elements(arr)[index] = value;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_bastore:
    insn_bastore:
      {
      {
        jbyte value = (jbyte) POPI();
        jbyte value = (jbyte) POPI();
        jint index  = POPI();
        jint index  = POPI();
        jbyteArray arr = (jbyteArray) POPA();
        jbyteArray arr = (jbyteArray) POPA();
        NULLARRAYCHECK (arr);
        NULLARRAYCHECK (arr);
        ARRAYBOUNDSCHECK (arr, index);
        ARRAYBOUNDSCHECK (arr, index);
        elements(arr)[index] = value;
        elements(arr)[index] = value;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_castore:
    insn_castore:
      {
      {
        jchar value = (jchar) POPI();
        jchar value = (jchar) POPI();
        jint index  = POPI();
        jint index  = POPI();
        jcharArray arr = (jcharArray) POPA();
        jcharArray arr = (jcharArray) POPA();
        NULLARRAYCHECK (arr);
        NULLARRAYCHECK (arr);
        ARRAYBOUNDSCHECK (arr, index);
        ARRAYBOUNDSCHECK (arr, index);
        elements(arr)[index] = value;
        elements(arr)[index] = value;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_sastore:
    insn_sastore:
      {
      {
        jshort value = (jshort) POPI();
        jshort value = (jshort) POPI();
        jint index  = POPI();
        jint index  = POPI();
        jshortArray arr = (jshortArray) POPA();
        jshortArray arr = (jshortArray) POPA();
        NULLARRAYCHECK (arr);
        NULLARRAYCHECK (arr);
        ARRAYBOUNDSCHECK (arr, index);
        ARRAYBOUNDSCHECK (arr, index);
        elements(arr)[index] = value;
        elements(arr)[index] = value;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_pop:
    insn_pop:
      sp -= 1;
      sp -= 1;
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_pop2:
    insn_pop2:
      sp -= 2;
      sp -= 2;
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_dup:
    insn_dup:
      sp[0] = sp[-1];
      sp[0] = sp[-1];
      sp += 1;
      sp += 1;
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_dup_x1:
    insn_dup_x1:
      dupx (sp, 1, 1); sp+=1;
      dupx (sp, 1, 1); sp+=1;
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_dup_x2:
    insn_dup_x2:
      dupx (sp, 1, 2); sp+=1;
      dupx (sp, 1, 2); sp+=1;
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_dup2:
    insn_dup2:
      sp[0] = sp[-2];
      sp[0] = sp[-2];
      sp[1] = sp[-1];
      sp[1] = sp[-1];
      sp += 2;
      sp += 2;
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_dup2_x1:
    insn_dup2_x1:
      dupx (sp, 2, 1); sp+=2;
      dupx (sp, 2, 1); sp+=2;
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_dup2_x2:
    insn_dup2_x2:
      dupx (sp, 2, 2); sp+=2;
      dupx (sp, 2, 2); sp+=2;
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_swap:
    insn_swap:
      {
      {
        jobject tmp1 = POPA();
        jobject tmp1 = POPA();
        jobject tmp2 = POPA();
        jobject tmp2 = POPA();
        PUSHA (tmp1);
        PUSHA (tmp1);
        PUSHA (tmp2);
        PUSHA (tmp2);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_iadd:
    insn_iadd:
      BINOPI(+);
      BINOPI(+);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_ladd:
    insn_ladd:
      BINOPL(+);
      BINOPL(+);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_fadd:
    insn_fadd:
      BINOPF(+);
      BINOPF(+);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_dadd:
    insn_dadd:
      BINOPD(+);
      BINOPD(+);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_isub:
    insn_isub:
      BINOPI(-);
      BINOPI(-);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_lsub:
    insn_lsub:
      BINOPL(-);
      BINOPL(-);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_fsub:
    insn_fsub:
      BINOPF(-);
      BINOPF(-);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_dsub:
    insn_dsub:
      BINOPD(-);
      BINOPD(-);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_imul:
    insn_imul:
      BINOPI(*);
      BINOPI(*);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_lmul:
    insn_lmul:
      BINOPL(*);
      BINOPL(*);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_fmul:
    insn_fmul:
      BINOPF(*);
      BINOPF(*);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_dmul:
    insn_dmul:
      BINOPD(*);
      BINOPD(*);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_idiv:
    insn_idiv:
      {
      {
        SAVE_PC();
        SAVE_PC();
        jint value2 = POPI();
        jint value2 = POPI();
        jint value1 = POPI();
        jint value1 = POPI();
        jint res = _Jv_divI (value1, value2);
        jint res = _Jv_divI (value1, value2);
        PUSHI (res);
        PUSHI (res);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_ldiv:
    insn_ldiv:
      {
      {
        SAVE_PC();
        SAVE_PC();
        jlong value2 = POPL();
        jlong value2 = POPL();
        jlong value1 = POPL();
        jlong value1 = POPL();
        jlong res = _Jv_divJ (value1, value2);
        jlong res = _Jv_divJ (value1, value2);
        PUSHL (res);
        PUSHL (res);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_fdiv:
    insn_fdiv:
      {
      {
        jfloat value2 = POPF();
        jfloat value2 = POPF();
        jfloat value1 = POPF();
        jfloat value1 = POPF();
        jfloat res = value1 / value2;
        jfloat res = value1 / value2;
        PUSHF (res);
        PUSHF (res);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_ddiv:
    insn_ddiv:
      {
      {
        jdouble value2 = POPD();
        jdouble value2 = POPD();
        jdouble value1 = POPD();
        jdouble value1 = POPD();
        jdouble res = value1 / value2;
        jdouble res = value1 / value2;
        PUSHD (res);
        PUSHD (res);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_irem:
    insn_irem:
      {
      {
        SAVE_PC();
        SAVE_PC();
        jint value2 = POPI();
        jint value2 = POPI();
        jint value1 =  POPI();
        jint value1 =  POPI();
        jint res = _Jv_remI (value1, value2);
        jint res = _Jv_remI (value1, value2);
        PUSHI (res);
        PUSHI (res);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_lrem:
    insn_lrem:
      {
      {
        SAVE_PC();
        SAVE_PC();
        jlong value2 = POPL();
        jlong value2 = POPL();
        jlong value1 = POPL();
        jlong value1 = POPL();
        jlong res = _Jv_remJ (value1, value2);
        jlong res = _Jv_remJ (value1, value2);
        PUSHL (res);
        PUSHL (res);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_frem:
    insn_frem:
      {
      {
        jfloat value2 = POPF();
        jfloat value2 = POPF();
        jfloat value1 = POPF();
        jfloat value1 = POPF();
        jfloat res    = __ieee754_fmod (value1, value2);
        jfloat res    = __ieee754_fmod (value1, value2);
        PUSHF (res);
        PUSHF (res);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_drem:
    insn_drem:
      {
      {
        jdouble value2 = POPD();
        jdouble value2 = POPD();
        jdouble value1 = POPD();
        jdouble value1 = POPD();
        jdouble res    = __ieee754_fmod (value1, value2);
        jdouble res    = __ieee754_fmod (value1, value2);
        PUSHD (res);
        PUSHD (res);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_ineg:
    insn_ineg:
      {
      {
        jint value = POPI();
        jint value = POPI();
        PUSHI (value * -1);
        PUSHI (value * -1);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_lneg:
    insn_lneg:
      {
      {
        jlong value = POPL();
        jlong value = POPL();
        PUSHL (value * -1);
        PUSHL (value * -1);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_fneg:
    insn_fneg:
      {
      {
        jfloat value = POPF();
        jfloat value = POPF();
        PUSHF (value * -1);
        PUSHF (value * -1);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_dneg:
    insn_dneg:
      {
      {
        jdouble value = POPD();
        jdouble value = POPD();
        PUSHD (value * -1);
        PUSHD (value * -1);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_ishl:
    insn_ishl:
      {
      {
        jint shift = (POPI() & 0x1f);
        jint shift = (POPI() & 0x1f);
        jint value = POPI();
        jint value = POPI();
        PUSHI (value << shift);
        PUSHI (value << shift);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_lshl:
    insn_lshl:
      {
      {
        jint shift = (POPI() & 0x3f);
        jint shift = (POPI() & 0x3f);
        jlong value = POPL();
        jlong value = POPL();
        PUSHL (value << shift);
        PUSHL (value << shift);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_ishr:
    insn_ishr:
      {
      {
        jint shift = (POPI() & 0x1f);
        jint shift = (POPI() & 0x1f);
        jint value = POPI();
        jint value = POPI();
        PUSHI (value >> shift);
        PUSHI (value >> shift);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_lshr:
    insn_lshr:
      {
      {
        jint shift = (POPI() & 0x3f);
        jint shift = (POPI() & 0x3f);
        jlong value = POPL();
        jlong value = POPL();
        PUSHL (value >> shift);
        PUSHL (value >> shift);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_iushr:
    insn_iushr:
      {
      {
        jint shift = (POPI() & 0x1f);
        jint shift = (POPI() & 0x1f);
        _Jv_uint value = (_Jv_uint) POPI();
        _Jv_uint value = (_Jv_uint) POPI();
        PUSHI ((jint) (value >> shift));
        PUSHI ((jint) (value >> shift));
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_lushr:
    insn_lushr:
      {
      {
        jint shift = (POPI() & 0x3f);
        jint shift = (POPI() & 0x3f);
        _Jv_ulong value = (_Jv_ulong) POPL();
        _Jv_ulong value = (_Jv_ulong) POPL();
        PUSHL ((jlong) (value >> shift));
        PUSHL ((jlong) (value >> shift));
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_iand:
    insn_iand:
      BINOPI (&);
      BINOPI (&);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_land:
    insn_land:
      BINOPL (&);
      BINOPL (&);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_ior:
    insn_ior:
      BINOPI (|);
      BINOPI (|);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_lor:
    insn_lor:
      BINOPL (|);
      BINOPL (|);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_ixor:
    insn_ixor:
      BINOPI (^);
      BINOPI (^);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_lxor:
    insn_lxor:
      BINOPL (^);
      BINOPL (^);
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_iinc:
    insn_iinc:
      {
      {
        jint index  = GET1U ();
        jint index  = GET1U ();
        jint amount = GET1S ();
        jint amount = GET1S ();
        locals[index].i += amount;
        locals[index].i += amount;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_i2l:
    insn_i2l:
      {jlong value = POPI(); PUSHL (value);}
      {jlong value = POPI(); PUSHL (value);}
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_i2f:
    insn_i2f:
      {jfloat value = POPI(); PUSHF (value);}
      {jfloat value = POPI(); PUSHF (value);}
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_i2d:
    insn_i2d:
      {jdouble value = POPI(); PUSHD (value);}
      {jdouble value = POPI(); PUSHD (value);}
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_l2i:
    insn_l2i:
      {jint value = POPL(); PUSHI (value);}
      {jint value = POPL(); PUSHI (value);}
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_l2f:
    insn_l2f:
      {jfloat value = POPL(); PUSHF (value);}
      {jfloat value = POPL(); PUSHF (value);}
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_l2d:
    insn_l2d:
      {jdouble value = POPL(); PUSHD (value);}
      {jdouble value = POPL(); PUSHD (value);}
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_f2i:
    insn_f2i:
      {
      {
        using namespace java::lang;
        using namespace java::lang;
        jint value = convert (POPF (), Integer::MIN_VALUE, Integer::MAX_VALUE);
        jint value = convert (POPF (), Integer::MIN_VALUE, Integer::MAX_VALUE);
        PUSHI(value);
        PUSHI(value);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_f2l:
    insn_f2l:
      {
      {
        using namespace java::lang;
        using namespace java::lang;
        jlong value = convert (POPF (), Long::MIN_VALUE, Long::MAX_VALUE);
        jlong value = convert (POPF (), Long::MIN_VALUE, Long::MAX_VALUE);
        PUSHL(value);
        PUSHL(value);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_f2d:
    insn_f2d:
      { jdouble value = POPF (); PUSHD(value); }
      { jdouble value = POPF (); PUSHD(value); }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_d2i:
    insn_d2i:
      {
      {
        using namespace java::lang;
        using namespace java::lang;
        jint value = convert (POPD (), Integer::MIN_VALUE, Integer::MAX_VALUE);
        jint value = convert (POPD (), Integer::MIN_VALUE, Integer::MAX_VALUE);
        PUSHI(value);
        PUSHI(value);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_d2l:
    insn_d2l:
      {
      {
        using namespace java::lang;
        using namespace java::lang;
        jlong value = convert (POPD (), Long::MIN_VALUE, Long::MAX_VALUE);
        jlong value = convert (POPD (), Long::MIN_VALUE, Long::MAX_VALUE);
        PUSHL(value);
        PUSHL(value);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_d2f:
    insn_d2f:
      { jfloat value = POPD (); PUSHF(value); }
      { jfloat value = POPD (); PUSHF(value); }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_i2b:
    insn_i2b:
      { jbyte value = POPI (); PUSHI(value); }
      { jbyte value = POPI (); PUSHI(value); }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_i2c:
    insn_i2c:
      { jchar value = POPI (); PUSHI(value); }
      { jchar value = POPI (); PUSHI(value); }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_i2s:
    insn_i2s:
      { jshort value = POPI (); PUSHI(value); }
      { jshort value = POPI (); PUSHI(value); }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_lcmp:
    insn_lcmp:
      {
      {
        jlong value2 = POPL ();
        jlong value2 = POPL ();
        jlong value1 = POPL ();
        jlong value1 = POPL ();
        if (value1 > value2)
        if (value1 > value2)
          { PUSHI (1); }
          { PUSHI (1); }
        else if (value1 == value2)
        else if (value1 == value2)
          { PUSHI (0); }
          { PUSHI (0); }
        else
        else
          { PUSHI (-1); }
          { PUSHI (-1); }
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_fcmpl:
    insn_fcmpl:
      tmpval = -1;
      tmpval = -1;
      goto fcmp;
      goto fcmp;
 
 
    insn_fcmpg:
    insn_fcmpg:
      tmpval = 1;
      tmpval = 1;
 
 
    fcmp:
    fcmp:
      {
      {
        jfloat value2 = POPF ();
        jfloat value2 = POPF ();
        jfloat value1 = POPF ();
        jfloat value1 = POPF ();
        if (value1 > value2)
        if (value1 > value2)
          PUSHI (1);
          PUSHI (1);
        else if (value1 == value2)
        else if (value1 == value2)
          PUSHI (0);
          PUSHI (0);
        else if (value1 < value2)
        else if (value1 < value2)
          PUSHI (-1);
          PUSHI (-1);
        else
        else
          PUSHI (tmpval);
          PUSHI (tmpval);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_dcmpl:
    insn_dcmpl:
      tmpval = -1;
      tmpval = -1;
      goto dcmp;
      goto dcmp;
 
 
    insn_dcmpg:
    insn_dcmpg:
      tmpval = 1;
      tmpval = 1;
 
 
    dcmp:
    dcmp:
      {
      {
        jdouble value2 = POPD ();
        jdouble value2 = POPD ();
        jdouble value1 = POPD ();
        jdouble value1 = POPD ();
        if (value1 > value2)
        if (value1 > value2)
          PUSHI (1);
          PUSHI (1);
        else if (value1 == value2)
        else if (value1 == value2)
          PUSHI (0);
          PUSHI (0);
        else if (value1 < value2)
        else if (value1 < value2)
          PUSHI (-1);
          PUSHI (-1);
        else
        else
          PUSHI (tmpval);
          PUSHI (tmpval);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_ifeq:
    insn_ifeq:
      {
      {
        if (POPI() == 0)
        if (POPI() == 0)
          TAKE_GOTO;
          TAKE_GOTO;
        else
        else
          SKIP_GOTO;
          SKIP_GOTO;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_ifne:
    insn_ifne:
      {
      {
        if (POPI() != 0)
        if (POPI() != 0)
          TAKE_GOTO;
          TAKE_GOTO;
        else
        else
          SKIP_GOTO;
          SKIP_GOTO;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_iflt:
    insn_iflt:
      {
      {
        if (POPI() < 0)
        if (POPI() < 0)
          TAKE_GOTO;
          TAKE_GOTO;
        else
        else
          SKIP_GOTO;
          SKIP_GOTO;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_ifge:
    insn_ifge:
      {
      {
        if (POPI() >= 0)
        if (POPI() >= 0)
          TAKE_GOTO;
          TAKE_GOTO;
        else
        else
          SKIP_GOTO;
          SKIP_GOTO;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_ifgt:
    insn_ifgt:
      {
      {
        if (POPI() > 0)
        if (POPI() > 0)
          TAKE_GOTO;
          TAKE_GOTO;
        else
        else
          SKIP_GOTO;
          SKIP_GOTO;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_ifle:
    insn_ifle:
      {
      {
        if (POPI() <= 0)
        if (POPI() <= 0)
          TAKE_GOTO;
          TAKE_GOTO;
        else
        else
          SKIP_GOTO;
          SKIP_GOTO;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_if_icmpeq:
    insn_if_icmpeq:
      {
      {
        jint value2 = POPI();
        jint value2 = POPI();
        jint value1 = POPI();
        jint value1 = POPI();
        if (value1 == value2)
        if (value1 == value2)
          TAKE_GOTO;
          TAKE_GOTO;
        else
        else
          SKIP_GOTO;
          SKIP_GOTO;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_if_icmpne:
    insn_if_icmpne:
      {
      {
        jint value2 = POPI();
        jint value2 = POPI();
        jint value1 = POPI();
        jint value1 = POPI();
        if (value1 != value2)
        if (value1 != value2)
          TAKE_GOTO;
          TAKE_GOTO;
        else
        else
          SKIP_GOTO;
          SKIP_GOTO;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_if_icmplt:
    insn_if_icmplt:
      {
      {
        jint value2 = POPI();
        jint value2 = POPI();
        jint value1 = POPI();
        jint value1 = POPI();
        if (value1 < value2)
        if (value1 < value2)
          TAKE_GOTO;
          TAKE_GOTO;
        else
        else
          SKIP_GOTO;
          SKIP_GOTO;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_if_icmpge:
    insn_if_icmpge:
      {
      {
        jint value2 = POPI();
        jint value2 = POPI();
        jint value1 = POPI();
        jint value1 = POPI();
        if (value1 >= value2)
        if (value1 >= value2)
          TAKE_GOTO;
          TAKE_GOTO;
        else
        else
          SKIP_GOTO;
          SKIP_GOTO;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_if_icmpgt:
    insn_if_icmpgt:
      {
      {
        jint value2 = POPI();
        jint value2 = POPI();
        jint value1 = POPI();
        jint value1 = POPI();
        if (value1 > value2)
        if (value1 > value2)
          TAKE_GOTO;
          TAKE_GOTO;
        else
        else
          SKIP_GOTO;
          SKIP_GOTO;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_if_icmple:
    insn_if_icmple:
      {
      {
        jint value2 = POPI();
        jint value2 = POPI();
        jint value1 = POPI();
        jint value1 = POPI();
        if (value1 <= value2)
        if (value1 <= value2)
          TAKE_GOTO;
          TAKE_GOTO;
        else
        else
          SKIP_GOTO;
          SKIP_GOTO;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_if_acmpeq:
    insn_if_acmpeq:
      {
      {
        jobject value2 = POPA();
        jobject value2 = POPA();
        jobject value1 = POPA();
        jobject value1 = POPA();
        if (value1 == value2)
        if (value1 == value2)
          TAKE_GOTO;
          TAKE_GOTO;
        else
        else
          SKIP_GOTO;
          SKIP_GOTO;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_if_acmpne:
    insn_if_acmpne:
      {
      {
        jobject value2 = POPA();
        jobject value2 = POPA();
        jobject value1 = POPA();
        jobject value1 = POPA();
        if (value1 != value2)
        if (value1 != value2)
          TAKE_GOTO;
          TAKE_GOTO;
        else
        else
          SKIP_GOTO;
          SKIP_GOTO;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_goto_w:
    insn_goto_w:
#ifndef DIRECT_THREADED
#ifndef DIRECT_THREADED
      // For direct threaded, goto and goto_w are the same.
      // For direct threaded, goto and goto_w are the same.
      pc = pc - 1 + get4 (pc);
      pc = pc - 1 + get4 (pc);
      NEXT_INSN;
      NEXT_INSN;
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
    insn_goto:
    insn_goto:
      TAKE_GOTO;
      TAKE_GOTO;
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_jsr_w:
    insn_jsr_w:
#ifndef DIRECT_THREADED
#ifndef DIRECT_THREADED
      // For direct threaded, jsr and jsr_w are the same.
      // For direct threaded, jsr and jsr_w are the same.
      {
      {
        pc_t next = pc - 1 + get4 (pc);
        pc_t next = pc - 1 + get4 (pc);
        pc += 4;
        pc += 4;
        PUSHA ((jobject) pc);
        PUSHA ((jobject) pc);
        pc = next;
        pc = next;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
    insn_jsr:
    insn_jsr:
      {
      {
        pc_t next = GOTO_VAL();
        pc_t next = GOTO_VAL();
        SKIP_GOTO;
        SKIP_GOTO;
        PUSHA ((jobject) pc);
        PUSHA ((jobject) pc);
        pc = next;
        pc = next;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_ret:
    insn_ret:
      {
      {
        jint index = GET1U ();
        jint index = GET1U ();
        pc = (pc_t) PEEKA (index);
        pc = (pc_t) PEEKA (index);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_tableswitch:
    insn_tableswitch:
      {
      {
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
        void *def = (pc++)->datum;
        void *def = (pc++)->datum;
 
 
        int index = POPI();
        int index = POPI();
 
 
        jint low = INTVAL ();
        jint low = INTVAL ();
        jint high = INTVAL ();
        jint high = INTVAL ();
 
 
        if (index < low || index > high)
        if (index < low || index > high)
          pc = (insn_slot *) def;
          pc = (insn_slot *) def;
        else
        else
          pc = (insn_slot *) ((pc + index - low)->datum);
          pc = (insn_slot *) ((pc + index - low)->datum);
#else
#else
        pc_t base_pc = pc - 1;
        pc_t base_pc = pc - 1;
        int index = POPI ();
        int index = POPI ();
 
 
        pc_t base = (pc_t) meth->bytecode ();
        pc_t base = (pc_t) meth->bytecode ();
        while ((pc - base) % 4 != 0)
        while ((pc - base) % 4 != 0)
          ++pc;
          ++pc;
 
 
        jint def = get4 (pc);
        jint def = get4 (pc);
        jint low = get4 (pc + 4);
        jint low = get4 (pc + 4);
        jint high = get4 (pc + 8);
        jint high = get4 (pc + 8);
        if (index < low || index > high)
        if (index < low || index > high)
          pc = base_pc + def;
          pc = base_pc + def;
        else
        else
          pc = base_pc + get4 (pc + 4 * (index - low + 3));
          pc = base_pc + get4 (pc + 4 * (index - low + 3));
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_lookupswitch:
    insn_lookupswitch:
      {
      {
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
        void *def = (pc++)->insn;
        void *def = (pc++)->insn;
 
 
        int index = POPI();
        int index = POPI();
 
 
        jint npairs = INTVAL ();
        jint npairs = INTVAL ();
 
 
        int max = npairs - 1;
        int max = npairs - 1;
        int min = 0;
        int min = 0;
 
 
        // Simple binary search...
        // Simple binary search...
        while (min < max)
        while (min < max)
          {
          {
            int half = (min + max) / 2;
            int half = (min + max) / 2;
            int match = pc[2 * half].int_val;
            int match = pc[2 * half].int_val;
 
 
            if (index == match)
            if (index == match)
              {
              {
                // Found it.
                // Found it.
                pc = (insn_slot *) pc[2 * half + 1].datum;
                pc = (insn_slot *) pc[2 * half + 1].datum;
                NEXT_INSN;
                NEXT_INSN;
              }
              }
            else if (index < match)
            else if (index < match)
              // We can use HALF - 1 here because we check again on
              // We can use HALF - 1 here because we check again on
              // loop exit.
              // loop exit.
              max = half - 1;
              max = half - 1;
            else
            else
              // We can use HALF + 1 here because we check again on
              // We can use HALF + 1 here because we check again on
              // loop exit.
              // loop exit.
              min = half + 1;
              min = half + 1;
          }
          }
        if (index == pc[2 * min].int_val)
        if (index == pc[2 * min].int_val)
          pc = (insn_slot *) pc[2 * min + 1].datum;
          pc = (insn_slot *) pc[2 * min + 1].datum;
        else
        else
          pc = (insn_slot *) def;
          pc = (insn_slot *) def;
#else
#else
        unsigned char *base_pc = pc-1;
        unsigned char *base_pc = pc-1;
        int index = POPI();
        int index = POPI();
 
 
        unsigned char* base = meth->bytecode ();
        unsigned char* base = meth->bytecode ();
        while ((pc-base) % 4 != 0)
        while ((pc-base) % 4 != 0)
          ++pc;
          ++pc;
 
 
        jint def     = get4 (pc);
        jint def     = get4 (pc);
        jint npairs  = get4 (pc+4);
        jint npairs  = get4 (pc+4);
 
 
        int max = npairs-1;
        int max = npairs-1;
        int min = 0;
        int min = 0;
 
 
        // Simple binary search...
        // Simple binary search...
        while (min < max)
        while (min < max)
          {
          {
            int half = (min+max)/2;
            int half = (min+max)/2;
            int match = get4 (pc+ 4*(2 + 2*half));
            int match = get4 (pc+ 4*(2 + 2*half));
 
 
            if (index == match)
            if (index == match)
              min = max = half;
              min = max = half;
            else if (index < match)
            else if (index < match)
              // We can use HALF - 1 here because we check again on
              // We can use HALF - 1 here because we check again on
              // loop exit.
              // loop exit.
              max = half - 1;
              max = half - 1;
            else
            else
              // We can use HALF + 1 here because we check again on
              // We can use HALF + 1 here because we check again on
              // loop exit.
              // loop exit.
              min = half + 1;
              min = half + 1;
          }
          }
 
 
        if (index == get4 (pc+ 4*(2 + 2*min)))
        if (index == get4 (pc+ 4*(2 + 2*min)))
          pc = base_pc + get4 (pc+ 4*(2 + 2*min + 1));
          pc = base_pc + get4 (pc+ 4*(2 + 2*min + 1));
        else
        else
          pc = base_pc + def;
          pc = base_pc + def;
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_areturn:
    insn_areturn:
      *(jobject *) retp = POPA ();
      *(jobject *) retp = POPA ();
      return;
      return;
 
 
    insn_lreturn:
    insn_lreturn:
      *(jlong *) retp = POPL ();
      *(jlong *) retp = POPL ();
      return;
      return;
 
 
    insn_freturn:
    insn_freturn:
      *(jfloat *) retp = POPF ();
      *(jfloat *) retp = POPF ();
      return;
      return;
 
 
    insn_dreturn:
    insn_dreturn:
      *(jdouble *) retp = POPD ();
      *(jdouble *) retp = POPD ();
      return;
      return;
 
 
    insn_ireturn:
    insn_ireturn:
      *(jint *) retp = POPI ();
      *(jint *) retp = POPI ();
      return;
      return;
 
 
    insn_return:
    insn_return:
      return;
      return;
 
 
    insn_getstatic:
    insn_getstatic:
      {
      {
        jint fieldref_index = GET2U ();
        jint fieldref_index = GET2U ();
        SAVE_PC(); // Constant pool resolution could throw.
        SAVE_PC(); // Constant pool resolution could throw.
        _Jv_Linker::resolve_pool_entry (meth->defining_class, fieldref_index);
        _Jv_Linker::resolve_pool_entry (meth->defining_class, fieldref_index);
        _Jv_Field *field = pool_data[fieldref_index].field;
        _Jv_Field *field = pool_data[fieldref_index].field;
 
 
        if ((field->flags & Modifier::STATIC) == 0)
        if ((field->flags & Modifier::STATIC) == 0)
          throw_incompatible_class_change_error
          throw_incompatible_class_change_error
            (JvNewStringLatin1 ("field no longer static"));
            (JvNewStringLatin1 ("field no longer static"));
 
 
        jclass type = field->type;
        jclass type = field->type;
 
 
        // We rewrite the instruction once we discover what it refers
        // We rewrite the instruction once we discover what it refers
        // to.
        // to.
        void *newinsn = NULL;
        void *newinsn = NULL;
        if (type->isPrimitive ())
        if (type->isPrimitive ())
          {
          {
            switch (type->size_in_bytes)
            switch (type->size_in_bytes)
              {
              {
              case 1:
              case 1:
                PUSHI (*field->u.byte_addr);
                PUSHI (*field->u.byte_addr);
                newinsn = AMPAMP (getstatic_resolved_1);
                newinsn = AMPAMP (getstatic_resolved_1);
                break;
                break;
 
 
              case 2:
              case 2:
                if (type == JvPrimClass (char))
                if (type == JvPrimClass (char))
                  {
                  {
                    PUSHI (*field->u.char_addr);
                    PUSHI (*field->u.char_addr);
                    newinsn = AMPAMP (getstatic_resolved_char);
                    newinsn = AMPAMP (getstatic_resolved_char);
                  }
                  }
                else
                else
                  {
                  {
                    PUSHI (*field->u.short_addr);
                    PUSHI (*field->u.short_addr);
                    newinsn = AMPAMP (getstatic_resolved_short);
                    newinsn = AMPAMP (getstatic_resolved_short);
                  }
                  }
                break;
                break;
 
 
              case 4:
              case 4:
                PUSHI(*field->u.int_addr);
                PUSHI(*field->u.int_addr);
                newinsn = AMPAMP (getstatic_resolved_4);
                newinsn = AMPAMP (getstatic_resolved_4);
                break;
                break;
 
 
              case 8:
              case 8:
                PUSHL(*field->u.long_addr);
                PUSHL(*field->u.long_addr);
                newinsn = AMPAMP (getstatic_resolved_8);
                newinsn = AMPAMP (getstatic_resolved_8);
                break;
                break;
              }
              }
          }
          }
        else
        else
          {
          {
            PUSHA(*field->u.object_addr);
            PUSHA(*field->u.object_addr);
            newinsn = AMPAMP (getstatic_resolved_obj);
            newinsn = AMPAMP (getstatic_resolved_obj);
          }
          }
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
        REWRITE_INSN (newinsn, datum, field->u.addr);
        REWRITE_INSN (newinsn, datum, field->u.addr);
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
    getstatic_resolved_1:
    getstatic_resolved_1:
      PUSHI (*(jbyte *) AVAL ());
      PUSHI (*(jbyte *) AVAL ());
      NEXT_INSN;
      NEXT_INSN;
 
 
    getstatic_resolved_char:
    getstatic_resolved_char:
      PUSHI (*(jchar *) AVAL ());
      PUSHI (*(jchar *) AVAL ());
      NEXT_INSN;
      NEXT_INSN;
 
 
    getstatic_resolved_short:
    getstatic_resolved_short:
      PUSHI (*(jshort *) AVAL ());
      PUSHI (*(jshort *) AVAL ());
      NEXT_INSN;
      NEXT_INSN;
 
 
    getstatic_resolved_4:
    getstatic_resolved_4:
      PUSHI (*(jint *) AVAL ());
      PUSHI (*(jint *) AVAL ());
      NEXT_INSN;
      NEXT_INSN;
 
 
    getstatic_resolved_8:
    getstatic_resolved_8:
      PUSHL (*(jlong *) AVAL ());
      PUSHL (*(jlong *) AVAL ());
      NEXT_INSN;
      NEXT_INSN;
 
 
    getstatic_resolved_obj:
    getstatic_resolved_obj:
      PUSHA (*(jobject *) AVAL ());
      PUSHA (*(jobject *) AVAL ());
      NEXT_INSN;
      NEXT_INSN;
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
 
 
    insn_getfield:
    insn_getfield:
      {
      {
        SAVE_PC();
        SAVE_PC();
        jint fieldref_index = GET2U ();
        jint fieldref_index = GET2U ();
        _Jv_Linker::resolve_pool_entry (meth->defining_class, fieldref_index);
        _Jv_Linker::resolve_pool_entry (meth->defining_class, fieldref_index);
        _Jv_Field *field = pool_data[fieldref_index].field;
        _Jv_Field *field = pool_data[fieldref_index].field;
 
 
        if ((field->flags & Modifier::STATIC) != 0)
        if ((field->flags & Modifier::STATIC) != 0)
          throw_incompatible_class_change_error
          throw_incompatible_class_change_error
            (JvNewStringLatin1 ("field is static"));
            (JvNewStringLatin1 ("field is static"));
 
 
        jclass type = field->type;
        jclass type = field->type;
        jint field_offset = field->u.boffset;
        jint field_offset = field->u.boffset;
 
 
        jobject obj   = POPA();
        jobject obj   = POPA();
        NULLCHECK(obj);
        NULLCHECK(obj);
 
 
        void *newinsn = NULL;
        void *newinsn = NULL;
        _Jv_value *val = (_Jv_value *) ((char *)obj + field_offset);
        _Jv_value *val = (_Jv_value *) ((char *)obj + field_offset);
        if (type->isPrimitive ())
        if (type->isPrimitive ())
          {
          {
            switch (type->size_in_bytes)
            switch (type->size_in_bytes)
              {
              {
              case 1:
              case 1:
                PUSHI (val->byte_value);
                PUSHI (val->byte_value);
                newinsn = AMPAMP (getfield_resolved_1);
                newinsn = AMPAMP (getfield_resolved_1);
                break;
                break;
 
 
              case 2:
              case 2:
                if (type == JvPrimClass (char))
                if (type == JvPrimClass (char))
                  {
                  {
                    PUSHI (val->char_value);
                    PUSHI (val->char_value);
                    newinsn = AMPAMP (getfield_resolved_char);
                    newinsn = AMPAMP (getfield_resolved_char);
                  }
                  }
                else
                else
                  {
                  {
                    PUSHI (val->short_value);
                    PUSHI (val->short_value);
                    newinsn = AMPAMP (getfield_resolved_short);
                    newinsn = AMPAMP (getfield_resolved_short);
                  }
                  }
                break;
                break;
 
 
              case 4:
              case 4:
                PUSHI (val->int_value);
                PUSHI (val->int_value);
                newinsn = AMPAMP (getfield_resolved_4);
                newinsn = AMPAMP (getfield_resolved_4);
                break;
                break;
 
 
              case 8:
              case 8:
                PUSHL (val->long_value);
                PUSHL (val->long_value);
                newinsn = AMPAMP (getfield_resolved_8);
                newinsn = AMPAMP (getfield_resolved_8);
                break;
                break;
              }
              }
          }
          }
        else
        else
          {
          {
            PUSHA (val->object_value);
            PUSHA (val->object_value);
            newinsn = AMPAMP (getfield_resolved_obj);
            newinsn = AMPAMP (getfield_resolved_obj);
          }
          }
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
        REWRITE_INSN (newinsn, int_val, field_offset);
        REWRITE_INSN (newinsn, int_val, field_offset);
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
    getfield_resolved_1:
    getfield_resolved_1:
      {
      {
        char *obj = (char *) POPA ();
        char *obj = (char *) POPA ();
        NULLCHECK (obj);
        NULLCHECK (obj);
        PUSHI (*(jbyte *) (obj + INTVAL ()));
        PUSHI (*(jbyte *) (obj + INTVAL ()));
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    getfield_resolved_char:
    getfield_resolved_char:
      {
      {
        char *obj = (char *) POPA ();
        char *obj = (char *) POPA ();
        NULLCHECK (obj);
        NULLCHECK (obj);
        PUSHI (*(jchar *) (obj + INTVAL ()));
        PUSHI (*(jchar *) (obj + INTVAL ()));
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    getfield_resolved_short:
    getfield_resolved_short:
      {
      {
        char *obj = (char *) POPA ();
        char *obj = (char *) POPA ();
        NULLCHECK (obj);
        NULLCHECK (obj);
        PUSHI (*(jshort *) (obj + INTVAL ()));
        PUSHI (*(jshort *) (obj + INTVAL ()));
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    getfield_resolved_4:
    getfield_resolved_4:
      {
      {
        char *obj = (char *) POPA ();
        char *obj = (char *) POPA ();
        NULLCHECK (obj);
        NULLCHECK (obj);
        PUSHI (*(jint *) (obj + INTVAL ()));
        PUSHI (*(jint *) (obj + INTVAL ()));
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    getfield_resolved_8:
    getfield_resolved_8:
      {
      {
        char *obj = (char *) POPA ();
        char *obj = (char *) POPA ();
        NULLCHECK (obj);
        NULLCHECK (obj);
        PUSHL (*(jlong *) (obj + INTVAL ()));
        PUSHL (*(jlong *) (obj + INTVAL ()));
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    getfield_resolved_obj:
    getfield_resolved_obj:
      {
      {
        char *obj = (char *) POPA ();
        char *obj = (char *) POPA ();
        NULLCHECK (obj);
        NULLCHECK (obj);
        PUSHA (*(jobject *) (obj + INTVAL ()));
        PUSHA (*(jobject *) (obj + INTVAL ()));
      }
      }
      NEXT_INSN;
      NEXT_INSN;
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
 
 
    insn_putstatic:
    insn_putstatic:
      {
      {
        SAVE_PC();
        SAVE_PC();
        jint fieldref_index = GET2U ();
        jint fieldref_index = GET2U ();
        _Jv_Linker::resolve_pool_entry (meth->defining_class, fieldref_index);
        _Jv_Linker::resolve_pool_entry (meth->defining_class, fieldref_index);
        _Jv_Field *field = pool_data[fieldref_index].field;
        _Jv_Field *field = pool_data[fieldref_index].field;
 
 
        jclass type = field->type;
        jclass type = field->type;
 
 
        // ResolvePoolEntry cannot check this
        // ResolvePoolEntry cannot check this
        if ((field->flags & Modifier::STATIC) == 0)
        if ((field->flags & Modifier::STATIC) == 0)
          throw_incompatible_class_change_error
          throw_incompatible_class_change_error
            (JvNewStringLatin1 ("field no longer static"));
            (JvNewStringLatin1 ("field no longer static"));
 
 
        void *newinsn = NULL;
        void *newinsn = NULL;
        if (type->isPrimitive ())
        if (type->isPrimitive ())
          {
          {
            switch (type->size_in_bytes)
            switch (type->size_in_bytes)
              {
              {
              case 1:
              case 1:
                {
                {
                  jint value = POPI();
                  jint value = POPI();
                  *field->u.byte_addr = value;
                  *field->u.byte_addr = value;
                  newinsn = AMPAMP (putstatic_resolved_1);
                  newinsn = AMPAMP (putstatic_resolved_1);
                  break;
                  break;
                }
                }
 
 
              case 2:
              case 2:
                {
                {
                  jint value = POPI();
                  jint value = POPI();
                  *field->u.char_addr = value;
                  *field->u.char_addr = value;
                  newinsn = AMPAMP (putstatic_resolved_2);
                  newinsn = AMPAMP (putstatic_resolved_2);
                  break;
                  break;
                }
                }
 
 
              case 4:
              case 4:
                {
                {
                  jint value = POPI();
                  jint value = POPI();
                  *field->u.int_addr = value;
                  *field->u.int_addr = value;
                  newinsn = AMPAMP (putstatic_resolved_4);
                  newinsn = AMPAMP (putstatic_resolved_4);
                  break;
                  break;
                }
                }
 
 
              case 8:
              case 8:
                {
                {
                  jlong value = POPL();
                  jlong value = POPL();
                  *field->u.long_addr = value;
                  *field->u.long_addr = value;
                  newinsn = AMPAMP (putstatic_resolved_8);
                  newinsn = AMPAMP (putstatic_resolved_8);
                  break;
                  break;
                }
                }
              }
              }
          }
          }
        else
        else
          {
          {
            jobject value = POPA();
            jobject value = POPA();
            *field->u.object_addr = value;
            *field->u.object_addr = value;
            newinsn = AMPAMP (putstatic_resolved_obj);
            newinsn = AMPAMP (putstatic_resolved_obj);
          }
          }
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
        REWRITE_INSN (newinsn, datum, field->u.addr);
        REWRITE_INSN (newinsn, datum, field->u.addr);
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
    putstatic_resolved_1:
    putstatic_resolved_1:
      *(jbyte *) AVAL () = POPI ();
      *(jbyte *) AVAL () = POPI ();
      NEXT_INSN;
      NEXT_INSN;
 
 
    putstatic_resolved_2:
    putstatic_resolved_2:
      *(jchar *) AVAL () = POPI ();
      *(jchar *) AVAL () = POPI ();
      NEXT_INSN;
      NEXT_INSN;
 
 
    putstatic_resolved_4:
    putstatic_resolved_4:
      *(jint *) AVAL () = POPI ();
      *(jint *) AVAL () = POPI ();
      NEXT_INSN;
      NEXT_INSN;
 
 
    putstatic_resolved_8:
    putstatic_resolved_8:
      *(jlong *) AVAL () = POPL ();
      *(jlong *) AVAL () = POPL ();
      NEXT_INSN;
      NEXT_INSN;
 
 
    putstatic_resolved_obj:
    putstatic_resolved_obj:
      *(jobject *) AVAL () = POPA ();
      *(jobject *) AVAL () = POPA ();
      NEXT_INSN;
      NEXT_INSN;
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
 
 
    insn_putfield:
    insn_putfield:
      {
      {
        SAVE_PC();
        SAVE_PC();
        jint fieldref_index = GET2U ();
        jint fieldref_index = GET2U ();
        _Jv_Linker::resolve_pool_entry (meth->defining_class, fieldref_index);
        _Jv_Linker::resolve_pool_entry (meth->defining_class, fieldref_index);
        _Jv_Field *field = pool_data[fieldref_index].field;
        _Jv_Field *field = pool_data[fieldref_index].field;
 
 
        jclass type = field->type;
        jclass type = field->type;
 
 
        if ((field->flags & Modifier::STATIC) != 0)
        if ((field->flags & Modifier::STATIC) != 0)
          throw_incompatible_class_change_error
          throw_incompatible_class_change_error
            (JvNewStringLatin1 ("field is static"));
            (JvNewStringLatin1 ("field is static"));
 
 
        jint field_offset = field->u.boffset;
        jint field_offset = field->u.boffset;
 
 
        void *newinsn = NULL;
        void *newinsn = NULL;
        if (type->isPrimitive ())
        if (type->isPrimitive ())
          {
          {
            switch (type->size_in_bytes)
            switch (type->size_in_bytes)
              {
              {
              case 1:
              case 1:
                {
                {
                  jint    value = POPI();
                  jint    value = POPI();
                  jobject obj   = POPA();
                  jobject obj   = POPA();
                  NULLCHECK(obj);
                  NULLCHECK(obj);
                  *(jbyte*) ((char*)obj + field_offset) = value;
                  *(jbyte*) ((char*)obj + field_offset) = value;
                  newinsn = AMPAMP (putfield_resolved_1);
                  newinsn = AMPAMP (putfield_resolved_1);
                  break;
                  break;
                }
                }
 
 
              case 2:
              case 2:
                {
                {
                  jint    value = POPI();
                  jint    value = POPI();
                  jobject obj   = POPA();
                  jobject obj   = POPA();
                  NULLCHECK(obj);
                  NULLCHECK(obj);
                  *(jchar*) ((char*)obj + field_offset) = value;
                  *(jchar*) ((char*)obj + field_offset) = value;
                  newinsn = AMPAMP (putfield_resolved_2);
                  newinsn = AMPAMP (putfield_resolved_2);
                  break;
                  break;
                }
                }
 
 
              case 4:
              case 4:
                {
                {
                  jint    value = POPI();
                  jint    value = POPI();
                  jobject obj   = POPA();
                  jobject obj   = POPA();
                  NULLCHECK(obj);
                  NULLCHECK(obj);
                  *(jint*) ((char*)obj + field_offset) = value;
                  *(jint*) ((char*)obj + field_offset) = value;
                  newinsn = AMPAMP (putfield_resolved_4);
                  newinsn = AMPAMP (putfield_resolved_4);
                  break;
                  break;
                }
                }
 
 
              case 8:
              case 8:
                {
                {
                  jlong   value = POPL();
                  jlong   value = POPL();
                  jobject obj   = POPA();
                  jobject obj   = POPA();
                  NULLCHECK(obj);
                  NULLCHECK(obj);
                  *(jlong*) ((char*)obj + field_offset) = value;
                  *(jlong*) ((char*)obj + field_offset) = value;
                  newinsn = AMPAMP (putfield_resolved_8);
                  newinsn = AMPAMP (putfield_resolved_8);
                  break;
                  break;
                }
                }
              }
              }
          }
          }
        else
        else
          {
          {
            jobject value = POPA();
            jobject value = POPA();
            jobject obj   = POPA();
            jobject obj   = POPA();
            NULLCHECK(obj);
            NULLCHECK(obj);
            *(jobject*) ((char*)obj + field_offset) = value;
            *(jobject*) ((char*)obj + field_offset) = value;
            newinsn = AMPAMP (putfield_resolved_obj);
            newinsn = AMPAMP (putfield_resolved_obj);
          }
          }
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
        REWRITE_INSN (newinsn, int_val, field_offset);
        REWRITE_INSN (newinsn, int_val, field_offset);
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
    putfield_resolved_1:
    putfield_resolved_1:
      {
      {
        jint val = POPI ();
        jint val = POPI ();
        char *obj = (char *) POPA ();
        char *obj = (char *) POPA ();
        NULLCHECK (obj);
        NULLCHECK (obj);
        *(jbyte *) (obj + INTVAL ()) = val;
        *(jbyte *) (obj + INTVAL ()) = val;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    putfield_resolved_2:
    putfield_resolved_2:
      {
      {
        jint val = POPI ();
        jint val = POPI ();
        char *obj = (char *) POPA ();
        char *obj = (char *) POPA ();
        NULLCHECK (obj);
        NULLCHECK (obj);
        *(jchar *) (obj + INTVAL ()) = val;
        *(jchar *) (obj + INTVAL ()) = val;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    putfield_resolved_4:
    putfield_resolved_4:
      {
      {
        jint val = POPI ();
        jint val = POPI ();
        char *obj = (char *) POPA ();
        char *obj = (char *) POPA ();
        NULLCHECK (obj);
        NULLCHECK (obj);
        *(jint *) (obj + INTVAL ()) = val;
        *(jint *) (obj + INTVAL ()) = val;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    putfield_resolved_8:
    putfield_resolved_8:
      {
      {
        jlong val = POPL ();
        jlong val = POPL ();
        char *obj = (char *) POPA ();
        char *obj = (char *) POPA ();
        NULLCHECK (obj);
        NULLCHECK (obj);
        *(jlong *) (obj + INTVAL ()) = val;
        *(jlong *) (obj + INTVAL ()) = val;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    putfield_resolved_obj:
    putfield_resolved_obj:
      {
      {
        jobject val = POPA ();
        jobject val = POPA ();
        char *obj = (char *) POPA ();
        char *obj = (char *) POPA ();
        NULLCHECK (obj);
        NULLCHECK (obj);
        *(jobject *) (obj + INTVAL ()) = val;
        *(jobject *) (obj + INTVAL ()) = val;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
 
 
    insn_invokespecial:
    insn_invokespecial:
      {
      {
        SAVE_PC();
        SAVE_PC();
        int index = GET2U ();
        int index = GET2U ();
 
 
        rmeth = (_Jv_Linker::resolve_pool_entry (meth->defining_class,
        rmeth = (_Jv_Linker::resolve_pool_entry (meth->defining_class,
                                                   index)).rmethod;
                                                   index)).rmethod;
 
 
        sp -= rmeth->stack_item_count;
        sp -= rmeth->stack_item_count;
 
 
        // We don't use NULLCHECK here because we can't rely on that
        // We don't use NULLCHECK here because we can't rely on that
        // working for <init>.  So instead we do an explicit test.
        // working for <init>.  So instead we do an explicit test.
        if (! sp[0].o)
        if (! sp[0].o)
          {
          {
            SAVE_PC();
            SAVE_PC();
            throw_null_pointer_exception ();
            throw_null_pointer_exception ();
          }
          }
 
 
        fun = (void (*)()) rmeth->method->ncode;
        fun = (void (*)()) rmeth->method->ncode;
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
        // Rewrite instruction so that we use a faster pre-resolved
        // Rewrite instruction so that we use a faster pre-resolved
        // method.
        // method.
        REWRITE_INSN (&&invokespecial_resolved, datum, rmeth);
        REWRITE_INSN (&&invokespecial_resolved, datum, rmeth);
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
      }
      }
      goto perform_invoke;
      goto perform_invoke;
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
    invokespecial_resolved:
    invokespecial_resolved:
      {
      {
        SAVE_PC();
        SAVE_PC();
        rmeth = (_Jv_ResolvedMethod *) AVAL ();
        rmeth = (_Jv_ResolvedMethod *) AVAL ();
        sp -= rmeth->stack_item_count;
        sp -= rmeth->stack_item_count;
        // We don't use NULLCHECK here because we can't rely on that
        // We don't use NULLCHECK here because we can't rely on that
        // working for <init>.  So instead we do an explicit test.
        // working for <init>.  So instead we do an explicit test.
        if (! sp[0].o)
        if (! sp[0].o)
          {
          {
            throw_null_pointer_exception ();
            throw_null_pointer_exception ();
          }
          }
        fun = (void (*)()) rmeth->method->ncode;
        fun = (void (*)()) rmeth->method->ncode;
      }
      }
      goto perform_invoke;
      goto perform_invoke;
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
 
 
    insn_invokestatic:
    insn_invokestatic:
      {
      {
        SAVE_PC();
        SAVE_PC();
        int index = GET2U ();
        int index = GET2U ();
 
 
        rmeth = (_Jv_Linker::resolve_pool_entry (meth->defining_class,
        rmeth = (_Jv_Linker::resolve_pool_entry (meth->defining_class,
                                                   index)).rmethod;
                                                   index)).rmethod;
 
 
        sp -= rmeth->stack_item_count;
        sp -= rmeth->stack_item_count;
 
 
        fun = (void (*)()) rmeth->method->ncode;
        fun = (void (*)()) rmeth->method->ncode;
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
        // Rewrite instruction so that we use a faster pre-resolved
        // Rewrite instruction so that we use a faster pre-resolved
        // method.
        // method.
        REWRITE_INSN (&&invokestatic_resolved, datum, rmeth);
        REWRITE_INSN (&&invokestatic_resolved, datum, rmeth);
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
      }
      }
      goto perform_invoke;
      goto perform_invoke;
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
    invokestatic_resolved:
    invokestatic_resolved:
      {
      {
        SAVE_PC();
        SAVE_PC();
        rmeth = (_Jv_ResolvedMethod *) AVAL ();
        rmeth = (_Jv_ResolvedMethod *) AVAL ();
        sp -= rmeth->stack_item_count;
        sp -= rmeth->stack_item_count;
        fun = (void (*)()) rmeth->method->ncode;
        fun = (void (*)()) rmeth->method->ncode;
      }
      }
      goto perform_invoke;
      goto perform_invoke;
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
 
 
    insn_invokeinterface:
    insn_invokeinterface:
      {
      {
        SAVE_PC();
        SAVE_PC();
        int index = GET2U ();
        int index = GET2U ();
 
 
        rmeth = (_Jv_Linker::resolve_pool_entry (meth->defining_class,
        rmeth = (_Jv_Linker::resolve_pool_entry (meth->defining_class,
                                                   index)).rmethod;
                                                   index)).rmethod;
 
 
        sp -= rmeth->stack_item_count;
        sp -= rmeth->stack_item_count;
 
 
        jobject rcv = sp[0].o;
        jobject rcv = sp[0].o;
 
 
        NULLCHECK (rcv);
        NULLCHECK (rcv);
 
 
        fun = (void (*)())
        fun = (void (*)())
          _Jv_LookupInterfaceMethod (rcv->getClass (),
          _Jv_LookupInterfaceMethod (rcv->getClass (),
                                     rmeth->method->name,
                                     rmeth->method->name,
                                     rmeth->method->signature);
                                     rmeth->method->signature);
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
        // Rewrite instruction so that we use a faster pre-resolved
        // Rewrite instruction so that we use a faster pre-resolved
        // method.
        // method.
        REWRITE_INSN (&&invokeinterface_resolved, datum, rmeth);
        REWRITE_INSN (&&invokeinterface_resolved, datum, rmeth);
#else
#else
        // Skip dummy bytes.
        // Skip dummy bytes.
        pc += 2;
        pc += 2;
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
      }
      }
      goto perform_invoke;
      goto perform_invoke;
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
    invokeinterface_resolved:
    invokeinterface_resolved:
      {
      {
        SAVE_PC();
        SAVE_PC();
        rmeth = (_Jv_ResolvedMethod *) AVAL ();
        rmeth = (_Jv_ResolvedMethod *) AVAL ();
        sp -= rmeth->stack_item_count;
        sp -= rmeth->stack_item_count;
        jobject rcv = sp[0].o;
        jobject rcv = sp[0].o;
        NULLCHECK (rcv);
        NULLCHECK (rcv);
        fun = (void (*)())
        fun = (void (*)())
          _Jv_LookupInterfaceMethod (rcv->getClass (),
          _Jv_LookupInterfaceMethod (rcv->getClass (),
                                     rmeth->method->name,
                                     rmeth->method->name,
                                     rmeth->method->signature);
                                     rmeth->method->signature);
      }
      }
      goto perform_invoke;
      goto perform_invoke;
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
 
 
    insn_new:
    insn_new:
      {
      {
        SAVE_PC();
        SAVE_PC();
        int index = GET2U ();
        int index = GET2U ();
        jclass klass = (_Jv_Linker::resolve_pool_entry (meth->defining_class,
        jclass klass = (_Jv_Linker::resolve_pool_entry (meth->defining_class,
                                                          index)).clazz;
                                                          index)).clazz;
        /* VM spec, section 3.11.5 */
        /* VM spec, section 3.11.5 */
        if ((klass->getModifiers() & Modifier::ABSTRACT)
        if ((klass->getModifiers() & Modifier::ABSTRACT)
            || klass->isInterface())
            || klass->isInterface())
          {
          {
            jthrowable t = new java::lang::InstantiationException;
            jthrowable t = new java::lang::InstantiationException;
            INTERP_REPORT_EXCEPTION (t);
            INTERP_REPORT_EXCEPTION (t);
            throw t;
            throw t;
          }
          }
        jobject res = _Jv_AllocObject (klass);
        jobject res = _Jv_AllocObject (klass);
        PUSHA (res);
        PUSHA (res);
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
        REWRITE_INSN (&&new_resolved, datum, klass);
        REWRITE_INSN (&&new_resolved, datum, klass);
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
    new_resolved:
    new_resolved:
      {
      {
        jclass klass = (jclass) AVAL ();
        jclass klass = (jclass) AVAL ();
        jobject res = _Jv_AllocObject (klass);
        jobject res = _Jv_AllocObject (klass);
        PUSHA (res);
        PUSHA (res);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
 
 
    insn_newarray:
    insn_newarray:
      {
      {
        int atype = GET1U ();
        int atype = GET1U ();
        int size  = POPI();
        int size  = POPI();
        jobject result = _Jv_NewArray (atype, size);
        jobject result = _Jv_NewArray (atype, size);
        PUSHA (result);
        PUSHA (result);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_anewarray:
    insn_anewarray:
      {
      {
        SAVE_PC();
        SAVE_PC();
        int index = GET2U ();
        int index = GET2U ();
        jclass klass = (_Jv_Linker::resolve_pool_entry (meth->defining_class,
        jclass klass = (_Jv_Linker::resolve_pool_entry (meth->defining_class,
                                                          index)).clazz;
                                                          index)).clazz;
        int size  = POPI();
        int size  = POPI();
        jobject result = _Jv_NewObjectArray (size, klass, 0);
        jobject result = _Jv_NewObjectArray (size, klass, 0);
        PUSHA (result);
        PUSHA (result);
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
        REWRITE_INSN (&&anewarray_resolved, datum, klass);
        REWRITE_INSN (&&anewarray_resolved, datum, klass);
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
    anewarray_resolved:
    anewarray_resolved:
      {
      {
        jclass klass = (jclass) AVAL ();
        jclass klass = (jclass) AVAL ();
        int size = POPI ();
        int size = POPI ();
        jobject result = _Jv_NewObjectArray (size, klass, 0);
        jobject result = _Jv_NewObjectArray (size, klass, 0);
        PUSHA (result);
        PUSHA (result);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
 
 
    insn_arraylength:
    insn_arraylength:
      {
      {
        __JArray *arr = (__JArray*)POPA();
        __JArray *arr = (__JArray*)POPA();
        NULLARRAYCHECK (arr);
        NULLARRAYCHECK (arr);
        PUSHI (arr->length);
        PUSHI (arr->length);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_athrow:
    insn_athrow:
      {
      {
        jobject value = POPA();
        jobject value = POPA();
        jthrowable t = static_cast<jthrowable> (value);
        jthrowable t = static_cast<jthrowable> (value);
        INTERP_REPORT_EXCEPTION (t);
        INTERP_REPORT_EXCEPTION (t);
        throw t;
        throw t;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_checkcast:
    insn_checkcast:
      {
      {
        SAVE_PC();
        SAVE_PC();
        jobject value = POPA();
        jobject value = POPA();
        jint index = GET2U ();
        jint index = GET2U ();
        jclass to = (_Jv_Linker::resolve_pool_entry (meth->defining_class,
        jclass to = (_Jv_Linker::resolve_pool_entry (meth->defining_class,
                                                       index)).clazz;
                                                       index)).clazz;
 
 
        value = (jobject) _Jv_CheckCast (to, value);
        value = (jobject) _Jv_CheckCast (to, value);
 
 
        PUSHA (value);
        PUSHA (value);
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
        REWRITE_INSN (&&checkcast_resolved, datum, to);
        REWRITE_INSN (&&checkcast_resolved, datum, to);
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
    checkcast_resolved:
    checkcast_resolved:
      {
      {
        SAVE_PC();
        SAVE_PC();
        jobject value = POPA ();
        jobject value = POPA ();
        jclass to = (jclass) AVAL ();
        jclass to = (jclass) AVAL ();
        value = (jobject) _Jv_CheckCast (to, value);
        value = (jobject) _Jv_CheckCast (to, value);
        PUSHA (value);
        PUSHA (value);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
 
 
    insn_instanceof:
    insn_instanceof:
      {
      {
        SAVE_PC();
        SAVE_PC();
        jobject value = POPA();
        jobject value = POPA();
        jint index = GET2U ();
        jint index = GET2U ();
        jclass to = (_Jv_Linker::resolve_pool_entry (meth->defining_class,
        jclass to = (_Jv_Linker::resolve_pool_entry (meth->defining_class,
                                                       index)).clazz;
                                                       index)).clazz;
        PUSHI (to->isInstance (value));
        PUSHI (to->isInstance (value));
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
        REWRITE_INSN (&&instanceof_resolved, datum, to);
        REWRITE_INSN (&&instanceof_resolved, datum, to);
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
    instanceof_resolved:
    instanceof_resolved:
      {
      {
        jobject value = POPA ();
        jobject value = POPA ();
        jclass to = (jclass) AVAL ();
        jclass to = (jclass) AVAL ();
        PUSHI (to->isInstance (value));
        PUSHI (to->isInstance (value));
      }
      }
      NEXT_INSN;
      NEXT_INSN;
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
 
 
    insn_monitorenter:
    insn_monitorenter:
      {
      {
        jobject value = POPA();
        jobject value = POPA();
        NULLCHECK(value);
        NULLCHECK(value);
        _Jv_MonitorEnter (value);
        _Jv_MonitorEnter (value);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_monitorexit:
    insn_monitorexit:
      {
      {
        jobject value = POPA();
        jobject value = POPA();
        NULLCHECK(value);
        NULLCHECK(value);
        _Jv_MonitorExit (value);
        _Jv_MonitorExit (value);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_ifnull:
    insn_ifnull:
      {
      {
        jobject val = POPA();
        jobject val = POPA();
        if (val == NULL)
        if (val == NULL)
          TAKE_GOTO;
          TAKE_GOTO;
        else
        else
          SKIP_GOTO;
          SKIP_GOTO;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_ifnonnull:
    insn_ifnonnull:
      {
      {
        jobject val = POPA();
        jobject val = POPA();
        if (val != NULL)
        if (val != NULL)
          TAKE_GOTO;
          TAKE_GOTO;
        else
        else
          SKIP_GOTO;
          SKIP_GOTO;
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
    insn_multianewarray:
    insn_multianewarray:
      {
      {
        SAVE_PC();
        SAVE_PC();
        int kind_index = GET2U ();
        int kind_index = GET2U ();
        int dim        = GET1U ();
        int dim        = GET1U ();
 
 
        jclass type
        jclass type
          = (_Jv_Linker::resolve_pool_entry (meth->defining_class,
          = (_Jv_Linker::resolve_pool_entry (meth->defining_class,
                                               kind_index)).clazz;
                                               kind_index)).clazz;
        jint *sizes    = (jint*) __builtin_alloca (sizeof (jint)*dim);
        jint *sizes    = (jint*) __builtin_alloca (sizeof (jint)*dim);
 
 
        for (int i = dim - 1; i >= 0; i--)
        for (int i = dim - 1; i >= 0; i--)
          {
          {
            sizes[i] = POPI ();
            sizes[i] = POPI ();
          }
          }
 
 
        jobject res    = _Jv_NewMultiArray (type,dim, sizes);
        jobject res    = _Jv_NewMultiArray (type,dim, sizes);
 
 
        PUSHA (res);
        PUSHA (res);
      }
      }
      NEXT_INSN;
      NEXT_INSN;
 
 
#ifndef DIRECT_THREADED
#ifndef DIRECT_THREADED
    insn_wide:
    insn_wide:
      {
      {
        jint the_mod_op = get1u (pc++);
        jint the_mod_op = get1u (pc++);
        jint wide       = get2u (pc); pc += 2;
        jint wide       = get2u (pc); pc += 2;
 
 
        switch (the_mod_op)
        switch (the_mod_op)
          {
          {
          case op_istore:
          case op_istore:
            STOREI (wide);
            STOREI (wide);
            NEXT_INSN;
            NEXT_INSN;
 
 
          case op_fstore:
          case op_fstore:
            STOREF (wide);
            STOREF (wide);
            NEXT_INSN;
            NEXT_INSN;
 
 
          case op_astore:
          case op_astore:
            STOREA (wide);
            STOREA (wide);
            NEXT_INSN;
            NEXT_INSN;
 
 
          case op_lload:
          case op_lload:
            LOADL (wide);
            LOADL (wide);
            NEXT_INSN;
            NEXT_INSN;
 
 
          case op_dload:
          case op_dload:
            LOADD (wide);
            LOADD (wide);
            NEXT_INSN;
            NEXT_INSN;
 
 
          case op_iload:
          case op_iload:
            LOADI (wide);
            LOADI (wide);
            NEXT_INSN;
            NEXT_INSN;
 
 
          case op_fload:
          case op_fload:
            LOADF (wide);
            LOADF (wide);
            NEXT_INSN;
            NEXT_INSN;
 
 
          case op_aload:
          case op_aload:
            LOADA (wide);
            LOADA (wide);
            NEXT_INSN;
            NEXT_INSN;
 
 
          case op_lstore:
          case op_lstore:
            STOREL (wide);
            STOREL (wide);
            NEXT_INSN;
            NEXT_INSN;
 
 
          case op_dstore:
          case op_dstore:
            STORED (wide);
            STORED (wide);
            NEXT_INSN;
            NEXT_INSN;
 
 
          case op_ret:
          case op_ret:
            pc = (unsigned char*) PEEKA (wide);
            pc = (unsigned char*) PEEKA (wide);
            NEXT_INSN;
            NEXT_INSN;
 
 
          case op_iinc:
          case op_iinc:
            {
            {
              jint amount = get2s (pc); pc += 2;
              jint amount = get2s (pc); pc += 2;
              jint value = PEEKI (wide);
              jint value = PEEKI (wide);
              POKEI (wide, value+amount);
              POKEI (wide, value+amount);
            }
            }
            NEXT_INSN;
            NEXT_INSN;
 
 
          default:
          default:
            throw_internal_error ("illegal bytecode modified by wide");
            throw_internal_error ("illegal bytecode modified by wide");
          }
          }
 
 
      }
      }
#endif /* DIRECT_THREADED */
#endif /* DIRECT_THREADED */
 
 
    insn_breakpoint:
    insn_breakpoint:
      {
      {
        using namespace ::java::lang;
        using namespace ::java::lang;
        jmethodID method = meth->self;
        jmethodID method = meth->self;
        jlocation location = meth->insn_index (pc - 1);
        jlocation location = meth->insn_index (pc - 1);
 
 
        using namespace gnu::gcj::jvmti;
        using namespace gnu::gcj::jvmti;
        Breakpoint *bp
        Breakpoint *bp
          = BreakpointManager::getBreakpoint (reinterpret_cast<jlong> (method),
          = BreakpointManager::getBreakpoint (reinterpret_cast<jlong> (method),
                                              location);
                                              location);
        JvAssert (bp != NULL);
        JvAssert (bp != NULL);
 
 
        // Save the insn here since the breakpoint could be removed
        // Save the insn here since the breakpoint could be removed
        // before the JVMTI notification returns.
        // before the JVMTI notification returns.
        pc_t opc = reinterpret_cast<pc_t> (bp->getInsn ());
        pc_t opc = reinterpret_cast<pc_t> (bp->getInsn ());
 
 
        bp->execute ();
        bp->execute ();
 
 
        // Continue execution
        // Continue execution
#ifdef DIRECT_THREADED
#ifdef DIRECT_THREADED
        goto *(opc->insn);
        goto *(opc->insn);
#else
#else
        goto *(insn_target[*opc]);
        goto *(insn_target[*opc]);
#endif
#endif
      }
      }
    }
    }
  catch (java::lang::Throwable *ex)
  catch (java::lang::Throwable *ex)
    {
    {
      // Check if the exception is handled and, if so, set the pc to the start
      // Check if the exception is handled and, if so, set the pc to the start
      // of the appropriate catch block.
      // of the appropriate catch block.
      if (meth->check_handler (&pc, meth, ex))
      if (meth->check_handler (&pc, meth, ex))
        {
        {
          sp = stack;
          sp = stack;
          sp++->o = ex; // Push exception.
          sp++->o = ex; // Push exception.
#ifdef __GCJ_DEBUG
#ifdef __GCJ_DEBUG
          if (JVMTI_REQUESTED_EVENT (ExceptionCatch))
          if (JVMTI_REQUESTED_EVENT (ExceptionCatch))
            {
            {
              using namespace gnu::gcj::jvmti;
              using namespace gnu::gcj::jvmti;
              jlong catch_meth = reinterpret_cast<jlong> (meth->get_method ());
              jlong catch_meth = reinterpret_cast<jlong> (meth->get_method ());
              jlong catch_loc = meth->insn_index (pc);
              jlong catch_loc = meth->insn_index (pc);
              _Jv_JVMTI_PostEvent (JVMTI_EVENT_EXCEPTION_CATCH, thread,
              _Jv_JVMTI_PostEvent (JVMTI_EVENT_EXCEPTION_CATCH, thread,
                                   _Jv_GetCurrentJNIEnv (), catch_meth,
                                   _Jv_GetCurrentJNIEnv (), catch_meth,
                                   catch_loc, ex);
                                   catch_loc, ex);
            }
            }
#endif
#endif
          NEXT_INSN;
          NEXT_INSN;
        }
        }
 
 
      // No handler, so re-throw.
      // No handler, so re-throw.
      throw ex;
      throw ex;
    }
    }
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.