author | chegar |
Thu, 17 Oct 2019 20:53:35 +0100 | |
branch | datagramsocketimpl-branch |
changeset 58678 | 9cf78a70fa4f |
parent 53844 | 8323fdac6da5 |
child 58679 | 9c3209ff7550 |
permissions | -rw-r--r-- |
53542
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
1 |
// |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
2 |
// Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
3 |
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
4 |
// |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
5 |
// This code is free software; you can redistribute it and/or modify it |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
6 |
// under the terms of the GNU General Public License version 2 only, as |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
7 |
// published by the Free Software Foundation. |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
8 |
// |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
9 |
// This code is distributed in the hope that it will be useful, but WITHOUT |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
10 |
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
11 |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
12 |
// version 2 for more details (a copy is included in the LICENSE file that |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
13 |
// accompanied this code). |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
14 |
// |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
15 |
// You should have received a copy of the GNU General Public License version |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
16 |
// 2 along with this work; if not, write to the Free Software Foundation, |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
17 |
// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
18 |
// |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
19 |
// Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
20 |
// or visit www.oracle.com if you need additional information or have any |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
21 |
// questions. |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
22 |
// |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
23 |
|
58678 | 24 |
source_hpp %{ |
25 |
||
26 |
#include "gc/z/c2/zBarrierSetC2.hpp" |
|
27 |
#include "gc/z/zThreadLocalData.hpp" |
|
28 |
||
29 |
%} |
|
30 |
||
53542
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
31 |
source %{ |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
32 |
|
58678 | 33 |
static void z_load_barrier(MacroAssembler& _masm, const MachNode* node, Address ref_addr, Register ref, Register tmp, bool weak) { |
34 |
ZLoadBarrierStubC2* const stub = ZLoadBarrierStubC2::create(node, ref_addr, ref, tmp, weak); |
|
35 |
__ testptr(ref, Address(r15_thread, ZThreadLocalData::address_bad_mask_offset())); |
|
36 |
__ jcc(Assembler::notZero, *stub->entry()); |
|
37 |
__ bind(*stub->continuation()); |
|
38 |
} |
|
53542
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
39 |
|
58678 | 40 |
static void z_load_barrier_slow_path(MacroAssembler& _masm, const MachNode* node, Address ref_addr, Register ref, Register tmp) { |
41 |
ZLoadBarrierStubC2* const stub = ZLoadBarrierStubC2::create(node, ref_addr, ref, tmp, false /* weak */); |
|
42 |
__ jmp(*stub->entry()); |
|
43 |
__ bind(*stub->continuation()); |
|
53542
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
44 |
} |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
45 |
|
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
46 |
%} |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
47 |
|
58678 | 48 |
// Load Pointer |
49 |
instruct zLoadP(rRegP dst, memory mem, rFlagsReg cr) |
|
50 |
%{ |
|
51 |
predicate(UseZGC && n->as_Load()->barrier_data() == ZLoadBarrierStrong); |
|
52 |
match(Set dst (LoadP mem)); |
|
53 |
effect(KILL cr, TEMP dst); |
|
53542
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
54 |
|
58678 | 55 |
ins_cost(125); |
53542
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
56 |
|
58678 | 57 |
format %{ "movq $dst, $mem" %} |
53542
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
58 |
|
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
59 |
ins_encode %{ |
58678 | 60 |
__ movptr($dst$$Register, $mem$$Address); |
61 |
if (barrier_data() != ZLoadBarrierElided) { |
|
62 |
z_load_barrier(_masm, this, $mem$$Address, $dst$$Register, noreg /* tmp */, false /* weak */); |
|
63 |
} |
|
53542
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
64 |
%} |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
65 |
|
58678 | 66 |
ins_pipe(ialu_reg_mem); |
53542
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
67 |
%} |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
68 |
|
58678 | 69 |
// Load Weak Pointer |
70 |
instruct zLoadWeakP(rRegP dst, memory mem, rFlagsReg cr) |
|
71 |
%{ |
|
72 |
predicate(UseZGC && n->as_Load()->barrier_data() == ZLoadBarrierWeak); |
|
73 |
match(Set dst (LoadP mem)); |
|
74 |
effect(KILL cr, TEMP dst); |
|
53542
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
75 |
|
58678 | 76 |
ins_cost(125); |
53542
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
77 |
|
58678 | 78 |
format %{ "movq $dst, $mem" %} |
53542
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
79 |
|
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
80 |
ins_encode %{ |
58678 | 81 |
__ movptr($dst$$Register, $mem$$Address); |
82 |
z_load_barrier(_masm, this, $mem$$Address, $dst$$Register, noreg /* tmp */, true /* weak */); |
|
53542
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
83 |
%} |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
84 |
|
58678 | 85 |
ins_pipe(ialu_reg_mem); |
53542
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
86 |
%} |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
87 |
|
58678 | 88 |
instruct zCompareAndExchangeP(memory mem, rax_RegP oldval, rRegP newval, rRegP tmp, rFlagsReg cr) %{ |
89 |
match(Set oldval (CompareAndExchangeP mem (Binary oldval newval))); |
|
90 |
predicate(UseZGC && n->as_LoadStore()->barrier_data() == ZLoadBarrierStrong); |
|
91 |
effect(KILL cr, TEMP tmp); |
|
53542
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
92 |
|
58678 | 93 |
format %{ "lock\n\t" |
94 |
"cmpxchgq $newval, $mem" %} |
|
53542
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
95 |
|
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
96 |
ins_encode %{ |
58678 | 97 |
if (barrier_data() != ZLoadBarrierElided) { |
98 |
__ movptr($tmp$$Register, $oldval$$Register); |
|
99 |
} |
|
100 |
__ lock(); |
|
101 |
__ cmpxchgptr($newval$$Register, $mem$$Address); |
|
102 |
if (barrier_data() != ZLoadBarrierElided) { |
|
103 |
Label good; |
|
104 |
__ testptr($oldval$$Register, Address(r15_thread, ZThreadLocalData::address_bad_mask_offset())); |
|
105 |
__ jcc(Assembler::zero, good); |
|
106 |
z_load_barrier_slow_path(_masm, this, $mem$$Address, $oldval$$Register, $tmp$$Register); |
|
107 |
__ movptr($oldval$$Register, $tmp$$Register); |
|
108 |
__ lock(); |
|
109 |
__ cmpxchgptr($newval$$Register, $mem$$Address); |
|
110 |
__ bind(good); |
|
111 |
} |
|
53542
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
112 |
%} |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
113 |
|
58678 | 114 |
ins_pipe(pipe_cmpxchg); |
53542
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
115 |
%} |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
116 |
|
58678 | 117 |
instruct zCompareAndSwapP(rRegI res, memory mem, rRegP newval, rRegP tmp, rFlagsReg cr, rax_RegP oldval) %{ |
118 |
match(Set res (CompareAndSwapP mem (Binary oldval newval))); |
|
119 |
match(Set res (WeakCompareAndSwapP mem (Binary oldval newval))); |
|
120 |
predicate(UseZGC && n->as_LoadStore()->barrier_data() == ZLoadBarrierStrong); |
|
121 |
effect(KILL cr, KILL oldval, TEMP tmp); |
|
53542
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
122 |
|
58678 | 123 |
format %{ "lock\n\t" |
124 |
"cmpxchgq $newval, $mem\n\t" |
|
125 |
"sete $res\n\t" |
|
126 |
"movzbl $res, $res" %} |
|
53542
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
127 |
|
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
128 |
ins_encode %{ |
58678 | 129 |
if (barrier_data() != ZLoadBarrierElided) { |
130 |
__ movptr($tmp$$Register, $oldval$$Register); |
|
131 |
} |
|
132 |
__ lock(); |
|
133 |
__ cmpxchgptr($newval$$Register, $mem$$Address); |
|
134 |
if (barrier_data() != ZLoadBarrierElided) { |
|
135 |
Label good; |
|
136 |
__ testptr($oldval$$Register, Address(r15_thread, ZThreadLocalData::address_bad_mask_offset())); |
|
137 |
__ jcc(Assembler::zero, good); |
|
138 |
z_load_barrier_slow_path(_masm, this, $mem$$Address, $oldval$$Register, $tmp$$Register); |
|
139 |
__ movptr($oldval$$Register, $tmp$$Register); |
|
140 |
__ lock(); |
|
141 |
__ cmpxchgptr($newval$$Register, $mem$$Address); |
|
142 |
__ bind(good); |
|
143 |
__ cmpptr($tmp$$Register, $oldval$$Register); |
|
144 |
} |
|
145 |
__ setb(Assembler::equal, $res$$Register); |
|
146 |
__ movzbl($res$$Register, $res$$Register); |
|
53542
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
147 |
%} |
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
148 |
|
58678 | 149 |
ins_pipe(pipe_cmpxchg); |
53542
5c80e6994d8a
8217856: ZGC: Break out C2 matching rules into separate AD file
pliden
parents:
diff
changeset
|
150 |
%} |
58678 | 151 |
|
152 |
instruct zXChgP(memory mem, rRegP newval, rFlagsReg cr) %{ |
|
153 |
match(Set newval (GetAndSetP mem newval)); |
|
154 |
predicate(UseZGC && n->as_LoadStore()->barrier_data() == ZLoadBarrierStrong); |
|
155 |
effect(KILL cr); |
|
156 |
||
157 |
format %{ "xchgq $newval, $mem" %} |
|
158 |
||
159 |
ins_encode %{ |
|
160 |
__ xchgptr($newval$$Register, $mem$$Address); |
|
161 |
if (barrier_data() != ZLoadBarrierElided) { |
|
162 |
z_load_barrier(_masm, this, Address(noreg, 0), $newval$$Register, noreg /* tmp */, false /* weak */); |
|
163 |
} |
|
164 |
%} |
|
165 |
||
166 |
ins_pipe(pipe_cmpxchg); |
|
167 |
%} |