8344381: [s390x] Test failures with error: Register type is not known

Reviewed-by: mdoerr, lucy
This commit is contained in:
Amit Kumar 2024-11-20 08:25:37 +00:00
parent 8a1f9f0a32
commit 189fc8ddef

View File

@ -218,10 +218,10 @@ SaveLiveRegisters::SaveLiveRegisters(MacroAssembler *masm, BarrierStubC2 *stub)
const int register_save_size = iterate_over_register_mask(ACTION_COUNT_ONLY) * BytesPerWord; const int register_save_size = iterate_over_register_mask(ACTION_COUNT_ONLY) * BytesPerWord;
_frame_size = align_up(register_save_size, frame::alignment_in_bytes) + frame::z_abi_160_size; // FIXME: this could be restricted to argument only _frame_size = align_up(register_save_size, frame::alignment_in_bytes) + frame::z_abi_160_size;
__ save_return_pc(); __ save_return_pc();
__ push_frame(_frame_size, Z_R14); // FIXME: check if Z_R1_scaratch can do a job here; __ push_frame(_frame_size, Z_R14);
__ z_lg(Z_R14, _z_common_abi(return_pc) + _frame_size, Z_SP); __ z_lg(Z_R14, _z_common_abi(return_pc) + _frame_size, Z_SP);
@ -240,6 +240,7 @@ int SaveLiveRegisters::iterate_over_register_mask(IterationAction action, int of
int reg_save_index = 0; int reg_save_index = 0;
RegMaskIterator live_regs_iterator(_reg_mask); RegMaskIterator live_regs_iterator(_reg_mask);
// Going to preserve the volatile registers which can be used by Register Allocator.
while(live_regs_iterator.has_next()) { while(live_regs_iterator.has_next()) {
const OptoReg::Name opto_reg = live_regs_iterator.next(); const OptoReg::Name opto_reg = live_regs_iterator.next();
@ -251,8 +252,11 @@ int SaveLiveRegisters::iterate_over_register_mask(IterationAction action, int of
const VMReg vm_reg = OptoReg::as_VMReg(opto_reg); const VMReg vm_reg = OptoReg::as_VMReg(opto_reg);
if (vm_reg->is_Register()) { if (vm_reg->is_Register()) {
Register std_reg = vm_reg->as_Register(); Register std_reg = vm_reg->as_Register();
// Z_R0 and Z_R1 will not be allocated by the register allocator, see s390.ad (Integer Register Classes)
if (std_reg->encoding() >= Z_R2->encoding() && std_reg->encoding() <= Z_R15->encoding()) { // Z_R6 to Z_R15 are saved registers, except Z_R14 (see Z-Abi)
if (std_reg->encoding() == Z_R14->encoding() ||
(std_reg->encoding() >= Z_R2->encoding() &&
std_reg->encoding() <= Z_R5->encoding())) {
reg_save_index++; reg_save_index++;
if (action == ACTION_SAVE) { if (action == ACTION_SAVE) {
@ -265,8 +269,10 @@ int SaveLiveRegisters::iterate_over_register_mask(IterationAction action, int of
} }
} else if (vm_reg->is_FloatRegister()) { } else if (vm_reg->is_FloatRegister()) {
FloatRegister fp_reg = vm_reg->as_FloatRegister(); FloatRegister fp_reg = vm_reg->as_FloatRegister();
if (fp_reg->encoding() >= Z_F0->encoding() && fp_reg->encoding() <= Z_F15->encoding() // Z_R1 will not be allocated by the register allocator, see s390.ad (Float Register Classes)
&& fp_reg->encoding() != Z_F1->encoding()) { if (fp_reg->encoding() >= Z_F0->encoding() &&
fp_reg->encoding() <= Z_F7->encoding() &&
fp_reg->encoding() != Z_F1->encoding()) {
reg_save_index++; reg_save_index++;
if (action == ACTION_SAVE) { if (action == ACTION_SAVE) {
@ -277,8 +283,20 @@ int SaveLiveRegisters::iterate_over_register_mask(IterationAction action, int of
assert(action == ACTION_COUNT_ONLY, "Sanity"); assert(action == ACTION_COUNT_ONLY, "Sanity");
} }
} }
} else if (false /* vm_reg->is_VectorRegister() */){ } else if (vm_reg->is_VectorRegister()) {
fatal("Vector register support is not there yet!"); VectorRegister vs_reg = vm_reg->as_VectorRegister();
// Z_V0 to Z_V15 will not be allocated by the register allocator, see s390.ad (reg class z_v_reg)
if (vs_reg->encoding() >= Z_V16->encoding() &&
vs_reg->encoding() <= Z_V31->encoding()) {
reg_save_index += 2;
if (action == ACTION_SAVE) {
__ z_vst(vs_reg, Address(Z_SP, offset - reg_save_index * BytesPerWord));
} else if (action == ACTION_RESTORE) {
__ z_vl(vs_reg, Address(Z_SP, offset - reg_save_index * BytesPerWord));
} else {
assert(action == ACTION_COUNT_ONLY, "Sanity");
}
}
} else { } else {
fatal("Register type is not known"); fatal("Register type is not known");
} }