From 189fc8ddeffb4dd595ccd8ad3ca53a0ed4cee91f Mon Sep 17 00:00:00 2001 From: Amit Kumar Date: Wed, 20 Nov 2024 08:25:37 +0000 Subject: [PATCH] 8344381: [s390x] Test failures with error: Register type is not known Reviewed-by: mdoerr, lucy --- .../gc/shared/barrierSetAssembler_s390.cpp | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/src/hotspot/cpu/s390/gc/shared/barrierSetAssembler_s390.cpp b/src/hotspot/cpu/s390/gc/shared/barrierSetAssembler_s390.cpp index d826b4a06f3..8ead8e8ff38 100644 --- a/src/hotspot/cpu/s390/gc/shared/barrierSetAssembler_s390.cpp +++ b/src/hotspot/cpu/s390/gc/shared/barrierSetAssembler_s390.cpp @@ -218,10 +218,10 @@ SaveLiveRegisters::SaveLiveRegisters(MacroAssembler *masm, BarrierStubC2 *stub) 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(); - __ 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); @@ -240,6 +240,7 @@ int SaveLiveRegisters::iterate_over_register_mask(IterationAction action, int of int reg_save_index = 0; 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()) { 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); if (vm_reg->is_Register()) { Register std_reg = vm_reg->as_Register(); - - if (std_reg->encoding() >= Z_R2->encoding() && std_reg->encoding() <= Z_R15->encoding()) { + // Z_R0 and Z_R1 will not be allocated by the register allocator, see s390.ad (Integer Register Classes) + // 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++; if (action == ACTION_SAVE) { @@ -265,8 +269,10 @@ int SaveLiveRegisters::iterate_over_register_mask(IterationAction action, int of } } else if (vm_reg->is_FloatRegister()) { FloatRegister fp_reg = vm_reg->as_FloatRegister(); - if (fp_reg->encoding() >= Z_F0->encoding() && fp_reg->encoding() <= Z_F15->encoding() - && fp_reg->encoding() != Z_F1->encoding()) { + // Z_R1 will not be allocated by the register allocator, see s390.ad (Float Register Classes) + if (fp_reg->encoding() >= Z_F0->encoding() && + fp_reg->encoding() <= Z_F7->encoding() && + fp_reg->encoding() != Z_F1->encoding()) { reg_save_index++; if (action == ACTION_SAVE) { @@ -277,8 +283,20 @@ int SaveLiveRegisters::iterate_over_register_mask(IterationAction action, int of assert(action == ACTION_COUNT_ONLY, "Sanity"); } } - } else if (false /* vm_reg->is_VectorRegister() */){ - fatal("Vector register support is not there yet!"); + } else if (vm_reg->is_VectorRegister()) { + 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 { fatal("Register type is not known"); }