--- old/src/hotspot/cpu/x86/x86_64.ad 2019-02-19 13:04:32.942225437 +0100 +++ new/src/hotspot/cpu/x86/x86_64.ad 2019-02-19 13:04:32.680227932 +0100 @@ -258,135 +258,6 @@ return _INT_NO_RCX_REG_mask; %} -// Class for all pointer registers (including RSP and RBP) -reg_class any_reg0_with_rbp(RAX, RAX_H, - RDX, RDX_H, - RBP, RBP_H, - RDI, RDI_H, - RSI, RSI_H, - RCX, RCX_H, - RBX, RBX_H, - RSP, RSP_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R12, R12_H, - R13, R13_H, - R14, R14_H, - R15, R15_H); - -// Class for all pointer registers (including RSP, but excluding RBP) -reg_class any_reg0_no_rbp(RAX, RAX_H, - RDX, RDX_H, - RDI, RDI_H, - RSI, RSI_H, - RCX, RCX_H, - RBX, RBX_H, - RSP, RSP_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R12, R12_H, - R13, R13_H, - R14, R14_H, - R15, R15_H); - -// Dynamic register class that selects at runtime between register classes -// any_reg_no_rbp and any_reg_with_rbp (depending on the value of the flag PreserveFramePointer). -// Equivalent to: return PreserveFramePointer ? any_reg_no_rbp : any_reg_with_rbp; -reg_class_dynamic any_reg0(any_reg0_no_rbp, any_reg0_with_rbp, %{ PreserveFramePointer %}); - -// Class for all pointer registers -reg_class ptr_reg0_with_rbp(RAX, RAX_H, - RDX, RDX_H, - RBP, RBP_H, - RDI, RDI_H, - RSI, RSI_H, - RCX, RCX_H, - RBX, RBX_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R13, R13_H, - R14, R14_H); - -reg_class ptr_reg0_no_rbp(RAX, RAX_H, - RDX, RDX_H, - RDI, RDI_H, - RSI, RSI_H, - RCX, RCX_H, - RBX, RBX_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R13, R13_H, - R14, R14_H); - -// Dynamic register class that selects between ptr_reg_no_rbp and ptr_reg_with_rbp. -reg_class_dynamic ptr_reg0(ptr_reg0_no_rbp, ptr_reg0_with_rbp, %{ PreserveFramePointer %}); - -// Class for all pointer registers (excluding RAX and RSP) -reg_class ptr_no_rax_reg0_with_rbp(RDX, RDX_H, - RBP, RBP_H, - RDI, RDI_H, - RSI, RSI_H, - RCX, RCX_H, - RBX, RBX_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R13, R13_H, - R14, R14_H); - -// Class for all pointer registers (excluding RAX, RSP, and RBP) -reg_class ptr_no_rax_reg0_no_rbp(RDX, RDX_H, - RDI, RDI_H, - RSI, RSI_H, - RCX, RCX_H, - RBX, RBX_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R13, R13_H, - R14, R14_H); - -// Dynamic register class that selects between ptr_no_rax_reg_no_rbp and ptr_no_rax_reg_with_rbp. -reg_class_dynamic ptr_no_rax_reg0(ptr_no_rax_reg0_no_rbp, ptr_no_rax_reg0_with_rbp, %{ PreserveFramePointer %}); - -// Class for all pointer registers (excluding RAX, RBX, and RSP) -reg_class ptr_no_rax_rbx_reg0_with_rbp(RDX, RDX_H, - RBP, RBP_H, - RDI, RDI_H, - RSI, RSI_H, - RCX, RCX_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R13, R13_H, - R14, R14_H); - -// Class for all pointer registers (excluding RAX, RBX, RSP, and RBP) -reg_class ptr_no_rax_rbx_reg0_no_rbp(RDX, RDX_H, - RDI, RDI_H, - RSI, RSI_H, - RCX, RCX_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R13, R13_H, - R14, R14_H); - -// Dynamic register class that selects between ptr_no_rax_rbx_reg_no_rbp and ptr_no_rax_rbx_reg_with_rbp. -reg_class_dynamic ptr_no_rax_rbx_reg0(ptr_no_rax_rbx_reg0_no_rbp, ptr_no_rax_rbx_reg0_with_rbp, %{ PreserveFramePointer %}); - // Singleton class for RAX pointer register reg_class ptr_rax_reg(RAX, RAX_H); @@ -405,96 +276,6 @@ // Singleton class for TLS pointer reg_class ptr_r15_reg(R15, R15_H); -// Class for all long registers (excluding RSP) -reg_class long_reg0_with_rbp(RAX, RAX_H, - RDX, RDX_H, - RBP, RBP_H, - RDI, RDI_H, - RSI, RSI_H, - RCX, RCX_H, - RBX, RBX_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R13, R13_H, - R14, R14_H); - -// Class for all long registers (excluding RSP and RBP) -reg_class long_reg0_no_rbp(RAX, RAX_H, - RDX, RDX_H, - RDI, RDI_H, - RSI, RSI_H, - RCX, RCX_H, - RBX, RBX_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R13, R13_H, - R14, R14_H); - -// Dynamic register class that selects between long_reg_no_rbp and long_reg_with_rbp. -reg_class_dynamic long_reg0(long_reg0_no_rbp, long_reg0_with_rbp, %{ PreserveFramePointer %}); - -// Class for all long registers (excluding RAX, RDX and RSP) -reg_class long_no_rax_rdx_reg0_with_rbp(RBP, RBP_H, - RDI, RDI_H, - RSI, RSI_H, - RCX, RCX_H, - RBX, RBX_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R13, R13_H, - R14, R14_H); - -// Class for all long registers (excluding RAX, RDX, RSP, and RBP) -reg_class long_no_rax_rdx_reg0_no_rbp(RDI, RDI_H, - RSI, RSI_H, - RCX, RCX_H, - RBX, RBX_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R13, R13_H, - R14, R14_H); - -// Dynamic register class that selects between long_no_rax_rdx_reg_no_rbp and long_no_rax_rdx_reg_with_rbp. -reg_class_dynamic long_no_rax_rdx_reg0(long_no_rax_rdx_reg0_no_rbp, long_no_rax_rdx_reg0_with_rbp, %{ PreserveFramePointer %}); - -// Class for all long registers (excluding RCX and RSP) -reg_class long_no_rcx_reg0_with_rbp(RBP, RBP_H, - RDI, RDI_H, - RSI, RSI_H, - RAX, RAX_H, - RDX, RDX_H, - RBX, RBX_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R13, R13_H, - R14, R14_H); - -// Class for all long registers (excluding RCX, RSP, and RBP) -reg_class long_no_rcx_reg0_no_rbp(RDI, RDI_H, - RSI, RSI_H, - RAX, RAX_H, - RDX, RDX_H, - RBX, RBX_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R13, R13_H, - R14, R14_H); - -// Dynamic register class that selects between long_no_rcx_reg_no_rbp and long_no_rcx_reg_with_rbp. -reg_class_dynamic long_no_rcx_reg0(long_no_rcx_reg0_no_rbp, long_no_rcx_reg0_with_rbp, %{ PreserveFramePointer %}); - // Singleton class for RAX long register reg_class long_rax_reg(RAX, RAX_H); @@ -504,96 +285,6 @@ // Singleton class for RDX long register reg_class long_rdx_reg(RDX, RDX_H); -// Class for all int registers (excluding RSP) -reg_class int_reg0_with_rbp(RAX, - RDX, - RBP, - RDI, - RSI, - RCX, - RBX, - R8, - R9, - R10, - R11, - R13, - R14); - -// Class for all int registers (excluding RSP and RBP) -reg_class int_reg0_no_rbp(RAX, - RDX, - RDI, - RSI, - RCX, - RBX, - R8, - R9, - R10, - R11, - R13, - R14); - -// Dynamic register class that selects between int_reg_no_rbp and int_reg_with_rbp. -reg_class_dynamic int_reg0(int_reg0_no_rbp, int_reg0_with_rbp, %{ PreserveFramePointer %}); - -// Class for all int registers (excluding RCX and RSP) -reg_class int_no_rcx_reg0_with_rbp(RAX, - RDX, - RBP, - RDI, - RSI, - RBX, - R8, - R9, - R10, - R11, - R13, - R14); - -// Class for all int registers (excluding RCX, RSP, and RBP) -reg_class int_no_rcx_reg0_no_rbp(RAX, - RDX, - RDI, - RSI, - RBX, - R8, - R9, - R10, - R11, - R13, - R14); - -// Dynamic register class that selects between int_no_rcx_reg_no_rbp and int_no_rcx_reg_with_rbp. -reg_class_dynamic int_no_rcx_reg0(int_no_rcx_reg0_no_rbp, int_no_rcx_reg0_with_rbp, %{ PreserveFramePointer %}); - -// Class for all int registers (excluding RAX, RDX, and RSP) -reg_class int_no_rax_rdx_reg0_with_rbp(RBP, - RDI, - RSI, - RCX, - RBX, - R8, - R9, - R10, - R11, - R13, - R14); - -// Class for all int registers (excluding RAX, RDX, RSP, and RBP) -reg_class int_no_rax_rdx_reg0_no_rbp(RDI, - RSI, - RCX, - RBX, - R8, - R9, - R10, - R11, - R13, - R14); - -// Dynamic register class that selects between int_no_rax_rdx_reg_no_rbp and int_no_rax_rdx_reg_with_rbp. -reg_class_dynamic int_no_rax_rdx_reg0(int_no_rax_rdx_reg0_no_rbp, int_no_rax_rdx_reg0_with_rbp, %{ PreserveFramePointer %}); - // Singleton class for RAX int register reg_class int_rax_reg(RAX); @@ -662,13 +353,9 @@ RegMask _STACK_OR_LONG_REG_mask; RegMask _STACK_OR_INT_REG_mask; -#ifdef ASSERT -static bool same_mask(const RegMask &a, const RegMask &b) { - RegMask a_sub_b = a; a_sub_b.SUBTRACT(b); - RegMask b_sub_a = b; b_sub_a.SUBTRACT(a); - return a_sub_b.Size() == 0 && b_sub_a.Size() == 0; +static bool need_r12_heapbase() { + return UseCompressedOops || UseCompressedClassPointers || UseZGC; } -#endif void reg_mask_init() { // _ALL_REG_mask is generated by adlc from the all_reg register class below. @@ -679,10 +366,12 @@ _ANY_REG_mask.Remove(OptoReg::as_OptoReg(rbp->as_VMReg())); _ANY_REG_mask.Remove(OptoReg::as_OptoReg(rbp->as_VMReg()->next())); } + if (need_r12_heapbase()) { + _ANY_REG_mask.Remove(OptoReg::as_OptoReg(r12->as_VMReg())); + _ANY_REG_mask.Remove(OptoReg::as_OptoReg(r12->as_VMReg()->next())); + } _PTR_REG_mask = _ANY_REG_mask; - _PTR_REG_mask.Remove(OptoReg::as_OptoReg(r12->as_VMReg())); - _PTR_REG_mask.Remove(OptoReg::as_OptoReg(r12->as_VMReg()->next())); _PTR_REG_mask.Remove(OptoReg::as_OptoReg(rsp->as_VMReg())); _PTR_REG_mask.Remove(OptoReg::as_OptoReg(rsp->as_VMReg()->next())); _PTR_REG_mask.Remove(OptoReg::as_OptoReg(r15->as_VMReg())); @@ -718,10 +407,12 @@ _LONG_NO_RCX_REG_mask.Remove(OptoReg::as_OptoReg(rcx->as_VMReg()->next())); _INT_REG_mask = _ALL_INT_REG_mask; - _INT_REG_mask.Remove(OptoReg::as_OptoReg(r12->as_VMReg())); if (PreserveFramePointer) { _INT_REG_mask.Remove(OptoReg::as_OptoReg(rbp->as_VMReg())); } + if (need_r12_heapbase()) { + _INT_REG_mask.Remove(OptoReg::as_OptoReg(r12->as_VMReg())); + } _STACK_OR_INT_REG_mask = _INT_REG_mask; _STACK_OR_INT_REG_mask.OR(STACK_OR_STACK_SLOTS_mask()); @@ -732,18 +423,6 @@ _INT_NO_RCX_REG_mask = _INT_REG_mask; _INT_NO_RCX_REG_mask.Remove(OptoReg::as_OptoReg(rcx->as_VMReg())); - - assert(same_mask(_ANY_REG_mask, ANY_REG0_mask()), "!"); - assert(same_mask(_PTR_REG_mask, PTR_REG0_mask()), "!"); - assert(same_mask(_PTR_REG_NO_RBP_mask, PTR_REG0_NO_RBP_mask()), "!"); - assert(same_mask(_PTR_NO_RAX_REG_mask, PTR_NO_RAX_REG0_mask()), "!"); - assert(same_mask(_PTR_NO_RAX_RBX_REG_mask, PTR_NO_RAX_RBX_REG0_mask()), "!"); - assert(same_mask(_LONG_REG_mask, LONG_REG0_mask()), "!"); - assert(same_mask(_LONG_NO_RAX_RDX_REG_mask, LONG_NO_RAX_RDX_REG0_mask()), "!"); - assert(same_mask(_LONG_NO_RCX_REG_mask, LONG_NO_RCX_REG0_mask()), "!"); - assert(same_mask(_INT_REG_mask, INT_REG0_mask()), "!"); - assert(same_mask(_INT_NO_RAX_RDX_REG_mask, INT_NO_RAX_RDX_REG0_mask()), "!"); - assert(same_mask(_INT_NO_RCX_REG_mask, INT_NO_RCX_REG0_mask()), "!"); } static bool generate_vzeroupper(Compile* C) {