src/hotspot/cpu/aarch64/gc/z/z_aarch64.ad
author eosterlund
Tue, 02 Jul 2019 11:33:05 +0200
changeset 55563 d56b192c73e9
parent 55379 865775b86780
child 58516 d376d86b0a01
permissions -rw-r--r--
8225642: ZGC: Crash due to bad oops being spilled to stack in load barriers Reviewed-by: neliasso, pliden Contributed-by: erik.osterlund@oracle.com, stuart.monteith@linaro.org
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
55379
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
     1
//
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
     2
// Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
     3
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
     4
//
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
     5
// This code is free software; you can redistribute it and/or modify it
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
     6
// under the terms of the GNU General Public License version 2 only, as
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
     7
// published by the Free Software Foundation.
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
     8
//
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
     9
// This code is distributed in the hope that it will be useful, but WITHOUT
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    10
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    11
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    12
// version 2 for more details (a copy is included in the LICENSE file that
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    13
// accompanied this code).
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    14
//
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    15
// You should have received a copy of the GNU General Public License version
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    16
// 2 along with this work; if not, write to the Free Software Foundation,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    17
// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    18
//
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    19
// Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    20
// or visit www.oracle.com if you need additional information or have any
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    21
// questions.
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    22
//
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    23
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    24
source_hpp %{
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    25
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    26
#include "gc/z/c2/zBarrierSetC2.hpp"
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    27
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    28
%}
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    29
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    30
source %{
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    31
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    32
#include "gc/z/zBarrierSetAssembler.hpp"
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    33
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    34
static void z_load_barrier_slow_reg(MacroAssembler& _masm, Register dst, 
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    35
                                    Register base, int index, int scale, 
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    36
                                    int disp, bool weak) {
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    37
  const address stub = weak ? ZBarrierSet::assembler()->load_barrier_weak_slow_stub(dst)
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    38
                            : ZBarrierSet::assembler()->load_barrier_slow_stub(dst);
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    39
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    40
  if (index == -1) {
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    41
    if (disp != 0) {
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    42
      __ lea(dst, Address(base, disp));
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    43
    } else {
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    44
       __ mov(dst, base);
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    45
    }
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    46
  } else {
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    47
    Register index_reg = as_Register(index);
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    48
    if (disp == 0) {
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    49
      __ lea(dst, Address(base, index_reg, Address::lsl(scale)));
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    50
    } else {
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    51
      __ lea(dst, Address(base, disp));
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    52
      __ lea(dst, Address(dst, index_reg, Address::lsl(scale)));
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    53
    }
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    54
  }
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    55
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    56
  __ far_call(RuntimeAddress(stub));
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    57
}
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    58
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    59
%}
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    60
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    61
//
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    62
// Execute ZGC load barrier (strong) slow path
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    63
//
55563
d56b192c73e9 8225642: ZGC: Crash due to bad oops being spilled to stack in load barriers
eosterlund
parents: 55379
diff changeset
    64
instruct loadBarrierSlowReg(iRegP dst, memory src, rFlagsReg cr,
55379
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    65
    vRegD_V0 v0, vRegD_V1 v1, vRegD_V2 v2, vRegD_V3 v3, vRegD_V4 v4,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    66
    vRegD_V5 v5, vRegD_V6 v6, vRegD_V7 v7, vRegD_V8 v8, vRegD_V9 v9,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    67
    vRegD_V10 v10, vRegD_V11 v11, vRegD_V12 v12, vRegD_V13 v13, vRegD_V14 v14,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    68
    vRegD_V15 v15, vRegD_V16 v16, vRegD_V17 v17, vRegD_V18 v18, vRegD_V19 v19,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    69
    vRegD_V20 v20, vRegD_V21 v21, vRegD_V22 v22, vRegD_V23 v23, vRegD_V24 v24,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    70
    vRegD_V25 v25, vRegD_V26 v26, vRegD_V27 v27, vRegD_V28 v28, vRegD_V29 v29,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    71
    vRegD_V30 v30, vRegD_V31 v31) %{
55563
d56b192c73e9 8225642: ZGC: Crash due to bad oops being spilled to stack in load barriers
eosterlund
parents: 55379
diff changeset
    72
  match(Set dst (LoadBarrierSlowReg src dst));
55379
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    73
  predicate(!n->as_LoadBarrierSlowReg()->is_weak());
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    74
55563
d56b192c73e9 8225642: ZGC: Crash due to bad oops being spilled to stack in load barriers
eosterlund
parents: 55379
diff changeset
    75
  effect(KILL cr,
55379
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    76
     KILL v0, KILL v1, KILL v2, KILL v3, KILL v4, KILL v5, KILL v6, KILL v7,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    77
     KILL v8, KILL v9, KILL v10, KILL v11, KILL v12, KILL v13, KILL v14,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    78
     KILL v15, KILL v16, KILL v17, KILL v18, KILL v19, KILL v20, KILL v21,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    79
     KILL v22, KILL v23, KILL v24, KILL v25, KILL v26, KILL v27, KILL v28,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    80
     KILL v29, KILL v30, KILL v31);
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    81
55563
d56b192c73e9 8225642: ZGC: Crash due to bad oops being spilled to stack in load barriers
eosterlund
parents: 55379
diff changeset
    82
  format %{ "lea $dst, $src\n\t"
d56b192c73e9 8225642: ZGC: Crash due to bad oops being spilled to stack in load barriers
eosterlund
parents: 55379
diff changeset
    83
            "call #ZLoadBarrierSlowPath" %}
d56b192c73e9 8225642: ZGC: Crash due to bad oops being spilled to stack in load barriers
eosterlund
parents: 55379
diff changeset
    84
55379
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    85
  ins_encode %{
55563
d56b192c73e9 8225642: ZGC: Crash due to bad oops being spilled to stack in load barriers
eosterlund
parents: 55379
diff changeset
    86
    z_load_barrier_slow_reg(_masm, $dst$$Register, $src$$base$$Register,
d56b192c73e9 8225642: ZGC: Crash due to bad oops being spilled to stack in load barriers
eosterlund
parents: 55379
diff changeset
    87
                            $src$$index, $src$$scale, $src$$disp, false);
55379
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    88
  %}
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    89
  ins_pipe(pipe_slow);
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    90
%}
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    91
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    92
//
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    93
// Execute ZGC load barrier (weak) slow path
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    94
//
55563
d56b192c73e9 8225642: ZGC: Crash due to bad oops being spilled to stack in load barriers
eosterlund
parents: 55379
diff changeset
    95
instruct loadBarrierWeakSlowReg(iRegP dst, memory src, rFlagsReg cr,
55379
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    96
    vRegD_V0 v0, vRegD_V1 v1, vRegD_V2 v2, vRegD_V3 v3, vRegD_V4 v4,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    97
    vRegD_V5 v5, vRegD_V6 v6, vRegD_V7 v7, vRegD_V8 v8, vRegD_V9 v9,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    98
    vRegD_V10 v10, vRegD_V11 v11, vRegD_V12 v12, vRegD_V13 v13, vRegD_V14 v14,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
    99
    vRegD_V15 v15, vRegD_V16 v16, vRegD_V17 v17, vRegD_V18 v18, vRegD_V19 v19,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   100
    vRegD_V20 v20, vRegD_V21 v21, vRegD_V22 v22, vRegD_V23 v23, vRegD_V24 v24,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   101
    vRegD_V25 v25, vRegD_V26 v26, vRegD_V27 v27, vRegD_V28 v28, vRegD_V29 v29,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   102
    vRegD_V30 v30, vRegD_V31 v31) %{
55563
d56b192c73e9 8225642: ZGC: Crash due to bad oops being spilled to stack in load barriers
eosterlund
parents: 55379
diff changeset
   103
  match(Set dst (LoadBarrierSlowReg src dst));
55379
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   104
  predicate(n->as_LoadBarrierSlowReg()->is_weak());
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   105
55563
d56b192c73e9 8225642: ZGC: Crash due to bad oops being spilled to stack in load barriers
eosterlund
parents: 55379
diff changeset
   106
  effect(KILL cr,
55379
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   107
     KILL v0, KILL v1, KILL v2, KILL v3, KILL v4, KILL v5, KILL v6, KILL v7,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   108
     KILL v8, KILL v9, KILL v10, KILL v11, KILL v12, KILL v13, KILL v14,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   109
     KILL v15, KILL v16, KILL v17, KILL v18, KILL v19, KILL v20, KILL v21,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   110
     KILL v22, KILL v23, KILL v24, KILL v25, KILL v26, KILL v27, KILL v28,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   111
     KILL v29, KILL v30, KILL v31);
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   112
55563
d56b192c73e9 8225642: ZGC: Crash due to bad oops being spilled to stack in load barriers
eosterlund
parents: 55379
diff changeset
   113
  format %{ "lea $dst, $src\n\t"
d56b192c73e9 8225642: ZGC: Crash due to bad oops being spilled to stack in load barriers
eosterlund
parents: 55379
diff changeset
   114
            "call #ZLoadBarrierSlowPath" %}
d56b192c73e9 8225642: ZGC: Crash due to bad oops being spilled to stack in load barriers
eosterlund
parents: 55379
diff changeset
   115
55379
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   116
  ins_encode %{
55563
d56b192c73e9 8225642: ZGC: Crash due to bad oops being spilled to stack in load barriers
eosterlund
parents: 55379
diff changeset
   117
    z_load_barrier_slow_reg(_masm, $dst$$Register, $src$$base$$Register,
d56b192c73e9 8225642: ZGC: Crash due to bad oops being spilled to stack in load barriers
eosterlund
parents: 55379
diff changeset
   118
                            $src$$index, $src$$scale, $src$$disp, true);
55379
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   119
  %}
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   120
  ins_pipe(pipe_slow);
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   121
%}
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   122
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   123
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   124
// Specialized versions of compareAndExchangeP that adds a keepalive that is consumed
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   125
// but doesn't affect output.
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   126
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   127
instruct z_compareAndExchangeP(iRegPNoSp res, indirect mem,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   128
                               iRegP oldval, iRegP newval, iRegP keepalive,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   129
                               rFlagsReg cr) %{
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   130
  match(Set res (ZCompareAndExchangeP (Binary mem keepalive) (Binary oldval newval)));
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   131
  ins_cost(2 * VOLATILE_REF_COST);
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   132
  effect(TEMP_DEF res, KILL cr);
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   133
  format %{
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   134
    "cmpxchg $res = $mem, $oldval, $newval\t# (ptr, weak) if $mem == $oldval then $mem <-- $newval"
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   135
  %}
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   136
  ins_encode %{
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   137
    __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   138
               Assembler::xword, /*acquire*/ false, /*release*/ true,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   139
               /*weak*/ false, $res$$Register);
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   140
  %}
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   141
  ins_pipe(pipe_slow);
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   142
%}
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   143
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   144
instruct z_compareAndSwapP(iRegINoSp res,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   145
                           indirect mem,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   146
                           iRegP oldval, iRegP newval, iRegP keepalive,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   147
                            rFlagsReg cr) %{
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   148
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   149
  match(Set res (ZCompareAndSwapP (Binary mem keepalive) (Binary oldval newval)));
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   150
  match(Set res (ZWeakCompareAndSwapP (Binary mem keepalive) (Binary oldval newval)));
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   151
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   152
  ins_cost(2 * VOLATILE_REF_COST);
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   153
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   154
  effect(KILL cr);
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   155
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   156
 format %{
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   157
    "cmpxchg $mem, $oldval, $newval\t# (ptr) if $mem == $oldval then $mem <-- $newval"
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   158
    "cset $res, EQ\t# $res <-- (EQ ? 1 : 0)"
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   159
 %}
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   160
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   161
 ins_encode(aarch64_enc_cmpxchg(mem, oldval, newval),
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   162
            aarch64_enc_cset_eq(res));
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   163
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   164
  ins_pipe(pipe_slow);
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   165
%}
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   166
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   167
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   168
instruct z_get_and_setP(indirect mem, iRegP newv, iRegPNoSp prev,
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   169
                        iRegP keepalive) %{
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   170
  match(Set prev (ZGetAndSetP mem (Binary newv keepalive)));
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   171
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   172
  ins_cost(2 * VOLATILE_REF_COST);
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   173
  format %{ "atomic_xchg  $prev, $newv, [$mem]" %}
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   174
  ins_encode %{
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   175
    __ atomic_xchg($prev$$Register, $newv$$Register, as_Register($mem$$base));
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   176
  %}
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   177
  ins_pipe(pipe_serial);
865775b86780 8214527: ZGC for Aarch64
smonteith
parents:
diff changeset
   178
%}