Program: 150107
Project: 150107
Buggy source:
/** 
 * This method is called periodically by the allocation subsystem (by default, each time a page is consumed), and provides the collector with an opportunity to collect.<p> We trigger a collection whenever an allocation request is made that would take the number of pages in use (committed for use) beyond the number of pages available.  Collections are triggered through the runtime, and ultimately call the <code>collect()</code> method of this class or its superclass.<p> This method is clearly interruptible since it can lead to a GC. However, the caller is typically uninterruptible and this fiat allows  the interruptibility check to work.  The caveat is that the caller  of this method must code as though the method is interruptible.  In practice, this means that, after this call, processor-specific values must be reloaded.
 * @see org.mmtk.policy.Space#acquire(int)
 * @param mustCollect if <code>true</code> then a collection isrequired and must be triggered.  Otherwise a collection is only triggered if we deem it necessary.
 * @param space the space that triggered the polling (i.e. the spaceinto which an allocation is about to occur).
 * @return True if a collection has been triggered
 */
public final boolean poll(boolean mustCollect,Space space) throws LogicallyUninterruptiblePragma {
  if (collectionsInitiated > 0 || !initialized || space == metaDataSpace)   return false;
  mustCollect|=stressTestGCRequired();
  boolean heapFull=getPagesReserved() > getTotalPages();
  boolean nurseryFull=nurserySpace.reservedPages() > nurserySize.getMaxNursery();
  if (mustCollect || heapFull || nurseryFull) {
    required=space.reservedPages() - space.committedPages();
    if (space == nurserySpace || (Plan.COPY_MATURE() && (space == activeMatureSpace)))     required=required << 1;
    int nurseryYield=((int)((float)nurserySpace.committedPages() * SURVIVAL_ESTIMATE)) << 1;
    fullHeapGC=mustCollect || (nurseryYield < required) || fullHeapGC;
    Collection.triggerCollection(Collection.RESOURCE_GC_TRIGGER);
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * This method is called periodically by the allocation subsystem (by default, each time a page is consumed), and provides the collector with an opportunity to collect.<p> We trigger a collection whenever an allocation request is made that would take the number of pages in use (committed for use) beyond the number of pages available.  Collections are triggered through the runtime, and ultimately call the <code>collect()</code> method of this class or its superclass.<p> This method is clearly interruptible since it can lead to a GC. However, the caller is typically uninterruptible and this fiat allows  the interruptibility check to work.  The caveat is that the caller  of this method must code as though the method is interruptible.  In practice, this means that, after this call, processor-specific values must be reloaded.
 * @see org.mmtk.policy.Space#acquire(int)
 * @param mustCollect if <code>true</code> then a collection isrequired and must be triggered.  Otherwise a collection is only triggered if we deem it necessary.
 * @param space the space that triggered the polling (i.e. the spaceinto which an allocation is about to occur).
 * @return True if a collection has been triggered
 */
public final boolean poll(boolean mustCollect,Space space) throws LogicallyUninterruptiblePragma {
  if (collectionsInitiated > 0 || !initialized || space == metaDataSpace)   return false;
  mustCollect|=stressTestGCRequired();
  boolean heapFull=getPagesReserved() > getTotalPages();
  boolean nurseryFull=nurserySpace.reservedPages() > nurserySize.getMaxNursery();
  boolean metaDataFull=metaDataSpace.reservedPages() > META_DATA_FULL_THRESHOLD;
  if (mustCollect || heapFull || nurseryFull|| metaDataFull) {
    required=space.reservedPages() - space.committedPages();
    if (space == nurserySpace || (Plan.COPY_MATURE() && (space == activeMatureSpace)))     required=required << 1;
    int nurseryYield=((int)((float)nurserySpace.committedPages() * SURVIVAL_ESTIMATE)) << 1;
    fullHeapGC=mustCollect || (nurseryYield < required) || fullHeapGC;
    Collection.triggerCollection(Collection.RESOURCE_GC_TRIGGER);
    return true;
  }
  return false;
}