Program: 150106
Project: 150106
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)   return false;
  mustCollect|=stressTestGCRequired();
  boolean heapFull=getPagesReserved() > getTotalPages();
  boolean nurseryFull=nurserySpace.reservedPages() > nurserySize.getMaxNursery();
  int newMetaDataPages=metaDataSpace.committedPages() - previousMetaDataPages;
  if (mustCollect || heapFull || nurseryFull|| (progress && (newMetaDataPages > metaDataLimit.getPages()))) {
    if (space == metaDataSpace) {
      awaitingCollection=true;
      return false;
    }
    required=space.reservedPages() - space.committedPages();
    if (space == nurserySpace)     required=required << 1;
    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)   return false;
  mustCollect|=stressTestGCRequired();
  boolean heapFull=getPagesReserved() > getTotalPages();
  boolean nurseryFull=nurserySpace.reservedPages() > nurserySize.getMaxNursery();
  boolean metaDataFull=metaDataSpace.reservedPages() > META_DATA_FULL_THRESHOLD;
  int newMetaDataPages=metaDataSpace.committedPages() - previousMetaDataPages;
  if (mustCollect || heapFull || nurseryFull|| metaDataFull(progress && (newMetaDataPages > metaDataLimit.getPages()))) {
    if (space == metaDataSpace) {
      awaitingCollection=true;
      return false;
    }
    required=space.reservedPages() - space.committedPages();
    if (space == nurserySpace)     required=required << 1;
    Collection.triggerCollection(Collection.RESOURCE_GC_TRIGGER);
    return true;
  }
  return false;
}