Example #1
0
// convert JVMCI register indices (as used in oop maps) to HotSpot registers
VMReg CodeInstaller::get_hotspot_reg(jint jvmci_reg, TRAPS) {
  if (jvmci_reg < RegisterImpl::number_of_registers) {
    return as_Register(jvmci_reg)->as_VMReg();
  } else {
    jint floatRegisterNumber = jvmci_reg - RegisterImpl::number_of_registers;
    if (floatRegisterNumber < XMMRegisterImpl::number_of_registers) {
      return as_XMMRegister(floatRegisterNumber)->as_VMReg();
    }
    JVMCI_ERROR_NULL("invalid register number: %d", jvmci_reg);
  }
}
// convert JVMCI register indices (as used in oop maps) to HotSpot registers
VMReg CodeInstaller::get_hotspot_reg(jint jvmci_reg, TRAPS) {
  // JVMCI Registers are numbered as follows:
  //   0..31: Thirty-two General Purpose registers (CPU Registers)
  //   32..63: Thirty-two single precision float registers
  //   64..95: Thirty-two double precision float registers
  //   96..111: Sixteen quad precision float registers
  if (jvmci_reg < 32) {
    return as_Register(jvmci_reg)->as_VMReg();
  } else {
    jint floatRegisterNumber;
    if(jvmci_reg < 64) { // Single precision
      floatRegisterNumber = jvmci_reg - 32;
    } else if(jvmci_reg < 96) {
      floatRegisterNumber = 2 * (jvmci_reg - 64);
    } else if(jvmci_reg < 112) {
      floatRegisterNumber = 4 * (jvmci_reg - 96);
    } else {
      JVMCI_ERROR_NULL("invalid register number: %d", jvmci_reg);
    }
    return as_FloatRegister(floatRegisterNumber)->as_VMReg();
  }
}