Program: 149833
Project: 149833
Buggy source:
/** 
 * Trace a reference to an object, forwarding the object if appropriate If the object is not already marked, mark the object and enqueue it for subsequent processing.
 * @param trace The trace performing the transitive closure
 * @param object The object to be traced.
 * @param allocator The allocator to which any copying should be directed
 * @return Either the object or a forwarded object, if it was forwarded.
 */
@Inline private ObjectReference traceObjectWithOpportunisticCopy(TransitiveClosure trace,ObjectReference object,int allocator,boolean nurseryCollection){
  if (VM.VERIFY_ASSERTIONS)   VM.assertions._assert(nurseryCollection || (defrag.determined(true) && isDefragSource(object)));
  Word forwardingWord=ObjectHeader.attemptToBeForwarder(object);
  if (ObjectHeader.isForwardedOrBeingForwarded(forwardingWord)) {
    ObjectReference rtn=ObjectHeader.spinAndGetForwardedObject(object,forwardingWord);
    if (VM.VERIFY_ASSERTIONS)     VM.assertions._assert(((rtn == object) && ((nurseryCollection && ObjectHeader.testMarkState(object,markState)) || defrag.spaceExhausted() || ObjectHeader.isPinnedObject(object))) || (rtn != object) && (nurseryCollection || !isDefragSource(rtn)));
    if (VM.VERIFY_ASSERTIONS && Plan.NEEDS_LOG_BIT_IN_HEADER)     VM.assertions._assert(ObjectHeader.isUnloggedObject(rtn));
    return rtn;
  }
 else {
    if (ObjectHeader.testMarkState(object,markState)) {
      if (VM.VERIFY_ASSERTIONS)       VM.assertions._assert(nurseryCollection || defrag.spaceExhausted() || ObjectHeader.isPinnedObject(object));
      ObjectHeader.setForwardingWord(object,forwardingWord.or(ObjectHeader.UNLOGGED_BIT));
      if (VM.VERIFY_ASSERTIONS && Plan.NEEDS_LOG_BIT_IN_HEADER)       VM.assertions._assert(ObjectHeader.isUnloggedObject(object));
      return object;
    }
 else {
      ObjectReference newObject;
      if (ObjectHeader.isPinnedObject(object) || (!TMP_DEFRAG_TO_IMMORTAL && defrag.spaceExhausted())) {
        Word markValue=Plan.NEEDS_LOG_BIT_IN_HEADER ? markState.or(ObjectHeader.UNLOGGED_BIT) : markState;
        Word oldMarkState=ObjectHeader.testAndMark(object,markValue);
        if (VM.VERIFY_ASSERTIONS)         VM.assertions._assert(oldMarkState != markValue);
        newObject=object;
        if (TMP_VERBOSE_DEFRAG_STATS)         Defrag.defragBytesSkipped.inc(VM.objectModel.getCurrentSize(newObject));
        if (VM.VERIFY_ASSERTIONS && Plan.NEEDS_LOG_BIT_IN_HEADER)         VM.assertions._assert(ObjectHeader.isUnloggedObject(newObject));
      }
 else {
        newObject=ObjectHeader.forwardObject(object,allocator);
        if (TMP_VERBOSE_DEFRAG_STATS)         Defrag.defragBytesCopied.inc(VM.objectModel.getCurrentSize(newObject));
        if (VM.VERIFY_ASSERTIONS && Plan.NEEDS_LOG_BIT_IN_HEADER)         VM.assertions._assert(ObjectHeader.isUnloggedObject(newObject));
      }
      if (!MARK_LINE_AT_SCAN_TIME)       ImmixSpace.markLines(newObject);
      trace.processNode(newObject);
      if (VM.VERIFY_ASSERTIONS) {
        if (!((getSpaceForObject(newObject) != this) || (newObject == object) || (nurseryCollection && willNotMoveThisNurseryGC(newObject))|| (defrag.inDefrag() && willNotMoveThisGC(newObject)))) {
          Log.write("String_Node_Str");
          Log.writeln(object);
          Log.write("String_Node_Str");
          Log.writeln(newObject);
          Log.write("String_Node_Str");
          Log.writeln(ObjectReference.fromObject(this));
          Log.write("String_Node_Str");
          Log.writeln(ObjectReference.fromObject(getSpaceForObject(newObject)));
          Log.write("String_Node_Str");
          Log.writeln(nurseryCollection);
          Log.write("String_Node_Str");
          Log.writeln(ObjectHeader.isMatureObject(object));
          Log.write("String_Node_Str");
          Log.writeln(willNotMoveThisNurseryGC(newObject));
          Log.write("String_Node_Str");
          Log.writeln(ObjectHeader.isPinnedObject(object));
          VM.assertions._assert(false);
        }
      }
      return newObject;
    }
  }
}

Fixed version (ground truth):
/** 
 * Trace a reference to an object, forwarding the object if appropriate If the object is not already marked, mark the object and enqueue it for subsequent processing.
 * @param trace The trace performing the transitive closure
 * @param object The object to be traced.
 * @param allocator The allocator to which any copying should be directed
 * @return Either the object or a forwarded object, if it was forwarded.
 */
@Inline private ObjectReference traceObjectWithOpportunisticCopy(TransitiveClosure trace,ObjectReference object,int allocator,boolean nurseryCollection){
  if (VM.VERIFY_ASSERTIONS)   VM.assertions._assert(nurseryCollection || (defrag.determined(true) && isDefragSource(object)));
  Word priorForwardingWord=ObjectHeader.attemptToBeForwarder(object);
  if (ObjectHeader.isForwardedOrBeingForwarded(priorForwardingWord)) {
    ObjectReference rtn=ObjectHeader.spinAndGetForwardedObject(object,priorForwardingWord);
    if (VM.VERIFY_ASSERTIONS && rtn == object)     VM.assertions._assert((nurseryCollection && ObjectHeader.testMarkState(object,markState)) || defrag.spaceExhausted() || ObjectHeader.isPinnedObject(object));
    if (VM.VERIFY_ASSERTIONS && rtn != object)     VM.assertions._assert(nurseryCollection || !isDefragSource(rtn));
    if (VM.VERIFY_ASSERTIONS && Plan.NEEDS_LOG_BIT_IN_HEADER)     VM.assertions._assert(ObjectHeader.isUnloggedObject(rtn));
    return rtn;
  }
 else {
    if (ObjectHeader.testMarkState(priorForwardingWord,markState)) {
      if (VM.VERIFY_ASSERTIONS)       VM.assertions._assert(nurseryCollection || defrag.spaceExhausted() || ObjectHeader.isPinnedObject(object));
      ObjectHeader.setForwardingWordAndEnsureUnlogged(object,priorForwardingWord);
      if (VM.VERIFY_ASSERTIONS && Plan.NEEDS_LOG_BIT_IN_HEADER)       VM.assertions._assert(ObjectHeader.isUnloggedObject(object));
      return object;
    }
 else {
      ObjectReference newObject;
      if (ObjectHeader.isPinnedObject(object) || (!TMP_DEFRAG_TO_IMMORTAL && defrag.spaceExhausted())) {
        ObjectHeader.setMarkStateUnlogAndUnlock(object,priorForwardingWord,markState);
        newObject=object;
        if (TMP_VERBOSE_DEFRAG_STATS)         Defrag.defragBytesSkipped.inc(VM.objectModel.getCurrentSize(newObject));
        if (VM.VERIFY_ASSERTIONS && Plan.NEEDS_LOG_BIT_IN_HEADER)         VM.assertions._assert(ObjectHeader.isUnloggedObject(newObject));
      }
 else {
        newObject=ObjectHeader.forwardObject(object,allocator);
        if (TMP_VERBOSE_DEFRAG_STATS)         Defrag.defragBytesCopied.inc(VM.objectModel.getCurrentSize(newObject));
        if (VM.VERIFY_ASSERTIONS && Plan.NEEDS_LOG_BIT_IN_HEADER)         VM.assertions._assert(ObjectHeader.isUnloggedObject(newObject));
      }
      if (!MARK_LINE_AT_SCAN_TIME)       ImmixSpace.markLines(newObject);
      trace.processNode(newObject);
      if (VM.VERIFY_ASSERTIONS) {
        if (!((getSpaceForObject(newObject) != this) || (newObject == object) || (nurseryCollection && willNotMoveThisNurseryGC(newObject))|| (defrag.inDefrag() && willNotMoveThisGC(newObject)))) {
          Log.write("String_Node_Str");
          Log.writeln(object);
          Log.write("String_Node_Str");
          Log.writeln(newObject);
          Log.write("String_Node_Str");
          Log.writeln(ObjectReference.fromObject(this));
          Log.write("String_Node_Str");
          Log.writeln(ObjectReference.fromObject(getSpaceForObject(newObject)));
          Log.write("String_Node_Str");
          Log.writeln(nurseryCollection);
          Log.write("String_Node_Str");
          Log.writeln(ObjectHeader.isMatureObject(object));
          Log.write("String_Node_Str");
          Log.writeln(willNotMoveThisNurseryGC(newObject));
          Log.write("String_Node_Str");
          Log.writeln(ObjectHeader.isPinnedObject(object));
          VM.assertions._assert(false);
        }
      }
      return newObject;
    }
  }
}