Program: 149883
Project: 149883
Buggy source:
private OSR_ExecutionState getExecStateSequence(VM_Thread thread,byte[] stack,Offset ipOffset,Offset fpOffset,int cmid,Offset tsFPOffset,OSR_TempRegisters registers,OSR_EncodedOSRMap osrmap){
  int lpart_one=0;
  OSR_MapIterator iterator=osrmap.getOsrMapIteratorForMCOffset(ipOffset);
  if (VM.VerifyAssertions)   VM._assert(iterator != null);
  OSR_ExecutionState state=new OSR_ExecutionState(thread,fpOffset,cmid,iterator.getBcIndex(),tsFPOffset);
  VM_MethodReference mref=VM_MemberReference.getMemberRef(iterator.getMethodId()).asMethodReference();
  state.setMethod((VM_NormalMethod)mref.peekResolvedMethod());
  state.callerState=null;
  if (VM.TraceOnStackReplacement) {
    VM.sysWriteln("String_Node_Str" + state.meth.toString());
  }
  while (iterator.hasMore()) {
    if (iterator.getMethodId() != state.meth.getId()) {
      OSR_ExecutionState newstate=new OSR_ExecutionState(thread,fpOffset,cmid,iterator.getBcIndex(),tsFPOffset);
      mref=VM_MemberReference.getMemberRef(iterator.getMethodId()).asMethodReference();
      newstate.setMethod((VM_NormalMethod)mref.peekResolvedMethod());
      newstate.callerState=state;
      state=newstate;
      if (VM.TraceOnStackReplacement) {
        VM.sysWriteln("String_Node_Str" + state.meth.toString());
      }
    }
    int kind=iterator.getKind();
    int num=iterator.getNumber();
    int tcode=iterator.getTypeCode();
    int vtype=iterator.getValueType();
    int value=iterator.getValue();
    iterator.moveToNext();
    if (VM.TraceOnStackReplacement) {
      VM.sysWrite((kind == LOCAL) ? "String_Node_Str" : "String_Node_Str");
      VM.sysWrite(num);
      VM.sysWrite("String_Node_Str");
      if (vtype == ICONST) {
        VM.sysWrite("String_Node_Str");
        VM.sysWrite(value);
      }
 else       if (vtype == PHYREG) {
        VM.sysWrite("String_Node_Str");
        VM.sysWrite(GPR_NAMES[value]);
      }
 else       if (vtype == SPILL) {
        VM.sysWrite("String_Node_Str");
        VM.sysWrite(value);
      }
      VM.sysWriteln();
    }
switch (tcode) {
case INT:
{
        int ibits=getIntBitsFrom(vtype,value,stack,fpOffset,registers);
        state.add(new OSR_VariableElement(kind,num,tcode,ibits));
        break;
      }
case FLOAT:
{
      float fv=(float)getDoubleFrom(vtype,value,stack,fpOffset,registers);
      int ibits=VM_Magic.floatAsIntBits(fv);
      state.add(new OSR_VariableElement(kind,num,tcode,ibits));
      break;
    }
case HIGH_64BIT:
{
    lpart_one=value;
    break;
  }
case LONG:
{
  long lbits=getLongBitsFrom(vtype,lpart_one,value,stack,fpOffset,registers);
  lpart_one=0;
  state.add(new OSR_VariableElement(kind,num,LONG,lbits));
  break;
}
case DOUBLE:
{
double dv=getDoubleFrom(vtype,value,stack,fpOffset,registers);
long lbits=VM_Magic.doubleAsLongBits(dv);
state.add(new OSR_VariableElement(kind,num,tcode,lbits));
break;
}
case RET_ADDR:
{
int bcIndex=getIntBitsFrom(vtype,value,stack,fpOffset,registers);
state.add(new OSR_VariableElement(kind,num,tcode,bcIndex));
break;
}
case WORD:
{
if (VM.BuildFor64Addr) VM._assert(VM.NOT_REACHED);
int word=getIntBitsFrom(vtype,value,stack,fpOffset,registers);
state.add(new OSR_VariableElement(kind,num,tcode,word));
break;
}
case REF:
{
Object ref=getObjectFrom(vtype,value,stack,fpOffset,registers);
state.add(new OSR_VariableElement(kind,num,tcode,ref));
break;
}
default :
if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED);
break;
}
}
return state;
}

Fixed version (ground truth):
private OSR_ExecutionState getExecStateSequence(VM_Thread thread,byte[] stack,Offset ipOffset,Offset fpOffset,int cmid,Offset tsFPOffset,OSR_TempRegisters registers,OSR_EncodedOSRMap osrmap){
  int lvalue_one=0;
  int lvtype_one=0;
  OSR_MapIterator iterator=osrmap.getOsrMapIteratorForMCOffset(ipOffset);
  if (VM.VerifyAssertions)   VM._assert(iterator != null);
  OSR_ExecutionState state=new OSR_ExecutionState(thread,fpOffset,cmid,iterator.getBcIndex(),tsFPOffset);
  VM_MethodReference mref=VM_MemberReference.getMemberRef(iterator.getMethodId()).asMethodReference();
  state.setMethod((VM_NormalMethod)mref.peekResolvedMethod());
  state.callerState=null;
  if (VM.TraceOnStackReplacement) {
    VM.sysWriteln("String_Node_Str" + state.meth.toString());
  }
  while (iterator.hasMore()) {
    if (iterator.getMethodId() != state.meth.getId()) {
      OSR_ExecutionState newstate=new OSR_ExecutionState(thread,fpOffset,cmid,iterator.getBcIndex(),tsFPOffset);
      mref=VM_MemberReference.getMemberRef(iterator.getMethodId()).asMethodReference();
      newstate.setMethod((VM_NormalMethod)mref.peekResolvedMethod());
      newstate.callerState=state;
      state=newstate;
      if (VM.TraceOnStackReplacement) {
        VM.sysWriteln("String_Node_Str" + state.meth.toString());
      }
    }
    int kind=iterator.getKind();
    int num=iterator.getNumber();
    int tcode=iterator.getTypeCode();
    int vtype=iterator.getValueType();
    int value=iterator.getValue();
    iterator.moveToNext();
    if (VM.TraceOnStackReplacement) {
      VM.sysWrite((kind == LOCAL) ? "String_Node_Str" : "String_Node_Str");
      VM.sysWrite(num);
      VM.sysWrite("String_Node_Str");
      if (vtype == ICONST) {
        VM.sysWrite("String_Node_Str");
        VM.sysWrite(value);
      }
 else       if (vtype == PHYREG) {
        VM.sysWrite("String_Node_Str");
        VM.sysWrite(GPR_NAMES[value]);
      }
 else       if (vtype == SPILL) {
        VM.sysWrite("String_Node_Str");
        VM.sysWrite(value);
      }
      VM.sysWriteln();
    }
switch (tcode) {
case INT:
{
        int ibits=getIntBitsFrom(vtype,value,stack,fpOffset,registers);
        state.add(new OSR_VariableElement(kind,num,tcode,ibits));
        break;
      }
case FLOAT:
{
      float fv=(float)getDoubleFrom(vtype,value,stack,fpOffset,registers);
      int ibits=VM_Magic.floatAsIntBits(fv);
      state.add(new OSR_VariableElement(kind,num,tcode,ibits));
      break;
    }
case HIGH_64BIT:
{
    lvalue_one=value;
    lvtype_one=vtype;
    break;
  }
case LONG:
{
  long lbits=getLongBitsFrom(lvtype_one,lvalue_one,vtype,value,stack,fpOffset,registers);
  lvalue_one=0;
  lvtype_one=0;
  state.add(new OSR_VariableElement(kind,num,LONG,lbits));
  break;
}
case DOUBLE:
{
double dv=getDoubleFrom(vtype,value,stack,fpOffset,registers);
long lbits=VM_Magic.doubleAsLongBits(dv);
state.add(new OSR_VariableElement(kind,num,tcode,lbits));
break;
}
case RET_ADDR:
{
int bcIndex=getIntBitsFrom(vtype,value,stack,fpOffset,registers);
state.add(new OSR_VariableElement(kind,num,tcode,bcIndex));
break;
}
case WORD:
{
if (VM.BuildFor64Addr) VM._assert(VM.NOT_REACHED);
int word=getIntBitsFrom(vtype,value,stack,fpOffset,registers);
state.add(new OSR_VariableElement(kind,num,tcode,word));
break;
}
case REF:
{
Object ref=getObjectFrom(vtype,value,stack,fpOffset,registers);
state.add(new OSR_VariableElement(kind,num,tcode,ref));
break;
}
default :
if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED);
break;
}
}
return state;
}