VM_Magic.setIntAtOffset(this, latestContenderOffset, 0);
VM_Magic.setObjectAtOffset(this, latestContenderOffset, null);
  public void unlock () {    if (VM.BuildForSingleVirtualProcessor) return;    VM_Magic.sync(); // commit changes while lock was held so they are visiable to the next processor that acquires the lock    int latestContenderOffset = VM_Entrypoints.latestContenderField.getOffset();    VM_Processor i = VM_Processor.getCurrentProcessor();    if (!MCS_Locking) {      if (VM.VerifyAssertions) i.lockCount -= 1;      VM_Magic.setIntAtOffset(this, latestContenderOffset, 0);  // latestContender = null;      return;    }    VM_Processor p;    int retries = 0;    do {      p = VM_Magic.objectAsProcessor(VM_Magic.addressAsObject(VM_Magic.prepareAddress(this, latestContenderOffset)));      if (p == i) { // nobody is waiting for the lock	if (VM_Magic.attemptAddress(this, latestContenderOffset, VM_Magic.objectAsAddress(p), VM_Address.zero())) {	  break;	}      } else if (VM_Magic.objectAsAddress(p).NE(IN_FLUX)) { // there are waiters, but the contention chain is not being chainged	if (VM_Magic.attemptAddress(this, latestContenderOffset, VM_Magic.objectAsAddress(p), IN_FLUX)) {	  break; 	}      } else { // in flux	handleMicrocontention(-1); // wait a little before trying again      }    } while (true);    if (p != i) { // p is the last processor on the chain of processors contending for the lock      VM_Processor q = p.contenderLink; // q is first processor on the chain      if (p == q) { // only one processor waiting for the lock	q.awaitingProcessorLock = null; // q now owns the lock	VM_Magic.sync(); // make sure the chain of waiting processors gets updated before another processor accesses the chain	// other contenders can get at the lock:	VM_Magic.setObjectAtOffset(this, latestContenderOffset, q); // latestContender = q;       } else { // more than one processor waiting for the lock	p.contenderLink = q.contenderLink; // remove q from the chain	q.awaitingProcessorLock = null; // q now owns the lock	VM_Magic.sync(); // make sure the chain of waiting processors gets updated before another processor accesses the chain        VM_Magic.setObjectAtOffset(this, latestContenderOffset, p); // other contenders can get at the lock      }    }    if (VM.VerifyAssertions) i.lockCount -= 1;  }