nus-yam/ex-repair huggingface dataset:
Program: 150007
Project: 150007
Buggy source:
/** 
 * Atomically set the live bit for a given object
 * @param object The object whose live bit is to be set.
 * @return True if the bit was changed to true.
 */
public static final boolean liveObject(ObjectReference object) throws InlinePragma {
  return liveAddress(VM.objectModel.refToAddress(object),true);
}

Fixed version (ground truth):
/** 
 * Atomically set the live bit for a given object
 * @param object The object whose live bit is to be set.
 * @return True if the bit was changed to true.
 */
public static final boolean liveObject(ObjectReference object) throws InlinePragma {
  return liveAddress(VM.objectModel.objectStartRef(object),true);
}
Program: 150008
Project: 150008
Buggy source:
/** 
 * Perform a per-collector collection phase.
 * @param phaseId The collection phase to perform
 * @param primary Use this thread for single-threaded local activities.
 */
public final void collectionPhase(int phaseId,boolean primary) throws InlinePragma {
  if (phaseId == CopyMS.PREPARE) {
    super.collectionPhase(phaseId,primary);
    mature.prepare();
    trace.prepare();
    return;
  }
  if (phaseId == CopyMS.START_CLOSURE) {
    trace.startTrace();
    return;
  }
  if (phaseId == CopyMS.COMPLETE_CLOSURE) {
    trace.completeTrace();
    return;
  }
  if (phaseId == CopyMS.RELEASE) {
    mature.releaseCollector();
    trace.release();
    super.collectionPhase(phaseId,primary);
    return;
  }
  super.collectionPhase(phaseId,primary);
}

Fixed version (ground truth):
/** 
 * Perform a per-collector collection phase.
 * @param phaseId The collection phase to perform
 * @param primary Use this thread for single-threaded local activities.
 */
public final void collectionPhase(int phaseId,boolean primary) throws InlinePragma {
  if (phaseId == CopyMS.PREPARE) {
    super.collectionPhase(phaseId,primary);
    mature.prepare();
    trace.prepare();
    return;
  }
  if (phaseId == CopyMS.START_CLOSURE) {
    trace.startTrace();
    return;
  }
  if (phaseId == CopyMS.COMPLETE_CLOSURE) {
    trace.completeTrace();
    return;
  }
  if (phaseId == CopyMS.RELEASE) {
    mature.releaseCollector();
    mature.releaseMutator();
    trace.release();
    super.collectionPhase(phaseId,primary);
    return;
  }
  super.collectionPhase(phaseId,primary);
}
Program: 150009
Project: 150009
Buggy source:
/** 
 * Create a new (local) instance.
 */
public CopyMSCollector(){
  mature=new MarkSweepLocal(CopyMS.msSpace);
  trace=new CopyMSTraceLocal(global().trace);
}

Fixed version (ground truth):
/** 
 * Create a new (local) instance.
 */
public CopyMSCollector(){
  mature=new MarkSweepLocal(CopyMS.msSpace);
  trace=new CopyMSTraceLocal(global().trace);
  sanityChecker=new CopyMSSanityCheckerLocal();
}
Program: 150010
Project: 150010
Buggy source:
/** 
 * Perform any post-copy actions.
 * @param object The newly allocated object
 * @param typeRef the type reference for the instance being created
 * @param bytes The size of the space to be allocated (in bytes)
 */
public final void postCopy(ObjectReference object,ObjectReference typeRef,int bytes,int allocator) throws InlinePragma {
  CopyMS.msSpace.writeMarkBit(object);
  MarkSweepLocal.liveObject(object);
}

Fixed version (ground truth):
/** 
 * Perform any post-copy actions.
 * @param object The newly allocated object
 * @param typeRef the type reference for the instance being created
 * @param bytes The size of the space to be allocated (in bytes)
 */
public final void postCopy(ObjectReference object,ObjectReference typeRef,int bytes,int allocator) throws InlinePragma {
  CopyMS.msSpace.postCopy(object,true);
}
Program: 150011
Project: 150011
Buggy source:
/** 
 * Where do we send copied objects ?
 * @return The allocator for copied objects
 */
public final int getAllocator() throws InlinePragma {
  return Gen.ALLOC_MATURE;
}

Fixed version (ground truth):
/** 
 * Where do we send copied objects ?
 * @return The allocator for copied objects
 */
public final int getAllocator() throws InlinePragma {
  return Gen.ALLOC_MATURE_MAJORGC;
}
Program: 150012
Project: 150012
Buggy source:
/** 
 * @return The allocator to use when copying objects during this trace.
 */
public final int getAllocator() throws InlinePragma {
  return Gen.ALLOC_MATURE;
}

Fixed version (ground truth):
/** 
 * @return The allocator to use when copying objects during this trace.
 */
public final int getAllocator() throws InlinePragma {
  return Gen.ALLOC_MATURE_MINORGC;
}
Program: 150013
Project: 150013
Buggy source:
/** 
 * Allocate space for copying an object (this method <i>does not</i> copy the object, it only allocates space)
 * @param original A reference to the original object
 * @param bytes The size of the space to be allocated (in bytes)
 * @param align The requested alignment.
 * @param offset The alignment offset.
 * @return The address of the first byte of the allocated region
 */
public Address allocCopy(ObjectReference original,int bytes,int align,int offset,int allocator) throws InlinePragma {
  if (Assert.VERIFY_ASSERTIONS) {
    Assert._assert(bytes <= Plan.LOS_SIZE_THRESHOLD);
    Assert._assert(allocator == GenCopy.ALLOC_MATURE);
  }
  Address result=mature.alloc(bytes,align,offset,true);
  return result;
}

Fixed version (ground truth):
/** 
 * Allocate space for copying an object (this method <i>does not</i> copy the object, it only allocates space)
 * @param original A reference to the original object
 * @param bytes The size of the space to be allocated (in bytes)
 * @param align The requested alignment.
 * @param offset The alignment offset.
 * @return The address of the first byte of the allocated region
 */
public Address allocCopy(ObjectReference original,int bytes,int align,int offset,int allocator) throws InlinePragma {
  if (Assert.VERIFY_ASSERTIONS) {
    Assert._assert(bytes <= Plan.LOS_SIZE_THRESHOLD);
    Assert._assert(allocator == GenCopy.ALLOC_MATURE_MINORGC || allocator == GenCopy.ALLOC_MATURE_MAJORGC);
  }
  Address result=mature.alloc(bytes,align,offset,true);
  return result;
}
Program: 150014
Project: 150014
Buggy source:
/** 
 * Allocate space for copying an object (this method <i>does not</i> copy the object, it only allocates space)
 * @param original A reference to the original object
 * @param bytes The size of the space to be allocated (in bytes)
 * @param align The requested alignment.
 * @param offset The alignment offset.
 * @param allocator The allocator to use.
 * @return The address of the first byte of the allocated region
 */
public final Address allocCopy(ObjectReference original,int bytes,int align,int offset,int allocator) throws InlinePragma {
  if (Assert.VERIFY_ASSERTIONS) {
    Assert._assert(bytes <= Plan.LOS_SIZE_THRESHOLD);
    Assert._assert(allocator == GenMS.ALLOC_MATURE);
  }
  if (Stats.GATHER_MARK_CONS_STATS) {
    if (Space.isInSpace(GenMS.NURSERY,original))     GenMS.nurseryMark.inc(bytes);
  }
  return mature.alloc(bytes,align,offset,GenMS.msSpace.inMSCollection());
}

Fixed version (ground truth):
/** 
 * Allocate space for copying an object (this method <i>does not</i> copy the object, it only allocates space)
 * @param original A reference to the original object
 * @param bytes The size of the space to be allocated (in bytes)
 * @param align The requested alignment.
 * @param offset The alignment offset.
 * @param allocator The allocator to use.
 * @return The address of the first byte of the allocated region
 */
public final Address allocCopy(ObjectReference original,int bytes,int align,int offset,int allocator) throws InlinePragma {
  if (Assert.VERIFY_ASSERTIONS) {
    Assert._assert(bytes <= Plan.LOS_SIZE_THRESHOLD);
    Assert._assert(allocator == GenMS.ALLOC_MATURE_MINORGC || allocator == GenMS.ALLOC_MATURE_MAJORGC);
  }
  if (Stats.GATHER_MARK_CONS_STATS) {
    if (Space.isInSpace(GenMS.NURSERY,original))     GenMS.nurseryMark.inc(bytes);
  }
  return mature.alloc(bytes,align,offset,GenMS.msSpace.inMSCollection());
}
Program: 150015
Project: 150015
Buggy source:
/** 
 * Perform any post-copy actions.
 * @param object The newly allocated object
 * @param typeRef the type reference for the instance being created
 * @param bytes The size of the space to be allocated (in bytes)
 */
public final void postCopy(ObjectReference object,ObjectReference typeRef,int bytes,int allocator) throws InlinePragma {
  GenMS.msSpace.writeMarkBit(object);
  MarkSweepLocal.liveObject(object);
}

Fixed version (ground truth):
/** 
 * Perform any post-copy actions.
 * @param object The newly allocated object
 * @param typeRef the type reference for the instance being created
 * @param bytes The size of the space to be allocated (in bytes)
 */
public final void postCopy(ObjectReference object,ObjectReference typeRef,int bytes,int allocator) throws InlinePragma {
  GenMS.msSpace.postCopy(object,allocator == GenMS.ALLOC_MATURE_MAJORGC);
}
Program: 150016
Project: 150016
Buggy source:
/** 
 * Perform post-allocation actions.  Initialize the object header for objects in the mark-sweep space, and delegate to the superclass for other objects.
 * @param ref The newly allocated object
 * @param typeRef the type reference for the instance being created
 * @param bytes The size of the space to be allocated (in bytes)
 * @param allocator The allocator number to be used for this allocation
 */
public void postAlloc(ObjectReference ref,ObjectReference typeRef,int bytes,int allocator) throws InlinePragma {
  if (allocator == MS.ALLOC_DEFAULT)   MS.msSpace.initializeHeader(ref);
 else   super.postAlloc(ref,typeRef,bytes,allocator);
}

Fixed version (ground truth):
/** 
 * Perform post-allocation actions.  Initialize the object header for objects in the mark-sweep space, and delegate to the superclass for other objects.
 * @param ref The newly allocated object
 * @param typeRef the type reference for the instance being created
 * @param bytes The size of the space to be allocated (in bytes)
 * @param allocator The allocator number to be used for this allocation
 */
public void postAlloc(ObjectReference ref,ObjectReference typeRef,int bytes,int allocator) throws InlinePragma {
  if (allocator == MS.ALLOC_DEFAULT)   MS.msSpace.postAlloc(ref);
 else   super.postAlloc(ref,typeRef,bytes,allocator);
}
Program: 150017
Project: 150017
Buggy source:
/** 
 * Prepare for a collection. If paranoid, perform a sanity check.
 */
public final void prepare(){
  if (Options.fragmentationStats.getValue())   fragmentationStatistics(true);
  flushFreeLists();
}

Fixed version (ground truth):
/** 
 * Prepare for a collection. If paranoid, perform a sanity check.
 */
public final void prepare(){
  if (Options.fragmentationStats.getValue())   fragmentationStatistics(true);
  if (HEADER_MARK_BITS && Options.eagerCompleteSweep.getValue()) {
    consumeBlockLists(msSpace.getPreviousMarkState());
  }
  flushFreeLists();
}
Program: 150018
Project: 150018
Buggy source:
/** 
 * Prepare the next block in the free block list for use by the free list allocator.  In the case of lazy sweeping this involves sweeping the available cells.  <b>The sweeping operation must ensure that cells are pre-zeroed</b>, as this method must return pre-zeroed cells.
 * @param block The block to be prepared for use
 * @param sizeClass The size class of the block
 * @return The address of the first pre-zeroed cell in the free listfor this block, or zero if there are no available cells.
 */
protected final Address advanceToBlock(Address block,int sizeClass){
  if (LAZY_SWEEP)   return makeFreeListFromLiveBits(block,sizeClass);
 else   return getFreeList(block);
}

Fixed version (ground truth):
/** 
 * Prepare the next block in the free block list for use by the free list allocator.  In the case of lazy sweeping this involves sweeping the available cells.  <b>The sweeping operation must ensure that cells are pre-zeroed</b>, as this method must return pre-zeroed cells.
 * @param block The block to be prepared for use
 * @param sizeClass The size class of the block
 * @return The address of the first pre-zeroed cell in the free listfor this block, or zero if there are no available cells.
 */
protected final Address advanceToBlock(Address block,int sizeClass){
  if (LAZY_SWEEP)   return makeFreeListFromLiveBits(block,sizeClass,msSpace.getMarkState());
 else   return getFreeList(block);
}
Program: 150020
Project: 150020
Buggy source:
/** 
 * Should the IR be printed before and/or after this phase?
 * @param options controlling compiler options
 * @param before query control
 * @return true or false.
 */
final boolean printingEnabled(OPT_Options options,boolean before){
  return false;
}

Fixed version (ground truth):
/** 
 * Should the IR be printed before and/or after this phase?
 * @param options controlling compiler options
 * @param before query control
 * @return true or false.
 */
public final boolean printingEnabled(OPT_Options options,boolean before){
  return false;
}
Program: 150021
Project: 150021
Buggy source:
/** 
 * Returns "Dominator Tree"
 * @return "Dominator Tree"
 */
final String getName(){
  return "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Returns "Dominator Tree"
 * @return "Dominator Tree"
 */
public final String getName(){
  return "String_Node_Str";
}
Program: 150022
Project: 150022
Buggy source:
/** 
 * Should this phase be performed?
 * @param options controlling compiler options
 * @return true or false
 */
final boolean shouldPerform(OPT_Options options){
  return options.SSA || options.PRINT_DOMINATORS;
}

Fixed version (ground truth):
/** 
 * Should this phase be performed?
 * @param options controlling compiler options
 * @return true or false
 */
public final boolean shouldPerform(OPT_Options options){
  return options.SSA || options.PRINT_DOMINATORS;
}
Program: 150023
Project: 150023
Buggy source:
/** 
 * Main driver.
 * @param ir the governing IR
 */
final void perform(OPT_IR ir){
  if (!ir.HIRInfo.dominatorsAreComputed)   return;
  try {
    OPT_DominatorTree.perform(ir,true);
  }
 catch (  OPT_OperationNotImplementedException e) {
    if (ir.options.PRINT_DOMINATORS || ir.options.PRINT_SSA) {
      OPT_Compiler.report(e.getMessage());
    }
  }
}

Fixed version (ground truth):
/** 
 * Main driver.
 * @param ir the governing IR
 */
public final void perform(OPT_IR ir){
  if (!ir.HIRInfo.dominatorsAreComputed)   return;
  try {
    OPT_DominatorTree.perform(ir,true);
  }
 catch (  OPT_OperationNotImplementedException e) {
    if (ir.options.PRINT_DOMINATORS || ir.options.PRINT_SSA) {
      OPT_Compiler.report(e.getMessage());
    }
  }
}
Program: 150024
Project: 150024
Buggy source:
/** 
 * Should the IR be printed before and/or after this phase?
 * @param options controlling compiler options
 * @param before query control
 * @return true or false
 */
final boolean printingEnabled(OPT_Options options,boolean before){
  return false;
}

Fixed version (ground truth):
/** 
 * Should the IR be printed before and/or after this phase?
 * @param options controlling compiler options
 * @param before query control
 * @return true or false
 */
public final boolean printingEnabled(OPT_Options options,boolean before){
  return false;
}
Program: 150025
Project: 150025
Buggy source:
/** 
 * Return a string representation of this phase
 * @return "Post-Dominators"
 */
final String getName(){
  return "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Return a string representation of this phase
 * @return "Post-Dominators"
 */
public final String getName(){
  return "String_Node_Str";
}
Program: 150026
Project: 150026
Buggy source:
/** 
 * Should this phase be performed?  This is a member of a composite phase, so always return true.  The parent composite phase will dictate.
 * @param options controlling compiler options
 */
final boolean shouldPerform(OPT_Options options){
  return true;
}

Fixed version (ground truth):
/** 
 * Should this phase be performed?  This is a member of a composite phase, so always return true.  The parent composite phase will dictate.
 * @param options controlling compiler options
 */
public final boolean shouldPerform(OPT_Options options){
  return true;
}
Program: 150027
Project: 150027
Buggy source:
/** 
 * @param unfactor Should we unfactor the CFG before computingdominators?
 */
OPT_PostDominatorsPhase(boolean unfactor){
  this.unfactor=unfactor;
}

Fixed version (ground truth):
/** 
 * @param unfactor Should we unfactor the CFG before computingdominators?
 */
public OPT_PostDominatorsPhase(boolean unfactor){
  this.unfactor=unfactor;
}
Program: 150028
Project: 150028
Buggy source:
/** 
 * Main driver for the post-dominator calculation.
 */
final void perform(OPT_IR ir){
  try {
    ir.HIRInfo.postDominatorsAreComputed=false;
    OPT_LTDominators.perform(ir,false,unfactor);
    OPT_DominatorTree.perform(ir,false);
    ir.HIRInfo.postDominatorsAreComputed=true;
  }
 catch (  OPT_OperationNotImplementedException e) {
    OPT_Options options=ir.options;
    if (options.PRINT_POST_DOMINATORS) {
      OPT_Compiler.report(e.getMessage());
    }
  }
}

Fixed version (ground truth):
/** 
 * Main driver for the post-dominator calculation.
 */
public final void perform(OPT_IR ir){
  try {
    ir.HIRInfo.postDominatorsAreComputed=false;
    OPT_LTDominators.perform(ir,false,unfactor);
    OPT_DominatorTree.perform(ir,false);
    ir.HIRInfo.postDominatorsAreComputed=true;
  }
 catch (  OPT_OperationNotImplementedException e) {
    OPT_Options options=ir.options;
    if (options.PRINT_POST_DOMINATORS) {
      OPT_Compiler.report(e.getMessage());
    }
  }
}
Program: 150029
Project: 150029
Buggy source:
static void gc(){
  MM_Interface.gc();
}

Fixed version (ground truth):
static void gc(){
  if (VM_Synchronization.testAndSet(instance,gcLockOffset,1)) {
    MM_Interface.gc();
    VM_Synchronization.fetchAndStore(instance,gcLockOffset,0);
  }
}
Program: 150030
Project: 150030
Buggy source:
/** 
 * Allocate something like "new int[cnt]" or "new Foo[cnt]".
 * @param numElements number of array elements
 * @param logElementSize size in bytes of an array element, log base 2.
 * @param headerSize size in bytes of array header
 * @param tib type information block for array object
 * @param allocator int that encodes which allocator should be used
 * @param align the alignment requested; must be a power of 2.
 * @param offset the offset at which the alignment is desired.
 * @return array object with header installed and all elements set to zero/null See also: bytecode 0xbc ("newarray") and 0xbd ("anewarray")
 */
public static Object resolvedNewArray(int numElements,int logElementSize,int headerSize,Object[] tib,int allocator,int align,int offset) throws OutOfMemoryError, NegativeArraySizeException {
  if (numElements < 0)   raiseNegativeArraySizeException();
  if (VM.ForceFrequentGC && VM_Scheduler.allProcessorsInitialized) {
    if (countDownToGC-- <= 0) {
      VM.sysWrite("String_Node_Str");
      countDownToGC=GCInterval;
      MM_Interface.gc();
    }
  }
  return MM_Interface.allocateArray(numElements,logElementSize,headerSize,tib,allocator,align,offset);
}

Fixed version (ground truth):
/** 
 * Allocate something like "new int[cnt]" or "new Foo[cnt]".
 * @param numElements number of array elements
 * @param logElementSize size in bytes of an array element, log base 2.
 * @param headerSize size in bytes of array header
 * @param tib type information block for array object
 * @param allocator int that encodes which allocator should be used
 * @param align the alignment requested; must be a power of 2.
 * @param offset the offset at which the alignment is desired.
 * @return array object with header installed and all elements set to zero/null See also: bytecode 0xbc ("newarray") and 0xbd ("anewarray")
 */
public static Object resolvedNewArray(int numElements,int logElementSize,int headerSize,Object[] tib,int allocator,int align,int offset) throws OutOfMemoryError, NegativeArraySizeException {
  if (numElements < 0)   raiseNegativeArraySizeException();
  if (VM.ForceFrequentGC && VM_Scheduler.allProcessorsInitialized) {
    if (countDownToGC-- <= 0) {
      VM.sysWrite("String_Node_Str");
      countDownToGC=GCInterval;
      System.gc();
    }
  }
  return MM_Interface.allocateArray(numElements,logElementSize,headerSize,tib,allocator,align,offset);
}
Program: 150032
Project: 150032
Buggy source:
/** 
 * Allocate something like "new Foo()".
 * @param size size of object (including header), in bytes
 * @param tib  type information block for object
 * @param hasFinalizer does this type have a finalizer?
 * @param allocator int that encodes which allocator should be used
 * @param align the alignment requested; must be a power of 2.
 * @param offset the offset at which the alignment is desired.
 * @return object with header installed and all fields set to zero/null(ready for initializer to be run on it) See also: bytecode 0xbb ("new")
 */
public static Object resolvedNewScalar(int size,Object[] tib,boolean hasFinalizer,int allocator,int align,int offset) throws OutOfMemoryError {
  if (VM.ForceFrequentGC && VM_Scheduler.allProcessorsInitialized) {
    if (countDownToGC-- <= 0) {
      VM.sysWrite("String_Node_Str");
      countDownToGC=GCInterval;
      MM_Interface.gc();
    }
  }
  Object newObj=MM_Interface.allocateScalar(size,tib,allocator,align,offset);
  if (hasFinalizer)   MM_Interface.addFinalizer(newObj);
  return newObj;
}

Fixed version (ground truth):
/** 
 * Allocate something like "new Foo()".
 * @param size size of object (including header), in bytes
 * @param tib  type information block for object
 * @param hasFinalizer does this type have a finalizer?
 * @param allocator int that encodes which allocator should be used
 * @param align the alignment requested; must be a power of 2.
 * @param offset the offset at which the alignment is desired.
 * @return object with header installed and all fields set to zero/null(ready for initializer to be run on it) See also: bytecode 0xbb ("new")
 */
public static Object resolvedNewScalar(int size,Object[] tib,boolean hasFinalizer,int allocator,int align,int offset) throws OutOfMemoryError {
  if (VM.ForceFrequentGC && VM_Scheduler.allProcessorsInitialized) {
    if (countDownToGC-- <= 0) {
      VM.sysWrite("String_Node_Str");
      countDownToGC=GCInterval;
      System.gc();
    }
  }
  Object newObj=MM_Interface.allocateScalar(size,tib,allocator,align,offset);
  if (hasFinalizer)   MM_Interface.addFinalizer(newObj);
  return newObj;
}
Program: 150033
Project: 150033
Buggy source:
/** 
 * Computes all roots.  This method establishes all roots for collection and places them in the root values, root locations and interior root locations queues.  This method should not have side effects (such as copying or forwarding of objects).  There are a number of important preconditions: <ul>  <li> All objects used in the course of GC (such as the GC thread objects) need to be "pre-copied" prior to calling this method. <li> The <code>threadCounter</code> must be reset so that load balancing parallel GC can share the work of scanning threads. </ul> TODO rewrite to avoid the per-thread synchronization, like precopy.
 * @param trace The trace object to use to report root locations.
 */
public static void computeAllRoots(TraceLocal trace){
  boolean processCodeLocations=MM_Interface.MOVES_OBJECTS;
  ScanStatics.scanStatics(trace);
  while (true) {
    int threadIndex=threadCounter.increment();
    if (threadIndex > VM_Scheduler.threadHighWatermark)     break;
    VM_Thread thread=VM_Scheduler.threads[threadIndex];
    if (thread == null)     continue;
    ScanThread.scanThread(thread,trace,processCodeLocations);
    trace.addRootLocation(VM_Magic.objectAsAddress(VM_Scheduler.threads).plus(threadIndex << LOG_BYTES_IN_ADDRESS));
  }
  Collection.rendezvous(4200);
}

Fixed version (ground truth):
/** 
 * Computes all roots.  This method establishes all roots for collection and places them in the root values, root locations and interior root locations queues.  This method should not have side effects (such as copying or forwarding of objects).  There are a number of important preconditions: <ul>  <li> All objects used in the course of GC (such as the GC thread objects) need to be "pre-copied" prior to calling this method. <li> The <code>threadCounter</code> must be reset so that load balancing parallel GC can share the work of scanning threads. </ul> TODO rewrite to avoid the per-thread synchronization, like precopy.
 * @param trace The trace object to use to report root locations.
 */
public static void computeAllRoots(TraceLocal trace){
  boolean processCodeLocations=MM_Interface.MOVES_OBJECTS;
  ScanStatics.scanStatics(trace);
  while (true) {
    int threadIndex=threadCounter.increment();
    if (threadIndex > VM_Scheduler.threadHighWatermark)     break;
    VM_Thread thread=VM_Scheduler.threads[threadIndex];
    if (thread == null)     continue;
    ScanThread.scanThread(thread,trace,processCodeLocations);
    trace.addRootLocation(VM_Magic.objectAsAddress(VM_Scheduler.threads).plus(threadIndex << LOG_BYTES_IN_ADDRESS));
  }
  ActivePlan.flushRememberedSets();
  Collection.rendezvous(4200);
}
Program: 150034
Project: 150034
Buggy source:
/** 
 * Constructor Note that the collector is a consumer of remsets, while the mutator is a producer.  The <code>GenMutator</code> class is responsible for construction of the WriteBuffer (producer).
 * @see GenMutator
 */
public GenCollector(){
  remset=new WriteBuffer(global().remsetPool);
  global().remsetPool.newConsumer();
  arrayRemset=new AddressPairDeque(global().arrayRemsetPool);
  global().arrayRemsetPool.newConsumer();
  traceRemset=new AddressDeque("String_Node_Str",global().remsetPool);
  nurseryTrace=new GenNurseryTraceLocal(global().nurseryTrace,this);
  sanityChecker=new GenSanityCheckerLocal();
}

Fixed version (ground truth):
/** 
 * Constructor Note that the collector is a consumer of remsets, while the mutator is a producer.  The <code>GenMutator</code> class is responsible for construction of the WriteBuffer (producer).
 * @see GenMutator
 */
public GenCollector(){
  global().remsetPool.newConsumer();
  arrayRemset=new AddressPairDeque(global().arrayRemsetPool);
  global().arrayRemsetPool.newConsumer();
  remset=new AddressDeque("String_Node_Str",global().remsetPool);
  nurseryTrace=new GenNurseryTraceLocal(global().nurseryTrace,this);
  sanityChecker=new GenSanityCheckerLocal();
}
Program: 150035
Project: 150035
Buggy source:
/** 
 * Process any remembered set entries.
 */
protected void flushRememberedSets(){
  logMessage(5,"String_Node_Str");
  remset.flushLocal();
  while (!traceRemset.isEmpty()) {
    traceRemset.pop();
  }
  logMessage(5,"String_Node_Str");
  while (!arrayRemset.isEmpty()) {
    arrayRemset.pop1();
    arrayRemset.pop2();
  }
}

Fixed version (ground truth):
/** 
 * Process any remembered set entries.
 */
protected void flushRememberedSets(){
  logMessage(5,"String_Node_Str");
  while (!remset.isEmpty()) {
    remset.pop();
  }
  logMessage(5,"String_Node_Str");
  while (!arrayRemset.isEmpty()) {
    arrayRemset.pop1();
    arrayRemset.pop2();
  }
}
Program: 150036
Project: 150036
Buggy source:
/** 
 * Constructor
 */
public GenMatureTraceLocal(Trace trace,GenCollector plan){
  super(trace);
  this.remset=plan.remset;
  this.traceRemset=plan.traceRemset;
  this.arrayRemset=plan.arrayRemset;
}

Fixed version (ground truth):
/** 
 * Constructor
 */
public GenMatureTraceLocal(Trace trace,GenCollector plan){
  super(trace);
  this.remset=plan.remset;
  this.arrayRemset=plan.arrayRemset;
}
Program: 150037
Project: 150037
Buggy source:
/** 
 * Constructor
 */
public GenNurseryTraceLocal(Trace trace,GenCollector plan){
  super(trace);
  this.remset=plan.remset;
  this.traceRemset=plan.traceRemset;
  this.arrayRemset=plan.arrayRemset;
}

Fixed version (ground truth):
/** 
 * Constructor
 */
public GenNurseryTraceLocal(Trace trace,GenCollector plan){
  super(trace);
  this.remset=plan.remset;
  this.arrayRemset=plan.arrayRemset;
}
Program: 150038
Project: 150038
Buggy source:
/** 
 * Process any remembered set entries.
 */
protected void flushRememberedSets() throws InlinePragma {
  logMessage(5,"String_Node_Str");
  remset.flushLocal();
  while (!traceRemset.isEmpty()) {
    Address loc=traceRemset.pop();
    traceObjectLocation(loc,false);
  }
  logMessage(5,"String_Node_Str");
  arrayRemset.flushLocal();
  while (!arrayRemset.isEmpty()) {
    Address start=arrayRemset.pop1();
    Address guard=arrayRemset.pop2();
    while (start.LT(guard)) {
      traceObjectLocation(start,false);
      start=start.plus(BYTES_IN_ADDRESS);
    }
  }
}

Fixed version (ground truth):
/** 
 * Process any remembered set entries.
 */
protected void flushRememberedSets() throws InlinePragma {
  logMessage(5,"String_Node_Str");
  while (!remset.isEmpty()) {
    Address loc=remset.pop();
    traceObjectLocation(loc,false);
  }
  logMessage(5,"String_Node_Str");
  arrayRemset.flushLocal();
  while (!arrayRemset.isEmpty()) {
    Address start=arrayRemset.pop1();
    Address guard=arrayRemset.pop2();
    while (start.LT(guard)) {
      traceObjectLocation(start,false);
      start=start.plus(BYTES_IN_ADDRESS);
    }
  }
}
Program: 150039
Project: 150039
Buggy source:
public static boolean validRef(ObjectReference ref) throws UninterruptiblePragma {
  if (ref.isNull())   return true;
  if (!Space.isMappedObject(ref)) {
    VM.sysWrite("String_Node_Str");
    VM.sysWrite(ref);
    VM.sysWrite("String_Node_Str");
    Space.printVMMap();
    return false;
  }
  if (MM_Interface.MOVES_OBJECTS) {
  }
  Object[] tib=VM_ObjectModel.getTIB(ref);
  Address tibAddr=VM_Magic.objectAsAddress(tib);
  if (!Space.isMappedObject(ref)) {
    VM.sysWrite("String_Node_Str");
    VM.sysWrite(ref);
    VM.sysWrite("String_Node_Str");
    VM.sysWrite(tibAddr);
    VM.sysWrite("String_Node_Str");
    return false;
  }
  if (tibAddr.isZero()) {
    VM.sysWrite("String_Node_Str");
    VM.sysWrite(ref);
    VM.sysWrite("String_Node_Str");
    return false;
  }
  if (tib.length == 0) {
    VM.sysWrite("String_Node_Str");
    VM.sysWrite(ref);
    VM.sysWrite("String_Node_Str");
    VM.sysWrite(tibAddr);
    VM.sysWrite("String_Node_Str");
    return false;
  }
  ObjectReference type=ObjectReference.fromObject(tib[0]);
  if (!validType(type)) {
    VM.sysWrite("String_Node_Str");
    VM.sysWrite(ref);
    VM.sysWrite("String_Node_Str");
    VM.sysWrite(VM_Magic.objectAsAddress(tib));
    VM.sysWrite("String_Node_Str");
    VM.sysWrite(type);
    VM.sysWrite("String_Node_Str");
    return false;
  }
  return true;
}

Fixed version (ground truth):
public static boolean validRef(ObjectReference ref) throws UninterruptiblePragma {
  if (ref.isNull())   return true;
  if (!Space.isMappedObject(ref)) {
    VM.sysWrite("String_Node_Str");
    VM.sysWrite(ref);
    VM.sysWrite("String_Node_Str");
    Space.printVMMap();
    return false;
  }
  if (MM_Interface.MOVES_OBJECTS) {
  }
  Object[] tib=VM_ObjectModel.getTIB(ref);
  Address tibAddr=VM_Magic.objectAsAddress(tib);
  if (!Space.isMappedObject(ObjectReference.fromObject(tib))) {
    VM.sysWrite("String_Node_Str");
    VM.sysWrite(ref);
    VM.sysWrite("String_Node_Str");
    VM.sysWrite(tibAddr);
    VM.sysWrite("String_Node_Str");
    return false;
  }
  if (tibAddr.isZero()) {
    VM.sysWrite("String_Node_Str");
    VM.sysWrite(ref);
    VM.sysWrite("String_Node_Str");
    return false;
  }
  if (tib.length == 0) {
    VM.sysWrite("String_Node_Str");
    VM.sysWrite(ref);
    VM.sysWrite("String_Node_Str");
    VM.sysWrite(tibAddr);
    VM.sysWrite("String_Node_Str");
    return false;
  }
  ObjectReference type=ObjectReference.fromObject(tib[0]);
  if (!validType(type)) {
    VM.sysWrite("String_Node_Str");
    VM.sysWrite(ref);
    VM.sysWrite("String_Node_Str");
    VM.sysWrite(VM_Magic.objectAsAddress(tib));
    VM.sysWrite("String_Node_Str");
    VM.sysWrite(type);
    VM.sysWrite("String_Node_Str");
    return false;
  }
  return true;
}
Program: 150040
Project: 150040
Buggy source:
/** 
 * Prepare a mutator for a collection.
 * @param m the mutator to prepare
 */
public static void prepareMutator(MutatorContext m){
  VM_Processor vp=((SelectedMutatorContext)m).getProcessor();
  int vpStatus=vp.vpStatus;
  if (vpStatus == VM_Processor.BLOCKED_IN_NATIVE) {
    VM_Thread t=vp.activeThread;
    t.contextRegisters.setInnermost(Address.zero(),t.jniEnv.topJavaFP());
  }
 else {
    VM_Thread t=VM_Thread.getCurrentThread();
    Address fp=VM_Magic.getFramePointer();
    while (true) {
      Address caller_ip=VM_Magic.getReturnAddress(fp);
      Address caller_fp=VM_Magic.getCallerFramePointer(fp);
      if (VM_Magic.getCallerFramePointer(caller_fp).EQ(STACKFRAME_SENTINEL_FP))       VM.sysFail("String_Node_Str");
      int compiledMethodId=VM_Magic.getCompiledMethodID(caller_fp);
      VM_CompiledMethod compiledMethod=VM_CompiledMethods.getCompiledMethod(compiledMethodId);
      VM_Method method=compiledMethod.getMethod();
      VM_Atom cls=method.getDeclaringClass().getDescriptor();
      VM_Atom name=method.getName();
      if (name == runAtom && cls == collectorThreadAtom) {
        t.contextRegisters.setInnermost(caller_ip,caller_fp);
        break;
      }
      fp=caller_fp;
    }
  }
}

Fixed version (ground truth):
/** 
 * Prepare a mutator for a collection.
 * @param m the mutator to prepare
 */
public static void prepareMutator(MutatorContext m){
  VM_Processor vp=((SelectedMutatorContext)m).getProcessor();
  int vpStatus=vp.vpStatus;
  if (vpStatus == VM_Processor.BLOCKED_IN_NATIVE) {
    VM_Thread t=vp.activeThread;
    t.contextRegisters.setInnermost(Address.zero(),t.jniEnv.topJavaFP());
  }
}
Program: 150042
Project: 150042
Buggy source:
/** 
 * Fill the specified region with the alignment value.
 * @param start The start of the region.
 * @param end A pointer past the end of the region.
 */
final public static void fillAlignmentGap(Address start,Address end) throws InlinePragma {
  while (start.LT(end)) {
    start.store(ALIGNMENT_VALUE);
    start=start.add(BYTES_IN_INT);
  }
}

Fixed version (ground truth):
/** 
 * Fill the specified region with the alignment value.
 * @param start The start of the region.
 * @param end A pointer past the end of the region.
 */
final public static void fillAlignmentGap(Address start,Address end) throws InlinePragma {
  if ((MAX_ALIGNMENT - MIN_ALIGNMENT) == BYTES_IN_INT) {
    if (!end.diff(start).isZero()) {
      start.store(ALIGNMENT_VALUE);
    }
  }
 else {
    while (start.LT(end)) {
      start.store(ALIGNMENT_VALUE);
      start=start.add(BYTES_IN_INT);
    }
  }
}
Program: 150043
Project: 150043
Buggy source:
/** 
 * Allocate space for a new object.  This is frequently executed code and  the coding is deliberaetly sensitive to the optimizing compiler. After changing this, always check the IR/MC that is generated.
 * @param bytes The number of bytes allocated
 * @param align The requested alignment
 * @param offset The offset from the alignment 
 * @return The address of the first byte of the allocated region
 */
final public Address alloc(int bytes,int align,int offset) throws InlinePragma {
  Address oldCursor=alignAllocation(cursor,align,offset);
  Address newCursor=oldCursor.add(bytes);
  if (newCursor.GT(limit))   return allocSlow(bytes,align,offset);
  cursor=newCursor;
  return oldCursor;
}

Fixed version (ground truth):
/** 
 * Allocate space for a new object.  This is frequently executed code and  the coding is deliberaetly sensitive to the optimizing compiler. After changing this, always check the IR/MC that is generated.
 * @param bytes The number of bytes allocated
 * @param align The requested alignment
 * @param offset The offset from the alignment 
 * @return The address of the first byte of the allocated region
 */
final public Address alloc(int bytes,int align,int offset) throws InlinePragma {
  Address oldCursor=alignAllocationNoFill(cursor,align,offset);
  Address newCursor=oldCursor.add(bytes);
  if (newCursor.GT(limit))   return allocSlow(bytes,align,offset);
  fillAlignmentGap(cursor,oldCursor);
  cursor=newCursor;
  return oldCursor;
}
Program: 150044
Project: 150044
Buggy source:
private void processEdge(OPT_LSTNode n,OPT_BasicBlock source,OPT_BasicBlock target,float prob,float weight){
  if (target.getScratchFlag())   return;
  if (n.loop.get(target.getNumber())) {
    OPT_LSTNode other=lst.getLoop(target);
    if (other == n) {
      target.augmentExecutionFrequency(prob * weight);
    }
 else {
      float exitWeight=computeLoopExitWeight(other);
      for (Iterator i=other.loopExits.iterator(); i.hasNext(); ) {
        OPT_LSTNode.Edge exit=(OPT_LSTNode.Edge)i.next();
        float myWeight=exit.source.getExecutionFrequency() * exit.probability;
        float myFraction=myWeight / exitWeight;
        processEdge(n,source,exit.target,prob * myFraction,weight);
      }
    }
  }
 else {
    n.addLoopExit(source,target,prob);
  }
}

Fixed version (ground truth):
private void processEdge(OPT_LSTNode n,OPT_BasicBlock source,OPT_BasicBlock target,float prob,float weight){
  if (target.getScratchFlag())   return;
  if (n.loop.get(target.getNumber())) {
    OPT_LSTNode other=lst.getLoop(target);
    if (other == n) {
      target.augmentExecutionFrequency(prob * weight);
    }
 else {
      target.setScratchFlag();
      float exitWeight=computeLoopExitWeight(other);
      for (Iterator i=other.loopExits.iterator(); i.hasNext(); ) {
        OPT_LSTNode.Edge exit=(OPT_LSTNode.Edge)i.next();
        float myWeight=exit.source.getExecutionFrequency() * exit.probability;
        float myFraction=myWeight / exitWeight;
        processEdge(n,source,exit.target,prob * myFraction,weight);
      }
      target.clearScratchFlag();
    }
  }
 else {
    n.addLoopExit(source,target,prob);
  }
}
Program: 150045
Project: 150045
Buggy source:
/** 
 * How much time do we expect to spend in the method in the future if we take no recompilation action? The key assumption is that we'll spend just as much time  executing in the the method in the future as we have done so far in the past.
 * @param hme The VM_HotMethodEvent in question
 * @return estimate of future execution time to be spent in this method
 */
double futureTimeForMethod(VM_HotMethodEvent hme){
  VM_AOSOptions opts=VM_Controller.options;
  double numSamples=hme.getNumSamples();
  double timePerSample=(double)VM.interruptQuantum;
  if (!VM.UseEpilogueYieldPoints) {
    timePerSample/=2.0;
  }
  if (VM_Controller.options.mlCBS()) {
    timePerSample/=(double)VM.CBSMethodSamplesPerTick;
  }
  double timeInMethodSoFar=numSamples * timePerSample;
  return timeInMethodSoFar;
}

Fixed version (ground truth):
/** 
 * How much time do we expect to spend in the method in the future if we take no recompilation action? The key assumption is that we'll spend just as much time  executing in the the method in the future as we have done so far in the past.
 * @param hme The VM_HotMethodEvent in question
 * @return estimate of future execution time to be spent in this method
 */
double futureTimeForMethod(VM_HotMethodEvent hme){
  double numSamples=hme.getNumSamples();
  double timePerSample=(double)VM.interruptQuantum;
  if (!VM.UseEpilogueYieldPoints) {
    timePerSample/=2.0;
  }
  if (VM_Controller.options.mlCBS()) {
    timePerSample/=(double)VM.CBSMethodSamplesPerTick;
  }
  double timeInMethodSoFar=numSamples * timePerSample;
  return timeInMethodSoFar;
}
Program: 150046
Project: 150046
Buggy source:
public String toString(){
  VM_CompiledMethod cm=VM_CompiledMethods.getCompiledMethod(cmid);
  VM_Method m=cm.getMethod();
  return "String_Node_Str" + Integer.toHexString(cmid) + "String_Node_Str"+ "String_Node_Str"+ origIdx;
}

Fixed version (ground truth):
public String toString(){
  VM_CompiledMethod cm=VM_CompiledMethods.getCompiledMethod(cmid);
  return "String_Node_Str" + Integer.toHexString(cmid) + "String_Node_Str"+ "String_Node_Str"+ origIdx;
}
Program: 150049
Project: 150049
Buggy source:
/** 
 * We have to save/restore the non-volatile registers around syscalls, to protect ourselves from malicious C compilers and Linux kernels. Although the register allocator is not yet ready to insert these spills, allocate space on the stack in preparation. For now, we naively save/restore all nonvolatiles.
 */
public static void allocateSpaceForSysCall(OPT_IR ir){
  OPT_PhysicalRegisterSet phys=ir.regpool.getPhysicalRegisterSet();
  OPT_StackManager sm=(OPT_StackManager)ir.stackManager;
  int nToSave=OPT_PhysicalRegisterSet.getNumberOfNonvolatileGPRs() + 1;
  sm.allocateSpaceForSysCall(nToSave);
}

Fixed version (ground truth):
/** 
 * We have to save/restore the non-volatile registers around syscalls, to protect ourselves from malicious C compilers and Linux kernels. Although the register allocator is not yet ready to insert these spills, allocate space on the stack in preparation. For now, we naively save/restore all nonvolatiles.
 */
public static void allocateSpaceForSysCall(OPT_IR ir){
  OPT_StackManager sm=(OPT_StackManager)ir.stackManager;
  int nToSave=OPT_PhysicalRegisterSet.getNumberOfNonvolatileGPRs() + 1;
  sm.allocateSpaceForSysCall(nToSave);
}
Program: 150050
Project: 150050
Buggy source:
/** 
 * Insert a spill of a physical register 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, as an offset from the framepointer
 */
final void insertSpillBefore(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,spill,rOp));
}

Fixed version (ground truth):
/** 
 * Insert a spill of a physical register 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, as an offset from the framepointer
 */
final void insertSpillBefore(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,spill,rOp));
}
Program: 150051
Project: 150051
Buggy source:
/** 
 * Insert the epilogue before a particular return instruction.
 * @param ret the return instruction.
 */
private void insertEpilogue(OPT_Instruction ret){
  OPT_PhysicalRegisterSet phys=ir.regpool.getPhysicalRegisterSet();
  OPT_Register ESP=phys.getESP();
  OPT_Register PR=phys.getPR();
  if (ir.compiledMethod.isSaveVolatile()) {
    restoreVolatileRegisters(ret);
    restoreFloatingPointState(ret);
  }
  restoreNonVolatiles(ret);
  int frameSize=getFrameFixedSize();
  ret.insertBefore(MIR_UnaryNoRes.create(REQUIRE_ESP,IC(frameSize)));
  OPT_MemoryOperand fpHome=OPT_MemoryOperand.BD(new OPT_RegisterOperand(PR,VM_TypeReference.Int),VM_Entrypoints.framePointerField.getOffset(),(byte)WORDSIZE,null,null);
  ret.insertBefore(MIR_Nullary.create(IA32_POP,fpHome));
}

Fixed version (ground truth):
/** 
 * Insert the epilogue before a particular return instruction.
 * @param ret the return instruction.
 */
private void insertEpilogue(OPT_Instruction ret){
  OPT_PhysicalRegisterSet phys=ir.regpool.getPhysicalRegisterSet();
  OPT_Register PR=phys.getPR();
  if (ir.compiledMethod.isSaveVolatile()) {
    restoreVolatileRegisters(ret);
    restoreFloatingPointState(ret);
  }
  restoreNonVolatiles(ret);
  int frameSize=getFrameFixedSize();
  ret.insertBefore(MIR_UnaryNoRes.create(REQUIRE_ESP,IC(frameSize)));
  OPT_MemoryOperand fpHome=OPT_MemoryOperand.BD(new OPT_RegisterOperand(PR,VM_TypeReference.Int),VM_Entrypoints.framePointerField.getOffset(),(byte)WORDSIZE,null,null);
  ret.insertBefore(MIR_Nullary.create(IA32_POP,fpHome));
}
Program: 150052
Project: 150052
Buggy source:
/** 
 * In instruction s, replace all appearances of a symbolic register  operand with uses of the appropriate spill location, as cached by the register allocator.
 * @param s the instruction to mutate.
 * @param symb the symbolic register operand to replace
 */
void replaceOperandWithSpillLocation(OPT_Instruction s,OPT_RegisterOperand symb){
  int location=OPT_RegisterAllocatorState.getSpill(symb.register);
  OPT_PhysicalRegisterSet phys=ir.regpool.getPhysicalRegisterSet();
  OPT_Operand M=null;
  int type=OPT_PhysicalRegisterSet.getPhysicalRegisterType(symb.register);
  int size=OPT_PhysicalRegisterSet.getSpillSize(type);
  M=new OPT_StackLocationOperand(true,-location,(byte)size);
  s.replaceOperand(symb,M);
}

Fixed version (ground truth):
/** 
 * In instruction s, replace all appearances of a symbolic register  operand with uses of the appropriate spill location, as cached by the register allocator.
 * @param s the instruction to mutate.
 * @param symb the symbolic register operand to replace
 */
void replaceOperandWithSpillLocation(OPT_Instruction s,OPT_RegisterOperand symb){
  int location=OPT_RegisterAllocatorState.getSpill(symb.register);
  OPT_Operand M=null;
  int type=OPT_PhysicalRegisterSet.getPhysicalRegisterType(symb.register);
  int size=OPT_PhysicalRegisterSet.getSpillSize(type);
  M=new OPT_StackLocationOperand(true,-location,(byte)size);
  s.replaceOperand(symb,M);
}
Program: 150053
Project: 150053
Buggy source:
/** 
 * Clean up some junk that's left in the IR after register allocation, and add epilogue code.
 */
void cleanUpAndInsertEpilogue(){
  OPT_PhysicalRegisterSet phys=ir.regpool.getPhysicalRegisterSet();
  OPT_Instruction inst=ir.firstInstructionInCodeOrder().nextInstructionInCodeOrder();
  for (; inst != null; inst=inst.nextInstructionInCodeOrder()) {
switch (inst.getOpcode()) {
case IA32_MOV_opcode:
      OPT_Operand result=MIR_Move.getResult(inst);
    OPT_Operand val=MIR_Move.getValue(inst);
  if (result.similar(val)) {
    inst=inst.remove();
  }
break;
case IA32_FMOV_opcode:
result=MIR_Move.getResult(inst);
val=MIR_Move.getValue(inst);
if (result.similar(val)) {
inst=inst.remove();
}
break;
case IA32_RET_opcode:
if (frameIsRequired()) {
insertEpilogue(inst);
}
default :
break;
}
}
rewriteStackLocations();
}

Fixed version (ground truth):
/** 
 * Clean up some junk that's left in the IR after register allocation, and add epilogue code.
 */
void cleanUpAndInsertEpilogue(){
  OPT_Instruction inst=ir.firstInstructionInCodeOrder().nextInstructionInCodeOrder();
  for (; inst != null; inst=inst.nextInstructionInCodeOrder()) {
switch (inst.getOpcode()) {
case IA32_MOV_opcode:
      OPT_Operand result=MIR_Move.getResult(inst);
    OPT_Operand val=MIR_Move.getValue(inst);
  if (result.similar(val)) {
    inst=inst.remove();
  }
break;
case IA32_FMOV_opcode:
result=MIR_Move.getResult(inst);
val=MIR_Move.getValue(inst);
if (result.similar(val)) {
inst=inst.remove();
}
break;
case IA32_RET_opcode:
if (frameIsRequired()) {
insertEpilogue(inst);
}
default :
break;
}
}
rewriteStackLocations();
}
Program: 150054
Project: 150054
Buggy source:
/** 
 * Insert code into the prologue to save the floating point state.
 * @param inst the first instruction after the prologue.  
 */
private void saveFloatingPointState(OPT_Instruction inst){
  OPT_PhysicalRegisterSet phys=ir.regpool.getPhysicalRegisterSet();
  OPT_Operand M=new OPT_StackLocationOperand(true,-fsaveLocation,4);
  inst.insertBefore(MIR_FSave.create(IA32_FNSAVE,M));
}

Fixed version (ground truth):
/** 
 * Insert code into the prologue to save the floating point state.
 * @param inst the first instruction after the prologue.  
 */
private void saveFloatingPointState(OPT_Instruction inst){
  OPT_Operand M=new OPT_StackLocationOperand(true,-fsaveLocation,4);
  inst.insertBefore(MIR_FSave.create(IA32_FNSAVE,M));
}