# HG changeset patch # User rkennke # Date 1550057017 -3600 # Wed Feb 13 12:23:37 2019 +0100 # Node ID 9ec5ad9958bf48965f6744516f76ac860e0c5ecf # Parent b9addb1cfe9c749b1135d85fab21bc0e95c41635 [mq]: JDK-8217909.patch diff --git a/src/hotspot/cpu/x86/c2_init_x86.cpp b/src/hotspot/cpu/x86/c2_init_x86.cpp --- a/src/hotspot/cpu/x86/c2_init_x86.cpp +++ b/src/hotspot/cpu/x86/c2_init_x86.cpp @@ -29,6 +29,8 @@ // processor dependent initialization for i486 +extern void reg_mask_init(); + void Compile::pd_compiler2_init() { guarantee(CodeEntryAlignment >= InteriorEntryAlignment, "" ); // QQQ presumably all 64bit cpu's support this. Seems like the ifdef could @@ -58,4 +60,5 @@ OptoReg::invalidate(i); } } + reg_mask_init(); } diff --git a/src/hotspot/cpu/x86/x86_64.ad b/src/hotspot/cpu/x86/x86_64.ad --- a/src/hotspot/cpu/x86/x86_64.ad +++ b/src/hotspot/cpu/x86/x86_64.ad @@ -169,77 +169,33 @@ // Empty register class. reg_class no_reg(); -// Class for all pointer registers (including RSP and RBP) -reg_class any_reg_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_reg_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_reg(any_reg_no_rbp, any_reg_with_rbp, %{ PreserveFramePointer %}); +// Class for all pointer registers +reg_class all_reg(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 +reg_class any_reg %{ + return _ANY_REG_mask; +%} // Class for all pointer registers (excluding RSP) -reg_class ptr_reg_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 pointer registers (excluding RSP and RBP) -reg_class ptr_reg_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_reg(ptr_reg_no_rbp, ptr_reg_with_rbp, %{ PreserveFramePointer %}); +reg_class ptr_reg %{ + return _PTR_REG_mask; +%} // Class for all pointer registers (excluding RAX and RSP) reg_class ptr_no_rax_reg_with_rbp(RDX, RDX_H, @@ -529,12 +485,35 @@ //----------SOURCE BLOCK------------------------------------------------------- // This is a block of C++ code which provides values, functions, and // definitions necessary in the rest of the architecture description +source_hpp %{ +extern RegMask _ANY_REG_mask; +extern RegMask _PTR_REG_mask; +%} + source %{ #define RELOC_IMM64 Assembler::imm_operand #define RELOC_DISP32 Assembler::disp32_operand #define __ _masm. +RegMask _ANY_REG_mask; +RegMask _PTR_REG_mask; + +void reg_mask_init() { + // _ALL_REG_mask is generated by adlc from the all_reg register class below. + // We derive a number of subsets from it. + _ANY_REG_mask = _ALL_REG_mask; + if (PreserveFramePointer) { + _ANY_REG_mask.Remove(OptoReg::as_OptoReg(rbp->as_VMReg())); + _ANY_REG_mask.Remove(OptoReg::as_OptoReg(rbp->as_VMReg()->next())); + } + + _PTR_REG_mask = _ANY_REG_mask; + _PTR_REG_mask.Remove(OptoReg::as_OptoReg(rsp->as_VMReg())); + _PTR_REG_mask.Remove(OptoReg::as_OptoReg(rsp->as_VMReg()->next())); + +} + static bool generate_vzeroupper(Compile* C) { return (VM_Version::supports_vzeroupper() && (C->max_vector_size() > 16 || C->clear_upper_avx() == true)) ? true: false; // Generate vzeroupper }