if (type != null && type.isResolved() && type.isClassType() && target != null && type != target.getDeclaringClass()) { VM_Method vmeth = OPT_ClassLoaderProxy.lookupMethod(type.asClass(), ref); if (vmeth != null && vmeth != target) { methOp.refine(vmeth, isPreciseType);
if (type != null && type.isResolved() && type.isClassType() && target != null) { if (type == target.getDeclaringClass()) { if (isPreciseType) { methOp.refine(target, true); } } else { VM_Method vmeth = OPT_ClassLoaderProxy.lookupMethod(type.asClass(), ref); if (vmeth != null && vmeth != target) { methOp.refine(vmeth, isPreciseType); }
  private void generateFrom(int fromIndex) {    if (DBG_BB || DBG_SELECTED) {      db("generating code into " + currentBBLE + " with runoff " + runoff);    }    currentBBLE.setGenerated();    endOfBasicBlock = fallThrough = false;    lastInstr = null;    bcodes.reset(fromIndex);    while (true) {      // Must keep currentBBLE.high up-to-date in case we try to jump into       // the middle of the block we're currently generating.  Simply updating       // high once endsBasicBlock is true doesn't enable us to catch this case.      currentBBLE.high = instrIndex = bcodes.index();      int code = bcodes.nextInstruction();      if (DBG_BCPARSE) {        db("parsing " + instrIndex + " " + code + " : 0x" + Integer.toHexString(code));      }      OPT_Instruction s = null;      //-#if RVM_WITH_OSR      lastOsrBarrier = null;      //-#endif      switch (code) {      case JBC_nop:        break;      case JBC_aconst_null:        push(new OPT_NullConstantOperand());        break;      case JBC_iconst_m1:case JBC_iconst_0:case JBC_iconst_1:      case JBC_iconst_2:case JBC_iconst_3:case JBC_iconst_4:      case JBC_iconst_5:        push(new OPT_IntConstantOperand(code - JBC_iconst_0));        break;      case JBC_lconst_0:case JBC_lconst_1:        pushDual(new OPT_LongConstantOperand(code - JBC_lconst_0));        break;      case JBC_fconst_0:        push(new OPT_FloatConstantOperand(0.f));        break;      case JBC_fconst_1:        push(new OPT_FloatConstantOperand(1.f));        break;      case JBC_fconst_2:        push(new OPT_FloatConstantOperand(2.f));        break;      case JBC_dconst_0:        pushDual(new OPT_DoubleConstantOperand(0.));        break;      case JBC_dconst_1:        pushDual(new OPT_DoubleConstantOperand(1.));        break;      case JBC_bipush:        push(new OPT_IntConstantOperand(bcodes.getByteValue()));        break;              case JBC_sipush:        push(new OPT_IntConstantOperand(bcodes.getShortValue()));        break;      case JBC_ldc:        push(getConstantOperand(bcodes.getConstantIndex()));        break;      case JBC_ldc_w:        push(getConstantOperand(bcodes.getWideConstantIndex()));        break;      case JBC_ldc2_w:        pushDual(getConstantOperand(bcodes.getWideConstantIndex()));        break;      case JBC_iload:        s = do_iload(bcodes.getLocalNumber());        break;      case JBC_lload:        s = do_lload(bcodes.getLocalNumber());        break;      case JBC_fload:        s = do_fload(bcodes.getLocalNumber());        break;      case JBC_dload:        s = do_dload(bcodes.getLocalNumber());        break;      case JBC_aload:        s = do_aload(bcodes.getLocalNumber());        break;      case JBC_iload_0:case JBC_iload_1:case JBC_iload_2:case JBC_iload_3:        s = do_iload(code - JBC_iload_0);        break;      case JBC_lload_0:case JBC_lload_1:case JBC_lload_2:case JBC_lload_3:        s = do_lload(code - JBC_lload_0);        break;            case JBC_fload_0:case JBC_fload_1:case JBC_fload_2:case JBC_fload_3:        s = do_fload(code - JBC_fload_0);        break;            case JBC_dload_0:case JBC_dload_1:case JBC_dload_2:case JBC_dload_3:        s = do_dload(code - JBC_dload_0);        break;      case JBC_aload_0:case JBC_aload_1:case JBC_aload_2:case JBC_aload_3:        s = do_aload(code - JBC_aload_0);        break;      case JBC_iaload:        {          OPT_Operand index = popInt();          OPT_Operand ref = pop();          clearCurrentGuard();          if (do_NullCheck(ref) || do_BoundsCheck(ref, index))            break;          if (VM.VerifyAssertions)            assertIsType(ref, VM_TypeReference.IntArray);          s = _aloadHelper(INT_ALOAD, ref, index, VM_TypeReference.Int);        }        break;      case JBC_laload:        {          OPT_Operand index = popInt();          OPT_Operand ref = pop();          clearCurrentGuard();          if (do_NullCheck(ref) || do_BoundsCheck(ref, index))            break;          if (VM.VerifyAssertions)            assertIsType(ref, VM_TypeReference.LongArray);          s = _aloadHelper(LONG_ALOAD, ref, index, VM_TypeReference.Long);        }        break;      case JBC_faload:        {          OPT_Operand index = popInt();          OPT_Operand ref = pop();          clearCurrentGuard();          if (do_NullCheck(ref) || do_BoundsCheck(ref, index))            break;          if (VM.VerifyAssertions)            assertIsType(ref, VM_TypeReference.FloatArray);          s = _aloadHelper(FLOAT_ALOAD, ref, index, VM_TypeReference.Float);        }        break;                case JBC_daload:        {          OPT_Operand index = popInt();          OPT_Operand ref = pop();          clearCurrentGuard();          if (do_NullCheck(ref) || do_BoundsCheck(ref, index))            break;          if (VM.VerifyAssertions)            assertIsType(ref, VM_TypeReference.DoubleArray);          s = _aloadHelper(DOUBLE_ALOAD, ref, index, VM_TypeReference.Double);        }        break;      case JBC_aaload:        {          OPT_Operand index = popInt();          OPT_Operand ref = pop();          clearCurrentGuard();          if (do_NullCheck(ref) || do_BoundsCheck(ref, index))            break;          VM_TypeReference type = getRefTypeOf(ref).getArrayElementType();          if (VM.VerifyAssertions) VM._assert(type.isReferenceType());          s = _aloadHelper(REF_ALOAD, ref, index, type);        }        break;      case JBC_baload:        {          OPT_Operand index = popInt();          OPT_Operand ref = pop();          clearCurrentGuard();          if (do_NullCheck(ref) || do_BoundsCheck(ref, index))            break;          VM_TypeReference type = getArrayTypeOf(ref);          if (VM.VerifyAssertions) {            VM._assert(type == VM_TypeReference.ByteArray ||                        type == VM_TypeReference.BooleanArray);          }          if (type == VM_TypeReference.ByteArray)            s = _aloadHelper(BYTE_ALOAD, ref, index, VM_TypeReference.Byte);          else             s = _aloadHelper(UBYTE_ALOAD, ref, index, VM_TypeReference.Boolean);        }        break;      case JBC_caload:        {          OPT_Operand index = popInt();          OPT_Operand ref = pop();          clearCurrentGuard();          if (do_NullCheck(ref) || do_BoundsCheck(ref, index))            break;          if (VM.VerifyAssertions)            assertIsType(ref, VM_TypeReference.CharArray);          s = _aloadHelper(USHORT_ALOAD, ref, index, VM_TypeReference.Char);        }        break;              case JBC_saload:        {          OPT_Operand index = popInt();          OPT_Operand ref = pop();          clearCurrentGuard();          if (do_NullCheck(ref) || do_BoundsCheck(ref, index))            break;          if (VM.VerifyAssertions)            assertIsType(ref, VM_TypeReference.ShortArray);          s = _aloadHelper(SHORT_ALOAD, ref, index, VM_TypeReference.Short);        }        break;      case JBC_istore:        s = do_store(bcodes.getLocalNumber(), popInt());        break;      case JBC_lstore:        s = do_store(bcodes.getLocalNumber(), popLong());        break;      case JBC_fstore:        s = do_store(bcodes.getLocalNumber(), popFloat());        break;      case JBC_dstore:        s = do_store(bcodes.getLocalNumber(), popDouble());        break;      case JBC_astore:        s = do_astore(bcodes.getLocalNumber());        break;      case JBC_istore_0:case JBC_istore_1:case JBC_istore_2:case JBC_istore_3:        s = do_store(code - JBC_istore_0, popInt());        break;      case JBC_lstore_0:case JBC_lstore_1:case JBC_lstore_2:case JBC_lstore_3:        s = do_store(code - JBC_lstore_0, popLong());        break;      case JBC_fstore_0:case JBC_fstore_1:case JBC_fstore_2:case JBC_fstore_3:        s = do_store(code - JBC_fstore_0, popFloat());        break;      case JBC_dstore_0:case JBC_dstore_1:case JBC_dstore_2:case JBC_dstore_3:        s = do_store(code - JBC_dstore_0, popDouble());        break;      case JBC_astore_0:case JBC_astore_1:case JBC_astore_2:case JBC_astore_3:        s = do_astore(code - JBC_astore_0);        break;      case JBC_iastore:        {          OPT_Operand val = popInt();          OPT_Operand index = popInt();          OPT_Operand ref = pop();          clearCurrentGuard();          if (do_NullCheck(ref) || do_BoundsCheck(ref, index))            break;          if (VM.VerifyAssertions)              assertIsType(ref, VM_TypeReference.IntArray);          s = AStore.create(INT_ASTORE, val, ref, index,                            new OPT_LocationOperand(VM_TypeReference.Int),                            getCurrentGuard());        }        break;      case JBC_lastore:        {          OPT_Operand val = popLong();          OPT_Operand index = popInt();          OPT_Operand ref = pop();          clearCurrentGuard();          if (do_NullCheck(ref) || do_BoundsCheck(ref, index))            break;          if (VM.VerifyAssertions)            assertIsType(ref, VM_TypeReference.LongArray);          s = AStore.create(LONG_ASTORE, val, ref, index,                             new OPT_LocationOperand(VM_TypeReference.Long),                            getCurrentGuard());        }        break;      case JBC_fastore:        {          OPT_Operand val = popFloat();          OPT_Operand index = popInt();          OPT_Operand ref = pop();          clearCurrentGuard();          if (do_NullCheck(ref) || do_BoundsCheck(ref, index))            break;          if (VM.VerifyAssertions)            assertIsType(ref, VM_TypeReference.FloatArray);          s = AStore.create(FLOAT_ASTORE, val, ref, index,                             new OPT_LocationOperand(VM_TypeReference.Float),                            getCurrentGuard());        }        break;      case JBC_dastore:        {          OPT_Operand val = popDouble();          OPT_Operand index = popInt();          OPT_Operand ref = pop();          clearCurrentGuard();          if (do_NullCheck(ref) || do_BoundsCheck(ref, index))            break;          if (VM.VerifyAssertions)            assertIsType(ref, VM_TypeReference.DoubleArray);          s = AStore.create(DOUBLE_ASTORE, val, ref, index,                             new OPT_LocationOperand(VM_TypeReference.Double),                            getCurrentGuard());        }        break;      case JBC_aastore:        {          OPT_Operand val = pop();          OPT_Operand index = popInt();          OPT_Operand ref = pop();          clearCurrentGuard();          if (do_NullCheck(ref) || do_BoundsCheck(ref, index))            break;          VM_TypeReference type = getRefTypeOf(ref).getArrayElementType();          if (VM.VerifyAssertions) VM._assert(type.isReferenceType());          if (do_CheckStore(ref, val, type))              break;          s = AStore.create(REF_ASTORE,                             val, ref, index,                            new OPT_LocationOperand(type),                            getCurrentGuard());        }        break;      case JBC_bastore:        {          OPT_Operand val = popInt();          OPT_Operand index = popInt();          OPT_Operand ref = pop();          clearCurrentGuard();          if (do_NullCheck(ref) || do_BoundsCheck(ref, index))            break;          VM_TypeReference type = getArrayTypeOf(ref);          if (VM.VerifyAssertions) {            VM._assert(type == VM_TypeReference.ByteArray ||                       type == VM_TypeReference.BooleanArray);          }          if (type == VM_TypeReference.ByteArray)            type = VM_TypeReference.Byte;          else             type = VM_TypeReference.Boolean;          s = AStore.create(BYTE_ASTORE, val, ref, index,                            new OPT_LocationOperand(type),                            getCurrentGuard());        }        break;      case JBC_castore:        {          OPT_Operand val = popInt();          OPT_Operand index = popInt();          OPT_Operand ref = pop();          clearCurrentGuard();          if (do_NullCheck(ref) || do_BoundsCheck(ref, index))            break;          if (VM.VerifyAssertions)            assertIsType(ref, VM_TypeReference.CharArray);          s = AStore.create(SHORT_ASTORE, val, ref, index,                            new OPT_LocationOperand(VM_TypeReference.Char),                            getCurrentGuard());        }        break;      case JBC_sastore:        {          OPT_Operand val = popInt();          OPT_Operand index = popInt();          OPT_Operand ref = pop();          clearCurrentGuard();          if (do_NullCheck(ref) || do_BoundsCheck(ref, index))            break;          if (VM.VerifyAssertions)            assertIsType(ref, VM_TypeReference.ShortArray);          s = AStore.create(SHORT_ASTORE, val, ref, index,                            new OPT_LocationOperand(VM_TypeReference.Short),                            getCurrentGuard());        }        break;      case JBC_pop:        stack.pop();        break;      case JBC_pop2:        stack.pop2();        break;      case JBC_dup:        {          OPT_Operand op1 = stack.pop();          stack.push(op1);          s = pushCopy(op1);        }        break;      case JBC_dup_x1:        {          OPT_Operand op1 = stack.pop();          OPT_Operand op2 = stack.pop();          stack.push(op1);          stack.push(op2);          s = pushCopy(op1);        }        break;      case JBC_dup_x2:        {          OPT_Operand op1 = stack.pop();          OPT_Operand op2 = stack.pop();          OPT_Operand op3 = stack.pop();          stack.push(op1);          stack.push(op3);          stack.push(op2);          s = pushCopy(op1);        }        break;      case JBC_dup2:        {          OPT_Operand op1 = stack.pop();          OPT_Operand op2 = stack.pop();          stack.push(op2);          stack.push(op1);          s = pushCopy(op2);          if (s != null) {            appendInstruction(s);            s = null;          }          s = pushCopy(op1);        }        break;      case JBC_dup2_x1:        {          OPT_Operand op1 = stack.pop();          OPT_Operand op2 = stack.pop();          OPT_Operand op3 = stack.pop();          stack.push(op2);          stack.push(op1);          stack.push(op3);          s = pushCopy(op2);          if (s != null) {            appendInstruction(s);            s = null;          }          s = pushCopy(op1);        }        break;      case JBC_dup2_x2:        {          OPT_Operand op1 = stack.pop();          OPT_Operand op2 = stack.pop();          OPT_Operand op3 = stack.pop();          OPT_Operand op4 = stack.pop();          stack.push(op2);          stack.push(op1);          stack.push(op4);          stack.push(op3);          s = pushCopy(op2);          if (s != null) {            appendInstruction(s);            s = null;          }          s = pushCopy(op1);        }        break;      case JBC_swap:        {          OPT_Operand op1 = stack.pop();          OPT_Operand op2 = stack.pop();          stack.push(op1);          stack.push(op2);        }        break;      case JBC_iadd:        {          OPT_Operand op2 = popInt();          OPT_Operand op1 = popInt();          s = _binaryHelper(INT_ADD, op1, op2, VM_TypeReference.Int);        }        break;      case JBC_ladd:        {          OPT_Operand op2 = popLong();          OPT_Operand op1 = popLong();          s = _binaryDualHelper(LONG_ADD, op1, op2, VM_TypeReference.Long);        }        break;      case JBC_fadd:        {          OPT_Operand op2 = popFloat();          OPT_Operand op1 = popFloat();          s = _binaryHelper(FLOAT_ADD, op1, op2, VM_TypeReference.Float);        }        break;      case JBC_dadd:        {          OPT_Operand op2 = popDouble();          OPT_Operand op1 = popDouble();          s = _binaryDualHelper(DOUBLE_ADD, op1, op2, VM_TypeReference.Double);        }        break;      case JBC_isub:        {          OPT_Operand op2 = popInt();          OPT_Operand op1 = popInt();          s = _binaryHelper(INT_SUB, op1, op2, VM_TypeReference.Int);        }        break;      case JBC_lsub:        {          OPT_Operand op2 = popLong();          OPT_Operand op1 = popLong();          s = _binaryDualHelper(LONG_SUB, op1, op2, VM_TypeReference.Long);        }        break;      case JBC_fsub:        {          OPT_Operand op2 = popFloat();          OPT_Operand op1 = popFloat();          s = _binaryHelper(FLOAT_SUB, op1, op2, VM_TypeReference.Float);        }        break;      case JBC_dsub:        {          OPT_Operand op2 = popDouble();          OPT_Operand op1 = popDouble();          s = _binaryDualHelper(DOUBLE_SUB, op1, op2, VM_TypeReference.Double);        }        break;      case JBC_imul:        {          OPT_Operand op2 = popInt();          OPT_Operand op1 = popInt();          s = _binaryHelper(INT_MUL, op1, op2, VM_TypeReference.Int);        }        break;      case JBC_lmul:        {          OPT_Operand op2 = popLong();          OPT_Operand op1 = popLong();          s = _binaryDualHelper(LONG_MUL, op1, op2, VM_TypeReference.Long);        }        break;      case JBC_fmul:        {          OPT_Operand op2 = popFloat();          OPT_Operand op1 = popFloat();          s = _binaryHelper(FLOAT_MUL, op1, op2, VM_TypeReference.Float);        }        break;      case JBC_dmul:        {          OPT_Operand op2 = popDouble();          OPT_Operand op1 = popDouble();          s = _binaryDualHelper(DOUBLE_MUL, op1, op2, VM_TypeReference.Double);        }        break;      case JBC_idiv:        {          clearCurrentGuard();          OPT_Operand op2 = popInt();          OPT_Operand op1 = popInt();          if (do_IntZeroCheck(op2))            break;          s = _guardedBinaryHelper(INT_DIV, op1, op2, getCurrentGuard(),                                    VM_TypeReference.Int);        }        break;      case JBC_ldiv:        {          clearCurrentGuard();          OPT_Operand op2 = popLong();          OPT_Operand op1 = popLong();          if (do_LongZeroCheck(op2))            break;          s = _guardedBinaryDualHelper(LONG_DIV, op1, op2, getCurrentGuard(),                                        VM_TypeReference.Long);        }        break;      case JBC_fdiv:        {          OPT_Operand op2 = popFloat();          OPT_Operand op1 = popFloat();          s = _binaryHelper(FLOAT_DIV, op1, op2, VM_TypeReference.Float);        }        break;      case JBC_ddiv:        {          OPT_Operand op2 = popDouble();          OPT_Operand op1 = popDouble();          s = _binaryDualHelper(DOUBLE_DIV, op1, op2, VM_TypeReference.Double);        }        break;      case JBC_irem:        {          clearCurrentGuard();          OPT_Operand op2 = popInt();          OPT_Operand op1 = popInt();          if (do_IntZeroCheck(op2))            break;          s = _guardedBinaryHelper(INT_REM, op1, op2, getCurrentGuard(),                                    VM_TypeReference.Int);        }        break;      case JBC_lrem:        {          clearCurrentGuard();          OPT_Operand op2 = popLong();          OPT_Operand op1 = popLong();          if (do_LongZeroCheck(op2))            break;          s = _guardedBinaryDualHelper(LONG_REM, op1, op2, getCurrentGuard(),                                        VM_TypeReference.Long);        }        break;      case JBC_frem:        {          OPT_Operand op2 = popFloat();          OPT_Operand op1 = popFloat();          s = _binaryHelper(FLOAT_REM, op1, op2, VM_TypeReference.Float);        }        break;      case JBC_drem:        {          OPT_Operand op2 = popDouble();          OPT_Operand op1 = popDouble();          s = _binaryDualHelper(DOUBLE_REM, op1, op2, VM_TypeReference.Double);        }        break;      case JBC_ineg:        s = _unaryHelper(INT_NEG, popInt(), VM_TypeReference.Int);        break;      case JBC_lneg:        s = _unaryDualHelper(LONG_NEG, popLong(), VM_TypeReference.Long);        break;      case JBC_fneg:        s = _unaryHelper(FLOAT_NEG, popFloat(), VM_TypeReference.Float);        break;      case JBC_dneg:        s = _unaryDualHelper(DOUBLE_NEG, popDouble(), VM_TypeReference.Double);        break;      case JBC_ishl:        {          OPT_Operand op2 = popInt();          OPT_Operand op1 = popInt();          s = _binaryHelper(INT_SHL, op1, op2, VM_TypeReference.Int);        }        break;      case JBC_lshl:        {          OPT_Operand op2 = popInt();          OPT_Operand op1 = popLong();          s = _binaryDualHelper(LONG_SHL, op1, op2, VM_TypeReference.Long);        }        break;            case JBC_ishr:        {          OPT_Operand op2 = popInt();          OPT_Operand op1 = popInt();          s = _binaryHelper(INT_SHR, op1, op2, VM_TypeReference.Int);        }        break;      case JBC_lshr:        {          OPT_Operand op2 = popInt();          OPT_Operand op1 = popLong();          s = _binaryDualHelper(LONG_SHR, op1, op2, VM_TypeReference.Long);        }         break;      case JBC_iushr:        {          OPT_Operand op2 = popInt();          OPT_Operand op1 = popInt();          s = _binaryHelper(INT_USHR, op1, op2, VM_TypeReference.Int);        }        break;      case JBC_lushr:        {          OPT_Operand op2 = popInt();          OPT_Operand op1 = popLong();          s = _binaryDualHelper(LONG_USHR, op1, op2, VM_TypeReference.Long);        }        break;            case JBC_iand:        {          OPT_Operand op2 = popInt();          OPT_Operand op1 = popInt();          s = _binaryHelper(INT_AND, op1, op2, VM_TypeReference.Int);        }        break;      case JBC_land:        {          OPT_Operand op2 = popLong();          OPT_Operand op1 = popLong();          s = _binaryDualHelper(LONG_AND, op1, op2, VM_TypeReference.Long);        }        break;      case JBC_ior:        {          OPT_Operand op2 = popInt();          OPT_Operand op1 = popInt();          s = _binaryHelper(INT_OR, op1, op2, VM_TypeReference.Int);        }        break;      case JBC_lor:        {          OPT_Operand op2 = popLong();          OPT_Operand op1 = popLong();          s = _binaryDualHelper(LONG_OR, op1, op2, VM_TypeReference.Long);        }        break;      case JBC_ixor:        {          OPT_Operand op2 = popInt();          OPT_Operand op1 = popInt();          s = _binaryHelper(INT_XOR, op1, op2, VM_TypeReference.Int);        }        break;      case JBC_lxor:        {          OPT_Operand op2 = popLong();          OPT_Operand op1 = popLong();          s = _binaryDualHelper(LONG_XOR, op1, op2, VM_TypeReference.Long);        }        break;      case JBC_iinc:        {          int index = bcodes.getLocalNumber();          s = do_iinc(index, bcodes.getIncrement());        }        break;      case JBC_i2l:        s = _unaryDualHelper(INT_2LONG, popInt(), VM_TypeReference.Long);        break;      case JBC_i2f:        s = _unaryHelper(INT_2FLOAT, popInt(), VM_TypeReference.Float);        break;      case JBC_i2d:        s = _unaryDualHelper(INT_2DOUBLE, popInt(), VM_TypeReference.Double);        break;      case JBC_l2i:        s = _unaryHelper(LONG_2INT, popLong(), VM_TypeReference.Int);        break;      case JBC_l2f:        s = _unaryHelper(LONG_2FLOAT, popLong(), VM_TypeReference.Float);        break;      case JBC_l2d:        s = _unaryDualHelper(LONG_2DOUBLE, popLong(), VM_TypeReference.Double);        break;      case JBC_f2i:        s = _unaryHelper(FLOAT_2INT, popFloat(), VM_TypeReference.Int);        break;      case JBC_f2l:        s = _unaryDualHelper(FLOAT_2LONG, popFloat(), VM_TypeReference.Long);        break;      case JBC_f2d:        s = _unaryDualHelper(FLOAT_2DOUBLE, popFloat(), VM_TypeReference.Double);        break;      case JBC_d2i:        s = _unaryHelper(DOUBLE_2INT, popDouble(), VM_TypeReference.Int);        break;      case JBC_d2l:        s = _unaryDualHelper(DOUBLE_2LONG, popDouble(), VM_TypeReference.Long);        break;      case JBC_d2f:        s = _unaryHelper(DOUBLE_2FLOAT, popDouble(), VM_TypeReference.Float);        break;      case JBC_int2byte:        s = _unaryHelper(INT_2BYTE, popInt(), VM_TypeReference.Byte);        break;      case JBC_int2char:        s = _unaryHelper(INT_2USHORT, popInt(), VM_TypeReference.Char);        break;      case JBC_int2short:        s = _unaryHelper(INT_2SHORT, popInt(), VM_TypeReference.Short);        break;      case JBC_lcmp:        {          OPT_Operand op2 = popLong();          OPT_Operand op1 = popLong();          s = _binaryHelper(LONG_CMP, op1, op2, VM_TypeReference.Int);        }        break;      case JBC_fcmpl:        {          OPT_Operand op2 = popFloat();          OPT_Operand op1 = popFloat();          s = _binaryHelper(FLOAT_CMPL, op1, op2, VM_TypeReference.Int);        }        break;            case JBC_fcmpg:        {          OPT_Operand op2 = popFloat();          OPT_Operand op1 = popFloat();          s = _binaryHelper(FLOAT_CMPG, op1, op2, VM_TypeReference.Int);        }        break;      case JBC_dcmpl:        {          OPT_Operand op2 = popDouble();          OPT_Operand op1 = popDouble();          s = _binaryHelper(DOUBLE_CMPL, op1, op2, VM_TypeReference.Int);        }        break;      case JBC_dcmpg:        {          OPT_Operand op2 = popDouble();          OPT_Operand op1 = popDouble();          s = _binaryHelper(DOUBLE_CMPG, op1, op2, VM_TypeReference.Int);        }        break;      case JBC_ifeq:        s = _intIfHelper(OPT_ConditionOperand.EQUAL());        break;      case JBC_ifne:        s = _intIfHelper(OPT_ConditionOperand.NOT_EQUAL());        break;      case JBC_iflt:        s = _intIfHelper(OPT_ConditionOperand.LESS());        break;      case JBC_ifge:        s = _intIfHelper(OPT_ConditionOperand.GREATER_EQUAL());        break;      case JBC_ifgt:        s = _intIfHelper(OPT_ConditionOperand.GREATER());        break;      case JBC_ifle:        s = _intIfHelper(OPT_ConditionOperand.LESS_EQUAL());        break;      case JBC_if_icmpeq:        s = _intIfCmpHelper(OPT_ConditionOperand.EQUAL());        break;      case JBC_if_icmpne:        s = _intIfCmpHelper(OPT_ConditionOperand.NOT_EQUAL());        break;      case JBC_if_icmplt:        s = _intIfCmpHelper(OPT_ConditionOperand.LESS());        break;      case JBC_if_icmpge:        s = _intIfCmpHelper(OPT_ConditionOperand.GREATER_EQUAL());        break;      case JBC_if_icmpgt:        s = _intIfCmpHelper(OPT_ConditionOperand.GREATER());        break;      case JBC_if_icmple:        s = _intIfCmpHelper(OPT_ConditionOperand.LESS_EQUAL());        break;      case JBC_if_acmpeq:        s = _refIfCmpHelper(OPT_ConditionOperand.EQUAL());        break;      case JBC_if_acmpne:        s = _refIfCmpHelper(OPT_ConditionOperand.NOT_EQUAL());        break;      case JBC_goto:        {          int offset = bcodes.getBranchOffset();          if (offset != 3)   // skip generating frivolous goto's            s = _gotoHelper(offset);        }        break;      case JBC_jsr:        s = _jsrHelper(bcodes.getBranchOffset());        break;      case JBC_ret:        s = _retHelper(bcodes.getLocalNumber());        break;      case JBC_tableswitch:        {          bcodes.alignSwitch();          OPT_Operand op0 = popInt();          int defaultoff = bcodes.getDefaultSwitchOffset();          int low = bcodes.getLowSwitchValue();          int high = bcodes.getHighSwitchValue();          int number = high - low + 1;          if (CF_TABLESWITCH && op0 instanceof OPT_IntConstantOperand) {            int v1 = ((OPT_IntConstantOperand)op0).value;            int match = bcodes.computeTableSwitchOffset(v1, low, high);            int offset = match == 0 ? defaultoff : match;            bcodes.skipTableSwitchOffsets(number);            if (DBG_CF) {              db("changed tableswitch to goto because index (" + v1 + ") is constant");            }            s = _gotoHelper(offset);            break;          }          s = TableSwitch.create(TABLESWITCH, op0, null, null,                                  new OPT_IntConstantOperand(low),                                  new OPT_IntConstantOperand(high),                                  generateTarget(defaultoff),                                  null,                                 number*2);          for (int i = 0; i < number; ++i) {            TableSwitch.setTarget(s, i, generateTarget(bcodes.getTableSwitchOffset(i)));          }          bcodes.skipTableSwitchOffsets(number);                    // Set branch probabilities//-#if RVM_WITH_OSR          VM_SwitchBranchProfile sp = gc.getSwitchProfile(instrIndex-bciAdjustment);//-#else          VM_SwitchBranchProfile sp = gc.getSwitchProfile(instrIndex);//-#endif          if (sp == null) {            float approxProb = 1.0f/(float)(number+1); // number targets + default            TableSwitch.setDefaultBranchProfile(s, new OPT_BranchProfileOperand(approxProb));            for (int i = 0; i < number; ++i) {              TableSwitch.setBranchProfile(s, i, new OPT_BranchProfileOperand(approxProb));            }          } else {            TableSwitch.setDefaultBranchProfile(s, new OPT_BranchProfileOperand(sp.getDefaultProbability()));            for (int i = 0; i < number; ++i) {              TableSwitch.setBranchProfile(s, i, new OPT_BranchProfileOperand(sp.getCaseProbability(i)));            }          }        }        break;      case JBC_lookupswitch:        {          bcodes.alignSwitch();          OPT_Operand op0 = popInt();          int defaultoff = bcodes.getDefaultSwitchOffset();          int numpairs = bcodes.getSwitchLength();          if (numpairs == 0) {            s = _gotoHelper(defaultoff);            break;          }          if (CF_LOOKUPSWITCH && op0 instanceof OPT_IntConstantOperand) {            int v1 = ((OPT_IntConstantOperand)op0).value;            int match = bcodes.computeLookupSwitchOffset(v1, numpairs);            int offset = match == 0 ? defaultoff : match;            bcodes.skipLookupSwitchPairs(numpairs);            if (DBG_CF) {              db("changed lookupswitch to goto because index (" + v1 + ") is constant");            }            s = _gotoHelper(offset);            break;          }          // Construct switch          s = LookupSwitch.create(LOOKUPSWITCH, op0, null, null,                                   generateTarget(defaultoff),                                   null,  numpairs*3);          for (int i = 0; i < numpairs; ++i) {            LookupSwitch.setMatch(s, i, new OPT_IntConstantOperand(bcodes.getLookupSwitchValue(i)));            LookupSwitch.setTarget(s, i, generateTarget(bcodes.getLookupSwitchOffset(i)));          }          bcodes.skipLookupSwitchPairs(numpairs);          // Set branch probabilities//-#if RVM_WITH_OSR          VM_SwitchBranchProfile sp = gc.getSwitchProfile(instrIndex-bciAdjustment);//-#else          VM_SwitchBranchProfile sp = gc.getSwitchProfile(instrIndex);//-#endif          if (sp == null) {            float approxProb = 1.0f/(float)(numpairs+1); // num targets + default            LookupSwitch.setDefaultBranchProfile(s, new OPT_BranchProfileOperand(approxProb));            for (int i = 0; i < numpairs; ++i) {              LookupSwitch.setBranchProfile(s, i, new OPT_BranchProfileOperand(approxProb));            }          } else {            LookupSwitch.setDefaultBranchProfile(s, new OPT_BranchProfileOperand(sp.getDefaultProbability()));            for (int i = 0; i < numpairs; ++i) {              LookupSwitch.setBranchProfile(s, i, new OPT_BranchProfileOperand(sp.getCaseProbability(i)));            }          }        }        break;      case JBC_ireturn:        _returnHelper(INT_MOVE, popInt());        break;      case JBC_lreturn:        _returnHelper(LONG_MOVE, popLong());        break;      case JBC_freturn:        _returnHelper(FLOAT_MOVE, popFloat());        break;      case JBC_dreturn:        _returnHelper(DOUBLE_MOVE, popDouble());        break;      case JBC_areturn:        {          OPT_Operand op0 = popRef();          if (VM.VerifyAssertions && !op0.isDefinitelyNull()) {            VM_TypeReference retType = op0.getType();            if (retType.isWordType()) {              VM._assert(gc.method.getReturnType().isWordType());            } else {              // fudge to deal with conservative approximation               // in OPT_ClassLoaderProxy.findCommonSuperclass              if (retType != VM_TypeReference.JavaLangObject) {                assertIsAssignable(gc.method.getReturnType(), retType);              }            }          }          _returnHelper(REF_MOVE, op0);        }        break;      case JBC_return:        _returnHelper(null, null);        break;      case JBC_getstatic:        {          // field resolution          VM_FieldReference ref = bcodes.getFieldReference();          boolean unresolved = ref.needsDynamicLink(bcodes.method());          OPT_LocationOperand fieldOp = makeStaticFieldRef(ref);          OPT_Operand offsetOp;          VM_TypeReference fieldType = ref.getFieldContentsType();          OPT_RegisterOperand t = gc.temps.makeTemp(fieldType);          if (unresolved) {            OPT_RegisterOperand offsetrop = gc.temps.makeTempInt();            appendInstruction(Unary.create(RESOLVE_MEMBER, offsetrop.copyRO(), fieldOp.copy()));            offsetOp = offsetrop;            rectifyStateWithErrorHandler();          } else {            VM_Field field = ref.peekResolvedField();            offsetOp = new OPT_IntConstantOperand(field.getOffset());                      // use results of field analysis to refine type of result            VM_Type ft = fieldType.peekResolvedType();            if (ft != null && ft.isClassType()) {              VM_TypeReference concreteType = OPT_FieldAnalysis.getConcreteType(field);              if (concreteType != null) {                t.setPreciseType();                if (concreteType == fieldType) {                  t.setDeclaredType();                } else {                  fieldType = concreteType;                  t.type = concreteType;                }              }            }            // optimization:             // if the field is final and either initialized or            // in the bootimage, then get the value at compile time.            // TODO: applying this optimization to Floats or Doubles             //       causes problems.  Figure out why and fix it!            if (!fieldType.isDoubleType() && !fieldType.isFloatType()) {              if (field.isFinal()) {                VM_Class declaringClass = field.getDeclaringClass();                if (declaringClass.isInitialized() ||                    (VM.writingBootImage && declaringClass.isInBootImage())) {                  try {                    if (fieldType.isPrimitiveType()) {                      OPT_ConstantOperand rhs = OPT_StaticFieldReader.getStaticFieldValue(field);                      // VM.sysWrite("Replaced getstatic of "+field+" with "+rhs+"\n");                      push (rhs, fieldType);                      break;                    } else {                      if (OPT_StaticFieldReader.isStaticFieldNull(field)) {                        // VM.sysWrite("Replaced getstatic of "+field+" with <null>\n");                        push(new OPT_NullConstantOperand(), fieldType);                        break;                      } else {                        VM_TypeReference rtType = OPT_StaticFieldReader.getTypeFromStaticField(field);                        if (rtType == VM_TypeReference.JavaLangString) {                          OPT_ConstantOperand rhs = OPT_StaticFieldReader.getStaticFieldValue(field);                          // VM.sysWrite("Replaced getstatic of "+field+" with "+rhs+"\n");                          push (rhs, fieldType);                          break;                        } else {                          t.type = rtType;                          if (rtType != fieldType) t.clearDeclaredType();                          t.setPreciseType();                          markGuardlessNonNull(t);                          // VM.sysWrite("Tightened type info for getstatic of "+field+" to "+t+"\n");                        }                      }                    }                  } catch (NoSuchFieldException e) {                    // Sigh, host JDK java.* class didn't have this RVM field.                    // VM.sysWrite("Field "+field+" does not exist on host JDK\n");                  }                }              }            }          }          s = GetStatic.create(GETSTATIC, t, offsetOp, fieldOp);          push(t.copyD2U(), fieldType);        }        break;      case JBC_putstatic:        {          // field resolution          VM_FieldReference ref = bcodes.getFieldReference();          boolean unresolved = ref.needsDynamicLink(bcodes.method());          OPT_LocationOperand fieldOp = makeStaticFieldRef(ref);          OPT_Operand offsetOp;          if (unresolved) {            OPT_RegisterOperand offsetrop = gc.temps.makeTempInt();            appendInstruction(Unary.create(RESOLVE_MEMBER, offsetrop.copyRO(), fieldOp.copy()));            offsetOp = offsetrop;            rectifyStateWithErrorHandler();          } else {            VM_Field field = ref.peekResolvedField();            offsetOp = new OPT_IntConstantOperand(field.getOffset());          }          VM_TypeReference fieldType = ref.getFieldContentsType();          OPT_Operand r = pop(fieldType);          s = PutStatic.create(PUTSTATIC, r, offsetOp, fieldOp);        }        break;      case JBC_getfield:        {          // field resolution          VM_FieldReference ref = bcodes.getFieldReference();          boolean unresolved = ref.needsDynamicLink(bcodes.method());          OPT_LocationOperand fieldOp = makeInstanceFieldRef(ref);          OPT_Operand offsetOp;          VM_TypeReference fieldType = ref.getFieldContentsType();          OPT_RegisterOperand t = gc.temps.makeTemp(fieldType);          if (unresolved) {            OPT_RegisterOperand offsetrop = gc.temps.makeTempInt();            appendInstruction(Unary.create(RESOLVE_MEMBER, offsetrop.copyRO(), fieldOp.copy()));            offsetOp = offsetrop;            rectifyStateWithErrorHandler();          } else {            VM_Field field = ref.peekResolvedField();            offsetOp = new OPT_IntConstantOperand(field.getOffset());            // use results of field analysis to refine type.            VM_Type ft = fieldType.peekResolvedType();            if (ft != null && ft.isClassType()) {              VM_TypeReference concreteType = OPT_FieldAnalysis.getConcreteType(field);              if (concreteType != null) {                t.setPreciseType();                if (concreteType == fieldType) {                  t.setDeclaredType();                } else {                  fieldType = concreteType;                  t.type = concreteType;                }              }            }          }                    OPT_Operand op1 = pop();          clearCurrentGuard();          if (do_NullCheck(op1))            break;                    s = GetField.create(GETFIELD, t, op1, offsetOp, fieldOp, getCurrentGuard());          push(t.copyD2U(), fieldType);        }        break;      case JBC_putfield:        {          // field resolution          VM_FieldReference ref = bcodes.getFieldReference();          boolean unresolved = ref.needsDynamicLink(bcodes.method());          OPT_LocationOperand fieldOp = makeInstanceFieldRef(ref);          VM_TypeReference fieldType = ref.getFieldContentsType();          OPT_Operand offsetOp;          if (unresolved) {            OPT_RegisterOperand offsetrop = gc.temps.makeTempInt();            appendInstruction(Unary.create(RESOLVE_MEMBER, offsetrop.copyRO(), fieldOp.copy()));            offsetOp = offsetrop;            rectifyStateWithErrorHandler();          } else {            VM_Field field = ref.peekResolvedField();            offsetOp = new OPT_IntConstantOperand(field.getOffset());          }                    OPT_Operand val = pop(fieldType);          OPT_Operand obj = popRef();          clearCurrentGuard();          if (do_NullCheck(obj))            break;          s = PutField.create(PUTFIELD, val, obj, offsetOp, fieldOp, getCurrentGuard());        }        break;      case JBC_invokevirtual:        {          VM_MethodReference ref = bcodes.getMethodReference();          // See if this is a magic method (Address, Word, etc.)          // If it is, generate the inline code and we are done.          if (ref.getType().isMagicType()) {            boolean generated = OPT_GenerateMagic.generateMagic(this, gc, ref);            if (generated) break; // all done.          }          // A non-magical invokevirtual.  Create call instruction.          boolean unresolved = ref.needsDynamicLink(bcodes.method());          VM_Method target = ref.peekResolvedMethod();          OPT_MethodOperand methOp = OPT_MethodOperand.VIRTUAL(ref, target);          //-#if RVM_WITH_OSR          /* just create an osr barrier right before _callHelper           * changes the states of locals and stacks.           */          if (this.osrGuardedInline)  {            lastOsrBarrier = _createOsrBarrier();          }          //-#endif          s = _callHelper(ref, methOp);          // Handle possibility of dynamic linking. Must be done before null_check!          if (unresolved) {            OPT_RegisterOperand offsetrop = gc.temps.makeTempInt();            appendInstruction(Unary.create(RESOLVE_MEMBER, offsetrop.copyRO(), Call.getMethod(s).copy()));            Call.setAddress(s, offsetrop);            rectifyStateWithErrorHandler();          } else {            if (VM.VerifyAssertions) VM._assert(target != null);            Call.setAddress(s, new OPT_IntConstantOperand(target.getOffset()));          }          // null check receiver          OPT_Operand receiver = Call.getParam(s, 0);          clearCurrentGuard();          if (do_NullCheck(receiver)) {            // call will always raise null pointer exception            s = null;             break;           }          Call.setGuard(s, getCurrentGuard());          // Use compile time type of receiver to try reduce the number of targets.          // If we succeed, we'll update meth and s's method operand.          boolean isExtant = false;          boolean isPreciseType = false;          VM_TypeReference tr = null;          if (receiver.isRegister()) {            OPT_RegisterOperand rop = receiver.asRegister();            isExtant = rop.isExtant();            isPreciseType = rop.isPreciseType();            tr = rop.type;          } else if (receiver.isStringConstant()) {            isExtant = true;            isPreciseType = true;            tr = VM_TypeReference.JavaLangString;          } else if (VM.VerifyAssertions) {            VM._assert(false, "unexpected receiver");          }          if (isPreciseType && target != null) {            methOp.refine(target, true);          }          VM_Type type = tr.peekResolvedType();          if (type != null && type.isResolved() && type.isClassType() && target != null && type != target.getDeclaringClass()) {            VM_Method vmeth = OPT_ClassLoaderProxy.lookupMethod(type.asClass(), ref);            if (vmeth != null && vmeth != target) {              methOp.refine(vmeth, isPreciseType);            }          }          // Consider inlining it.           if (maybeInlineMethod(shouldInline(s, isExtant), s)) {            return;          }           // noninlined CALL must be treated as potential throw of anything          rectifyStateWithExceptionHandlers();         }        break;      case JBC_invokespecial:        {          VM_MethodReference ref = bcodes.getMethodReference();          VM_Method target = ref.resolveInvokeSpecial();          //-#if RVM_WITH_OSR          /* just create an osr barrier right before _callHelper           * changes the states of locals and stacks.           */          if (this.osrGuardedInline)             lastOsrBarrier = _createOsrBarrier();          //-#endif          s = _callHelper(ref, OPT_MethodOperand.SPECIAL(ref, target));          // Handle possibility of dynamic linking. Must be done before null_check!          // NOTE: different definition of unresolved due to semantics of invokespecial.          if (target == null) {            OPT_RegisterOperand offsetrop = gc.temps.makeTempInt();            appendInstruction(Unary.create(RESOLVE_MEMBER, offsetrop.copyRO(), Call.getMethod(s).copy()));            Call.setAddress(s, offsetrop);            rectifyStateWithErrorHandler();          } else {            Call.setAddress(s, new OPT_IntConstantOperand(target.getOffset()));          }          // null check receiver          OPT_Operand receiver = Call.getParam(s, 0);          clearCurrentGuard();          if (do_NullCheck(receiver)) {            // call will always raise null pointer exception            s = null;             break;           }          Call.setGuard(s, getCurrentGuard());          // Consider inlining it.           if (maybeInlineMethod(shouldInline(s, false), s)) {            return;          }                    // noninlined CALL must be treated as potential throw of anything          rectifyStateWithExceptionHandlers();         }        break;      case JBC_invokestatic:        {          VM_MethodReference ref = bcodes.getMethodReference();          // See if this is a magic method (VM_Magic, Address, Word, etc.)          // If it is, generate the inline code and we are done.          if (ref.getType().isMagicType()) {            boolean generated = OPT_GenerateMagic.generateMagic(this, gc, ref);            if (generated) break;          }                    // A non-magical invokestatic.  Create call instruction.          boolean unresolved = ref.needsDynamicLink(bcodes.method());          VM_Method target = ref.peekResolvedMethod();                    //-#if RVM_WITH_OSR          /* just create an osr barrier right before _callHelper           * changes the states of locals and stacks.           */          if (this.osrGuardedInline)             lastOsrBarrier = _createOsrBarrier();          //-#endif          s = _callHelper(ref, OPT_MethodOperand.STATIC(ref, target));                    // Handle possibility of dynamic linking.          if (unresolved) {            OPT_RegisterOperand offsetrop = gc.temps.makeTempInt();            appendInstruction(Unary.create(RESOLVE_MEMBER, offsetrop.copyRO(), Call.getMethod(s).copy()));            Call.setAddress(s, offsetrop);            rectifyStateWithErrorHandler();          } else {            Call.setAddress(s, new OPT_IntConstantOperand(target.getOffset()));          }          // Consider inlining it.           if (maybeInlineMethod(shouldInline(s, false), s)) {            return;          }                    // noninlined CALL must be treated as potential throw of anything          rectifyStateWithExceptionHandlers();         }        break;      case JBC_invokeinterface:        {          VM_MethodReference ref = bcodes.getMethodReference();          bcodes.alignInvokeInterface();          VM_Method resolvedMethod = null;          resolvedMethod = ref.peekInterfaceMethod();          //-#if RVM_WITH_OSR          /* just create an osr barrier right before _callHelper           * changes the states of locals and stacks.           */          if (this.osrGuardedInline)             lastOsrBarrier = _createOsrBarrier();          //-#endif          s = _callHelper(ref, OPT_MethodOperand.INTERFACE(ref, resolvedMethod));          OPT_RegisterOperand receiver = Call.getParam(s, 0).asRegister();          VM_Class receiverType = (VM_Class)receiver.type.peekResolvedType();          // null check on this parameter of call          // TODO: Strictly speaking we need to do dynamic linking of the interface          //       type BEFORE we do the null check. FIXME.          clearCurrentGuard();          if (do_NullCheck(receiver)) {            // call will always raise null pointer exception            s = null;             break;           }          Call.setGuard(s, getCurrentGuard());          boolean requiresImplementsTest =             VM.BuildForIMTInterfaceInvocation ||            (VM.BuildForITableInterfaceInvocation && VM.DirectlyIndexedITables);          // Invokeinterface requires a dynamic type check          // to ensure that the receiver object actually          // implements the interface.  This is necessary          // because the verifier does not detect incompatible class changes.          // Depending on the implementation of interface dispatching          // we are using, we may have to make this test explicit           // in the calling sequence if we can't prove at compile time          // that it is not needed.           if (requiresImplementsTest) {            if (resolvedMethod == null) {              // Sigh.  Can't even resolve the reference to figure out what interface              // method we are trying to call. Therefore we must make generate a call               // to an out-of-line typechecking routine to handle it at runtime.              OPT_RegisterOperand tibPtr =                 gc.temps.makeTemp(VM_TypeReference.JavaLangObjectArray);              OPT_Instruction getTib =                 GuardedUnary.create(GET_OBJ_TIB, tibPtr, receiver.copyU2U(), getCurrentGuard());              appendInstruction(getTib);              getTib.bcIndex = RUNTIME_SERVICES_BCI;              VM_Method target = VM_Entrypoints.unresolvedInvokeinterfaceImplementsTestMethod;              OPT_Instruction callCheck =                Call.create2(CALL, null, new OPT_IntConstantOperand(target.getOffset()),                              OPT_MethodOperand.STATIC(target),                             new OPT_IntConstantOperand(ref.getId()),                             tibPtr.copyD2U());              if (gc.options.NO_CALLEE_EXCEPTIONS) {                callCheck.markAsNonPEI();              }                            appendInstruction(callCheck);              callCheck.bcIndex = RUNTIME_SERVICES_BCI;                            requiresImplementsTest = false; // the above call subsumes the test              rectifyStateWithErrorHandler(); // Can raise incompatible class change error.            } else {              // We know what interface method the program wants to invoke.              // Attempt to avoid inserting the type check by seeing if the               // known static type of the receiver implements the desired interface.              VM_Type interfaceType = resolvedMethod.getDeclaringClass();              if (receiverType != null && receiverType.isResolved() && !receiverType.isInterface()) {                byte doesImplement =                   OPT_ClassLoaderProxy.includesType(interfaceType.getTypeRef(), receiverType.getTypeRef());                requiresImplementsTest = doesImplement != YES;              }            }          }          // Attempt to resolve the interface call to a particular virtual method.          // This is independent of whether or not the static type of the receiver is           // known to implement the interface and it is not that case that being able          // to prove one implies the other.          VM_Method vmeth = null;          if (receiverType != null && receiverType.isInitialized() && !receiverType.isInterface()) {            vmeth = OPT_ClassLoaderProxy.lookupMethod(receiverType, ref);          }          if (vmeth != null) {            VM_MethodReference vmethRef = vmeth.getMemberRef().asMethodReference();            // We're going to virtualize the call.  Must inject the            // DTC to ensure the receiver implements the interface if            // requiresImplementsTest is still true.            // Note that at this point requiresImplementsTest => resolvedMethod != null             if (requiresImplementsTest) {              appendInstruction(TypeCheck.create(MUST_IMPLEMENT_INTERFACE,                                                 receiver.copyU2U(),                                                 makeTypeOperand(resolvedMethod.getDeclaringClass()),                                                 getCurrentGuard()));              rectifyStateWithErrorHandler(); // Can raise incompatible class change error.            }            OPT_MethodOperand mop = OPT_MethodOperand.VIRTUAL(vmethRef, vmeth);            if (receiver.isPreciseType()) {              mop.refine(vmeth, true);            }            Call.setMethod(s, mop);            boolean unresolved = vmethRef.needsDynamicLink(bcodes.method());            if (unresolved) {              OPT_RegisterOperand offsetrop = gc.temps.makeTempInt();              appendInstruction(Unary.create(RESOLVE_MEMBER, offsetrop.copyRO(), Call.getMethod(s).copy()));              Call.setAddress(s, offsetrop);              rectifyStateWithErrorHandler();            } else {              Call.setAddress(s, new OPT_IntConstantOperand(vmeth.getOffset()));            }                        // Attempt to inline virtualized call.            if (maybeInlineMethod(shouldInline(s, receiver.isExtant()), s)) {              return;            }          } else {            // We can't virtualize the call;             // try to inline a predicted target for the interface invocation            // inline code will include DTC to ensure receiver implements the interface.            if (resolvedMethod != null && maybeInlineMethod(shouldInline(s, false), s)) {              return;            } else {              if (requiresImplementsTest) {                appendInstruction(TypeCheck.create(MUST_IMPLEMENT_INTERFACE,                                                   receiver.copyU2U(),                                                   makeTypeOperand(resolvedMethod.getDeclaringClass()),                                                   getCurrentGuard()));                // don't have to rectify with error handlers; rectify call below subsusmes.              }            }          }          // CALL must be treated as potential throw of anything          rectifyStateWithExceptionHandlers();         }        break;      case JBC_xxxunusedxxx:        OPT_OptimizingCompilerException.UNREACHABLE();        break;      case JBC_new:        {          VM_TypeReference klass = bcodes.getTypeReference();          OPT_RegisterOperand t = gc.temps.makeTemp(klass);          t.setPreciseType();          markGuardlessNonNull(t);          OPT_Operator operator;          OPT_TypeOperand klassOp;          VM_Class klassType = (VM_Class)klass.peekResolvedType();          if (klassType != null && (klassType.isInitialized() || klassType.isInBootImage())) {            klassOp = makeTypeOperand(klassType);            operator = NEW;          } else {             operator = NEW_UNRESOLVED;            klassOp = makeTypeOperand(klass);          }          s = New.create(operator, t, klassOp);          push(t.copyD2U());          rectifyStateWithErrorHandler();        }        break;      case JBC_newarray:        {          VM_Type array = bcodes.getPrimitiveArrayType();          OPT_TypeOperand arrayOp = makeTypeOperand(array);          OPT_RegisterOperand t = gc.temps.makeTemp(array.getTypeRef());          t.setPreciseType();          markGuardlessNonNull(t);          s = NewArray.create(NEWARRAY, t, arrayOp, popInt());          push(t.copyD2U());           rectifyStateWithExceptionHandler(VM_TypeReference.JavaLangNegativeArraySizeException);        }        break;      case JBC_anewarray:        {          VM_TypeReference elementTypeRef = bcodes.getTypeReference();          s = generateAnewarray(elementTypeRef);        }        break;      case JBC_arraylength:        {          OPT_Operand op1 = pop();          clearCurrentGuard();          if (do_NullCheck(op1))            break;          if (VM.VerifyAssertions)            VM._assert(getArrayTypeOf(op1).isArrayType());          OPT_RegisterOperand t = gc.temps.makeTempInt();          s = GuardedUnary.create(ARRAYLENGTH, t, op1, getCurrentGuard());          push(t.copyD2U());        }        break;      case JBC_athrow:        {          OPT_Operand op0 = pop();          clearCurrentGuard();          if (do_NullCheck(op0))            break;          VM_TypeReference type = getRefTypeOf(op0);          if (VM.VerifyAssertions) {            // fudge to handle conservative approximation of             // OPT_ClassLoaderProxy.findCommonSuperclass            if (type != VM_TypeReference.JavaLangObject)              assertIsAssignable(VM_TypeReference.JavaLangThrowable, type);          }          if (!gc.method.isInterruptible()) {            // prevent code motion in or out of uninterruptible code sequence            appendInstruction(Empty.create(UNINT_END));          }          endOfBasicBlock = true;          OPT_BasicBlock definiteTarget =             rectifyStateWithExceptionHandler(type, true);          if (definiteTarget != null) {            appendInstruction(CacheOp.create(SET_CAUGHT_EXCEPTION, op0));            s = Goto.create(GOTO, definiteTarget.makeJumpTarget());          } else {            s = Athrow.create(ATHROW, (OPT_RegisterOperand)op0);          }        }        break;      case JBC_checkcast:        {          VM_TypeReference typeRef = bcodes.getTypeReference();          boolean classLoading = couldCauseClassLoading(typeRef);          OPT_Operand op2 = pop();          if (typeRef.isWordType()) {            op2 = op2.copy();            if (op2 instanceof OPT_RegisterOperand) {              ((OPT_RegisterOperand)op2).type = typeRef;            }            push(op2);            if (DBG_CF) db("skipped gen of checkcast to word type "+typeRef);            break;          }          if (VM.VerifyAssertions) VM._assert(op2.isRef());          if (CF_CHECKCAST && !classLoading) {            if (op2.isDefinitelyNull()) {              push(op2);              if (DBG_CF) db("skipped gen of null checkcast");              break;            }            VM_TypeReference type = getRefTypeOf(op2);  // non-null, null case above            if (OPT_ClassLoaderProxy.includesType(typeRef,type)==YES){              push(op2);              if (DBG_CF)                db("skipped gen of checkcast of " + op2 + " from "                   + typeRef + " to " + type);              break;            }          }          if (!gc.options.NO_CHECKCAST) {            if (classLoading) {              s = TypeCheck.create(CHECKCAST_UNRESOLVED, op2, makeTypeOperand(typeRef));            } else {              OPT_TypeOperand typeOp = makeTypeOperand(typeRef.peekResolvedType());              if (isNonNull(op2)) {                s = TypeCheck.create(CHECKCAST_NOTNULL, op2, typeOp, getGuard(op2));              } else {                s = TypeCheck.create(CHECKCAST, op2, typeOp);              }            }          }          op2 = op2.copy();          if (op2 instanceof OPT_RegisterOperand) {            ((OPT_RegisterOperand)op2).type = typeRef;          }          push(op2);          rectifyStateWithExceptionHandler(VM_TypeReference.JavaLangClassCastException);          if (classLoading) rectifyStateWithErrorHandler();        }        break;      case JBC_instanceof:        {          VM_TypeReference typeRef = bcodes.getTypeReference();          boolean classLoading = couldCauseClassLoading(typeRef);          OPT_Operand op2 = pop();          if (VM.VerifyAssertions) VM._assert(op2.isRef());          if (CF_INSTANCEOF && !classLoading) {            if (op2.isDefinitelyNull()) {              push(new OPT_IntConstantOperand(0));              if (DBG_CF) db("skipped gen of null instanceof");              break;            }            VM_TypeReference type = getRefTypeOf(op2);                 // non-null            int answer =               OPT_ClassLoaderProxy.includesType(typeRef, type);            if (answer == YES && isNonNull(op2)) {              push(new OPT_IntConstantOperand(1));              if (DBG_CF)                db(op2 + " instanceof " + typeRef + " is always true ");              break;            } else if (answer == NO) {              if (DBG_CF)                db(op2 + " instanceof " + typeRef + " is always false ");              push(new OPT_IntConstantOperand(0));              break;            }          }          OPT_RegisterOperand t = gc.temps.makeTempInt();          if (classLoading) {            s = InstanceOf.create(INSTANCEOF_UNRESOLVED, t, makeTypeOperand(typeRef), op2);          } else {            OPT_TypeOperand typeOp = makeTypeOperand(typeRef.peekResolvedType());            if (isNonNull(op2)) {              s = InstanceOf.create(INSTANCEOF_NOTNULL, t, typeOp, op2, getGuard(op2));            } else {              s = InstanceOf.create(INSTANCEOF, t, typeOp, op2);            }           }          push(t.copyD2U());          if (classLoading) rectifyStateWithErrorHandler();        }        break;      case JBC_monitorenter:        {          OPT_Operand op0 = pop();          clearCurrentGuard();          if (do_NullCheck(op0))            break;          if (VM.VerifyAssertions) VM._assert(op0.isRef());          if (gc.options.MONITOR_NOP) {            s = null;          } else {            s = MonitorOp.create(MONITORENTER, op0, getCurrentGuard());          }        }        break;      case JBC_monitorexit:        {          OPT_Operand op0 = pop();          clearCurrentGuard();          if (do_NullCheck(op0))            break;          if (gc.options.MONITOR_NOP) {            s = null;          } else {            s = MonitorOp.create(MONITOREXIT, op0, getCurrentGuard());          }          rectifyStateWithExceptionHandler(VM_TypeReference.JavaLangIllegalMonitorStateException);        }        break;      case JBC_wide:        {          int widecode = bcodes.getWideOpcode();          int index = bcodes.getWideLocalNumber();          switch (widecode) {          case JBC_iload:            s = do_iload(index);            break;          case JBC_lload:            s = do_lload(index);            break;          case JBC_fload:            s = do_fload(index);            break;          case JBC_dload:            s = do_dload(index);            break;          case JBC_aload:            s = do_aload(index);            break;          case JBC_istore:            s = do_store(index, popInt());            break;          case JBC_lstore:            s = do_store(index, popLong());            break;          case JBC_fstore:            s = do_store(index, popFloat());            break;          case JBC_dstore:            s = do_store(index, popDouble());            break;          case JBC_astore:            s = do_astore(index);            break;          case JBC_iinc:            s = do_iinc(index, bcodes.getWideIncrement());            break;          case JBC_ret:            s = _retHelper(index);            break;          default:            OPT_OptimizingCompilerException.UNREACHABLE();            break;          }        }        break;      case JBC_multianewarray:        {          VM_TypeReference arrayType = bcodes.getTypeReference();          OPT_TypeOperand typeOp = makeTypeOperand(arrayType);          int dimensions = bcodes.getArrayDimension();          // Step 1: Create an int array to hold the dimensions.          OPT_TypeOperand dimArrayType = makeTypeOperand(VM_Array.IntArray);          OPT_RegisterOperand dimArray = gc.temps.makeTemp(VM_TypeReference.IntArray);          markGuardlessNonNull(dimArray);          dimArray.setPreciseType();          appendInstruction(NewArray.create(NEWARRAY, dimArray, dimArrayType,                                             new OPT_IntConstantOperand(dimensions)));          // Step 2: Assign the dimension values to dimArray          for (int i = dimensions; i > 0; i--) {            OPT_LocationOperand loc = new OPT_LocationOperand(VM_TypeReference.Int);            appendInstruction(AStore.create(INT_ASTORE, popInt(),                                             dimArray.copyD2U(),                                             new OPT_IntConstantOperand(i - 1),                                             loc, new OPT_TrueGuardOperand()));          }          // Step 3: Actually create the multiD array          OPT_RegisterOperand result = gc.temps.makeTemp(arrayType);          markGuardlessNonNull(result);          result.setPreciseType();          appendInstruction(NewArray.create(NEWOBJMULTIARRAY, result,                                             typeOp, dimArray.copyD2U()));          push(result.copyD2U());          rectifyStateWithErrorHandler();          rectifyStateWithExceptionHandler(VM_TypeReference.JavaLangNegativeArraySizeException);        }        break;      case JBC_ifnull:        s = _refIfNullHelper(OPT_ConditionOperand.EQUAL());        break;      case JBC_ifnonnull:        s = _refIfNullHelper(OPT_ConditionOperand.NOT_EQUAL());        break;      case JBC_goto_w:        {          int offset = bcodes.getWideBranchOffset();          if (offset != 5)         // skip generating frivolous goto's            s = _gotoHelper(offset);        }        break;      case JBC_jsr_w:        s = _jsrHelper(bcodes.getWideBranchOffset());        break;      //-#if RVM_WITH_OSR      case JBC_impdep1: {        int pseudo_opcode = bcodes.nextPseudoInstruction();        switch (pseudo_opcode) {        case PSEUDO_LoadIntConst: {          int value = bcodes.readIntConst();          if (VM.TraceOnStackReplacement)             VM.sysWriteln("PSEUDO_LoadIntConst "+value);          push(new OPT_IntConstantOperand(value));          // used for PSEUDO_InvokeStatic to recover the type info          param1 = param2;          param2 = value;          break;        }        case PSEUDO_LoadLongConst: {          long value = bcodes.readLongConst();          if (VM.TraceOnStackReplacement)             VM.sysWriteln("PSEUDO_LoadLongConst "+value);          // put on jtoc          int offset = VM_Statics.findOrCreateLongLiteral(value);          pushDual(new OPT_LongConstantOperand(value, offset));          break;        }        case PSEUDO_LoadWordConst: {          Address a;          //-#if RVM_FOR_32_ADDR          a = Address.fromIntSignExtend(bcodes.readIntConst());          //-#endif          //-#if RVM_FOR_64_ADDR          a = Address.fromLong(bcodes.readLongConst());          //-#endif          push(new OPT_AddressConstantOperand(a));                    if (VM.TraceOnStackReplacement)             VM.sysWrite("PSEUDO_LoadWordConst 0x");            VM.sysWrite(a);            VM.sysWriteln();          break;        }        case PSEUDO_LoadFloatConst:        {          int ibits = bcodes.readIntConst();          float value = Float.intBitsToFloat(ibits);          if (VM.TraceOnStackReplacement)             VM.sysWriteln("PSEUDO_LoadFloatConst "+value);          int offset = VM_Statics.findOrCreateFloatLiteral(ibits);          push(new OPT_FloatConstantOperand(value, offset));          break;        }        case PSEUDO_LoadDoubleConst:        {          long lbits = bcodes.readLongConst();          double value = VM_Magic.longBitsAsDouble(lbits);          if (VM.TraceOnStackReplacement)             VM.sysWriteln("PSEUDO_LoadDoubleConst "+ lbits);          // put on jtoc          int offset = VM_Statics.findOrCreateDoubleLiteral(lbits);          pushDual(new OPT_DoubleConstantOperand(value, offset));          break;        }        case PSEUDO_LoadRetAddrConst:        {          int value = bcodes.readIntConst();          if (VM.TraceOnStackReplacement)                 VM.sysWriteln("PSEUDO_LoadRetAddrConst "+value);          push(new ReturnAddressOperand(value));          break;        }        case PSEUDO_InvokeStatic:        {          /* pseudo invoke static for getRefAt and cleanRefAt, both must be resolved already */          VM_Method meth = null;          int targetidx = bcodes.readIntConst();          switch (targetidx) {          case GETREFAT:            meth = VM_Entrypoints.osrGetRefAtMethod;            break;          case CLEANREFS:            meth = VM_Entrypoints.osrCleanRefsMethod;            break;          default:            if (VM.TraceOnStackReplacement) VM.sysWriteln("pseudo_invokestatic, unknown target index "+targetidx);            OPT_OptimizingCompilerException.UNREACHABLE();            break;          }                                           if (VM.TraceOnStackReplacement)                 VM.sysWriteln("PSEUDO_Invoke "+meth+"\n");          s = _callHelper(meth.getMemberRef().asMethodReference(), OPT_MethodOperand.STATIC(meth));          Call.setAddress(s, new OPT_IntConstantOperand(meth.getOffset()));          /* try to set the type of return register */          if (targetidx == GETREFAT) {            Object realObj = OSR_ObjectHolder.getRefAt(param1, param2);            if (VM.VerifyAssertions) VM._assert(realObj != null);            VM_TypeReference klass = VM_Magic.getObjectType(realObj).getTypeRef();            OPT_RegisterOperand op0 = gc.temps.makeTemp(klass);            Call.setResult(s, op0);            pop();    // pop the old one and push the new return type.            push(op0.copyD2U(), klass);          }            // CALL must be treated as potential throw of anything          rectifyStateWithExceptionHandlers();          break;        }        case PSEUDO_InvokeCompiledMethod: {          int cmid = bcodes.readIntConst();          int origBCIdx = bcodes.readIntConst(); // skip it          VM_CompiledMethod cm = VM_CompiledMethods.getCompiledMethod(cmid);          VM_Method meth = cm.getMethod();          if (VM.TraceOnStackReplacement)             VM.sysWriteln("PSEUDO_InvokeCompiledMethod "+meth+"\n");          /* the bcIndex should be adjusted to the original */           s = _callHelper(meth.getMemberRef().asMethodReference(),                          OPT_MethodOperand.COMPILED(meth, cm.getOsrJTOCoffset()));          // adjust the bcindex of s to the original bytecode's index          // it should be able to give the correct exception handling          s.bcIndex = origBCIdx + bciAdjustment;                    rectifyStateWithExceptionHandlers();          break;        }        case PSEUDO_ParamInitEnd: {          // indicates the place to insert method prologue and stack          // overflow checks.          // opt compiler should consider this too          break;        }        default:          if (VM.TraceOnStackReplacement)             VM.sysWriteln("OSR Error, no such pseudo opcode : "+pseudo_opcode);          OPT_OptimizingCompilerException.UNREACHABLE();          break;        }        break;      }     //-#endif              default:        OPT_OptimizingCompilerException.UNREACHABLE();        break;      }      if (s != null && !currentBBLE.isSelfRegen()) {        appendInstruction(s);      }      // check runoff      if (VM.VerifyAssertions) VM._assert(bcodes.index() <= runoff);      if (!endOfBasicBlock && bcodes.index() == runoff) {        if (DBG_BB || DBG_SELECTED)          db("runoff occurred! current basic block: " + currentBBLE +              ", runoff = " + runoff);        endOfBasicBlock = fallThrough = true;      }      if (endOfBasicBlock) {        if (currentBBLE.isSelfRegen()) {          // This block ended in a goto that jumped into the middle of it.          // Through away all out edges from this block, they're out of date          // because we're going to have to regenerate this block.          currentBBLE.block.deleteOut();          if (DBG_CFG || DBG_SELECTED)            db("Deleted all out edges of " + currentBBLE.block);          return;        }        if (fallThrough) {          if (VM.VerifyAssertions) VM._assert(bcodes.index() < bcodes.length());          // Get/Create fallthrough BBLE and record it as           // currentBBLE's fallThrough.          currentBBLE.fallThrough = getOrCreateBlock(bcodes.index());          currentBBLE.block.insertOut(currentBBLE.fallThrough.block);        }        return;      }    }   }