if (active) { if (buffer_code == ONE) { if (index_1 + record_size > OUTPUT_BUFFER_SIZE) { if (! consumer.isActive()) {  buffer = buffer_2; index = index_2; buffer_code = TWO; activateConsumer(); return true; } else { if(VM_HardwarePerformanceMonitors.verbose>=3) VM.sysWriteln("***VM_HPM.pickBuffer() missed trace record when buffer_code == ONE!***"); missed_records++; buffer = null; return false; } } else { buffer = buffer_1; index = index_1; buffer_code = ONE; return true; } } else if (buffer_code == TWO) { if (index_2 + record_size > OUTPUT_BUFFER_SIZE) { if (! consumer.isActive()) {  buffer = buffer_1; index = index_1; buffer_code = ONE; activateConsumer(); return true; } else { if(VM_HardwarePerformanceMonitors.verbose>=3) VM.sysWriteln("***VM_HPM.pickBuffer() missed trace record when buffer_code == TWO!***"); missed_records++; buffer = null; return false; } } else { buffer = buffer_2; index = index_2;  buffer_code = TWO; return true; } } else { VM.sysWriteln("***VM_HPM.pickBuffer() buffer_code ",buffer_code," not 1 or 2!***"); return false; } }
  private boolean pickBuffer(int record_size)   {    if (active) {      if (buffer_code == ONE) {	if (index_1 + record_size > OUTPUT_BUFFER_SIZE) {	  if (! consumer.isActive()) {	    // swap buffers and activate consumer to write full buffer to disk	    buffer = buffer_2; index = index_2; buffer_code = TWO; 	    activateConsumer();	    return true;	  } else {	    if(VM_HardwarePerformanceMonitors.verbose>=3)	      VM.sysWriteln("***VM_HPM.pickBuffer() missed trace record when buffer_code == ONE!***");	    missed_records++;	    buffer = null;	    return false;	  }	} else {	  buffer = buffer_1; index = index_1; buffer_code = ONE;	  return true;	}      } else if (buffer_code == TWO) { 	if (index_2 + record_size > OUTPUT_BUFFER_SIZE) {	  if (! consumer.isActive()) {	    // swap buffers and activate consumer to write full buffer to disk	    buffer = buffer_1; index = index_1; buffer_code = ONE; 	    activateConsumer();	    return true;	  } else {	    if(VM_HardwarePerformanceMonitors.verbose>=3)	      VM.sysWriteln("***VM_HPM.pickBuffer() missed trace record when buffer_code == TWO!***");	    missed_records++;	    buffer = null;	    return false;	  }	} else {	  buffer = buffer_2; index = index_2;  buffer_code = TWO;	  return true;	}      } else {	VM.sysWriteln("***VM_HPM.pickBuffer() buffer_code ",buffer_code," not 1 or 2!***");	return false;      }    }    if (notifyExit) {      notifyExit = false;      ((VM_TraceWriter)consumer).notifyExit = true;      activateConsumer();    }    return false;  }