< prev index next >

src/hotspot/cpu/x86/gc/z/z_x86_64.ad

Print this page
rev 54995 : 8224675: Late GC barrier insertion for ZGC
Reviewed-by:


  28 static void z_load_barrier_slow_reg(MacroAssembler& _masm, Register dst, Address src, bool weak) {
  29   assert(dst != rsp, "Invalid register");
  30   assert(dst != r15, "Invalid register");
  31 
  32   const address stub = weak ? ZBarrierSet::assembler()->load_barrier_weak_slow_stub(dst)
  33                             : ZBarrierSet::assembler()->load_barrier_slow_stub(dst);
  34   __ lea(dst, src);
  35   __ call(RuntimeAddress(stub));
  36 }
  37 
  38 %}
  39 
  40 // For XMM and YMM enabled processors
  41 instruct zLoadBarrierSlowRegXmmAndYmm(rRegP dst, memory src, rFlagsReg cr,
  42                                       rxmm0 x0, rxmm1 x1, rxmm2 x2,rxmm3 x3,
  43                                       rxmm4 x4, rxmm5 x5, rxmm6 x6, rxmm7 x7,
  44                                       rxmm8 x8, rxmm9 x9, rxmm10 x10, rxmm11 x11,
  45                                       rxmm12 x12, rxmm13 x13, rxmm14 x14, rxmm15 x15) %{
  46 
  47   match(Set dst (LoadBarrierSlowReg src));
  48   predicate(UseAVX <= 2);
  49 
  50   effect(DEF dst, KILL cr,
  51          KILL x0, KILL x1, KILL x2, KILL x3,
  52          KILL x4, KILL x5, KILL x6, KILL x7,
  53          KILL x8, KILL x9, KILL x10, KILL x11,
  54          KILL x12, KILL x13, KILL x14, KILL x15);
  55 
  56   format %{ "zLoadBarrierSlowRegXmmAndYmm $dst, $src" %}
  57 
  58   ins_encode %{
  59     z_load_barrier_slow_reg(_masm, $dst$$Register, $src$$Address, false /* weak */);
  60   %}
  61 
  62   ins_pipe(pipe_slow);
  63 %}
  64 
  65 // For ZMM enabled processors
  66 instruct zLoadBarrierSlowRegZmm(rRegP dst, memory src, rFlagsReg cr,
  67                                 rxmm0 x0, rxmm1 x1, rxmm2 x2,rxmm3 x3,
  68                                 rxmm4 x4, rxmm5 x5, rxmm6 x6, rxmm7 x7,
  69                                 rxmm8 x8, rxmm9 x9, rxmm10 x10, rxmm11 x11,
  70                                 rxmm12 x12, rxmm13 x13, rxmm14 x14, rxmm15 x15,
  71                                 rxmm16 x16, rxmm17 x17, rxmm18 x18, rxmm19 x19,
  72                                 rxmm20 x20, rxmm21 x21, rxmm22 x22, rxmm23 x23,
  73                                 rxmm24 x24, rxmm25 x25, rxmm26 x26, rxmm27 x27,
  74                                 rxmm28 x28, rxmm29 x29, rxmm30 x30, rxmm31 x31) %{
  75 
  76   match(Set dst (LoadBarrierSlowReg src));
  77   predicate(UseAVX == 3);
  78 
  79   effect(DEF dst, KILL cr,
  80          KILL x0, KILL x1, KILL x2, KILL x3,
  81          KILL x4, KILL x5, KILL x6, KILL x7,
  82          KILL x8, KILL x9, KILL x10, KILL x11,
  83          KILL x12, KILL x13, KILL x14, KILL x15,
  84          KILL x16, KILL x17, KILL x18, KILL x19,
  85          KILL x20, KILL x21, KILL x22, KILL x23,
  86          KILL x24, KILL x25, KILL x26, KILL x27,
  87          KILL x28, KILL x29, KILL x30, KILL x31);
  88 
  89   format %{ "zLoadBarrierSlowRegZmm $dst, $src" %}
  90 
  91   ins_encode %{
  92     z_load_barrier_slow_reg(_masm, $dst$$Register, $src$$Address, false /* weak */);
  93   %}
  94 
  95   ins_pipe(pipe_slow);
  96 %}
  97 
  98 // For XMM and YMM enabled processors
  99 instruct zLoadBarrierWeakSlowRegXmmAndYmm(rRegP dst, memory src, rFlagsReg cr,
 100                                           rxmm0 x0, rxmm1 x1, rxmm2 x2,rxmm3 x3,
 101                                           rxmm4 x4, rxmm5 x5, rxmm6 x6, rxmm7 x7,
 102                                           rxmm8 x8, rxmm9 x9, rxmm10 x10, rxmm11 x11,
 103                                           rxmm12 x12, rxmm13 x13, rxmm14 x14, rxmm15 x15) %{
 104 
 105   match(Set dst (LoadBarrierWeakSlowReg src));
 106   predicate(UseAVX <= 2);
 107 
 108   effect(DEF dst, KILL cr,
 109          KILL x0, KILL x1, KILL x2, KILL x3,
 110          KILL x4, KILL x5, KILL x6, KILL x7,
 111          KILL x8, KILL x9, KILL x10, KILL x11,
 112          KILL x12, KILL x13, KILL x14, KILL x15);
 113 
 114   format %{ "zLoadBarrierWeakSlowRegXmmAndYmm $dst, $src" %}
 115 
 116   ins_encode %{
 117     z_load_barrier_slow_reg(_masm, $dst$$Register, $src$$Address, true /* weak */);
 118   %}
 119 
 120   ins_pipe(pipe_slow);
 121 %}
 122 
 123 // For ZMM enabled processors
 124 instruct zLoadBarrierWeakSlowRegZmm(rRegP dst, memory src, rFlagsReg cr,
 125                                     rxmm0 x0, rxmm1 x1, rxmm2 x2,rxmm3 x3,
 126                                     rxmm4 x4, rxmm5 x5, rxmm6 x6, rxmm7 x7,
 127                                     rxmm8 x8, rxmm9 x9, rxmm10 x10, rxmm11 x11,
 128                                     rxmm12 x12, rxmm13 x13, rxmm14 x14, rxmm15 x15,
 129                                     rxmm16 x16, rxmm17 x17, rxmm18 x18, rxmm19 x19,
 130                                     rxmm20 x20, rxmm21 x21, rxmm22 x22, rxmm23 x23,
 131                                     rxmm24 x24, rxmm25 x25, rxmm26 x26, rxmm27 x27,
 132                                     rxmm28 x28, rxmm29 x29, rxmm30 x30, rxmm31 x31) %{
 133 
 134   match(Set dst (LoadBarrierWeakSlowReg src));
 135   predicate(UseAVX == 3);
 136 
 137   effect(DEF dst, KILL cr,
 138          KILL x0, KILL x1, KILL x2, KILL x3,
 139          KILL x4, KILL x5, KILL x6, KILL x7,
 140          KILL x8, KILL x9, KILL x10, KILL x11,
 141          KILL x12, KILL x13, KILL x14, KILL x15,
 142          KILL x16, KILL x17, KILL x18, KILL x19,
 143          KILL x20, KILL x21, KILL x22, KILL x23,
 144          KILL x24, KILL x25, KILL x26, KILL x27,
 145          KILL x28, KILL x29, KILL x30, KILL x31);
 146 
 147   format %{ "zLoadBarrierWeakSlowRegZmm $dst, $src" %}
 148 
 149   ins_encode %{
 150     z_load_barrier_slow_reg(_masm, $dst$$Register, $src$$Address, true /* weak */);
 151   %}
 152 
 153   ins_pipe(pipe_slow);























































 154 %}


  28 static void z_load_barrier_slow_reg(MacroAssembler& _masm, Register dst, Address src, bool weak) {
  29   assert(dst != rsp, "Invalid register");
  30   assert(dst != r15, "Invalid register");
  31 
  32   const address stub = weak ? ZBarrierSet::assembler()->load_barrier_weak_slow_stub(dst)
  33                             : ZBarrierSet::assembler()->load_barrier_slow_stub(dst);
  34   __ lea(dst, src);
  35   __ call(RuntimeAddress(stub));
  36 }
  37 
  38 %}
  39 
  40 // For XMM and YMM enabled processors
  41 instruct zLoadBarrierSlowRegXmmAndYmm(rRegP dst, memory src, rFlagsReg cr,
  42                                       rxmm0 x0, rxmm1 x1, rxmm2 x2,rxmm3 x3,
  43                                       rxmm4 x4, rxmm5 x5, rxmm6 x6, rxmm7 x7,
  44                                       rxmm8 x8, rxmm9 x9, rxmm10 x10, rxmm11 x11,
  45                                       rxmm12 x12, rxmm13 x13, rxmm14 x14, rxmm15 x15) %{
  46 
  47   match(Set dst (LoadBarrierSlowReg src));
  48   predicate((UseAVX <= 2) && !n->as_LoadBarrierSlowReg()->is_weak());
  49 
  50   effect(DEF dst, KILL cr,
  51          KILL x0, KILL x1, KILL x2, KILL x3,
  52          KILL x4, KILL x5, KILL x6, KILL x7,
  53          KILL x8, KILL x9, KILL x10, KILL x11,
  54          KILL x12, KILL x13, KILL x14, KILL x15);
  55 
  56   format %{ "zLoadBarrierSlowRegXmmAndYmm $dst, $src" %}
  57 
  58   ins_encode %{
  59     z_load_barrier_slow_reg(_masm, $dst$$Register, $src$$Address, false /* weak */);
  60   %}
  61 
  62   ins_pipe(pipe_slow);
  63 %}
  64 
  65 // For ZMM enabled processors
  66 instruct zLoadBarrierSlowRegZmm(rRegP dst, memory src, rFlagsReg cr,
  67                                 rxmm0 x0, rxmm1 x1, rxmm2 x2,rxmm3 x3,
  68                                 rxmm4 x4, rxmm5 x5, rxmm6 x6, rxmm7 x7,
  69                                 rxmm8 x8, rxmm9 x9, rxmm10 x10, rxmm11 x11,
  70                                 rxmm12 x12, rxmm13 x13, rxmm14 x14, rxmm15 x15,
  71                                 rxmm16 x16, rxmm17 x17, rxmm18 x18, rxmm19 x19,
  72                                 rxmm20 x20, rxmm21 x21, rxmm22 x22, rxmm23 x23,
  73                                 rxmm24 x24, rxmm25 x25, rxmm26 x26, rxmm27 x27,
  74                                 rxmm28 x28, rxmm29 x29, rxmm30 x30, rxmm31 x31) %{
  75 
  76   match(Set dst (LoadBarrierSlowReg src));
  77   predicate((UseAVX == 3) && !n->as_LoadBarrierSlowReg()->is_weak());
  78 
  79   effect(DEF dst, KILL cr,
  80          KILL x0, KILL x1, KILL x2, KILL x3,
  81          KILL x4, KILL x5, KILL x6, KILL x7,
  82          KILL x8, KILL x9, KILL x10, KILL x11,
  83          KILL x12, KILL x13, KILL x14, KILL x15,
  84          KILL x16, KILL x17, KILL x18, KILL x19,
  85          KILL x20, KILL x21, KILL x22, KILL x23,
  86          KILL x24, KILL x25, KILL x26, KILL x27,
  87          KILL x28, KILL x29, KILL x30, KILL x31);
  88 
  89   format %{ "zLoadBarrierSlowRegZmm $dst, $src" %}
  90 
  91   ins_encode %{
  92     z_load_barrier_slow_reg(_masm, $dst$$Register, $src$$Address, false /* weak */);
  93   %}
  94 
  95   ins_pipe(pipe_slow);
  96 %}
  97 
  98 // For XMM and YMM enabled processors
  99 instruct zLoadBarrierWeakSlowRegXmmAndYmm(rRegP dst, memory src, rFlagsReg cr,
 100                                           rxmm0 x0, rxmm1 x1, rxmm2 x2,rxmm3 x3,
 101                                           rxmm4 x4, rxmm5 x5, rxmm6 x6, rxmm7 x7,
 102                                           rxmm8 x8, rxmm9 x9, rxmm10 x10, rxmm11 x11,
 103                                           rxmm12 x12, rxmm13 x13, rxmm14 x14, rxmm15 x15) %{
 104 
 105   match(Set dst (LoadBarrierSlowReg src));
 106   predicate((UseAVX <= 2) && n->as_LoadBarrierSlowReg()->is_weak());
 107 
 108   effect(DEF dst, KILL cr,
 109          KILL x0, KILL x1, KILL x2, KILL x3,
 110          KILL x4, KILL x5, KILL x6, KILL x7,
 111          KILL x8, KILL x9, KILL x10, KILL x11,
 112          KILL x12, KILL x13, KILL x14, KILL x15);
 113 
 114   format %{ "zLoadBarrierWeakSlowRegXmmAndYmm $dst, $src" %}
 115 
 116   ins_encode %{
 117     z_load_barrier_slow_reg(_masm, $dst$$Register, $src$$Address, true /* weak */);
 118   %}
 119 
 120   ins_pipe(pipe_slow);
 121 %}
 122 
 123 // For ZMM enabled processors
 124 instruct zLoadBarrierWeakSlowRegZmm(rRegP dst, memory src, rFlagsReg cr,
 125                                     rxmm0 x0, rxmm1 x1, rxmm2 x2,rxmm3 x3,
 126                                     rxmm4 x4, rxmm5 x5, rxmm6 x6, rxmm7 x7,
 127                                     rxmm8 x8, rxmm9 x9, rxmm10 x10, rxmm11 x11,
 128                                     rxmm12 x12, rxmm13 x13, rxmm14 x14, rxmm15 x15,
 129                                     rxmm16 x16, rxmm17 x17, rxmm18 x18, rxmm19 x19,
 130                                     rxmm20 x20, rxmm21 x21, rxmm22 x22, rxmm23 x23,
 131                                     rxmm24 x24, rxmm25 x25, rxmm26 x26, rxmm27 x27,
 132                                     rxmm28 x28, rxmm29 x29, rxmm30 x30, rxmm31 x31) %{
 133 
 134   match(Set dst (LoadBarrierSlowReg src));
 135   predicate((UseAVX == 3) && n->as_LoadBarrierSlowReg()->is_weak());
 136 
 137   effect(DEF dst, KILL cr,
 138          KILL x0, KILL x1, KILL x2, KILL x3,
 139          KILL x4, KILL x5, KILL x6, KILL x7,
 140          KILL x8, KILL x9, KILL x10, KILL x11,
 141          KILL x12, KILL x13, KILL x14, KILL x15,
 142          KILL x16, KILL x17, KILL x18, KILL x19,
 143          KILL x20, KILL x21, KILL x22, KILL x23,
 144          KILL x24, KILL x25, KILL x26, KILL x27,
 145          KILL x28, KILL x29, KILL x30, KILL x31);
 146 
 147   format %{ "zLoadBarrierWeakSlowRegZmm $dst, $src" %}
 148 
 149   ins_encode %{
 150     z_load_barrier_slow_reg(_masm, $dst$$Register, $src$$Address, true /* weak */);
 151   %}
 152 
 153   ins_pipe(pipe_slow);
 154 %}
 155 
 156 // Specialized versions of compareAndExchangeP that adds a keepalive that is consumed
 157 // but doesn't affect output.
 158 
 159 instruct z_compareAndExchangeP(
 160         memory mem_ptr,
 161         rax_RegP oldval, rRegP newval, rRegP keepalive,
 162         rFlagsReg cr) %{
 163     predicate(VM_Version::supports_cx8());
 164     match(Set oldval (ZCompareAndExchangeP (Binary mem_ptr keepalive) (Binary oldval newval)));
 165     effect(KILL cr);
 166 
 167     format %{ "cmpxchgq $mem_ptr,$newval\t# "
 168               "If rax == $mem_ptr then store $newval into $mem_ptr\n\t" %}
 169     opcode(0x0F, 0xB1);
 170     ins_encode(lock_prefix,
 171             REX_reg_mem_wide(newval, mem_ptr),
 172             OpcP, OpcS,
 173             reg_mem(newval, mem_ptr)  // lock cmpxchg
 174     );
 175     ins_pipe( pipe_cmpxchg );
 176 %}
 177 
 178 instruct z_compareAndSwapP(rRegI res,
 179                          memory mem_ptr,
 180                          rax_RegP oldval, rRegP newval, rRegP keepalive,
 181                          rFlagsReg cr) %{
 182   predicate(VM_Version::supports_cx8());
 183   match(Set res (ZCompareAndSwapP (Binary mem_ptr keepalive) (Binary oldval newval)));
 184   match(Set res (ZWeakCompareAndSwapP (Binary mem_ptr keepalive) (Binary oldval newval)));
 185   effect(KILL cr, KILL oldval);
 186 
 187   format %{ "cmpxchgq $mem_ptr,$newval\t# "
 188             "If rax == $mem_ptr then store $newval into $mem_ptr\n\t"
 189             "sete    $res\n\t"
 190             "movzbl  $res, $res" %}
 191   opcode(0x0F, 0xB1);
 192   ins_encode(lock_prefix,
 193           REX_reg_mem_wide(newval, mem_ptr),
 194           OpcP, OpcS,
 195           reg_mem(newval, mem_ptr),
 196           REX_breg(res), Opcode(0x0F), Opcode(0x94), reg(res), // sete
 197           REX_reg_breg(res, res), // movzbl
 198           Opcode(0xF), Opcode(0xB6), reg_reg(res, res));
 199   ins_pipe( pipe_cmpxchg );
 200 %}
 201 
 202 instruct z_xchgP( memory mem, rRegP newval, rRegP keepalive) %{
 203   match(Set newval (ZGetAndSetP mem (Binary newval keepalive)));
 204   format %{ "XCHGQ  $newval,[$mem]" %}
 205   ins_encode %{
 206     __ xchgq($newval$$Register, $mem$$Address);
 207   %}
 208   ins_pipe( pipe_cmpxchg );
 209 %}
< prev index next >