nus-yam/ex-repair huggingface dataset:
Program: 150055
Project: 150055
Buggy source:
/** 
 * Insert code into the epilogue to restore the floating point state.
 * @param inst the return instruction after the epilogue.  
 */
private void restoreFloatingPointState(OPT_Instruction inst){
  OPT_PhysicalRegisterSet phys=ir.regpool.getPhysicalRegisterSet();
  OPT_Operand M=new OPT_StackLocationOperand(true,-fsaveLocation,4);
  inst.insertBefore(MIR_FSave.create(IA32_FRSTOR,M));
}

Fixed version (ground truth):
/** 
 * Insert code into the epilogue to restore the floating point state.
 * @param inst the return instruction after the epilogue.  
 */
private void restoreFloatingPointState(OPT_Instruction inst){
  OPT_Operand M=new OPT_StackLocationOperand(true,-fsaveLocation,4);
  inst.insertBefore(MIR_FSave.create(IA32_FRSTOR,M));
}
Program: 150056
Project: 150056
Buggy source:
/** 
 * Rewrite a move instruction if it has 2 memory operands. One of the 2 memory operands must be a stack location operand.  Move the SP to the appropriate location and use a push or pop instruction.
 */
private void rewriteMoveInstruction(OPT_Instruction s){
  if (mutateMoveToNop(s))   return;
  OPT_Register ESP=ir.regpool.getPhysicalRegisterSet().getESP();
  OPT_Operand result=MIR_Move.getResult(s);
  OPT_Operand val=MIR_Move.getValue(s);
  if (result instanceof OPT_StackLocationOperand) {
    if (val instanceof OPT_MemoryOperand || val instanceof OPT_StackLocationOperand) {
      int offset=((OPT_StackLocationOperand)result).getOffset();
      byte size=((OPT_StackLocationOperand)result).getSize();
      offset=FPOffset2SPOffset(offset) + size;
      moveESPBefore(s,offset);
      MIR_UnaryNoRes.mutate(s,IA32_PUSH,val);
    }
  }
 else {
    if (result instanceof OPT_MemoryOperand) {
      if (val instanceof OPT_StackLocationOperand) {
        int offset=((OPT_StackLocationOperand)val).getOffset();
        offset=FPOffset2SPOffset(offset);
        moveESPBefore(s,offset);
        MIR_Nullary.mutate(s,IA32_POP,result);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Rewrite a move instruction if it has 2 memory operands. One of the 2 memory operands must be a stack location operand.  Move the SP to the appropriate location and use a push or pop instruction.
 */
private void rewriteMoveInstruction(OPT_Instruction s){
  if (mutateMoveToNop(s))   return;
  OPT_Operand result=MIR_Move.getResult(s);
  OPT_Operand val=MIR_Move.getValue(s);
  if (result instanceof OPT_StackLocationOperand) {
    if (val instanceof OPT_MemoryOperand || val instanceof OPT_StackLocationOperand) {
      int offset=((OPT_StackLocationOperand)result).getOffset();
      byte size=((OPT_StackLocationOperand)result).getSize();
      offset=FPOffset2SPOffset(offset) + size;
      moveESPBefore(s,offset);
      MIR_UnaryNoRes.mutate(s,IA32_PUSH,val);
    }
  }
 else {
    if (result instanceof OPT_MemoryOperand) {
      if (val instanceof OPT_StackLocationOperand) {
        int offset=((OPT_StackLocationOperand)val).getOffset();
        offset=FPOffset2SPOffset(offset);
        moveESPBefore(s,offset);
        MIR_Nullary.mutate(s,IA32_POP,result);
      }
    }
  }
}
Program: 150057
Project: 150057
Buggy source:
/** 
 * Insert a load of a physical register from a spill location before  instruction s.
 * @param s the instruction before which the spill should occur
 * @param r the register (should be physical) to spill
 * @param type one of INT_VALUE, FLOAT_VALUE, DOUBLE_VALUE, orCONDITION_VALUE
 * @param location the spill location
 */
final void insertUnspillBefore(OPT_Instruction s,OPT_Register r,byte type,int location){
  OPT_PhysicalRegisterSet phys=ir.regpool.getPhysicalRegisterSet();
  OPT_Operator move=getMoveOperator(type);
  byte size=getSizeOfType(type);
  OPT_RegisterOperand rOp;
switch (type) {
case FLOAT_VALUE:
    rOp=F(r);
  break;
case DOUBLE_VALUE:
rOp=D(r);
break;
default :
rOp=new OPT_RegisterOperand(r,VM_TypeReference.Int);
break;
}
OPT_StackLocationOperand spill=new OPT_StackLocationOperand(true,-location,size);
s.insertBefore(MIR_Move.create(move,rOp,spill));
}

Fixed version (ground truth):
/** 
 * Insert a load of a physical register from a spill location before  instruction s.
 * @param s the instruction before which the spill should occur
 * @param r the register (should be physical) to spill
 * @param type one of INT_VALUE, FLOAT_VALUE, DOUBLE_VALUE, orCONDITION_VALUE
 * @param location the spill location
 */
final void insertUnspillBefore(OPT_Instruction s,OPT_Register r,byte type,int location){
  OPT_Operator move=getMoveOperator(type);
  byte size=getSizeOfType(type);
  OPT_RegisterOperand rOp;
switch (type) {
case FLOAT_VALUE:
    rOp=F(r);
  break;
case DOUBLE_VALUE:
rOp=D(r);
break;
default :
rOp=new OPT_RegisterOperand(r,VM_TypeReference.Int);
break;
}
OPT_StackLocationOperand spill=new OPT_StackLocationOperand(true,-location,size);
s.insertBefore(MIR_Move.create(move,rOp,spill));
}
Program: 150058
Project: 150058
Buggy source:
/** 
 * Read the contents of the field. If the contents of this field is an object, return that object. If the contents of this field is a primitive, get the value and wrap it in an object.
 */
public final Object getObjectUnchecked(Object obj){
  VM_TypeReference type=getType();
  if (type.isReferenceType()) {
    return getObjectValueUnchecked(obj);
  }
 else {
    if (type.isCharType())     return new Character(getCharValueUnchecked(obj));
    if (type.isDoubleType())     return new Double(getDoubleValueUnchecked(obj));
    if (type.isFloatType())     return new Float(getFloatValueUnchecked(obj));
    if (type.isLongType())     return new Long(getLongValueUnchecked(obj));
    if (type.isIntType())     return new Integer(getIntValueUnchecked(obj));
    if (type.isShortType())     return new Short(getShortValueUnchecked(obj));
    if (type.isByteType())     return new Byte(getByteValueUnchecked(obj));
    if (type.isBooleanType())     return new Boolean(getBooleanValueUnchecked(obj));
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Read the contents of the field. If the contents of this field is an object, return that object. If the contents of this field is a primitive, get the value and wrap it in an object.
 */
public final Object getObjectUnchecked(Object obj){
  VM_TypeReference type=getType();
  if (type.isReferenceType()) {
    return getObjectValueUnchecked(obj);
  }
 else {
    if (type.isCharType())     return new Character(getCharValueUnchecked(obj));
    if (type.isDoubleType())     return new Double(getDoubleValueUnchecked(obj));
    if (type.isFloatType())     return new Float(getFloatValueUnchecked(obj));
    if (type.isLongType())     return new Long(getLongValueUnchecked(obj));
    if (type.isIntType())     return new Integer(getIntValueUnchecked(obj));
    if (type.isShortType())     return new Short(getShortValueUnchecked(obj));
    if (type.isByteType())     return new Byte(getByteValueUnchecked(obj));
    if (type.isBooleanType())     return Boolean.valueOf(getBooleanValueUnchecked(obj));
    return null;
  }
}
Program: 150062
Project: 150062
Buggy source:
/** 
 * Set up to scan the current stack frame.  This means examining the frame to discover the method being invoked and then retrieving the associated metadata (stack maps etc).  Certain frames should not be scanned---these are identified and skipped.
 * @param verbosity The level of verbosity to be used whenperforming the scan.
 * @return True if the frame should be scanned, false if it shouldbe skipped.
 */
private boolean setUpFrame(int verbosity){
  int compiledMethodId=VM_Magic.getCompiledMethodID(fp);
  if (compiledMethodId == VM_Constants.INVISIBLE_METHOD_ID) {
    if (verbosity >= 1)     Log.writeln("String_Node_Str");
    return false;
  }
  compiledMethod=VM_CompiledMethods.getCompiledMethod(compiledMethodId);
  compiledMethod.setObsolete(false);
  VM_Method method=compiledMethod.getMethod();
  compiledMethodType=compiledMethod.getCompilerType();
  if (verbosity >= 1)   printMethodHeader();
  if (compiledMethodType == VM_CompiledMethod.TRAP)   return false;
  Offset offset=compiledMethod.getInstructionOffset(ip);
  iterator=iteratorGroup.selectIterator(compiledMethod);
  iterator.setupIterator(compiledMethod,offset,fp);
  if (verbosity >= 2)   dumpStackFrame(verbosity);
  if (verbosity >= 3)   Log.writeln("String_Node_Str");
  return true;
}

Fixed version (ground truth):
/** 
 * Set up to scan the current stack frame.  This means examining the frame to discover the method being invoked and then retrieving the associated metadata (stack maps etc).  Certain frames should not be scanned---these are identified and skipped.
 * @param verbosity The level of verbosity to be used whenperforming the scan.
 * @return True if the frame should be scanned, false if it shouldbe skipped.
 */
private boolean setUpFrame(int verbosity){
  int compiledMethodId=VM_Magic.getCompiledMethodID(fp);
  if (compiledMethodId == VM_Constants.INVISIBLE_METHOD_ID) {
    if (verbosity >= 1)     Log.writeln("String_Node_Str");
    return false;
  }
  compiledMethod=VM_CompiledMethods.getCompiledMethod(compiledMethodId);
  compiledMethod.setObsolete(false);
  compiledMethodType=compiledMethod.getCompilerType();
  if (verbosity >= 1)   printMethodHeader();
  if (compiledMethodType == VM_CompiledMethod.TRAP)   return false;
  Offset offset=compiledMethod.getInstructionOffset(ip);
  iterator=iteratorGroup.selectIterator(compiledMethod);
  iterator.setupIterator(compiledMethod,offset,fp);
  if (verbosity >= 2)   dumpStackFrame(verbosity);
  if (verbosity >= 3)   Log.writeln("String_Node_Str");
  return true;
}
Program: 150063
Project: 150063
Buggy source:
/** 
 * writes a <code>long</code> in hexadecimal
 * @param w the Word to be logged
 * @param bytes the number of bytes from the long to be logged.  Ifless than 8 then the least significant bytes are logged and some of the most significant bytes are ignored.
 */
private static void writeHex(Word w,int bytes){
  int hexDigits=bytes * (1 << LOG_HEX_DIGITS_IN_BYTE);
  int nextDigit;
  char[] intBuffer=getIntBuffer();
  write(HEX_PREFIX);
  for (int digitNumber=hexDigits - 1; digitNumber >= 0; digitNumber--) {
    nextDigit=w.rshl(digitNumber << LOG_BITS_IN_HEX_DIGIT).toInt() & 0xf;
    char nextChar=Barriers.getArrayNoBarrier(hexDigitCharacter,nextDigit);
    add(nextChar);
  }
}

Fixed version (ground truth):
/** 
 * writes a <code>long</code> in hexadecimal
 * @param w the Word to be logged
 * @param bytes the number of bytes from the long to be logged.  Ifless than 8 then the least significant bytes are logged and some of the most significant bytes are ignored.
 */
private static void writeHex(Word w,int bytes){
  int hexDigits=bytes * (1 << LOG_HEX_DIGITS_IN_BYTE);
  int nextDigit;
  write(HEX_PREFIX);
  for (int digitNumber=hexDigits - 1; digitNumber >= 0; digitNumber--) {
    nextDigit=w.rshl(digitNumber << LOG_BITS_IN_HEX_DIGIT).toInt() & 0xf;
    char nextChar=Barriers.getArrayNoBarrier(hexDigitCharacter,nextDigit);
    add(nextChar);
  }
}
Program: 150064
Project: 150064
Buggy source:
/** 
 * Perform a sanity traversal of a linked list of blocks, checking that the double links are sane, and returning the length of the list.
 * @param block The first block in the list to be checked
 * @param prev The previous block in the list (possibly null)
 * @param verbose If true then produce large amounts of debuggingoutput detailing the composition of the list.
 * @return The length of the list
 */
final static int sanityTraverse(Address block,Address prev,boolean verbose){
  if (verbose)   Log.write("String_Node_Str");
  boolean first=true;
  int blocks=0;
  while (!block.isZero()) {
    if (Assert.VERIFY_ASSERTIONS)     Assert._assert(getPrevBlock(block).EQ(prev));
    blocks++;
    if (verbose) {
      if (!first)       Log.write("String_Node_Str");
 else       first=false;
      Log.write(block);
    }
    prev=block;
    block=getNextBlock(block);
    Log.flush();
  }
  if (verbose)   Log.write("String_Node_Str");
  return blocks;
}

Fixed version (ground truth):
/** 
 * Perform a sanity traversal of a linked list of blocks, checking that the double links are sane, and returning the length of the list.
 * @param block The first block in the list to be checked
 * @param prev The previous block in the list (possibly null)
 * @param verbose If true then produce large amounts of debuggingoutput detailing the composition of the list.
 * @return The length of the list
 */
final static int sanityTraverse(Address block,Address prev,boolean verbose){
  if (verbose)   Log.write("String_Node_Str");
  boolean first=true;
  int blocks=0;
  while (!block.isZero()) {
    if (Assert.VERIFY_ASSERTIONS)     Assert._assert(getPrevBlock(block).EQ(prev));
    blocks++;
    if (verbose) {
      if (!first)       Log.write("String_Node_Str");
 else       first=false;
      Log.write(block);
    }
    block=getNextBlock(block);
    Log.flush();
  }
  if (verbose)   Log.write("String_Node_Str");
  return blocks;
}
Program: 150065
Project: 150065
Buggy source:
/** 
 * Perform a linear scan through a single contigious region
 * @param scanner The scan object to delegate to.
 * @param start The start of this region
 */
private void scanRegion(LinearScan scanner,Address start) throws InlinePragma {
  Address end=start.add(REGION_LIMIT_OFFSET).loadAddress();
  Address dataEnd=start.add(DATA_END_OFFSET).loadAddress();
  Address currentLimit=(dataEnd.isZero() ? cursor : dataEnd);
  ObjectReference current=ObjectModel.getObjectFromStartAddress(start.add(DATA_START_OFFSET));
  while (ObjectModel.refToAddress(current).LT(currentLimit)) {
    ObjectReference next=ObjectModel.getNextObject(current);
    scanner.scan(current);
    current=next;
  }
}

Fixed version (ground truth):
/** 
 * Perform a linear scan through a single contigious region
 * @param scanner The scan object to delegate to.
 * @param start The start of this region
 */
private void scanRegion(LinearScan scanner,Address start) throws InlinePragma {
  Address dataEnd=start.add(DATA_END_OFFSET).loadAddress();
  Address currentLimit=(dataEnd.isZero() ? cursor : dataEnd);
  ObjectReference current=ObjectModel.getObjectFromStartAddress(start.add(DATA_START_OFFSET));
  while (ObjectModel.refToAddress(current).LT(currentLimit)) {
    ObjectReference next=ObjectModel.getNextObject(current);
    scanner.scan(current);
    current=next;
  }
}
Program: 150070
Project: 150070
Buggy source:
/** 
 * Does the passed object have an entry in the table?
 * @param object The object to find an entry for
 * @return True if there is an entry for that object.
 */
public final boolean contains(Word key){
  return !getEntry(key,false).isZero();
}

Fixed version (ground truth):
/** 
 * Does the passed object have an entry in the table?
 * @param key The key to find an entry for
 * @return True if there is an entry for that object.
 */
public final boolean contains(Word key){
  return !getEntry(key,false).isZero();
}
Program: 150071
Project: 150071
Buggy source:
/** 
 * Create a new data table of a specified size.
 * @param space The space to acquire the data structure from.
 * @param logSize The log of the number of table entries. 
 * @param entrySize The size of each entry.
 */
protected SimpleHashtable(RawPageSpace rps,int logSize,Extent es){
  mask=Word.fromInt((1 << logSize) - 1);
  entrySize=es.add(BYTES_IN_WORD);
  size=Extent.fromInt((1 << logSize) * entrySize.toInt());
  base=Address.zero();
  space=rps;
  valid=false;
}

Fixed version (ground truth):
/** 
 * Create a new data table of a specified size.
 * @param rps The space to acquire the data structure from.
 * @param logSize The log of the number of table entries. 
 * @param es The size of each entry.
 */
protected SimpleHashtable(RawPageSpace rps,int logSize,Extent es){
  mask=Word.fromInt((1 << logSize) - 1);
  entrySize=es.add(BYTES_IN_WORD);
  size=Extent.fromInt((1 << logSize) * entrySize.toInt());
  base=Address.zero();
  space=rps;
  valid=false;
}
Program: 150072
Project: 150072
Buggy source:
/** 
 * Compute the hashtable index for a given object.
 * @param ref The object.
 * @return The index. 
 */
private final int computeHash(Word key) throws InlinePragma {
  return key.rshl(HASH_SHIFT).and(mask).toInt();
}

Fixed version (ground truth):
/** 
 * Compute the hashtable index for a given object.
 * @param key The key.
 * @return The index. 
 */
private final int computeHash(Word key) throws InlinePragma {
  return key.rshl(HASH_SHIFT).and(mask).toInt();
}
Program: 150073
Project: 150073
Buggy source:
/** 
 * Given a key, return a pointer to the payload.
 * @param entry The entry
 * @return The object reference.
 */
public final Address getPayloadAddress(Word key){
  Address entry=getEntry(key,false);
  if (entry.isZero())   return Address.zero();
  return entry.add(DATA_OFFSET);
}

Fixed version (ground truth):
/** 
 * Given a key, return a pointer to the payload.
 * @param key The key 
 * @return The object reference.
 */
public final Address getPayloadAddress(Word key){
  Address entry=getEntry(key,false);
  if (entry.isZero())   return Address.zero();
  return entry.add(DATA_OFFSET);
}
Program: 150074
Project: 150074
Buggy source:
/** 
 * Create a new data table of a specified size.
 * @param space The space to acquire the data structure from.
 * @param logSize The log of the number of table entries. 
 */
public SanityDataTable(RawPageSpace rps,int logSize){
  super(rps,logSize,Extent.fromInt(BYTES_IN_WORD));
}

Fixed version (ground truth):
/** 
 * Create a new data table of a specified size.
 * @param rps The space to acquire the data structure from.
 * @param logSize The log of the number of table entries. 
 */
public SanityDataTable(RawPageSpace rps,int logSize){
  super(rps,logSize,Extent.fromInt(BYTES_IN_WORD));
}
Program: 150081
Project: 150081
Buggy source:
/** 
 * Append an instruction after a store instruction that caches value in register r.
 */
static void appendMove(OPT_Register r,OPT_Operand src,OPT_Instruction store){
  VM_TypeReference type=src.getType();
  OPT_RegisterOperand rop=new OPT_RegisterOperand(r,type);
  store.insertAfter(Move.create(OPT_IRTools.getMoveOp(type),rop,src));
}

Fixed version (ground truth):
/** 
 * Append an instruction after a store instruction that caches value in register r.
 */
static void appendMove(OPT_Register r,OPT_Operand src,OPT_Instruction store){
  VM_TypeReference type=src.getType();
  OPT_RegisterOperand rop=new OPT_RegisterOperand(r,type);
  store.insertAfter(Move.create(OPT_IRTools.getMoveOp(type),rop,src.copy()));
}
Program: 150082
Project: 150082
Buggy source:
/** 
 * Expansion of INT_DIV and INT_REM
 * @param s the instruction to expand
 * @param result the result operand
 * @param val1 the first operand
 * @param val2 the second operand
 * @param isDiv true for div, false for rem
 */
protected final void INT_DIVIDES(OPT_Instruction s,OPT_RegisterOperand result,OPT_Operand val1,OPT_Operand val2,boolean isDiv){
  EMIT(MIR_Move.create(IA32_MOV,new OPT_RegisterOperand(getEAX(),VM_TypeReference.Int),val1));
  EMIT(MIR_ConvertDW2QW.create(IA32_CDQ,new OPT_RegisterOperand(getEDX(),VM_TypeReference.Int),new OPT_RegisterOperand(getEAX(),VM_TypeReference.Int)));
  if (val2 instanceof OPT_IntConstantOperand) {
    OPT_RegisterOperand temp=regpool.makeTempInt();
    EMIT(MIR_Move.create(IA32_MOV,temp,val2));
    val2=temp;
  }
  EMIT(MIR_Divide.mutate(s,IA32_IDIV,new OPT_RegisterOperand(getEDX(),VM_TypeReference.Int),new OPT_RegisterOperand(getEAX(),VM_TypeReference.Int),val2,GuardedBinary.getGuard(s)));
  if (isDiv) {
    EMIT(MIR_Move.create(IA32_MOV,result.copyD2D(),new OPT_RegisterOperand(getEAX(),VM_TypeReference.Int)));
  }
 else {
    EMIT(MIR_Move.create(IA32_MOV,result.copyD2D(),new OPT_RegisterOperand(getEDX(),VM_TypeReference.Int)));
  }
}

Fixed version (ground truth):
/** 
 * Expansion of INT_DIV and INT_REM
 * @param s the instruction to expand
 * @param result the result operand
 * @param val1 the first operand
 * @param val2 the second operand
 * @param isDiv true for div, false for rem
 */
protected final void INT_DIVIDES(OPT_Instruction s,OPT_RegisterOperand result,OPT_Operand val1,OPT_Operand val2,boolean isDiv){
  EMIT(MIR_Move.create(IA32_MOV,new OPT_RegisterOperand(getEAX(),VM_TypeReference.Int),val1));
  EMIT(MIR_ConvertDW2QW.create(IA32_CDQ,new OPT_RegisterOperand(getEDX(),VM_TypeReference.Int),new OPT_RegisterOperand(getEAX(),VM_TypeReference.Int)));
  if (val2 instanceof OPT_IntConstantOperand) {
    OPT_RegisterOperand temp=regpool.makeTempInt();
    EMIT(MIR_Move.create(IA32_MOV,temp,val2));
    val2=temp.copyRO();
  }
  EMIT(MIR_Divide.mutate(s,IA32_IDIV,new OPT_RegisterOperand(getEDX(),VM_TypeReference.Int),new OPT_RegisterOperand(getEAX(),VM_TypeReference.Int),val2,GuardedBinary.getGuard(s)));
  if (isDiv) {
    EMIT(MIR_Move.create(IA32_MOV,result.copyD2D(),new OPT_RegisterOperand(getEAX(),VM_TypeReference.Int)));
  }
 else {
    EMIT(MIR_Move.create(IA32_MOV,result.copyD2D(),new OPT_RegisterOperand(getEDX(),VM_TypeReference.Int)));
  }
}
Program: 150083
Project: 150083
Buggy source:
/** 
 * Expansion of LOWTABLESWITCH.  
 * @param s the instruction to expand
 */
protected final void LOWTABLESWITCH(OPT_Instruction s){
  OPT_RegisterOperand newIndex=regpool.makeTempInt();
  EMIT(MIR_Move.create(IA32_MOV,newIndex,LowTableSwitch.getIndex(s)));
  int number=LowTableSwitch.getNumberOfTargets(s);
  OPT_Instruction s2=CPOS(s,MIR_LowTableSwitch.create(MIR_LOWTABLESWITCH,newIndex,number * 2));
  for (int i=0; i < number; i++) {
    MIR_LowTableSwitch.setTarget(s2,i,LowTableSwitch.getTarget(s,i));
    MIR_LowTableSwitch.setBranchProfile(s2,i,LowTableSwitch.getBranchProfile(s,i));
  }
  EMIT(s2);
}

Fixed version (ground truth):
/** 
 * Expansion of LOWTABLESWITCH.  
 * @param s the instruction to expand
 */
protected final void LOWTABLESWITCH(OPT_Instruction s){
  OPT_RegisterOperand newIndex=regpool.makeTempInt();
  EMIT(MIR_Move.create(IA32_MOV,newIndex,LowTableSwitch.getIndex(s)));
  int number=LowTableSwitch.getNumberOfTargets(s);
  OPT_Instruction s2=CPOS(s,MIR_LowTableSwitch.create(MIR_LOWTABLESWITCH,newIndex.copyRO(),number * 2));
  for (int i=0; i < number; i++) {
    MIR_LowTableSwitch.setTarget(s2,i,LowTableSwitch.getTarget(s,i));
    MIR_LowTableSwitch.setBranchProfile(s2,i,LowTableSwitch.getBranchProfile(s,i));
  }
  EMIT(s2);
}
Program: 150084
Project: 150084
Buggy source:
/** 
 * expand an FCLEAR pseudo-insruction using FFREEs.
 * @param s the instruction to expand
 * @param phys controlling physical register set
 */
private static void expandFClear(OPT_Instruction s,OPT_IR ir){
  int nSave=MIR_UnaryNoRes.getVal(s).asIntConstant().value;
  int fpStackHeight=ir.MIRInfo.fpStackHeight;
  OPT_PhysicalRegisterSet phys=ir.regpool.getPhysicalRegisterSet();
  for (int i=nSave; i < fpStackHeight; i++) {
    OPT_Register f=phys.getFPR(i);
    s.insertBefore(MIR_UnaryAcc.create(IA32_FFREE,D(f)));
  }
  s.remove();
}

Fixed version (ground truth):
/** 
 * expand an FCLEAR pseudo-insruction using FFREEs.
 * @param s the instruction to expand
 * @param phys controlling physical register set
 */
private static void expandFClear(OPT_Instruction s,OPT_IR ir){
  int nSave=MIR_UnaryNoRes.getVal(s).asIntConstant().value;
  int fpStackHeight=ir.MIRInfo.fpStackHeight;
  OPT_PhysicalRegisterSet phys=ir.regpool.getPhysicalRegisterSet();
  for (int i=nSave; i < fpStackHeight; i++) {
    OPT_Register f=phys.getFPR(i);
    s.insertBefore(MIR_Nullary.create(IA32_FFREE,D(f)));
  }
  s.remove();
}
Program: 150087
Project: 150087
Buggy source:
/** 
 * removes the head element from the list
 */
final public OPT_LinkedListElement removeHead(){
  if (start == null)   return null;
  OPT_LinkedListElement result=start;
  start=result.next;
  result.next=null;
  return result;
}

Fixed version (ground truth):
/** 
 * removes the head element from the list
 */
final public OPT_LinkedListElement removeHead(){
  if (start == null)   return null;
  OPT_LinkedListElement result=start;
  start=result.next;
  if (start == null)   end=null;
  result.next=null;
  return result;
}
Program: 150089
Project: 150089
Buggy source:
/** 
 * Start the server and wait if necessary WARNING: allocates memory
 * @param wait Whether to wait
 * @param port The port to talk to the GCspy client (e.g. visualiser)
 */
public static final void startGCspyServer(int port,boolean wait) throws InterruptiblePragma {
  String eventNames[]={"String_Node_Str","String_Node_Str","String_Node_Str"};
  String generalInfo="String_Node_Str";
  ServerInterpreter.init("String_Node_Str",port,eventNames,true,generalInfo);
  int tilesize=Options.gcspyTileSize.getValue();
  ss0Driver=new ContiguousSpaceDriver("String_Node_Str",copySpace0,tilesize,true);
  ss1Driver=new ContiguousSpaceDriver("String_Node_Str",copySpace1,tilesize,false);
  immortalDriver=new ContiguousSpaceDriver("String_Node_Str",immortalSpace,tilesize,false);
  losDriver=new TreadmillDriver("String_Node_Str",loSpace,tilesize,LOS_SIZE_THRESHOLD,false);
  gcspyEvent_=BEFORE_COLLECTION;
  ServerInterpreter.startServer(wait);
}

Fixed version (ground truth):
/** 
 * Start the server and wait if necessary WARNING: allocates memory
 * @param wait Whether to wait
 * @param port The port to talk to the GCspy client (e.g. visualiser)
 */
public final void startGCspyServer(int port,boolean wait) throws InterruptiblePragma {
  String eventNames[]={"String_Node_Str","String_Node_Str","String_Node_Str"};
  String generalInfo="String_Node_Str";
  ServerInterpreter.init("String_Node_Str",port,eventNames,true,generalInfo);
  int tilesize=Options.gcspyTileSize.getValue();
  ss0Driver=new ContiguousSpaceDriver("String_Node_Str",copySpace0,tilesize,true);
  ss1Driver=new ContiguousSpaceDriver("String_Node_Str",copySpace1,tilesize,false);
  immortalDriver=new ContiguousSpaceDriver("String_Node_Str",immortalSpace,tilesize,false);
  losDriver=new TreadmillDriver("String_Node_Str",loSpace,tilesize,LOS_SIZE_THRESHOLD,false);
  gcspyEvent_=BEFORE_COLLECTION;
  ServerInterpreter.startServer(wait);
}
Program: 150090
Project: 150090
Buggy source:
/** 
 * Start the GCspy server WARNING: allocates memory indirectly
 */
public static void startGCspyServer() throws InterruptiblePragma {
  int port=getGCspyPort();
  Log.write("String_Node_Str");
  Log.write(port);
  Log.write("String_Node_Str");
  Log.writeln(getGCspyWait());
  if (port > 0) {
    SSGCspy.startGCspyServer(port,getGCspyWait());
    Log.writeln("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Start the GCspy server WARNING: allocates memory indirectly
 */
public static void startGCspyServer() throws InterruptiblePragma {
  int port=getGCspyPort();
  Log.write("String_Node_Str");
  Log.write(port);
  Log.write("String_Node_Str");
  Log.writeln(getGCspyWait());
  if (port > 0) {
    ActivePlan.global().startGCspyServer(port,getGCspyWait());
    Log.writeln("String_Node_Str");
  }
}
Program: 150092
Project: 150092
Buggy source:
protected final void SHL_USHR(OPT_Instruction s,OPT_RegisterOperand def,OPT_RegisterOperand left,OPT_IntConstantOperand shift1,OPT_IntConstantOperand shift2){
  int x=shift1.value;
  int y=shift2.value;
  if (x < y) {
    EMIT(MIR_RotateAndMask.create(PPC_RLWINM,def,left,IC((32 - (y - x)) & 0x1f),IC(y),IC(31)));
  }
 else {
    EMIT(MIR_RotateAndMask.create(PPC_RLWINM,def,left,IC(x - y),IC(y),IC(31 - (x - y))));
  }
}

Fixed version (ground truth):
protected final void SHL_USHR(OPT_Instruction s,OPT_RegisterOperand def,OPT_RegisterOperand left,OPT_IntConstantOperand shift1,OPT_IntConstantOperand shift2){
  int x=shift1.value;
  int y=shift2.value;
  if (x <= y) {
    EMIT(MIR_RotateAndMask.create(PPC64_RLDICL,def,left,IC(64 - (y - x)),IC(y),IC(63)));
    EMIT(MIR_RotateAndMask.create(PPC_RLWINM,def,left,IC((32 - (y - x)) & 0x1f),IC(y),IC(31)));
  }
 else {
    if (VM.VerifyAssertions)     VM._assert(false);
    EMIT(MIR_RotateAndMask.create(PPC_RLWINM,def,left,IC(x - y),IC(y),IC(31 - (x - y))));
  }
}
Program: 150093
Project: 150093
Buggy source:
protected final void USHR_SHL(OPT_Instruction s,OPT_RegisterOperand def,OPT_RegisterOperand left,OPT_IntConstantOperand shift1,OPT_IntConstantOperand shift2){
  int x=shift1.value;
  int y=shift2.value;
  if (x < y) {
    EMIT(MIR_RotateAndMask.create(PPC_RLWINM,def,left,IC(y - x),IC(0),IC(31 - y)));
  }
 else {
    EMIT(MIR_RotateAndMask.create(PPC_RLWINM,def,left,IC((32 - (x - y)) & 0x1f),IC(x - y),IC(31 - y)));
  }
}

Fixed version (ground truth):
protected final void USHR_SHL(OPT_Instruction s,OPT_RegisterOperand def,OPT_RegisterOperand left,OPT_IntConstantOperand shift1,OPT_IntConstantOperand shift2){
  int x=shift1.value;
  int y=shift2.value;
  if (x <= y) {
    EMIT(MIR_RotateAndMask.create(PPC64_RLDICR,def,left,IC(y - x),IC(0),IC(63 - y)));
    EMIT(MIR_RotateAndMask.create(PPC_RLWINM,def,left,IC(y - x),IC(0),IC(31 - y)));
  }
 else {
    if (VM.VerifyAssertions)     VM._assert(false);
    EMIT(MIR_RotateAndMask.create(PPC_RLWINM,def,left,IC((32 - (x - y)) & 0x1f),IC(x - y),IC(31 - y)));
  }
}
Program: 150095
Project: 150095
Buggy source:
/** 
 * Set list of places to be searched for application classes and resources. Do NOT set the java.class.path property; it is probably too early in the VM's booting cycle to set properties.
 * @param classpath path specification in standard "classpath" format
 */
public static void stashApplicationRepositories(String classpath){
  if (DBG_APP_CL) {
    VM.sysWriteln("String_Node_Str" + "String_Node_Str",classpath);
  }
  if (appCL != null && !classpath.equals(applicationRepositories)) {
    appCL=null;
    if (DBG_APP_CL)     VM.sysWriteln("String_Node_Str");
  }
  VM_ApplicationClassLoader2.setApplicationRepositories(classpath);
  applicationRepositories=classpath;
}

Fixed version (ground truth):
/** 
 * Set list of places to be searched for application classes and resources. Do NOT set the java.class.path property; it is probably too early in the VM's booting cycle to set properties.
 * @param classpath path specification in standard "classpath" format
 */
public static void stashApplicationRepositories(String classpath){
  if (DBG_APP_CL) {
    VM.sysWriteln("String_Node_Str" + "String_Node_Str",classpath);
  }
  if (appCL != null && !classpath.equals(applicationRepositories)) {
    appCL=null;
    if (DBG_APP_CL)     VM.sysWriteln("String_Node_Str");
  }
  applicationRepositories=classpath;
}
Program: 150096
Project: 150096
Buggy source:
public static ClassLoader getApplicationClassLoader(){
  if (!VM.runningVM)   return null;
  if (!appCLReady)   return VM_BootstrapClassLoader.getBootstrapClassLoader();
  if (appCL != null)   return appCL;
  if (gettingAppCL > 0 || DBG_APP_CL)   VM.sysWriteln("String_Node_Str",gettingAppCL > 0 ? "String_Node_Str" : "String_Node_Str","String_Node_Str",gettingAppCL,"String_Node_Str");
  if (gettingAppCL > 0) {
    VM.sysFail("String_Node_Str");
  }
  ++gettingAppCL;
  String r=getApplicationRepositories();
  if (VM_Properties.verboseBoot >= 1 || DBG_APP_CL)   VM.sysWriteln("String_Node_Str" + "String_Node_Str" + "String_Node_Str",r,"String_Node_Str");
  if (USE_OLD_APP_CLASSLOADER) {
    appCL=new ApplicationClassLoader(r);
  }
 else {
    VM_ApplicationClassLoader2.setApplicationRepositories(r);
    appCL=VM_ApplicationClassLoader2.getApplicationClassLoader();
  }
  if (VM_Properties.verboseBoot >= 1 || DBG_APP_CL)   VM.sysWriteln("String_Node_Str",appCL.toString());
  --gettingAppCL;
  return appCL;
}

Fixed version (ground truth):
public static ClassLoader getApplicationClassLoader(){
  if (!VM.runningVM)   return null;
  if (!appCLReady)   return VM_BootstrapClassLoader.getBootstrapClassLoader();
  if (appCL != null)   return appCL;
  if (gettingAppCL > 0 || DBG_APP_CL)   VM.sysWriteln("String_Node_Str",gettingAppCL > 0 ? "String_Node_Str" : "String_Node_Str","String_Node_Str",gettingAppCL,"String_Node_Str");
  if (gettingAppCL > 0) {
    VM.sysFail("String_Node_Str");
  }
  ++gettingAppCL;
  String r=getApplicationRepositories();
  if (VM_Properties.verboseBoot >= 1 || DBG_APP_CL)   VM.sysWriteln("String_Node_Str" + "String_Node_Str" + "String_Node_Str",r,"String_Node_Str");
  appCL=new ApplicationClassLoader(r);
  if (VM_Properties.verboseBoot >= 1 || DBG_APP_CL)   VM.sysWriteln("String_Node_Str",appCL.toString());
  --gettingAppCL;
  return appCL;
}
Program: 150097
Project: 150097
Buggy source:
/** 
 * Return the number of pages reserved for use given the pending allocation.  This is <i>exclusive of</i> space reserved for copying.
 * @return The number of pages reserved given the pendingallocation, excluding space reserved for copying.
 */
protected static final int getPagesUsed(){
  int pages=getCommonPagesReserved();
  pages+=nurserySpace.reservedPages();
  return pages;
}

Fixed version (ground truth):
/** 
 * Return the number of pages reserved for use given the pending allocation.  This is <i>exclusive of</i> space reserved for copying.
 * @return The number of pages reserved given the pendingallocation, excluding space reserved for copying.
 */
protected static final int getPagesUsed(){
  int pages=getCommonPagesReserved();
  pages+=nurserySpace.reservedPages();
  pages+=msSpace.reservedPages();
  return pages;
}
Program: 150098
Project: 150098
Buggy source:
protected final void SHL_USHR(OPT_Instruction s,OPT_RegisterOperand def,OPT_RegisterOperand left,OPT_IntConstantOperand shift1,OPT_IntConstantOperand shift2){
  int x=shift1.value;
  int y=shift2.value;
  if (x <= y) {
    EMIT(MIR_RotateAndMask.create(PPC64_RLDICL,def,left,IC(64 - (y - x)),IC(y),IC(63)));
    EMIT(MIR_RotateAndMask.create(PPC_RLWINM,def,left,IC((32 - (y - x)) & 0x1f),IC(y),IC(31)));
  }
 else {
    if (VM.VerifyAssertions)     VM._assert(false);
    EMIT(MIR_RotateAndMask.create(PPC_RLWINM,def,left,IC(x - y),IC(y),IC(31 - (x - y))));
  }
}

Fixed version (ground truth):
protected final void SHL_USHR(OPT_Instruction s,OPT_RegisterOperand def,OPT_RegisterOperand left,OPT_IntConstantOperand shift1,OPT_IntConstantOperand shift2){
  int x=shift1.value;
  int y=shift2.value;
  if (x <= y) {
    EMIT(MIR_RotateAndMask.create(PPC_RLWINM,def,left,IC((32 - (y - x)) & 0x1f),IC(y),IC(31)));
  }
 else {
    EMIT(MIR_RotateAndMask.create(PPC_RLWINM,def,left,IC(x - y),IC(y),IC(31 - (x - y))));
  }
}
Program: 150099
Project: 150099
Buggy source:
protected final void USHR_SHL(OPT_Instruction s,OPT_RegisterOperand def,OPT_RegisterOperand left,OPT_IntConstantOperand shift1,OPT_IntConstantOperand shift2){
  int x=shift1.value;
  int y=shift2.value;
  if (x <= y) {
    EMIT(MIR_RotateAndMask.create(PPC64_RLDICR,def,left,IC(y - x),IC(0),IC(63 - y)));
    EMIT(MIR_RotateAndMask.create(PPC_RLWINM,def,left,IC(y - x),IC(0),IC(31 - y)));
  }
 else {
    if (VM.VerifyAssertions)     VM._assert(false);
    EMIT(MIR_RotateAndMask.create(PPC_RLWINM,def,left,IC((32 - (x - y)) & 0x1f),IC(x - y),IC(31 - y)));
  }
}

Fixed version (ground truth):
protected final void USHR_SHL(OPT_Instruction s,OPT_RegisterOperand def,OPT_RegisterOperand left,OPT_IntConstantOperand shift1,OPT_IntConstantOperand shift2){
  int x=shift1.value;
  int y=shift2.value;
  if (x <= y) {
    EMIT(MIR_RotateAndMask.create(PPC_RLWINM,def,left,IC(y - x),IC(0),IC(31 - y)));
  }
 else {
    EMIT(MIR_RotateAndMask.create(PPC_RLWINM,def,left,IC((32 - (x - y)) & 0x1f),IC(x - y),IC(31 - y)));
  }
}
Program: 150100
Project: 150100
Buggy source:
/** 
 * @param level the minimum optimization level at which the branch optimizations should be performed.
 * @param mayReorderCode are we allowed to change the code order?
 * @param mayDuplicateCondBranches are we allowed to duplicate conditional branches?
 */
public OPT_BranchOptimizations(int level,boolean mayReorderCode,boolean mayDuplicateCondBranches){
  super(level);
  mayReorderCode=mayReorderCode;
  mayDuplicateCondBranches=mayDuplicateCondBranches;
}

Fixed version (ground truth):
/** 
 * @param level the minimum optimization level at which the branch optimizations should be performed.
 * @param mayReorderCode are we allowed to change the code order?
 * @param mayDuplicateCondBranches are we allowed to duplicate conditional branches?
 */
public OPT_BranchOptimizations(int level,boolean mayReorderCode,boolean mayDuplicateCondBranches){
  super(level);
  this.mayReorderCode=mayReorderCode;
  this.mayDuplicateCondBranches=mayDuplicateCondBranches;
}
Program: 150103
Project: 150103
Buggy source:
/** 
 * Initialization: set up data structures and sampling objects.
 */
public void initialize(){
  if (VM.LogAOSEvents)   VM_AOSLogging.DCGOrganizerThreadStarted();
  numberOfBufferTriples=VM_Controller.options.DCG_SAMPLE_SIZE;
  numberOfBufferTriples*=VM_Scheduler.numProcessors;
  bufferSize=numberOfBufferTriples * 3;
  buffer=new int[bufferSize];
  ((VM_EdgeListener)listener).setBuffer(buffer);
  VM_RuntimeMeasurements.installTimerContextListener((VM_EdgeListener)listener);
}

Fixed version (ground truth):
/** 
 * Initialization: set up data structures and sampling objects.
 */
public void initialize(){
  if (VM.LogAOSEvents)   VM_AOSLogging.DCGOrganizerThreadStarted();
  if (VM_Controller.options.cgCBS()) {
    numberOfBufferTriples=VM_Controller.options.DCG_SAMPLE_SIZE * VM.CBSCallSamplesPerTick;
  }
 else {
    numberOfBufferTriples=VM_Controller.options.DCG_SAMPLE_SIZE;
  }
  numberOfBufferTriples*=VM_Scheduler.numProcessors;
  bufferSize=numberOfBufferTriples * 3;
  buffer=new int[bufferSize];
  ((VM_EdgeListener)listener).setBuffer(buffer);
  if (VM_Controller.options.cgTimer()) {
    VM_RuntimeMeasurements.installTimerContextListener((VM_EdgeListener)listener);
  }
 else   if (VM_Controller.options.cgCBS()) {
    VM_RuntimeMeasurements.installCBSContextListener((VM_EdgeListener)listener);
  }
 else {
    if (VM.VerifyAssertions)     VM._assert(false,"String_Node_Str");
  }
}
Program: 150104
Project: 150104
Buggy source:
/** 
 * Print out the number of pages and or megabytes, depending on the mode.
 * @param pages The number of pages
 * @param mode An enumeration type that specifies the format for theprining (PAGES, MB, PAGES_MB, or MB_PAGES).
 */
private static void printPages(int pages,int mode){
  double mb=Conversions.pagesToMBytes(pages);
switch (mode) {
case PAGES:
    Log.write(pages);
  Log.write("String_Node_Str");
break;
case MB:
Log.write(mb);
Log.write("String_Node_Str");
break;
case PAGES_MB:
Log.write(pages);
Log.write("String_Node_Str");
Log.write(mb);
Log.write("String_Node_Str");
break;
case MB_PAGES:
Log.write(mb);
Log.write("String_Node_Str");
Log.write(pages);
Log.write("String_Node_Str");
break;
default :
Assert.fail("String_Node_Str");
}
}

Fixed version (ground truth):
/** 
 * Print out the number of pages and or megabytes, depending on the mode.
 * @param pages The number of pages
 * @param mode An enumeration type that specifies the format for theprining (PAGES, MB, PAGES_MB, or MB_PAGES).
 */
private static void printPages(int pages,int mode){
  double mb=(double)(pages << LOG_BYTES_IN_PAGE) / (double)(1 << 20);
switch (mode) {
case PAGES:
    Log.write(pages);
  Log.write("String_Node_Str");
break;
case MB:
Log.write(mb);
Log.write("String_Node_Str");
break;
case PAGES_MB:
Log.write(pages);
Log.write("String_Node_Str");
Log.write(mb);
Log.write("String_Node_Str");
break;
case MB_PAGES:
Log.write(mb);
Log.write("String_Node_Str");
Log.write(pages);
Log.write("String_Node_Str");
break;
default :
Assert.fail("String_Node_Str");
}
}
Program: 150105
Project: 150105
Buggy source:
/** 
 * Check if object might be a TIB.
 * @param obj address of object to check
 * @return <code>false</code> if the object is in the wrongallocation scheme/area for a TIB, <code>true</code> otherwise
 */
public static boolean mightBeTIB(ObjectReference obj) throws InlinePragma, UninterruptiblePragma {
  return Space.isImmortal(obj);
}

Fixed version (ground truth):
/** 
 * Check if object might be a TIB.
 * @param obj address of object to check
 * @return <code>false</code> if the object is in the wrongallocation scheme/area for a TIB, <code>true</code> otherwise
 */
public static boolean mightBeTIB(ObjectReference obj) throws InlinePragma, UninterruptiblePragma {
  return !obj.isNull() && Space.isImmortal(obj);
}
Program: 150108
Project: 150108
Buggy source:
final Address alloc() throws InlinePragma {
  Address rtn=rps.acquire(PAGES_PER_BUFFER);
  if (Assert.VERIFY_ASSERTIONS)   Assert._assert(rtn.EQ(bufferStart(rtn)));
  return rtn;
}

Fixed version (ground truth):
final Address alloc() throws InlinePragma {
  Address rtn=rps.acquire(PAGES_PER_BUFFER);
  if (rtn.isZero()) {
    Space.printUsageMB();
    Assert.fail("String_Node_Str");
  }
  if (Assert.VERIFY_ASSERTIONS)   Assert._assert(rtn.EQ(bufferStart(rtn)));
  return rtn;
}
Program: 150109
Project: 150109
Buggy source:
/** 
 * Print a message of a method name
 */
protected final void printMethodMessage(){
  String compilerName=getCompilerName();
  VM.sysWrite("String_Node_Str" + Character.toUpperCase(compilerName.charAt(0)) + compilerName.substring(1));
  VM.sysWrite("String_Node_Str");
  VM.sysWrite(method.getDeclaringClass().toString());
  VM.sysWrite("String_Node_Str");
  VM.sysWrite(method.getName());
  VM.sysWrite("String_Node_Str");
  VM.sysWrite(method.getDescriptor());
  VM.sysWrite("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Print a message of a method name
 */
protected final void printMethodMessage(){
  String compilerName=getCompilerName();
  if (compilerName.equals("String_Node_Str")) {
    VM.sysWrite("String_Node_Str");
  }
 else   if (compilerName.equals("String_Node_Str")) {
    VM.sysWrite("String_Node_Str");
  }
 else   if (VM.VerifyAssertions) {
    VM._assert(false,"String_Node_Str");
  }
  VM.sysWrite(method.getDeclaringClass().toString());
  VM.sysWrite("String_Node_Str");
  VM.sysWrite(method.getName());
  VM.sysWrite("String_Node_Str");
  VM.sysWrite(method.getDescriptor());
  VM.sysWrite("String_Node_Str");
}
Program: 150111
Project: 150111
Buggy source:
public static void zero(Address start,Extent len) throws InlinePragma {
  if (Assert.VERIFY_ASSERTIONS)   Assert._assert((len.toInt() & (BYTES_IN_WORD - 1)) == 0 && (start.toInt() & (BYTES_IN_WORD - 1)) == 0);
  if (len.GT(Extent.fromIntZeroExtend(256)))   org.mmtk.vm.Memory.zero(start,len);
 else   zeroSmall(start,len);
}

Fixed version (ground truth):
/** 
 * Zero a region of memory
 * @param start The start of the region to be zeroed (must be 4-byte aligned)
 * @param bytes The number of bytes to be zeroed (must be 4-byte aligned)
 */
public static void zero(Address start,Extent bytes) throws InlinePragma {
  if (Assert.VERIFY_ASSERTIONS) {
    assertAligned(start.toInt());
    assertAligned(bytes.toInt());
  }
  if (bytes.GT(Extent.fromIntZeroExtend(SMALL_REGION_THRESHOLD)))   org.mmtk.vm.Memory.zero(start,bytes);
 else   zeroSmall(start,bytes);
}
Program: 150112
Project: 150112
Buggy source:
public static void set(Address start,int len,int v) throws InlinePragma {
  if (Assert.VERIFY_ASSERTIONS)   Assert._assert((len & (BYTES_IN_WORD - 1)) == 0 && (start.toInt() & (BYTES_IN_WORD - 1)) == 0);
  for (int i=0; i < len; i+=BYTES_IN_WORD)   start.store(Word.fromInt(v),Offset.fromInt(i));
}

Fixed version (ground truth):
/** 
 * Set a region of memory
 * @param start The start of the region to be zeroed (must be 4-byte aligned)
 * @param bytes The number of bytes to be zeroed (must be 4-byte aligned)
 * @param value The value to which the integers in the region should be set
 */
public static void set(Address start,int bytes,int value) throws InlinePragma {
  if (Assert.VERIFY_ASSERTIONS) {
    assertAligned(start.toInt());
    assertAligned(bytes);
  }
  Address end=start.add(bytes);
  for (Address addr=start; addr.LT(end); addr=addr.add(BYTES_IN_INT))   addr.store(value);
}
Program: 150113
Project: 150113
Buggy source:
public static void zeroPages(Address start,int len) throws InlinePragma {
  org.mmtk.vm.Memory.zeroPages(start,len);
}

Fixed version (ground truth):
/** 
 * Zero a page-aligned region of memory
 * @param start The start of the region to be zeroed (must be page aligned)
 * @param bytes The number of bytes to be zeroed (must be page aligned)
 */
public static void zeroPages(Address start,int bytes) throws InlinePragma {
  org.mmtk.vm.Memory.zeroPages(start,bytes);
}
Program: 150114
Project: 150114
Buggy source:
public static void zeroSmall(Address start,Extent len) throws InlinePragma {
  if (Assert.VERIFY_ASSERTIONS)   Assert._assert((len.toInt() & (BYTES_IN_WORD - 1)) == 0 && (start.toInt() & (BYTES_IN_WORD - 1)) == 0);
  Address end=start.add(len);
  for (Address i=start; i.LT(end); i=i.add(BYTES_IN_WORD))   i.store(Word.zero());
}

Fixed version (ground truth):
/** 
 * Zero a small region of memory
 * @param start The start of the region to be zeroed (must be 4-byte aligned)
 * @param bytes The number of bytes to be zeroed (must be 4-byte aligned)
 */
public static void zeroSmall(Address start,Extent bytes) throws InlinePragma {
  if (Assert.VERIFY_ASSERTIONS) {
    assertAligned(start.toInt());
    assertAligned(bytes.toInt());
  }
  Address end=start.add(bytes);
  for (Address addr=start; addr.LT(end); addr=addr.add(BYTES_IN_INT))   addr.store(0);
}
Program: 150115
Project: 150115
Buggy source:
public static void assertIsZeroed(Address start,int size) throws NoInlinePragma {
  Assert._assert(isSetHelper(start,size,true,Word.zero()));
}

Fixed version (ground truth):
/** 
 * Assert that a memory range is zeroed.  An assertion failure will occur if the region is not zeroed. this is in the inline allocation sequence when Assert.VERIFY_ASSERTIONS is true, it is carefully written to reduce the impact on code space.
 * @param start The start address of the range to be checked
 * @param bytes The size of the region to be checked, in bytes
 */
public static void assertIsZeroed(Address start,int bytes) throws NoInlinePragma {
  Assert._assert(isSet(start,bytes,true,0));
}
Program: 150116
Project: 150116
Buggy source:
public static boolean IsZeroed(Address start,int size) throws InlinePragma {
  return isSetHelper(start,size,false,Word.zero());
}

Fixed version (ground truth):
/** 
 * Check that a memory range is zeroed
 * @param start The start address of the range to be checked
 * @param bytes The size of the region to be checked, in bytes
 * @return True if the region is zeroed
 */
public static boolean IsZeroed(Address start,int bytes) throws InlinePragma {
  return isSet(start,bytes,false,0);
}
Program: 150117
Project: 150117
Buggy source:
public static void dumpMemory(Address addr,int before,int after){
  org.mmtk.vm.Memory.dumpMemory(addr,before,after);
}

Fixed version (ground truth):
/** 
 * Dump the contents of memory around a given address
 * @param addr The address around which the memory should be dumped
 * @param beforeBytes The number of bytes before the address to beincluded in the dump
 * @param afterBytes The number of bytes after the address to beincluded in the dump
 */
public static void dumpMemory(Address addr,int beforeBytes,int afterBytes){
  org.mmtk.vm.Memory.dumpMemory(addr,beforeBytes,afterBytes);
}
Program: 150118
Project: 150118
Buggy source:
/** 
 * Scan static variables (JTOC) for object references. Executed by all GC threads in parallel, with each doing a portion of the JTOC.
 */
public static void scanStatics(AddressDeque rootLocations) throws UninterruptiblePragma {
  int numSlots=VM_Statics.getNumberOfSlots();
  Address slots=VM_Statics.getSlots();
  int chunkSize=512;
  int slot, start, end, stride, slotAddress;
  VM_CollectorThread ct;
  stride=chunkSize * VM_CollectorThread.numCollectors();
  ct=VM_Magic.threadAsCollectorThread(VM_Thread.getCurrentThread());
  start=(ct.getGCOrdinal() - 1) * chunkSize;
  while (start < numSlots) {
    end=start + chunkSize;
    if (end > numSlots)     end=numSlots;
    for (slot=start; slot < end; slot++) {
      if (!VM_Statics.isReference(slot))       continue;
      rootLocations.push(slots.add(slot << LOG_BYTES_IN_ADDRESS));
    }
    start=start + stride;
  }
}

Fixed version (ground truth):
/** 
 * Scan static variables (JTOC) for object references.  Executed by all GC threads in parallel, with each doing a portion of the JTOC.
 */
public static void scanStatics(AddressDeque rootLocations) throws UninterruptiblePragma {
  int numSlots=VM_Statics.getNumberOfSlots();
  Address slots=VM_Statics.getSlots();
  int chunkSize=512;
  int slot, start, end, stride, slotAddress;
  VM_CollectorThread ct;
  stride=chunkSize * VM_CollectorThread.numCollectors();
  ct=VM_Magic.threadAsCollectorThread(VM_Thread.getCurrentThread());
  start=(ct.getGCOrdinal() - 1) * chunkSize;
  while (start < numSlots) {
    end=start + chunkSize;
    if (end > numSlots)     end=numSlots;
    for (slot=start; slot < end; slot++) {
      if (!VM_Statics.isReference(slot))       continue;
      rootLocations.push(slots.add(slot << LOG_BYTES_IN_SLOT));
    }
    start=start + stride;
  }
}