Program: 149903
Project: 149903
Buggy source:
/** 
 * Process a reference with the current semantics.
 * @param reference the address of the reference. This may or may notbe the address of a heap object, depending on the VM.
 * @param trace the thread local trace element.
 */
public ObjectReference processReference(TraceLocal trace,ObjectReference reference){
  if (VM.VerifyAssertions)   VM._assert(!reference.isNull());
  if (TRACE_DETAIL)   VM.sysWriteln("String_Node_Str",reference);
  if (!trace.isLive(reference)) {
    clearReferent(reference);
    return ObjectReference.nullReference();
  }
  ObjectReference newReference=trace.getForwardedReference(reference);
  ObjectReference oldReferent=getReferent(reference);
  if (TRACE_DETAIL) {
    VM.sysWrite("String_Node_Str",newReference);
    VM.sysWriteln("String_Node_Str",oldReferent);
  }
  if (oldReferent.isNull()) {
    return ObjectReference.nullReference();
  }
  if (semantics == Semantics.SOFT) {
    if (!Plan.isEmergencyCollection()) {
      if (TRACE_DETAIL)       VM.sysWriteln("String_Node_Str",oldReferent);
      trace.retainReferent(oldReferent);
    }
  }
 else   if (semantics == Semantics.PHANTOM) {
  }
  if (trace.isLive(oldReferent)) {
    ObjectReference newReferent=trace.getForwardedReferent(oldReferent);
    if (TRACE_DETAIL)     VM.sysWriteln("String_Node_Str",newReferent);
    setReferent(newReference,newReferent);
    return newReference;
  }
 else {
    if (TRACE_UNREACHABLE)     VM.sysWriteln("String_Node_Str",oldReferent);
    clearReferent(newReference);
    enqueueReference(newReference);
    return ObjectReference.nullReference();
  }
}

Fixed version (ground truth):
/** 
 * Process a reference with the current semantics.
 * @param reference the address of the reference. This may or may notbe the address of a heap object, depending on the VM.
 * @param trace the thread local trace element.
 */
public ObjectReference processReference(TraceLocal trace,ObjectReference reference){
  if (VM.VerifyAssertions)   VM._assert(!reference.isNull());
  if (TRACE_DETAIL) {
    VM.sysWrite("String_Node_Str",reference);
  }
  if (!trace.isLive(reference)) {
    clearReferent(reference);
    if (TRACE_UNREACHABLE) {
      VM.sysWriteln("String_Node_Str",reference);
    }
    if (TRACE_DETAIL) {
      VM.sysWriteln("String_Node_Str");
    }
    return ObjectReference.nullReference();
  }
  ObjectReference newReference=trace.getForwardedReference(reference);
  ObjectReference oldReferent=getReferent(reference);
  if (TRACE_DETAIL) {
    VM.sysWrite("String_Node_Str",oldReferent);
  }
  if (oldReferent.isNull()) {
    if (TRACE_DETAIL)     VM.sysWriteln("String_Node_Str");
    return ObjectReference.nullReference();
  }
  if (TRACE_DETAIL)   VM.sysWrite("String_Node_Str",newReference);
  if (semantics == Semantics.SOFT) {
    if (!Plan.isEmergencyCollection()) {
      if (TRACE_DETAIL)       VM.sysWrite("String_Node_Str");
      trace.retainReferent(oldReferent);
    }
  }
 else   if (semantics == Semantics.PHANTOM) {
  }
  if (trace.isLive(oldReferent)) {
    if (VM.VerifyAssertions) {
      if (!DebugUtil.validRef(oldReferent)) {
        VM.sysWriteln("String_Node_Str");
        DebugUtil.dumpRef(oldReferent);
        VM.sysFail("String_Node_Str");
      }
    }
    ObjectReference newReferent=trace.getForwardedReferent(oldReferent);
    if (TRACE_DETAIL)     VM.sysWriteln("String_Node_Str",newReferent);
    if (VM.VerifyAssertions) {
      if (!DebugUtil.validRef(newReferent)) {
        VM.sysWriteln("String_Node_Str");
        DebugUtil.dumpRef(oldReferent);
        VM.sysFail("String_Node_Str");
      }
      VM._assert(trace.isLive(newReferent));
    }
    setReferent(newReference,newReferent);
    return newReference;
  }
 else {
    if (TRACE_DETAIL)     VM.sysWriteln("String_Node_Str");
 else     if (TRACE_UNREACHABLE)     VM.sysWriteln("String_Node_Str",oldReferent);
    clearReferent(newReference);
    enqueueReference(newReference);
    return ObjectReference.nullReference();
  }
}