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