if (index_1 + record_size > OUTPUT_BUFFER_SIZE) {
if (index_1.toInt() + record_size > OUTPUT_BUFFER_SIZE) {
  private boolean pickBuffer(int record_size)   {    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;    }  }