idx = VM_Synchronization.fetchAndAdd(this, nextIndexOffset, 1); if (idx < sampleSize && callerCmid != -1) { samples[idx] = callerCmid; sampleNumber = VM_Synchronization.fetchAndAdd(this, numSamplesOffset, 1);
if (callerCmid != -1) { idx = VM_Synchronization.fetchAndAdd(this, nextIndexOffset, 1); if (idx < sampleSize) { samples[idx] = callerCmid; sampleNumber = VM_Synchronization.fetchAndAdd(this, numSamplesOffset, 1); }
  public final void update(int cmid, int callerCmid, int whereFrom) {    int idx;    int sampleNumber=-1; // the sample number of our insertion    if (VM.UseEpilogueYieldPoints) {      // New scheme: Use epilogue yieldpoints.  We increment one sample      // for every yieldpoint.  On a prologue, we count the caller.      // On backedges and epilogues, we count the current method.      if (whereFrom == VM_Thread.PROLOGUE) { 	idx = VM_Synchronization.fetchAndAdd(this, nextIndexOffset, 1);	if (idx < sampleSize && callerCmid != -1) { 	  samples[idx] = callerCmid; 	  sampleNumber = VM_Synchronization.fetchAndAdd(this, 							numSamplesOffset, 1);        }      } else {         // loop backedge or epilogue.   	idx = VM_Synchronization.fetchAndAdd(this, nextIndexOffset, 1);	if (idx < sampleSize) { 	  samples[idx] = cmid; 	  sampleNumber = VM_Synchronization.fetchAndAdd(this, 							numSamplesOffset, 1);        }      }    } else {      // Original scheme: No epilogue yieldpoints.  We increment two samples      // for every yieldpoint.  On a prologue, we count both the caller      // and callee.  On backedges, we count the current method twice.      if (whereFrom == VM_Thread.PROLOGUE) {        // Increment both for this method and the caller 	idx = VM_Synchronization.fetchAndAdd(this, nextIndexOffset, 1);	if (idx < sampleSize) { 	  samples[idx] = cmid; 	  sampleNumber = VM_Synchronization.fetchAndAdd(this, 							numSamplesOffset, 1);	} 	idx = VM_Synchronization.fetchAndAdd(this, nextIndexOffset, 1);	if (idx < sampleSize && callerCmid != -1) { 	  samples[idx] = callerCmid; 	  sampleNumber = VM_Synchronization.fetchAndAdd(this, 							numSamplesOffset, 1);        }      } else {         // loop backedge.  We're only called once, so need to take        // two samples to avoid penalizing methods with loops. 	idx = VM_Synchronization.fetchAndAdd(this, nextIndexOffset, 1);	if (idx < sampleSize) { 	  samples[idx] = cmid; 	  sampleNumber = VM_Synchronization.fetchAndAdd(this, 							numSamplesOffset, 1);	} 	idx = VM_Synchronization.fetchAndAdd(this, nextIndexOffset, 1);	if (idx < sampleSize) { 	  samples[idx] = cmid; 	  sampleNumber = VM_Synchronization.fetchAndAdd(this, 							numSamplesOffset, 1);        }      }    }    // sampleNumber has the value before we incremented, add one to determine    // which sample we were    sampleNumber++;    if (sampleNumber >= sampleSize) {       passivate();      thresholdReached();    }  }