Program: 149659
Project: 149659
Buggy source:
@Override public void collectionPhase(short phaseId,boolean primary){
  if (phaseId == RCBase.PREPARE) {
    getRootTrace().prepare();
    if (RCBase.CC_BACKUP_TRACE && RCBase.performCycleCollection)     backupTrace.prepare();
    return;
  }
  if (phaseId == RCBase.CLOSURE) {
    getRootTrace().completeTrace();
    newRootBuffer.flushLocal();
    return;
  }
  if (phaseId == RCBase.BT_CLOSURE) {
    if (RCBase.CC_BACKUP_TRACE && RCBase.performCycleCollection) {
      backupTrace.completeTrace();
    }
    return;
  }
  if (phaseId == RCBase.PROCESS_OLDROOTBUFFER) {
    if (RCBase.CC_BACKUP_TRACE && RCBase.performCycleCollection)     return;
    ObjectReference current;
    while (!(current=oldRootBuffer.pop()).isNull()) {
      decBuffer.push(current);
    }
    return;
  }
  if (phaseId == RCBase.PROCESS_NEWROOTBUFFER) {
    ObjectReference current;
    if (RCBase.CC_BACKUP_TRACE && RCBase.performCycleCollection) {
      while (!(current=newRootBuffer.pop()).isNull()) {
        if (RCHeader.testAndMark(current)) {
          if (RCHeader.initRC(current) == RCHeader.INC_NEW) {
            modBuffer.push(current);
          }
          backupTrace.processNode(current);
        }
 else {
          if (RCHeader.incRC(current) == RCHeader.INC_NEW) {
            modBuffer.push(current);
          }
        }
      }
      modBuffer.flushLocal();
      return;
    }
    while (!(current=newRootBuffer.pop()).isNull()) {
      if (RCHeader.incRC(current) == RCHeader.INC_NEW) {
        modBuffer.push(current);
      }
      oldRootBuffer.push(current);
    }
    oldRootBuffer.flushLocal();
    modBuffer.flushLocal();
    return;
  }
  if (phaseId == RCBase.PROCESS_MODBUFFER) {
    ObjectReference current;
    while (!(current=modBuffer.pop()).isNull()) {
      RCHeader.makeUnlogged(current);
      if (Space.isInSpace(RCBase.REF_COUNT,current)) {
        ExplicitFreeListSpace.testAndSetLiveBit(current);
      }
      VM.scanning.scanObject(getModifiedProcessor(),current);
    }
    return;
  }
  if (phaseId == RCBase.PROCESS_DECBUFFER) {
    ObjectReference current;
    if (RCBase.CC_BACKUP_TRACE && RCBase.performCycleCollection) {
      while (!(current=decBuffer.pop()).isNull()) {
        if (RCHeader.isNew(current)) {
          if (Space.isInSpace(RCBase.REF_COUNT,current)) {
            RCBase.rcSpace.free(current);
          }
 else           if (Space.isInSpace(RCBase.REF_COUNT_LOS,current)) {
            RCBase.rcloSpace.free(current);
          }
 else           if (Space.isInSpace(RCBase.IMMORTAL,current)) {
            VM.scanning.scanObject(zero,current);
          }
        }
      }
      return;
    }
    while (!(current=decBuffer.pop()).isNull()) {
      if (RCHeader.isNew(current)) {
        if (Space.isInSpace(RCBase.REF_COUNT,current)) {
          RCBase.rcSpace.free(current);
        }
 else         if (Space.isInSpace(RCBase.REF_COUNT_LOS,current)) {
          RCBase.rcloSpace.free(current);
        }
 else         if (Space.isInSpace(RCBase.IMMORTAL,current)) {
          VM.scanning.scanObject(zero,current);
        }
      }
 else {
        if (RCHeader.decRC(current) == RCHeader.DEC_KILL) {
          decBuffer.processChildren(current);
          if (Space.isInSpace(RCBase.REF_COUNT,current)) {
            RCBase.rcSpace.free(current);
          }
 else           if (Space.isInSpace(RCBase.REF_COUNT_LOS,current)) {
            RCBase.rcloSpace.free(current);
          }
 else           if (Space.isInSpace(RCBase.IMMORTAL,current)) {
            VM.scanning.scanObject(zero,current);
          }
        }
      }
    }
    return;
  }
  if (phaseId == RCBase.RELEASE) {
    if (RCBase.CC_BACKUP_TRACE && RCBase.performCycleCollection) {
      backupTrace.release();
      global().oldRootPool.clearDeque(1);
    }
    getRootTrace().release();
    if (VM.VERIFY_ASSERTIONS) {
      VM.assertions._assert(newRootBuffer.isEmpty());
      VM.assertions._assert(modBuffer.isEmpty());
      VM.assertions._assert(decBuffer.isEmpty());
    }
    return;
  }
  super.collectionPhase(phaseId,primary);
}

Fixed version (ground truth):
@Override public void collectionPhase(short phaseId,boolean primary){
  if (phaseId == RCBase.PREPARE) {
    getRootTrace().prepare();
    if (RCBase.CC_BACKUP_TRACE && RCBase.performCycleCollection)     backupTrace.prepare();
    return;
  }
  if (phaseId == RCBase.CLOSURE) {
    getRootTrace().completeTrace();
    newRootBuffer.flushLocal();
    return;
  }
  if (phaseId == RCBase.BT_CLOSURE) {
    if (RCBase.CC_BACKUP_TRACE && RCBase.performCycleCollection) {
      backupTrace.completeTrace();
    }
    return;
  }
  if (phaseId == RCBase.PROCESS_OLDROOTBUFFER) {
    if (RCBase.CC_BACKUP_TRACE && RCBase.performCycleCollection)     return;
    ObjectReference current;
    while (!(current=oldRootBuffer.pop()).isNull()) {
      decBuffer.push(current);
    }
    return;
  }
  if (phaseId == RCBase.PROCESS_NEWROOTBUFFER) {
    ObjectReference current;
    if (RCBase.CC_BACKUP_TRACE && RCBase.performCycleCollection) {
      while (!(current=newRootBuffer.pop()).isNull()) {
        if (RCHeader.testAndMark(current)) {
          if (RCBase.BUILD_FOR_GENRC) {
            RCHeader.initRC(current);
          }
 else {
            if (RCHeader.initRC(current) == RCHeader.INC_NEW) {
              modBuffer.push(current);
            }
          }
          backupTrace.processNode(current);
        }
 else {
          if (RCBase.BUILD_FOR_GENRC) {
            RCHeader.incRC(current);
          }
 else {
            if (RCHeader.incRC(current) == RCHeader.INC_NEW) {
              modBuffer.push(current);
            }
          }
        }
      }
      if (!RCBase.BUILD_FOR_GENRC)       modBuffer.flushLocal();
      return;
    }
    while (!(current=newRootBuffer.pop()).isNull()) {
      if (RCBase.BUILD_FOR_GENRC) {
        RCHeader.incRC(current);
      }
 else {
        if (RCHeader.incRC(current) == RCHeader.INC_NEW) {
          modBuffer.push(current);
        }
      }
      oldRootBuffer.push(current);
    }
    oldRootBuffer.flushLocal();
    if (!RCBase.BUILD_FOR_GENRC)     modBuffer.flushLocal();
    return;
  }
  if (phaseId == RCBase.PROCESS_MODBUFFER) {
    ObjectReference current;
    while (!(current=modBuffer.pop()).isNull()) {
      RCHeader.makeUnlogged(current);
      if (!RCBase.BUILD_FOR_GENRC) {
        if (Space.isInSpace(RCBase.REF_COUNT,current)) {
          ExplicitFreeListSpace.testAndSetLiveBit(current);
        }
      }
      VM.scanning.scanObject(getModifiedProcessor(),current);
    }
    return;
  }
  if (phaseId == RCBase.PROCESS_DECBUFFER) {
    ObjectReference current;
    if (RCBase.CC_BACKUP_TRACE && RCBase.performCycleCollection) {
      if (!RCBase.BUILD_FOR_GENRC) {
        while (!(current=decBuffer.pop()).isNull()) {
          if (RCHeader.isNew(current)) {
            if (Space.isInSpace(RCBase.REF_COUNT,current)) {
              RCBase.rcSpace.free(current);
            }
 else             if (Space.isInSpace(RCBase.REF_COUNT_LOS,current)) {
              RCBase.rcloSpace.free(current);
            }
 else             if (Space.isInSpace(RCBase.IMMORTAL,current)) {
              VM.scanning.scanObject(zero,current);
            }
          }
        }
      }
      return;
    }
    while (!(current=decBuffer.pop()).isNull()) {
      if (RCBase.BUILD_FOR_GENRC) {
        if (RCHeader.decRC(current) == RCHeader.DEC_KILL) {
          decBuffer.processChildren(current);
          if (Space.isInSpace(RCBase.REF_COUNT,current)) {
            RCBase.rcSpace.free(current);
          }
 else           if (Space.isInSpace(RCBase.REF_COUNT_LOS,current)) {
            RCBase.rcloSpace.free(current);
          }
 else           if (Space.isInSpace(RCBase.IMMORTAL,current)) {
            VM.scanning.scanObject(zero,current);
          }
        }
      }
 else {
        if (RCHeader.isNew(current)) {
          if (Space.isInSpace(RCBase.REF_COUNT,current)) {
            RCBase.rcSpace.free(current);
          }
 else           if (Space.isInSpace(RCBase.REF_COUNT_LOS,current)) {
            RCBase.rcloSpace.free(current);
          }
 else           if (Space.isInSpace(RCBase.IMMORTAL,current)) {
            VM.scanning.scanObject(zero,current);
          }
        }
 else {
          if (RCHeader.decRC(current) == RCHeader.DEC_KILL) {
            decBuffer.processChildren(current);
            if (Space.isInSpace(RCBase.REF_COUNT,current)) {
              RCBase.rcSpace.free(current);
            }
 else             if (Space.isInSpace(RCBase.REF_COUNT_LOS,current)) {
              RCBase.rcloSpace.free(current);
            }
 else             if (Space.isInSpace(RCBase.IMMORTAL,current)) {
              VM.scanning.scanObject(zero,current);
            }
          }
        }
      }
    }
    return;
  }
  if (phaseId == RCBase.RELEASE) {
    if (RCBase.CC_BACKUP_TRACE && RCBase.performCycleCollection) {
      backupTrace.release();
      global().oldRootPool.clearDeque(1);
      if (RCBase.BUILD_FOR_GENRC)       global().decPool.clearDeque(1);
    }
    getRootTrace().release();
    if (VM.VERIFY_ASSERTIONS) {
      VM.assertions._assert(newRootBuffer.isEmpty());
      VM.assertions._assert(modBuffer.isEmpty());
      VM.assertions._assert(decBuffer.isEmpty());
    }
    return;
  }
  super.collectionPhase(phaseId,primary);
}