nus-yam/ex-repair huggingface dataset:
Program: 150120
Project: 150120
Buggy source:
/** 
 * Perform post-allocation actions.  For many allocators none are required.
 * @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)
 * @param allocator The allocator number to be used for this allocation
 */
public final void postAlloc(ObjectReference object,ObjectReference typeRef,int bytes,int allocator) throws InlinePragma {
  TraceGenerator.addTraceObject(object,allocator);
switch (allocator) {
case ALLOC_DEFAULT:
    break;
case ALLOC_IMMORTAL:
  immortalSpace.postAlloc(object);
break;
case ALLOC_LOS:
loSpace.initializeHeader(object);
break;
default :
if (Assert.VERIFY_ASSERTIONS) Assert.fail("String_Node_Str");
}
traceInducedGC=TraceGenerator.MERLIN_ANALYSIS;
TraceGenerator.traceAlloc(allocator == ALLOC_IMMORTAL,object,typeRef,bytes);
traceInducedGC=false;
}

Fixed version (ground truth):
/** 
 * Perform post-allocation actions.  For many allocators none are required.
 * @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)
 * @param allocator The allocator number to be used for this allocation
 */
public final void postAlloc(ObjectReference object,ObjectReference typeRef,int bytes,int allocator) throws InlinePragma {
  TraceGenerator.addTraceObject(object,allocator);
switch (allocator) {
case ALLOC_DEFAULT:
    break;
case ALLOC_IMMORTAL:
  ImmortalSpace.postAlloc(object);
break;
case ALLOC_LOS:
loSpace.initializeHeader(object);
break;
default :
if (Assert.VERIFY_ASSERTIONS) Assert.fail("String_Node_Str");
}
traceInducedGC=TraceGenerator.MERLIN_ANALYSIS;
TraceGenerator.traceAlloc(allocator == ALLOC_IMMORTAL,object,typeRef,bytes);
traceInducedGC=false;
}
Program: 150121
Project: 150121
Buggy source:
/** 
 * Return the appropriate value. 
 * @return the trace rate.
 */
public int getValue() throws UninterruptiblePragma {
  return (this.value < LOG_BYTES_IN_ADDRESS) ? 0 : this.value - LOG_BYTES_IN_ADDRESS;
}

Fixed version (ground truth):
/** 
 * Return the appropriate value. 
 * @return the trace rate.
 */
public int getValue() throws UninterruptiblePragma {
  return (this.value < LOG_BYTES_IN_ADDRESS) ? 0 : 1 << (this.value - LOG_BYTES_IN_ADDRESS);
}
Program: 150123
Project: 150123
Buggy source:
/** 
 * Rename the symbolic registers so that each register has only one  definition. <p><em> Note </em>: call this after phi functions have been inserted. <p> <b> Algorithm:</b> from Cytron et. al 91 <pre> call search(entry) search(X): for each statement A in X do if A is not-phi for each r in RHS(A) do if !r.isSSA, replace r with TOP(S(r)) done fi for each r in LHS(A) do if !r.isSSA r2 = new temp register push r2 onto S(r) replace r in A by r2 fi done done (end of first loop) for each Y in succ(X) do j <- whichPred(Y,X) for each phi-function F in Y do replace the j-th operand (r) in RHS(F) with TOP(S(r)) done done (end of second loop) for each Y in Children(X) do call search(Y) done (end of third loop) for each assignment A in X do for each r in LHS(A) do pop(S(r)) done done (end of fourth loop) end <pre>
 * @param ir the governing IR
 * @param symbolicRegisters mapping from integer to symbolic registers
 */
private void renameSymbolicRegisters(OPT_Register[] symbolicRegisters){
  OPT_SSADictionary dictionary=ir.HIRInfo.SSADictionary;
  int n=ir.getNumberOfSymbolicRegisters();
  Stack[] S=new Stack[n + 1];
  for (int i=0; i < S.length; i++) {
    S[i]=new Stack();
    if (i >= symbolicRegisters.length)     continue;
    OPT_Register r=symbolicRegisters[i];
    S[i].push(null);
  }
  OPT_BasicBlock entry=ir.cfg.entry();
  OPT_DefUse.clearDU(ir);
  numPredProcessed=new int[ir.getMaxBasicBlockNumber()];
  search(entry,S);
  OPT_DefUse.recomputeSSA(ir);
  rectifyPhiTypes();
}

Fixed version (ground truth):
/** 
 * Rename the symbolic registers so that each register has only one  definition. <p><em> Note </em>: call this after phi functions have been inserted. <p> <b> Algorithm:</b> from Cytron et. al 91 <pre> call search(entry) search(X): for each statement A in X do if A is not-phi for each r in RHS(A) do if !r.isSSA, replace r with TOP(S(r)) done fi for each r in LHS(A) do if !r.isSSA r2 = new temp register push r2 onto S(r) replace r in A by r2 fi done done (end of first loop) for each Y in succ(X) do j <- whichPred(Y,X) for each phi-function F in Y do replace the j-th operand (r) in RHS(F) with TOP(S(r)) done done (end of second loop) for each Y in Children(X) do call search(Y) done (end of third loop) for each assignment A in X do for each r in LHS(A) do pop(S(r)) done done (end of fourth loop) end <pre>
 * @param symbolicRegisters mapping from integer to symbolic registers
 */
private void renameSymbolicRegisters(OPT_Register[] symbolicRegisters){
  OPT_SSADictionary dictionary=ir.HIRInfo.SSADictionary;
  int n=ir.getNumberOfSymbolicRegisters();
  Stack[] S=new Stack[n + 1];
  for (int i=0; i < S.length; i++) {
    S[i]=new Stack();
    if (i >= symbolicRegisters.length)     continue;
    OPT_Register r=symbolicRegisters[i];
    S[i].push(null);
  }
  OPT_BasicBlock entry=ir.cfg.entry();
  OPT_DefUse.clearDU(ir);
  numPredProcessed=new int[ir.getMaxBasicBlockNumber()];
  search(entry,S);
  OPT_DefUse.recomputeSSA(ir);
  rectifyPhiTypes();
}
Program: 150125
Project: 150125
Buggy source:
/** 
 * Return the meet of the types on the rhs of a phi instruction
 * @param s phi instruction
 * @param a VM_type, or null if all rhs types are nullSIDE EFFECT: bashes the OPT_Instruction scratch field.
 */
private static VM_TypeReference meetPhiType(OPT_Instruction s){
  VM_TypeReference result=null;
  for (int i=0; i < Phi.getNumberOfValues(s); i++) {
    OPT_Operand val=Phi.getValue(s,i);
    if (val instanceof OPT_UnreachableOperand)     continue;
    VM_TypeReference t=val.getType();
    if (t == null) {
      s.scratch=FOUND_NULL_TYPE;
      continue;
    }
 else     if (result == null) {
      result=t;
      continue;
    }
 else {
      VM_TypeReference meet=OPT_ClassLoaderProxy.findCommonSuperclass(result,t);
      if (meet == null) {
        if ((result.isIntLikeType() && (t.isReferenceType() || t.isWordType())) || ((result.isReferenceType() || result.isWordType()) && t.isIntLikeType())) {
          meet=VM_TypeReference.Int;
        }
 else         if (result.isReferenceType() && t.isWordType()) {
          meet=t;
        }
 else         if (result.isWordType() && t.isReferenceType()) {
          meet=result;
        }
      }
      if (VM.VerifyAssertions && meet == null) {
        VM._assert(false,result + "String_Node_Str" + t+ "String_Node_Str");
      }
      result=meet;
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Return the meet of the types on the rhs of a phi instruction
 * @param s phi instructionSIDE EFFECT: bashes the OPT_Instruction scratch field.
 */
private static VM_TypeReference meetPhiType(OPT_Instruction s){
  VM_TypeReference result=null;
  for (int i=0; i < Phi.getNumberOfValues(s); i++) {
    OPT_Operand val=Phi.getValue(s,i);
    if (val instanceof OPT_UnreachableOperand)     continue;
    VM_TypeReference t=val.getType();
    if (t == null) {
      s.scratch=FOUND_NULL_TYPE;
      continue;
    }
 else     if (result == null) {
      result=t;
      continue;
    }
 else {
      VM_TypeReference meet=OPT_ClassLoaderProxy.findCommonSuperclass(result,t);
      if (meet == null) {
        if ((result.isIntLikeType() && (t.isReferenceType() || t.isWordType())) || ((result.isReferenceType() || result.isWordType()) && t.isIntLikeType())) {
          meet=VM_TypeReference.Int;
        }
 else         if (result.isReferenceType() && t.isWordType()) {
          meet=t;
        }
 else         if (result.isWordType() && t.isReferenceType()) {
          meet=result;
        }
      }
      if (VM.VerifyAssertions && meet == null) {
        VM._assert(false,result + "String_Node_Str" + t+ "String_Node_Str");
      }
      result=meet;
    }
  }
  return result;
}
Program: 150126
Project: 150126
Buggy source:
/** 
 * Store a copy of the Heap variables each instruction defs.
 * @param IR governing IR
 * @param store place to store copies
 */
private void copyHeapDefs(OPT_IR ir,HashMap store){
  OPT_SSADictionary dictionary=ir.HIRInfo.SSADictionary;
  for (OPT_BasicBlockEnumeration be=ir.forwardBlockEnumerator(); be.hasMoreElements(); ) {
    OPT_BasicBlock bb=be.next();
    for (Enumeration e=dictionary.getAllInstructions(bb); e.hasMoreElements(); ) {
      OPT_Instruction s=(OPT_Instruction)e.nextElement();
      store.put(s,ir.HIRInfo.SSADictionary.getHeapDefs(s));
    }
  }
}

Fixed version (ground truth):
/** 
 * Store a copy of the Heap variables each instruction defs.
 * @param ir governing IR
 * @param store place to store copies
 */
private void copyHeapDefs(OPT_IR ir,HashMap store){
  OPT_SSADictionary dictionary=ir.HIRInfo.SSADictionary;
  for (OPT_BasicBlockEnumeration be=ir.forwardBlockEnumerator(); be.hasMoreElements(); ) {
    OPT_BasicBlock bb=be.next();
    for (Enumeration e=dictionary.getAllInstructions(bb); e.hasMoreElements(); ) {
      OPT_Instruction s=(OPT_Instruction)e.nextElement();
      store.put(s,ir.HIRInfo.SSADictionary.getHeapDefs(s));
    }
  }
}
Program: 150127
Project: 150127
Buggy source:
/** 
 * Read a reference. Take appropriate read barrier action, and return the value that was read.<p> This is a <b>substituting<b> barrier.  The call to this barrier takes the place of a load.<p>
 * @param src The object being read.
 * @param src The address being read.
 * @param context The context in which the read arose (getfield, for example)
 * @return The reference that was read.
 */
public final Address readBarrier(ObjectReference src,Address slot,int context) throws InlinePragma {
  if (Assert.VERIFY_ASSERTIONS)   Assert._assert(false);
  return Address.max();
}

Fixed version (ground truth):
/** 
 * Read a reference. Take appropriate read barrier action, and return the value that was read.<p> This is a <b>substituting<b> barrier.  The call to this barrier takes the place of a load.<p>
 * @param src The object reference being read.
 * @param context The context in which the read arose (getfield, for example)
 * @return The reference that was read.
 */
public final Address readBarrier(ObjectReference src,Address slot,int context) throws InlinePragma {
  if (Assert.VERIFY_ASSERTIONS)   Assert._assert(false);
  return Address.max();
}
Program: 150128
Project: 150128
Buggy source:
/** 
 * If the object in question has been forwarded, return its forwarded value.  Mature objects are never forwarded in this collector, so this method is a no-op.<p>
 * @param object The object which may have been forwarded.
 * @param space The space in which the object resides.
 * @return The forwarded value for <code>object</code>.
 */
public static final ObjectReference getForwardedMatureReference(ObjectReference object){
  return object;
}

Fixed version (ground truth):
/** 
 * If the object in question has been forwarded, return its forwarded value.  Mature objects are never forwarded in this collector, so this method is a no-op.<p>
 * @param object The object which may have been forwarded.
 * @return The forwarded value for <code>object</code>.
 */
public static final ObjectReference getForwardedMatureReference(ObjectReference object){
  return object;
}
Program: 150129
Project: 150129
Buggy source:
/** 
 * Forward the mature space object referred to by a given address and update the address if necessary.  This <i>does not</i> enqueue the referent for processing; the referent must be explicitly enqueued if it is to be processed.<p> <i>In this case do nothing since the mature space is non-copying.</i>
 * @param location The location whose referent is to be forwarded ifnecessary.  The location will be updated if the referent is forwarded.
 * @param object The referent object.
 * @param space The space in which the referent object resides.
 */
protected static void forwardMatureObjectLocation(Address location,ObjectReference object){
}

Fixed version (ground truth):
/** 
 * Forward the mature space object referred to by a given address and update the address if necessary.  This <i>does not</i> enqueue the referent for processing; the referent must be explicitly enqueued if it is to be processed.<p> <i>In this case do nothing since the mature space is non-copying.</i>
 * @param location The location whose referent is to be forwarded ifnecessary.  The location will be updated if the referent is forwarded.
 * @param object The referent object.
 */
protected static void forwardMatureObjectLocation(Address location,ObjectReference object){
}
Program: 150130
Project: 150130
Buggy source:
/** 
 * Prepare for a collection.  Clear the treadmill to-space head and prepare the collector.  If paranoid, perform a sanity check.
 * @param vm Unused
 * @param mr Unused
 */
public final void prepare(){
  if (Assert.VERIFY_ASSERTIONS)   Assert._assert(treadmill.toSpaceEmpty());
}

Fixed version (ground truth):
/** 
 * Prepare for a collection.  Clear the treadmill to-space head and prepare the collector.  If paranoid, perform a sanity check.
 */
public final void prepare(){
  if (Assert.VERIFY_ASSERTIONS)   Assert._assert(treadmill.toSpaceEmpty());
}
Program: 150131
Project: 150131
Buggy source:
/** 
 * Finish up after a collection.
 * @param vm Unused
 * @param mr Unused
 */
public void release(){
  sweepLargePages();
}

Fixed version (ground truth):
/** 
 * Finish up after a collection.
 */
public void release(){
  sweepLargePages();
}
Program: 150132
Project: 150132
Buggy source:
/** 
 * Return the size of the per-superpage header required by this system.  In this case it is just the underlying superpage header size.
 * @param sizeClass The size class of the cells contained by thissuperpage.
 * @return The size of the per-superpage header required by thissystem.
 */
protected final int superPageHeaderSize() throws InlinePragma {
  return Treadmill.headerSize();
}

Fixed version (ground truth):
/** 
 * Return the size of the per-superpage header required by this system.  In this case it is just the underlying superpage header size.
 * @return The size of the per-superpage header required by thissystem.
 */
protected final int superPageHeaderSize() throws InlinePragma {
  return Treadmill.headerSize();
}
Program: 150133
Project: 150133
Buggy source:
/** 
 * Attempt to log <code>object</code> for coalescing RC. This is used to handle a race to log the object, and returns <code>true</code> if we are to log the object and <code>false</code> if we lost the race to log the object. <p>If this method returns <code>true</code>, it leaves the object in the <code>BEING_LOGGED</code> state.  It is the responsibility of the caller to change the object to <code>LOGGED</code> once the logging is complete.
 * @see makeLogged
 * @param object The object in question
 * @return <code>true</code> if the race to log<code>object</code>was won.
 */
public static boolean attemptToLog(ObjectReference object) throws UninterruptiblePragma, InlinePragma {
  Word oldValue;
  do {
    oldValue=ObjectModel.prepareAvailableBits(object);
    if (oldValue.and(LOGGING_MASK).EQ(LOGGED))     return false;
  }
 while ((oldValue.and(LOGGING_MASK).EQ(BEING_LOGGED)) || !ObjectModel.attemptAvailableBits(object,oldValue,oldValue.or(BEING_LOGGED)));
  if (Assert.VERIFY_ASSERTIONS) {
    Word value=ObjectModel.readAvailableBitsWord(object);
    Assert._assert(value.and(LOGGING_MASK).EQ(BEING_LOGGED));
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Attempt to log <code>object</code> for coalescing RC. This is used to handle a race to log the object, and returns <code>true</code> if we are to log the object and <code>false</code> if we lost the race to log the object. <p>If this method returns <code>true</code>, it leaves the object in the <code>BEING_LOGGED</code> state.  It is the responsibility of the caller to change the object to <code>LOGGED</code> once the logging is complete.
 * @see #makeLogged(ObjectReference)
 * @param object The object in question
 * @return <code>true</code> if the race to log<code>object</code>was won.
 */
public static boolean attemptToLog(ObjectReference object) throws UninterruptiblePragma, InlinePragma {
  Word oldValue;
  do {
    oldValue=ObjectModel.prepareAvailableBits(object);
    if (oldValue.and(LOGGING_MASK).EQ(LOGGED))     return false;
  }
 while ((oldValue.and(LOGGING_MASK).EQ(BEING_LOGGED)) || !ObjectModel.attemptAvailableBits(object,oldValue,oldValue.or(BEING_LOGGED)));
  if (Assert.VERIFY_ASSERTIONS) {
    Word value=ObjectModel.readAvailableBitsWord(object);
    Assert._assert(value.and(LOGGING_MASK).EQ(BEING_LOGGED));
  }
  return true;
}
Program: 150134
Project: 150134
Buggy source:
/** 
 * Signify completion of logging <code>object</code>. <code>object</code> is left in the <code>LOGGED</code> state.
 * @see attemptToLog
 * @param object The object whose state is to be changed.
 */
public static void makeLogged(ObjectReference object) throws UninterruptiblePragma, InlinePragma {
  Word value=ObjectModel.readAvailableBitsWord(object);
  Assert._assert(value.and(LOGGING_MASK).NE(LOGGED));
  ObjectModel.writeAvailableBitsWord(object,value.and(LOGGING_MASK.not()));
}

Fixed version (ground truth):
/** 
 * Signify completion of logging <code>object</code>. <code>object</code> is left in the <code>LOGGED</code> state.
 * @see #attemptToLog(ObjectReference)
 * @param object The object whose state is to be changed.
 */
public static void makeLogged(ObjectReference object) throws UninterruptiblePragma, InlinePragma {
  Word value=ObjectModel.readAvailableBitsWord(object);
  Assert._assert(value.and(LOGGING_MASK).NE(LOGGED));
  ObjectModel.writeAvailableBitsWord(object,value.and(LOGGING_MASK.not()));
}
Program: 150135
Project: 150135
Buggy source:
/** 
 * Coalesce two or three contigious lumps of units, removing start and end lumps from the free list as necessary.
 * @param start The index of the start of the first lump
 * @param start Index of the start of the last lump
 */
private final void coalesce(int start,int end){
  if (getFree(end))   removeFromFree(end);
  if (getFree(start))   removeFromFree(start);
  setSize(start,end - start + getSize(end));
}

Fixed version (ground truth):
/** 
 * Coalesce two or three contigious lumps of units, removing start and end lumps from the free list as necessary.
 * @param start The index of the start of the first lump
 * @param end The index of the start of the last lump
 */
private final void coalesce(int start,int end){
  if (getFree(end))   removeFromFree(end);
  if (getFree(start))   removeFromFree(start);
  setSize(start,end - start + getSize(end));
}
Program: 150136
Project: 150136
Buggy source:
/** 
 * Return true if a cell is on a given treadmill
 * @param cell The cell being searched for
 * @param head The head of the treadmill
 * @return True if the cell is found on the treadmill
 */
public final boolean isMember(Address node){
  if (Assert.VERIFY_ASSERTIONS)   Assert._assert(isNode(node));
  boolean result=false;
  if (lock != null)   lock.acquire();
  Address cur=head;
  while (!cur.isZero()) {
    if (cur.EQ(node)) {
      result=true;
      break;
    }
    cur=cur.loadAddress(NEXT_OFFSET);
  }
  if (lock != null)   lock.release();
  return result;
}

Fixed version (ground truth):
/** 
 * Return true if a cell is on a given treadmill
 * @param node The cell being searched for
 * @return True if the cell is found on the treadmill
 */
public final boolean isMember(Address node){
  if (Assert.VERIFY_ASSERTIONS)   Assert._assert(isNode(node));
  boolean result=false;
  if (lock != null)   lock.acquire();
  Address cur=head;
  while (!cur.isZero()) {
    if (cur.EQ(node)) {
      result=true;
      break;
    }
    cur=cur.loadAddress(NEXT_OFFSET);
  }
  if (lock != null)   lock.release();
  return result;
}
Program: 150137
Project: 150137
Buggy source:
/** 
 * writes a <code>long</code> in hexadecimal
 * @param l 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;
  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);
  }
}
Program: 150138
Project: 150138
Buggy source:
/** 
 * Return the superpage for a given cell.  If the cell is a small cell then this is found by masking the cell address to find the containing page.  Otherwise the first word of the cell contains the address of the page.
 * @param cell The address of the first word of the cell (exclusiveof any sub-class specific metadata).
 * @param small True if the cell is a small cell (single page superpage).
 * @return The address of the first word of the superpage containing<code>cell</code>.
 */
public static final Address getSuperPage(Address cell) throws InlinePragma {
  return cell.toWord().and(PAGE_MASK).toAddress();
}

Fixed version (ground truth):
/** 
 * Return the superpage for a given cell.  If the cell is a small cell then this is found by masking the cell address to find the containing page.  Otherwise the first word of the cell contains the address of the page.
 * @param cell The address of the first word of the cell (exclusiveof any sub-class specific metadata).
 * @return The address of the first word of the superpage containing<code>cell</code>.
 */
public static final Address getSuperPage(Address cell) throws InlinePragma {
  return cell.toWord().and(PAGE_MASK).toAddress();
}
Program: 150139
Project: 150139
Buggy source:
/** 
 * Constructor
 * @param vmr The virtual memory resource from which this free listallocator will acquire virtual memory.
 * @param mr The memory resource against which memory consumptionfor this free list allocator will be accounted.
 */
public LargeObjectAllocator(LargeObjectSpace space){
  this.space=space;
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param space The space with which this large object allocatorwill be associated.
 */
public LargeObjectAllocator(LargeObjectSpace space){
  this.space=space;
}
Program: 150140
Project: 150140
Buggy source:
/** 
 * Free a cell.  If the cell is large (own superpage) then release the superpage, if not add to the super page's free list and if all cells on the superpage are free, then release the superpage.
 * @param cell The address of the first byte of the cell to be freed
 * @param sp The superpage containing the cell
 * @param sizeClass The sizeclass of the cell.
 */
public final void free(Address cell) throws InlinePragma {
  space.release(getSuperPage(cell));
}

Fixed version (ground truth):
/** 
 * Free a cell.  If the cell is large (own superpage) then release the superpage, if not add to the super page's free list and if all cells on the superpage are free, then release the superpage.
 * @param cell The address of the first byte of the cell to be freed
 */
public final void free(Address cell) throws InlinePragma {
  space.release(getSuperPage(cell));
}
Program: 150141
Project: 150141
Buggy source:
/** 
 * Return the live word for a region including a given address
 * @param addr The address for which the live word is required
 * @return A word containing live bits for the given address.
 */
protected static final Word getLiveBits(Address address){
  return getLiveWordAddress(address).loadWord();
}

Fixed version (ground truth):
/** 
 * Return the live word for a region including a given address
 * @param address The address for which the live word is required
 * @return A word containing live bits for the given address.
 */
protected static final Word getLiveBits(Address address){
  return getLiveWordAddress(address).loadWord();
}
Program: 150142
Project: 150142
Buggy source:
/** 
 * Constructor
 * @param vmr The virtual memory resource from which this free listallocator will acquire virtual memory.
 * @param mr The memory resource against which memory consumptionfor this free list allocator will be accounted.
 */
public SegregatedFreeList(Space space){
  blockAllocator=new BlockAllocator(space);
  freeList=AddressArray.create(SIZE_CLASSES);
  firstBlock=AddressArray.create(SIZE_CLASSES);
  lastBlock=AddressArray.create(SIZE_CLASSES);
  currentBlock=AddressArray.create(SIZE_CLASSES);
  blockBucketHead=AddressArray.create(BLOCK_BUCKETS);
  blockBucketTail=AddressArray.create(BLOCK_BUCKETS);
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param space The space with which this allocator will be associated
 */
public SegregatedFreeList(Space space){
  blockAllocator=new BlockAllocator(space);
  freeList=AddressArray.create(SIZE_CLASSES);
  firstBlock=AddressArray.create(SIZE_CLASSES);
  lastBlock=AddressArray.create(SIZE_CLASSES);
  currentBlock=AddressArray.create(SIZE_CLASSES);
  blockBucketHead=AddressArray.create(BLOCK_BUCKETS);
  blockBucketTail=AddressArray.create(BLOCK_BUCKETS);
}
Program: 150143
Project: 150143
Buggy source:
/** 
 * Get the "next" pointer in a buffer forming the linked buffer chain.
 * @param bufRef The buffer whose next field is to be returned.
 * @return The next field for this buffer.
 */
protected final Address getNext(Address buf){
  return buf.loadAddress();
}

Fixed version (ground truth):
/** 
 * Get the "next" pointer in a buffer forming the linked buffer chain.
 * @param buf The buffer whose next field is to be returned.
 * @return The next field for this buffer.
 */
protected final Address getNext(Address buf){
  return buf.loadAddress();
}
Program: 150144
Project: 150144
Buggy source:
/** 
 * Get the "next" pointer in a buffer forming the linked buffer chain.
 * @param bufRef The buffer whose next field is to be returned.
 * @return The next field for this buffer.
 */
protected final Address getPrev(Address buf){
  return buf.loadAddress(PREV_OFFSET);
}

Fixed version (ground truth):
/** 
 * Get the "next" pointer in a buffer forming the linked buffer chain.
 * @param buf The buffer whose next field is to be returned.
 * @return The next field for this buffer.
 */
protected final Address getPrev(Address buf){
  return buf.loadAddress(PREV_OFFSET);
}
Program: 150145
Project: 150145
Buggy source:
/** 
 * Set the "next" pointer in a buffer forming the linked buffer chain.
 * @param bufRef The buffer whose next field is to be set.
 * @param next The reference to which next should point.
 */
private static final void setNext(Address buf,Address next){
  buf.store(next);
}

Fixed version (ground truth):
/** 
 * Set the "next" pointer in a buffer forming the linked buffer chain.
 * @param buf The buffer whose next field is to be set.
 * @param next The reference to which next should point.
 */
private static final void setNext(Address buf,Address next){
  buf.store(next);
}
Program: 150146
Project: 150146
Buggy source:
/** 
 * Set the "prev" pointer in a buffer forming the linked buffer chain.
 * @param bufRef The buffer whose next field is to be set.
 * @param next The reference to which next should point.
 */
private final void setPrev(Address buf,Address prev){
  buf.store(prev,PREV_OFFSET);
}

Fixed version (ground truth):
/** 
 * Set the "prev" pointer in a buffer forming the linked buffer chain.
 * @param buf The buffer whose next field is to be set.
 * @param prev The reference to which prev should point.
 */
private final void setPrev(Address buf,Address prev){
  buf.store(prev,PREV_OFFSET);
}
Program: 150147
Project: 150147
Buggy source:
/** 
 * Constructor
 * @param rps The space from which the instance should obtain buffers.
 * @param airty The arity of the data to be enqueued
 */
public SortTODSharedDeque(RawPageSpace rps,int arity){
  super(rps,arity);
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param rps The space from which the instance should obtain buffers.
 * @param arity The arity of the data to be enqueued
 */
public SortTODSharedDeque(RawPageSpace rps,int arity){
  super(rps,arity);
}
Program: 150148
Project: 150148
Buggy source:
/** 
 * Constructor
 * @param queue The shared queue to which this queue will appendits buffers (when full or flushed) and from which it will aquire new buffers when it has exhausted its own.
 */
public TraceBuffer(SharedDeque pool){
  super(pool);
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param pool The shared queue to which this queue will append itsbuffers (when full or flushed) and from which it will aquire new buffers when it has exhausted its own.
 */
public TraceBuffer(SharedDeque pool){
  super(pool);
}
Program: 150149
Project: 150149
Buggy source:
/** 
 * The "typical" number of objects in each tile
 * @param blocksize The size of a tile
 * @return The maximum number of objects in a tile
 */
public int maxObjectsPerBlock(int blockSize){
  return blockSize / ServerInterpreter.computeHeaderSize();
}

Fixed version (ground truth):
/** 
 * The "typical" number of objects in each tile
 * @param blockSize The size of a tile
 * @return The maximum number of objects in a tile
 */
public int maxObjectsPerBlock(int blockSize){
  return blockSize / ServerInterpreter.computeHeaderSize();
}
Program: 150151
Project: 150151
Buggy source:
/** 
 * Gets the value of bits available for memory manager use in an object, in preparation for setting those bits.
 * @param o the address of the object
 * @return the value of the bits
 */
public static Word prepareAvailableBits(ObjectReference object){
  return null;
}

Fixed version (ground truth):
/** 
 * Gets the value of bits available for memory manager use in an object, in preparation for setting those bits.
 * @param object the address of the object
 * @return the value of the bits
 */
public static Word prepareAvailableBits(ObjectReference object){
  return null;
}
Program: 150152
Project: 150152
Buggy source:
/** 
 * Attempts to set the bits available for memory manager use in an object.  The attempt will only be successful if the current value of the bits matches <code>oldVal</code>.  The comparison with the current value and setting are atomic with respect to other allocators.
 * @param oject the address of the object
 * @param oldVal the required current value of the bits
 * @param newVal the desired new value of the bits
 * @return <code>true</code> if the bits were set,<code>false</code> otherwise
 */
public static boolean attemptAvailableBits(ObjectReference object,Word oldVal,Word newVal){
  return false;
}

Fixed version (ground truth):
/** 
 * Attempts to set the bits available for memory manager use in an object.  The attempt will only be successful if the current value of the bits matches <code>oldVal</code>.  The comparison with the current value and setting are atomic with respect to other allocators.
 * @param object the address of the object
 * @param oldVal the required current value of the bits
 * @param newVal the desired new value of the bits
 * @return <code>true</code> if the bits were set,<code>false</code> otherwise
 */
public static boolean attemptAvailableBits(ObjectReference object,Word oldVal,Word newVal){
  return false;
}
Program: 150153
Project: 150153
Buggy source:
/** 
 * Emit code to store to a float array
 */
protected final void emit_fastore(){
  VM_Barriers.compileModifyCheck(asm,12);
  asm.emitMOV_Reg_RegDisp(T0,SP,4);
  asm.emitMOV_Reg_RegDisp(S0,SP,8);
  genBoundsCheck(asm,T0,S0);
  asm.emitMOV_Reg_RegDisp(T1,SP,0);
  asm.emitMOV_RegIdx_Reg(S0,T0,asm.WORD,0,T1);
  asm.emitADD_Reg_Imm(SP,WORDSIZE * 3);
}

Fixed version (ground truth):
/** 
 * Emit code to store to a float array
 */
protected final void emit_fastore(){
  VM_Barriers.compileModifyCheck(asm,8);
  asm.emitMOV_Reg_RegDisp(T0,SP,4);
  asm.emitMOV_Reg_RegDisp(S0,SP,8);
  genBoundsCheck(asm,T0,S0);
  asm.emitMOV_Reg_RegDisp(T1,SP,0);
  asm.emitMOV_RegIdx_Reg(S0,T0,asm.WORD,0,T1);
  asm.emitADD_Reg_Imm(SP,WORDSIZE * 3);
}
Program: 150155
Project: 150155
Buggy source:
/** 
 * Return the space into which an allocator is allocating.  The allocator, <code>a</code> may be assocaited with any plan instance.
 * @param a An allocator
 * @return The space into which <code>a</code> is allocating, or<code>null</code> if there is no space associated with <code>a</code>.
 */
private static Space getSpaceFromAllocatorAnyPlan(Allocator a){
  for (int i=0; i < plans.length; i++) {
    Space space=plans[i].getSpaceFromAllocator(a);
    if (space != null)     return space;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Return the space into which an allocator is allocating.  The allocator, <code>a</code> may be assocaited with any plan instance.
 * @param a An allocator
 * @return The space into which <code>a</code> is allocating, or<code>null</code> if there is no space associated with <code>a</code>.
 */
private static Space getSpaceFromAllocatorAnyPlan(Allocator a){
  for (int i=0; i < plans.length; i++) {
    if (plans[i] != null) {
      Space space=plans[i].getSpaceFromAllocator(a);
      if (space != null)       return space;
    }
  }
  return null;
}
Program: 150157
Project: 150157
Buggy source:
public void perform(OPT_IR ir){
  if (ir.hasReachableExceptionHandlers() || OPT_GCP.tooBig(ir))   return;
  verbose=OPT_LICM.verbose;
  this.ir=ir;
  dominator=ir.HIRInfo.dominatorTree;
  (new OPT_GlobalValueNumber()).perform(ir);
  valueNumbers=ir.HIRInfo.valueNumbers;
  if (true || ir.IRStage == ir.LIR) {
    if (verbose)     VM.sysWrite("String_Node_Str" + ir.method + "String_Node_Str");
    OPT_DefUse.computeDU(ir);
    OPT_Simple.copyPropagation(ir);
    OPT_DefUse.computeDU(ir);
    GlobalCSE(ir.firstBasicBlockInCodeOrder());
    if (VM.VerifyAssertions)     VM._assert(avail.size() == 0,avail.toString());
  }
}

Fixed version (ground truth):
public void perform(OPT_IR ir){
  if (ir.hasReachableExceptionHandlers() || OPT_GCP.tooBig(ir))   return;
  verbose=OPT_LICM.verbose;
  this.ir=ir;
  dominator=ir.HIRInfo.dominatorTree;
  (new OPT_GlobalValueNumber()).perform(ir);
  valueNumbers=ir.HIRInfo.valueNumbers;
  if (true || ir.IRStage == ir.LIR) {
    if (verbose)     VM.sysWrite("String_Node_Str" + ir.method + "String_Node_Str");
    OPT_DefUse.computeDU(ir);
    OPT_Simple.copyPropagation(ir);
    OPT_DefUse.computeDU(ir);
    GlobalCSE(ir.firstBasicBlockInCodeOrder());
    if (VM.VerifyAssertions) {
      VM._assert(avail.size() == 0,avail.toString());
    }
    ir.actualSSAOptions.setScalarValid(false);
  }
}
Program: 150159
Project: 150159
Buggy source:
/** 
 * Logs a message and traceback, then exits.
 * @param message the string to log
 */
public static void fail(String message){
  VM.sysFail(message);
}

Fixed version (ground truth):
/** 
 * Logs a message and traceback, then exits.   This two-argument form is needed for us to call before the VM's Integer class is initialized.  
 * @param message the string to log
 * @param number  an integer to append to <code>message</code>.  
 */
public static void fail(String message,int number){
  VM.sysFail(message,number);
}
Program: 150160
Project: 150160
Buggy source:
static void tracebackWithoutLock(String message){
  VM.sysWrite(message);
  VM.sysWrite("String_Node_Str");
  dumpStack(VM_Magic.getCallerFramePointer(VM_Magic.getFramePointer()));
}

Fixed version (ground truth):
static void tracebackWithoutLock(){
  dumpStack(VM_Magic.getCallerFramePointer(VM_Magic.getFramePointer()));
}
Program: 150161
Project: 150161
Buggy source:
/** 
 * Print interesting scheduler information, starting with a stack traceback. Note: the system could be in a fragile state when this method is called, so we try to rely on as little runtime functionality as possible (eg. use no bytecodes that require VM_Runtime support).
 */
static void traceback(String message){
  VM_Processor.getCurrentProcessor().disableThreadSwitching();
  lockOutput();
  tracebackWithoutLock(message);
  unlockOutput();
  VM_Processor.getCurrentProcessor().enableThreadSwitching();
}

Fixed version (ground truth):
static void traceback(String message,int number){
  VM_Processor.getCurrentProcessor().disableThreadSwitching();
  lockOutput();
  VM.sysWriteln(message,number);
  tracebackWithoutLock();
  unlockOutput();
  VM_Processor.getCurrentProcessor().enableThreadSwitching();
}
Program: 150162
Project: 150162
Buggy source:
public void release(){
  long diff=(REPORT_SLOW) ? VM_Time.cycles() - start : 0;
  boolean show=(verbose > 1) || (diff > SLOW_THRESHOLD);
  if (show) {
    Log.write("String_Node_Str");
    thread.dumpToLog();
    Log.write("String_Node_Str");
    Log.write(id);
    Log.write("String_Node_Str");
    Log.write(name);
    Log.write("String_Node_Str");
    Log.write(VM_Time.cyclesToMillis(diff));
    Log.writeln("String_Node_Str");
  }
  if (REPORT_SLOW) {
    endHistory[serving % 100]=VM_Time.cycles();
    setLocker(0,null,-1);
  }
  VM_Magic.sync();
  VM_Synchronization.fetchAndAdd(this,servingFieldOffset,1);
}

Fixed version (ground truth):
public void release(){
  long diff=(REPORT_SLOW) ? VM_Time.cycles() - start : 0;
  boolean show=(verbose > 1) || (diff > SLOW_THRESHOLD);
  if (show) {
    VM.sysWrite("String_Node_Str");
    thread.dump();
    VM.sysWrite("String_Node_Str",id);
    VM.sysWrite("String_Node_Str",name);
    VM.sysWrite("String_Node_Str");
    VM.sysWrite(VM_Time.cyclesToMillis(diff));
    VM.sysWriteln("String_Node_Str");
  }
  if (REPORT_SLOW) {
    endHistory[serving % 100]=VM_Time.cycles();
    setLocker(0,null,-1);
  }
  VM_Magic.sync();
  VM_Synchronization.fetchAndAdd(this,servingFieldOffset,1);
}
Program: 150163
Project: 150163
Buggy source:
public void check(int w){
  if (!REPORT_SLOW)   return;
  if (Assert.VERIFY_ASSERTIONS)   Assert._assert(VM_Thread.getCurrentThread() == thread);
  long diff=(REPORT_SLOW) ? VM_Time.cycles() - start : 0;
  boolean show=(verbose > 1) || (diff > SLOW_THRESHOLD);
  if (show) {
    Log.write("String_Node_Str");
    thread.dumpToLog();
    Log.write("String_Node_Str");
    Log.write(w);
    Log.write("String_Node_Str");
    Log.write(id);
    Log.write("String_Node_Str");
    Log.write(name);
    Log.write("String_Node_Str");
    Log.write(VM_Time.cyclesToMillis(diff));
    Log.writeln("String_Node_Str");
  }
  where=w;
}

Fixed version (ground truth):
public void check(int w){
  if (!REPORT_SLOW)   return;
  if (Assert.VERIFY_ASSERTIONS)   Assert._assert(VM_Thread.getCurrentThread() == thread);
  long diff=(REPORT_SLOW) ? VM_Time.cycles() - start : 0;
  boolean show=(verbose > 1) || (diff > SLOW_THRESHOLD);
  if (show) {
    VM.sysWrite("String_Node_Str");
    thread.dump();
    VM.sysWrite("String_Node_Str",w);
    VM.sysWrite("String_Node_Str",id);
    VM.sysWrite("String_Node_Str",name);
    VM.sysWrite("String_Node_Str",VM_Time.cyclesToMillis(diff));
    VM.sysWriteln("String_Node_Str");
  }
  where=w;
}
Program: 150165
Project: 150165
Buggy source:
public static void ptsysWriteln(String s1,String s2,String s3,String s4,String s5,String s6,String s7,int i8,String s9,String s10,String s11,String s12,String s13) throws NoInlinePragma {
  swLock();
  showProc();
  showThread();
  write(s1);
  write(s2);
  write(s3);
  write(s4);
  write(s5);
  write(s6);
  write(s7);
  write(i8);
  write(s9);
  write(s10);
  write(s11);
  write(s12);
  write(s13);
  writeln();
  swUnlock();
}

Fixed version (ground truth):
public static void ptsysWriteln(String s1,String s2,String s3,String s4,String s5,String s6,String s7,int i8,String s9,String s10,String s11,String s12,String s13,int i14) throws NoInlinePragma {
  swLock();
  showProc();
  showThread();
  write(s1);
  write(s2);
  write(s3);
  write(s4);
  write(s5);
  write(s6);
  write(s7);
  write(i8);
  write(s9);
  write(s10);
  write(s11);
  write(s12);
  write(s13);
  write(i14);
  writeln();
  swUnlock();
}
Program: 150166
Project: 150166
Buggy source:
private static void handlePossibleRecursiveCallToSysFail(String message){
  handlePossibleRecursiveExit("String_Node_Str",++inSysFail,message);
}

Fixed version (ground truth):
private static void handlePossibleRecursiveCallToSysFail(String message,int number){
  handlePossibleRecursiveExit("String_Node_Str",++inSysFail,message,number);
}
Program: 150167
Project: 150167
Buggy source:
/** 
 * Used only by VM.shutdown() 
 */
private static void handlePossibleRecursiveShutdown(){
  handlePossibleRecursiveExit("String_Node_Str",++inShutdown,null);
}

Fixed version (ground truth):
/** 
 * Used only by VM.shutdown() 
 */
private static void handlePossibleRecursiveShutdown(){
  handlePossibleRecursiveExit("String_Node_Str",++inShutdown);
}
Program: 150168
Project: 150168
Buggy source:
private static void handlePossibleRecursiveCallToSysExit(){
  handlePossibleRecursiveExit("String_Node_Str",++inSysExit,null);
}

Fixed version (ground truth):
private static void handlePossibleRecursiveCallToSysExit(){
  handlePossibleRecursiveExit("String_Node_Str",++inSysExit);
}
Program: 150169
Project: 150169
Buggy source:
/** 
 * Exit virtual machine due to internal failure of some sort.
 * @param message  error message describing the problem
 */
public static void sysFail(String message) throws NoInlinePragma {
  handlePossibleRecursiveCallToSysFail(message);
  VM_Scheduler.traceback(message);
  if (VM.runningVM)   VM.shutdown(exitStatusSysFail);
 else   VM.sysExit(exitStatusSysFail);
  if (VM.VerifyAssertions)   VM._assert(VM.NOT_REACHED);
}

Fixed version (ground truth):
/** 
 * Exit virtual machine due to internal failure of some sort.  This two-argument form is  needed for us to call before the VM's Integer class is initialized.   
 * @param message  error message describing the problem
 * @param number  an integer to append to <code>message</code>.  
 */
public static void sysFail(String message,int number) throws NoInlinePragma {
  handlePossibleRecursiveCallToSysFail(message,number);
  VM_Scheduler.traceback(message,number);
  if (VM.runningVM)   VM.shutdown(exitStatusSysFail);
 else   VM.sysExit(exitStatusSysFail);
  if (VM.VerifyAssertions)   VM._assert(VM.NOT_REACHED);
}
Program: 150170
Project: 150170
Buggy source:
/** 
 * @param called Name of the function called: "sysExit", "sysFail", or"shutdown".
 * @param depth How deep are we in that function?
 * @param message What message did it have?  null means this particularshutdown function  does not come with a message. 
 */
private static void handlePossibleRecursiveExit(String called,int depth,String message){
  int nProcessors=VM_Scheduler.numProcessors;
  int nProcessorAdjust=nProcessors - 1;
  if (depth > 1 && (depth <= maxSystemTroubleRecursionDepth + nProcessorAdjust + VM.maxSystemTroubleRecursionDepthBeforeWeStopVMSysWrite)) {
    ptsysWriteln("String_Node_Str",called,"String_Node_Str",depth > nProcessors ? "String_Node_Str" : "String_Node_Str","String_Node_Str",called,"String_Node_Str",depth,"String_Node_Str",message == null ? "String_Node_Str" : "String_Node_Str",message == null ? "String_Node_Str" : called,message == null ? "String_Node_Str" : "String_Node_Str",message == null ? "String_Node_Str" : message);
  }
  if (depth > maxSystemTroubleRecursionDepth + nProcessorAdjust) {
    dieAbruptlyRecursiveSystemTrouble();
    if (VM.VerifyAssertions)     VM._assert(VM.NOT_REACHED);
  }
}

Fixed version (ground truth):
/** 
 * @param called Name of the function called: "sysExit", "sysFail", or"shutdown".
 * @param depth How deep are we in that function?
 * @param message What message did it have?  null means this particularshutdown function  does not come with a message.
 * @param showNumber Print <code>number</code> following<code>message</code>? 
 * @param number Print this number, if <code>showNumber</code> is true. 
 */
private static void handlePossibleRecursiveExit(String called,int depth,String message,boolean showNumber,int number){
  int nProcessors=VM_Scheduler.numProcessors;
  int nProcessorAdjust=nProcessors - 1;
  if (depth > 1 && (depth <= maxSystemTroubleRecursionDepth + nProcessorAdjust + VM.maxSystemTroubleRecursionDepthBeforeWeStopVMSysWrite)) {
    if (showNumber) {
      ptsysWriteln("String_Node_Str",called,"String_Node_Str",depth > nProcessors ? "String_Node_Str" : "String_Node_Str","String_Node_Str",called,"String_Node_Str",depth,"String_Node_Str",message == null ? "String_Node_Str" : "String_Node_Str",message == null ? "String_Node_Str" : called,message == null ? "String_Node_Str" : "String_Node_Str",message == null ? "String_Node_Str" : message,number);
    }
 else {
      ptsysWriteln("String_Node_Str",called,"String_Node_Str",depth > nProcessors ? "String_Node_Str" : "String_Node_Str","String_Node_Str",called,"String_Node_Str",depth,"String_Node_Str",message == null ? "String_Node_Str" : "String_Node_Str",message == null ? "String_Node_Str" : called,message == null ? "String_Node_Str" : "String_Node_Str",message == null ? "String_Node_Str" : message);
    }
  }
  if (depth > maxSystemTroubleRecursionDepth + nProcessorAdjust) {
    dieAbruptlyRecursiveSystemTrouble();
    if (VM.VerifyAssertions)     VM._assert(VM.NOT_REACHED);
  }
}
Program: 150171
Project: 150171
Buggy source:
protected final void LONG_2INT(OPT_Instruction s,OPT_RegisterOperand def,OPT_RegisterOperand left){
  OPT_Register srcHigh=left.register;
  OPT_Register srcLow=regpool.getSecondReg(srcHigh);
  EMIT(MIR_Move.mutate(s,PPC_MOVE,def,I(srcLow)));
  EMIT(MIR_Unary.create(PPC64_EXTSW,I(srcHigh),left));
}

Fixed version (ground truth):
protected final void LONG_2INT(OPT_Instruction s,OPT_RegisterOperand def,OPT_RegisterOperand left){
  OPT_Register srcHigh=left.register;
  OPT_Register srcLow=regpool.getSecondReg(srcHigh);
  EMIT(MIR_Move.mutate(s,PPC_MOVE,def,I(srcLow)));
  EMIT(MIR_Unary.create(PPC64_EXTSW,def,left));
}