Program: 150119
Project: 150119
Buggy source:
/** 
 * Generate instructions for a basic block. May discover other basic blocks that need to be generated along the way.
 * @param fromIndex bytecode index to start from
 */
private void generateFrom(int fromIndex){
  if (DBG_BB || DBG_SELECTED) {
    db("String_Node_Str" + currentBBLE + "String_Node_Str"+ runoff);
  }
  currentBBLE.setGenerated();
  endOfBasicBlock=fallThrough=false;
  lastInstr=null;
  bcodes.reset(fromIndex);
  while (true) {
    currentBBLE.high=instrIndex=bcodes.index();
    int code=bcodes.nextInstruction();
    if (DBG_BCPARSE) {
      db("String_Node_Str" + instrIndex + "String_Node_Str"+ code+ "String_Node_Str"+ Integer.toHexString(code));
    }
    OPT_Instruction s=null;
    lastOsrBarrier=null;
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) 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("String_Node_Str" + v1 + "String_Node_Str");
}
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);
VM_SwitchBranchProfile sp=gc.getSwitchProfile(instrIndex - bciAdjustment);
VM_SwitchBranchProfile sp=gc.getSwitchProfile(instrIndex);
if (sp == null) {
float approxProb=1.0f / (float)(number + 1);
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("String_Node_Str" + v1 + "String_Node_Str");
}
s=_gotoHelper(offset);
break;
}
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);
VM_SwitchBranchProfile sp=gc.getSwitchProfile(instrIndex - bciAdjustment);
VM_SwitchBranchProfile sp=gc.getSwitchProfile(instrIndex);
if (sp == null) {
float approxProb=1.0f / (float)(numpairs + 1);
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 {
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:
{
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());
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;
}
}
}
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);
push(rhs,fieldType);
break;
}
 else {
if (OPT_StaticFieldReader.isStaticFieldNull(field)) {
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);
push(rhs,fieldType);
break;
}
 else {
t.type=rtType;
if (rtType != fieldType) t.clearDeclaredType();
t.setPreciseType();
markGuardlessNonNull(t);
}
}
}
}
 catch (NoSuchFieldException e) {
}
}
}
}
}
s=GetStatic.create(GETSTATIC,t,offsetOp,fieldOp);
push(t.copyD2U(),fieldType);
}
break;
case JBC_putstatic:
{
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:
{
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());
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:
{
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();
if (ref.getType().isMagicType()) {
boolean generated=OPT_GenerateMagic.generateMagic(this,gc,ref);
if (generated) break;
}
boolean unresolved=ref.needsDynamicLink(bcodes.method());
VM_Method target=ref.peekResolvedMethod();
OPT_MethodOperand methOp=OPT_MethodOperand.VIRTUAL(ref,target);
if (this.osrGuardedInline) {
lastOsrBarrier=_createOsrBarrier();
}
s=_callHelper(ref,methOp);
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()));
}
OPT_Operand receiver=Call.getParam(s,0);
clearCurrentGuard();
if (do_NullCheck(receiver)) {
s=null;
break;
}
Call.setGuard(s,getCurrentGuard());
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,"String_Node_Str");
}
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);
}
}
if (maybeInlineMethod(shouldInline(s,isExtant),s)) {
return;
}
rectifyStateWithExceptionHandlers();
}
break;
case JBC_invokespecial:
{
VM_MethodReference ref=bcodes.getMethodReference();
VM_Method target=ref.resolveInvokeSpecial();
if (this.osrGuardedInline) lastOsrBarrier=_createOsrBarrier();
s=_callHelper(ref,OPT_MethodOperand.SPECIAL(ref,target));
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()));
}
OPT_Operand receiver=Call.getParam(s,0);
clearCurrentGuard();
if (do_NullCheck(receiver)) {
s=null;
break;
}
Call.setGuard(s,getCurrentGuard());
if (maybeInlineMethod(shouldInline(s,false),s)) {
return;
}
rectifyStateWithExceptionHandlers();
}
break;
case JBC_invokestatic:
{
VM_MethodReference ref=bcodes.getMethodReference();
if (ref.getType().isMagicType()) {
boolean generated=OPT_GenerateMagic.generateMagic(this,gc,ref);
if (generated) break;
}
boolean unresolved=ref.needsDynamicLink(bcodes.method());
VM_Method target=ref.peekResolvedMethod();
if (this.osrGuardedInline) lastOsrBarrier=_createOsrBarrier();
s=_callHelper(ref,OPT_MethodOperand.STATIC(ref,target));
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()));
}
if (maybeInlineMethod(shouldInline(s,false),s)) {
return;
}
rectifyStateWithExceptionHandlers();
}
break;
case JBC_invokeinterface:
{
VM_MethodReference ref=bcodes.getMethodReference();
bcodes.alignInvokeInterface();
VM_Method resolvedMethod=null;
resolvedMethod=ref.peekInterfaceMethod();
if (this.osrGuardedInline) lastOsrBarrier=_createOsrBarrier();
s=_callHelper(ref,OPT_MethodOperand.INTERFACE(ref,resolvedMethod));
OPT_RegisterOperand receiver=Call.getParam(s,0).asRegister();
VM_Class receiverType=(VM_Class)receiver.type.peekResolvedType();
clearCurrentGuard();
if (do_NullCheck(receiver)) {
s=null;
break;
}
Call.setGuard(s,getCurrentGuard());
boolean requiresImplementsTest=VM.BuildForIMTInterfaceInvocation || (VM.BuildForITableInterfaceInvocation && VM.DirectlyIndexedITables);
if (requiresImplementsTest) {
if (resolvedMethod == null) {
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;
rectifyStateWithErrorHandler();
}
 else {
VM_Type interfaceType=resolvedMethod.getDeclaringClass();
if (receiverType != null && receiverType.isResolved() && !receiverType.isInterface()) {
byte doesImplement=OPT_ClassLoaderProxy.includesType(interfaceType.getTypeRef(),receiverType.getTypeRef());
requiresImplementsTest=doesImplement != YES;
}
}
}
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();
if (requiresImplementsTest) {
appendInstruction(TypeCheck.create(MUST_IMPLEMENT_INTERFACE,receiver.copyU2U(),makeTypeOperand(resolvedMethod.getDeclaringClass()),getCurrentGuard()));
rectifyStateWithErrorHandler();
}
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()));
}
if (maybeInlineMethod(shouldInline(s,receiver.isExtant()),s)) {
return;
}
}
 else {
if (resolvedMethod != null && maybeInlineMethod(shouldInline(s,false),s)) {
return;
}
 else {
if (requiresImplementsTest) {
appendInstruction(TypeCheck.create(MUST_IMPLEMENT_INTERFACE,receiver.copyU2U(),makeTypeOperand(resolvedMethod.getDeclaringClass()),getCurrentGuard()));
}
}
}
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) {
if (type != VM_TypeReference.JavaLangObject) assertIsAssignable(VM_TypeReference.JavaLangThrowable,type);
}
if (!gc.method.isInterruptible()) {
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("String_Node_Str" + typeRef);
break;
}
if (VM.VerifyAssertions) VM._assert(op2.isRef());
if (CF_CHECKCAST && !classLoading) {
if (op2.isDefinitelyNull()) {
push(op2);
if (DBG_CF) db("String_Node_Str");
break;
}
VM_TypeReference type=getRefTypeOf(op2);
if (OPT_ClassLoaderProxy.includesType(typeRef,type) == YES) {
push(op2);
if (DBG_CF) db("String_Node_Str" + op2 + "String_Node_Str"+ typeRef+ "String_Node_Str"+ 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("String_Node_Str");
break;
}
VM_TypeReference type=getRefTypeOf(op2);
int answer=OPT_ClassLoaderProxy.includesType(typeRef,type);
if (answer == YES && isNonNull(op2)) {
push(new OPT_IntConstantOperand(1));
if (DBG_CF) db(op2 + "String_Node_Str" + typeRef+ "String_Node_Str");
break;
}
 else if (answer == NO) {
if (DBG_CF) db(op2 + "String_Node_Str" + typeRef+ "String_Node_Str");
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();
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)));
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()));
}
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) s=_gotoHelper(offset);
}
break;
case JBC_jsr_w:
s=_jsrHelper(bcodes.getWideBranchOffset());
break;
case JBC_impdep1:
{
int pseudo_opcode=bcodes.nextPseudoInstruction();
switch (pseudo_opcode) {
case PSEUDO_LoadIntConst:
{
int value=bcodes.readIntConst();
if (VM.TraceOnStackReplacement) VM.sysWriteln("String_Node_Str" + value);
push(new OPT_IntConstantOperand(value));
param1=param2;
param2=value;
break;
}
case PSEUDO_LoadLongConst:
{
long value=bcodes.readLongConst();
if (VM.TraceOnStackReplacement) VM.sysWriteln("String_Node_Str" + value);
int offset=VM_Statics.findOrCreateLongLiteral(value);
pushDual(new OPT_LongConstantOperand(value,offset));
break;
}
case PSEUDO_LoadWordConst:
{
Address a;
a=Address.fromIntSignExtend(bcodes.readIntConst());
a=Address.fromLong(bcodes.readLongConst());
push(new OPT_AddressConstantOperand(a));
if (VM.TraceOnStackReplacement) VM.sysWrite("String_Node_Str");
VM.sysWrite(a);
VM.sysWriteln();
break;
}
case PSEUDO_LoadFloatConst:
{
int ibits=bcodes.readIntConst();
float value=Float.intBitsToFloat(ibits);
if (VM.TraceOnStackReplacement) VM.sysWriteln("String_Node_Str" + 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("String_Node_Str" + lbits);
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("String_Node_Str" + value);
push(new ReturnAddressOperand(value));
break;
}
case PSEUDO_InvokeStatic:
{
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("String_Node_Str" + targetidx);
OPT_OptimizingCompilerException.UNREACHABLE();
break;
}
if (VM.TraceOnStackReplacement) VM.sysWriteln("String_Node_Str" + meth + "String_Node_Str");
s=_callHelper(meth.getMemberRef().asMethodReference(),OPT_MethodOperand.STATIC(meth));
Call.setAddress(s,new OPT_IntConstantOperand(meth.getOffset()));
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();
push(op0.copyD2U(),klass);
}
rectifyStateWithExceptionHandlers();
break;
}
case PSEUDO_InvokeCompiledMethod:
{
int cmid=bcodes.readIntConst();
int origBCIdx=bcodes.readIntConst();
VM_CompiledMethod cm=VM_CompiledMethods.getCompiledMethod(cmid);
VM_Method meth=cm.getMethod();
if (VM.TraceOnStackReplacement) VM.sysWriteln("String_Node_Str" + meth + "String_Node_Str");
s=_callHelper(meth.getMemberRef().asMethodReference(),OPT_MethodOperand.COMPILED(meth,cm.getOsrJTOCoffset()));
s.bcIndex=origBCIdx + bciAdjustment;
rectifyStateWithExceptionHandlers();
break;
}
case PSEUDO_ParamInitEnd:
{
break;
}
default :
if (VM.TraceOnStackReplacement) VM.sysWriteln("String_Node_Str" + pseudo_opcode);
OPT_OptimizingCompilerException.UNREACHABLE();
break;
}
break;
}
default :
OPT_OptimizingCompilerException.UNREACHABLE();
break;
}
if (s != null && !currentBBLE.isSelfRegen()) {
appendInstruction(s);
}
if (VM.VerifyAssertions) VM._assert(bcodes.index() <= runoff);
if (!endOfBasicBlock && bcodes.index() == runoff) {
if (DBG_BB || DBG_SELECTED) db("String_Node_Str" + currentBBLE + "String_Node_Str"+ runoff);
endOfBasicBlock=fallThrough=true;
}
if (endOfBasicBlock) {
if (currentBBLE.isSelfRegen()) {
currentBBLE.block.deleteOut();
if (DBG_CFG || DBG_SELECTED) db("String_Node_Str" + currentBBLE.block);
return;
}
if (fallThrough) {
if (VM.VerifyAssertions) VM._assert(bcodes.index() < bcodes.length());
currentBBLE.fallThrough=getOrCreateBlock(bcodes.index());
currentBBLE.block.insertOut(currentBBLE.fallThrough.block);
}
return;
}
}
}

Fixed version (ground truth):
/** 
 * Generate instructions for a basic block. May discover other basic blocks that need to be generated along the way.
 * @param fromIndex bytecode index to start from
 */
private void generateFrom(int fromIndex){
  if (DBG_BB || DBG_SELECTED) {
    db("String_Node_Str" + currentBBLE + "String_Node_Str"+ runoff);
  }
  currentBBLE.setGenerated();
  endOfBasicBlock=fallThrough=false;
  lastInstr=null;
  bcodes.reset(fromIndex);
  while (true) {
    currentBBLE.high=instrIndex=bcodes.index();
    int code=bcodes.nextInstruction();
    if (DBG_BCPARSE) {
      db("String_Node_Str" + instrIndex + "String_Node_Str"+ code+ "String_Node_Str"+ Integer.toHexString(code));
    }
    OPT_Instruction s=null;
    lastOsrBarrier=null;
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) 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("String_Node_Str" + v1 + "String_Node_Str");
}
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);
VM_SwitchBranchProfile sp=gc.getSwitchProfile(instrIndex - bciAdjustment);
VM_SwitchBranchProfile sp=gc.getSwitchProfile(instrIndex);
if (sp == null) {
float approxProb=1.0f / (float)(number + 1);
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("String_Node_Str" + v1 + "String_Node_Str");
}
s=_gotoHelper(offset);
break;
}
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);
VM_SwitchBranchProfile sp=gc.getSwitchProfile(instrIndex - bciAdjustment);
VM_SwitchBranchProfile sp=gc.getSwitchProfile(instrIndex);
if (sp == null) {
float approxProb=1.0f / (float)(numpairs + 1);
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 {
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:
{
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());
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;
}
}
}
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);
push(rhs,fieldType);
break;
}
 else {
if (OPT_StaticFieldReader.isStaticFieldNull(field)) {
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);
push(rhs,fieldType);
break;
}
 else {
t.type=rtType;
if (rtType != fieldType) t.clearDeclaredType();
t.setPreciseType();
markGuardlessNonNull(t);
}
}
}
}
 catch (NoSuchFieldException e) {
}
}
}
}
}
s=GetStatic.create(GETSTATIC,t,offsetOp,fieldOp);
push(t.copyD2U(),fieldType);
}
break;
case JBC_putstatic:
{
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:
{
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());
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:
{
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();
if (ref.getType().isMagicType()) {
boolean generated=OPT_GenerateMagic.generateMagic(this,gc,ref);
if (generated) break;
}
boolean unresolved=ref.needsDynamicLink(bcodes.method());
VM_Method target=ref.peekResolvedMethod();
OPT_MethodOperand methOp=OPT_MethodOperand.VIRTUAL(ref,target);
if (this.osrGuardedInline) {
lastOsrBarrier=_createOsrBarrier();
}
s=_callHelper(ref,methOp);
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()));
}
OPT_Operand receiver=Call.getParam(s,0);
clearCurrentGuard();
if (do_NullCheck(receiver)) {
s=null;
break;
}
Call.setGuard(s,getCurrentGuard());
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,"String_Node_Str");
}
VM_Type type=tr.peekResolvedType();
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);
}
}
}
if (maybeInlineMethod(shouldInline(s,isExtant),s)) {
return;
}
rectifyStateWithExceptionHandlers();
}
break;
case JBC_invokespecial:
{
VM_MethodReference ref=bcodes.getMethodReference();
VM_Method target=ref.resolveInvokeSpecial();
if (this.osrGuardedInline) lastOsrBarrier=_createOsrBarrier();
s=_callHelper(ref,OPT_MethodOperand.SPECIAL(ref,target));
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()));
}
OPT_Operand receiver=Call.getParam(s,0);
clearCurrentGuard();
if (do_NullCheck(receiver)) {
s=null;
break;
}
Call.setGuard(s,getCurrentGuard());
if (maybeInlineMethod(shouldInline(s,false),s)) {
return;
}
rectifyStateWithExceptionHandlers();
}
break;
case JBC_invokestatic:
{
VM_MethodReference ref=bcodes.getMethodReference();
if (ref.getType().isMagicType()) {
boolean generated=OPT_GenerateMagic.generateMagic(this,gc,ref);
if (generated) break;
}
boolean unresolved=ref.needsDynamicLink(bcodes.method());
VM_Method target=ref.peekResolvedMethod();
if (this.osrGuardedInline) lastOsrBarrier=_createOsrBarrier();
s=_callHelper(ref,OPT_MethodOperand.STATIC(ref,target));
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()));
}
if (maybeInlineMethod(shouldInline(s,false),s)) {
return;
}
rectifyStateWithExceptionHandlers();
}
break;
case JBC_invokeinterface:
{
VM_MethodReference ref=bcodes.getMethodReference();
bcodes.alignInvokeInterface();
VM_Method resolvedMethod=null;
resolvedMethod=ref.peekInterfaceMethod();
if (this.osrGuardedInline) lastOsrBarrier=_createOsrBarrier();
s=_callHelper(ref,OPT_MethodOperand.INTERFACE(ref,resolvedMethod));
OPT_RegisterOperand receiver=Call.getParam(s,0).asRegister();
VM_Class receiverType=(VM_Class)receiver.type.peekResolvedType();
clearCurrentGuard();
if (do_NullCheck(receiver)) {
s=null;
break;
}
Call.setGuard(s,getCurrentGuard());
boolean requiresImplementsTest=VM.BuildForIMTInterfaceInvocation || (VM.BuildForITableInterfaceInvocation && VM.DirectlyIndexedITables);
if (requiresImplementsTest) {
if (resolvedMethod == null) {
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;
rectifyStateWithErrorHandler();
}
 else {
VM_Type interfaceType=resolvedMethod.getDeclaringClass();
if (receiverType != null && receiverType.isResolved() && !receiverType.isInterface()) {
byte doesImplement=OPT_ClassLoaderProxy.includesType(interfaceType.getTypeRef(),receiverType.getTypeRef());
requiresImplementsTest=doesImplement != YES;
}
}
}
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();
if (requiresImplementsTest) {
appendInstruction(TypeCheck.create(MUST_IMPLEMENT_INTERFACE,receiver.copyU2U(),makeTypeOperand(resolvedMethod.getDeclaringClass()),getCurrentGuard()));
rectifyStateWithErrorHandler();
}
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()));
}
if (maybeInlineMethod(shouldInline(s,receiver.isExtant()),s)) {
return;
}
}
 else {
if (resolvedMethod != null && maybeInlineMethod(shouldInline(s,false),s)) {
return;
}
 else {
if (requiresImplementsTest) {
appendInstruction(TypeCheck.create(MUST_IMPLEMENT_INTERFACE,receiver.copyU2U(),makeTypeOperand(resolvedMethod.getDeclaringClass()),getCurrentGuard()));
}
}
}
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) {
if (type != VM_TypeReference.JavaLangObject) assertIsAssignable(VM_TypeReference.JavaLangThrowable,type);
}
if (!gc.method.isInterruptible()) {
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("String_Node_Str" + typeRef);
break;
}
if (VM.VerifyAssertions) VM._assert(op2.isRef());
if (CF_CHECKCAST && !classLoading) {
if (op2.isDefinitelyNull()) {
push(op2);
if (DBG_CF) db("String_Node_Str");
break;
}
VM_TypeReference type=getRefTypeOf(op2);
if (OPT_ClassLoaderProxy.includesType(typeRef,type) == YES) {
push(op2);
if (DBG_CF) db("String_Node_Str" + op2 + "String_Node_Str"+ typeRef+ "String_Node_Str"+ 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("String_Node_Str");
break;
}
VM_TypeReference type=getRefTypeOf(op2);
int answer=OPT_ClassLoaderProxy.includesType(typeRef,type);
if (answer == YES && isNonNull(op2)) {
push(new OPT_IntConstantOperand(1));
if (DBG_CF) db(op2 + "String_Node_Str" + typeRef+ "String_Node_Str");
break;
}
 else if (answer == NO) {
if (DBG_CF) db(op2 + "String_Node_Str" + typeRef+ "String_Node_Str");
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();
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)));
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()));
}
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) s=_gotoHelper(offset);
}
break;
case JBC_jsr_w:
s=_jsrHelper(bcodes.getWideBranchOffset());
break;
case JBC_impdep1:
{
int pseudo_opcode=bcodes.nextPseudoInstruction();
switch (pseudo_opcode) {
case PSEUDO_LoadIntConst:
{
int value=bcodes.readIntConst();
if (VM.TraceOnStackReplacement) VM.sysWriteln("String_Node_Str" + value);
push(new OPT_IntConstantOperand(value));
param1=param2;
param2=value;
break;
}
case PSEUDO_LoadLongConst:
{
long value=bcodes.readLongConst();
if (VM.TraceOnStackReplacement) VM.sysWriteln("String_Node_Str" + value);
int offset=VM_Statics.findOrCreateLongLiteral(value);
pushDual(new OPT_LongConstantOperand(value,offset));
break;
}
case PSEUDO_LoadWordConst:
{
Address a;
a=Address.fromIntSignExtend(bcodes.readIntConst());
a=Address.fromLong(bcodes.readLongConst());
push(new OPT_AddressConstantOperand(a));
if (VM.TraceOnStackReplacement) VM.sysWrite("String_Node_Str");
VM.sysWrite(a);
VM.sysWriteln();
break;
}
case PSEUDO_LoadFloatConst:
{
int ibits=bcodes.readIntConst();
float value=Float.intBitsToFloat(ibits);
if (VM.TraceOnStackReplacement) VM.sysWriteln("String_Node_Str" + 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("String_Node_Str" + lbits);
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("String_Node_Str" + value);
push(new ReturnAddressOperand(value));
break;
}
case PSEUDO_InvokeStatic:
{
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("String_Node_Str" + targetidx);
OPT_OptimizingCompilerException.UNREACHABLE();
break;
}
if (VM.TraceOnStackReplacement) VM.sysWriteln("String_Node_Str" + meth + "String_Node_Str");
s=_callHelper(meth.getMemberRef().asMethodReference(),OPT_MethodOperand.STATIC(meth));
Call.setAddress(s,new OPT_IntConstantOperand(meth.getOffset()));
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();
push(op0.copyD2U(),klass);
}
rectifyStateWithExceptionHandlers();
break;
}
case PSEUDO_InvokeCompiledMethod:
{
int cmid=bcodes.readIntConst();
int origBCIdx=bcodes.readIntConst();
VM_CompiledMethod cm=VM_CompiledMethods.getCompiledMethod(cmid);
VM_Method meth=cm.getMethod();
if (VM.TraceOnStackReplacement) VM.sysWriteln("String_Node_Str" + meth + "String_Node_Str");
s=_callHelper(meth.getMemberRef().asMethodReference(),OPT_MethodOperand.COMPILED(meth,cm.getOsrJTOCoffset()));
s.bcIndex=origBCIdx + bciAdjustment;
rectifyStateWithExceptionHandlers();
break;
}
case PSEUDO_ParamInitEnd:
{
break;
}
default :
if (VM.TraceOnStackReplacement) VM.sysWriteln("String_Node_Str" + pseudo_opcode);
OPT_OptimizingCompilerException.UNREACHABLE();
break;
}
break;
}
default :
OPT_OptimizingCompilerException.UNREACHABLE();
break;
}
if (s != null && !currentBBLE.isSelfRegen()) {
appendInstruction(s);
}
if (VM.VerifyAssertions) VM._assert(bcodes.index() <= runoff);
if (!endOfBasicBlock && bcodes.index() == runoff) {
if (DBG_BB || DBG_SELECTED) db("String_Node_Str" + currentBBLE + "String_Node_Str"+ runoff);
endOfBasicBlock=fallThrough=true;
}
if (endOfBasicBlock) {
if (currentBBLE.isSelfRegen()) {
currentBBLE.block.deleteOut();
if (DBG_CFG || DBG_SELECTED) db("String_Node_Str" + currentBBLE.block);
return;
}
if (fallThrough) {
if (VM.VerifyAssertions) VM._assert(bcodes.index() < bcodes.length());
currentBBLE.fallThrough=getOrCreateBlock(bcodes.index());
currentBBLE.block.insertOut(currentBBLE.fallThrough.block);
}
return;
}
}
}