Program: 150281
Project: 150281
Buggy source:
/** 
 * Perform a collection. Important notes: . Global actions are executed by only one thread . Thread-local actions are executed by all threads . The following order is guaranteed by BasePlan, with each separated by a synchronization barrier.: 1. globalPrepare() 2. threadLocalPrepare() 3. threadLocalRelease() 4. globalRelease()
 */
public void collect(){
  if (VM_Interface.VerifyAssertions)   VM_Interface._assert(collectionsInitiated > 0);
  boolean designated=(VM_Interface.rendezvous(4210) == 1);
  if (designated)   Statistics.initTime.start();
  prepare();
  if (designated)   Statistics.initTime.stop();
  if (designated)   Statistics.rootTime.start();
  VM_Interface.computeAllRoots(rootLocations,interiorRootLocations);
  if (designated)   Statistics.rootTime.stop();
  if (designated)   Statistics.scanTime.start();
  processAllWork();
  if (designated)   Statistics.scanTime.pause();
  if (!Options.noReferenceTypes) {
    if (designated)     Statistics.refTypeTime.start();
    if (designated)     ReferenceProcessor.moveSoftReferencesToReadyList();
    if (designated)     ReferenceProcessor.moveWeakReferencesToReadyList();
    if (designated)     Statistics.refTypeTime.stop();
  }
  if (Options.noFinalizer) {
    if (designated)     Finalizer.kill();
  }
 else {
    if (designated)     Statistics.finalizeTime.start();
    if (designated)     Finalizer.moveToFinalizable();
    VM_Interface.rendezvous(4220);
    if (designated)     Statistics.finalizeTime.stop();
  }
  if (!Options.noReferenceTypes) {
    if (designated)     Statistics.refTypeTime.start();
    if (designated)     ReferenceProcessor.movePhantomReferencesToReadyList();
    if (designated)     Statistics.refTypeTime.stop();
  }
  if (!Options.noReferenceTypes || !Options.noFinalizer) {
    if (designated)     Statistics.scanTime.start();
    processAllWork();
    if (designated)     Statistics.scanTime.stop();
  }
 else {
    if (designated)     Statistics.scanTime.stop();
  }
  if (designated)   Statistics.finishTime.start();
  release();
  if (designated)   Statistics.finishTime.stop();
  if (designated)   printStats();
}

Fixed version (ground truth):
/** 
 * Perform a collection. Important notes: . Global actions are executed by only one thread . Thread-local actions are executed by all threads . The following order is guaranteed by BasePlan, with each separated by a synchronization barrier.: 1. globalPrepare() 2. threadLocalPrepare() 3. threadLocalRelease() 4. globalRelease()
 */
public void collect(){
  if (VM_Interface.VerifyAssertions)   VM_Interface._assert(collectionsInitiated > 0);
  boolean designated=(VM_Interface.rendezvous(4210) == 1);
  if (designated)   Statistics.initTime.start();
  prepare();
  if (designated)   Statistics.initTime.stop();
  if (designated)   Statistics.rootTime.start();
  VM_Interface.computeAllRoots(rootLocations,interiorRootLocations);
  if (designated)   Statistics.rootTime.stop();
  int order=VM_Interface.rendezvous(4900);
  if (order == 1) {
    VM_Interface.resetThreadCounter();
    setGcStatus(GC_PROPER);
  }
  VM_Interface.rendezvous(4901);
  if (designated)   Statistics.scanTime.start();
  processAllWork();
  if (designated)   Statistics.scanTime.pause();
  if (!Options.noReferenceTypes) {
    if (designated)     Statistics.refTypeTime.start();
    if (designated)     ReferenceProcessor.moveSoftReferencesToReadyList();
    if (designated)     ReferenceProcessor.moveWeakReferencesToReadyList();
    if (designated)     Statistics.refTypeTime.stop();
  }
  if (Options.noFinalizer) {
    if (designated)     Finalizer.kill();
  }
 else {
    if (designated)     Statistics.finalizeTime.start();
    if (designated)     Finalizer.moveToFinalizable();
    VM_Interface.rendezvous(4220);
    if (designated)     Statistics.finalizeTime.stop();
  }
  if (!Options.noReferenceTypes) {
    if (designated)     Statistics.refTypeTime.start();
    if (designated)     ReferenceProcessor.movePhantomReferencesToReadyList();
    if (designated)     Statistics.refTypeTime.stop();
  }
  if (!Options.noReferenceTypes || !Options.noFinalizer) {
    if (designated)     Statistics.scanTime.start();
    processAllWork();
    if (designated)     Statistics.scanTime.stop();
  }
 else {
    if (designated)     Statistics.scanTime.stop();
  }
  if (designated)   Statistics.finishTime.start();
  release();
  if (designated)   Statistics.finishTime.stop();
  if (designated)   printStats();
}