src/hotspot/cpu/x86/gc/shenandoah/shenandoah_x86_32.ad
author shade
Sun, 02 Jun 2019 10:08:39 +0200
changeset 55146 aa5eeb1a9871
permissions -rw-r--r--
8225048: Shenandoah x86_32 support Reviewed-by: erikj, rkennke
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
55146
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
     1
//
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
     2
// Copyright (c) 2018, Red Hat, Inc. All rights reserved.
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
     3
//
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
     4
// This code is free software; you can redistribute it and/or modify it
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
     5
// under the terms of the GNU General Public License version 2 only, as
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
     6
// published by the Free Software Foundation.
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
     7
//
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
     8
// This code is distributed in the hope that it will be useful, but WITHOUT
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
     9
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    10
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    11
// version 2 for more details (a copy is included in the LICENSE file that
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    12
// accompanied this code).
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    13
//
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    14
// You should have received a copy of the GNU General Public License version
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    15
// 2 along with this work; if not, write to the Free Software Foundation,
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    16
// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    17
//
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    18
// Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    19
// or visit www.oracle.com if you need additional information or have any
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    20
// questions.
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    21
//
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    22
//
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    23
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    24
source_hpp %{
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    25
#include "gc/shenandoah/shenandoahBarrierSetAssembler.hpp"
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    26
#include "gc/shenandoah/c2/shenandoahSupport.hpp"
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    27
%}
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    28
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    29
instruct compareAndSwapP_shenandoah(rRegI res,
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    30
                                    memory mem_ptr,
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    31
                                    eRegP tmp1, eRegP tmp2,
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    32
                                    eAXRegP oldval, eRegP newval,
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    33
                                    eFlagsReg cr)
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    34
%{
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    35
  match(Set res (ShenandoahCompareAndSwapP mem_ptr (Binary oldval newval)));
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    36
  match(Set res (ShenandoahWeakCompareAndSwapP mem_ptr (Binary oldval newval)));
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    37
  effect(TEMP tmp1, TEMP tmp2, KILL cr, KILL oldval);
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    38
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    39
  format %{ "shenandoah_cas_oop $mem_ptr,$newval" %}
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    40
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    41
  ins_encode %{
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    42
    ShenandoahBarrierSet::assembler()->cmpxchg_oop(&_masm,
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    43
                                                   $res$$Register, $mem_ptr$$Address, $oldval$$Register, $newval$$Register,
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    44
                                                   false, // swap
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    45
                                                   $tmp1$$Register, $tmp2$$Register
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    46
                                                   );
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    47
  %}
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    48
  ins_pipe( pipe_cmpxchg );
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    49
%}
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    50
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    51
instruct compareAndExchangeP_shenandoah(memory mem_ptr,
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    52
                                        eAXRegP oldval, eRegP newval,
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    53
                                        eRegP tmp1, eRegP tmp2,
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    54
                                        eFlagsReg cr)
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    55
%{
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    56
  match(Set oldval (ShenandoahCompareAndExchangeP mem_ptr (Binary oldval newval)));
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    57
  effect(KILL cr, TEMP tmp1, TEMP tmp2);
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    58
  ins_cost(1000);
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    59
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    60
  format %{ "shenandoah_cas_oop $mem_ptr,$newval" %}
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    61
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    62
  ins_encode %{
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    63
    ShenandoahBarrierSet::assembler()->cmpxchg_oop(&_masm,
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    64
                                                   NULL, $mem_ptr$$Address, $oldval$$Register, $newval$$Register,
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    65
                                                   true,  // exchange
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    66
                                                   $tmp1$$Register, $tmp2$$Register
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    67
                                                   );
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    68
  %}
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    69
  ins_pipe( pipe_cmpxchg );
aa5eeb1a9871 8225048: Shenandoah x86_32 support
shade
parents:
diff changeset
    70
%}