Mercurial > hg > graal-jvmci-8
annotate src/share/vm/opto/memnode.hpp @ 24164:f98ea2d742a2
fixed missing exception propagation (JDK-8185790)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 08 Aug 2017 10:06:50 +0200 |
parents | dd9cc155639c |
children |
rev | line source |
---|---|
0 | 1 /* |
14223
de6a9e811145
8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents:
13045
diff
changeset
|
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1367
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1367
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1367
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_OPTO_MEMNODE_HPP |
26 #define SHARE_VM_OPTO_MEMNODE_HPP | |
27 | |
28 #include "opto/multnode.hpp" | |
29 #include "opto/node.hpp" | |
30 #include "opto/opcodes.hpp" | |
31 #include "opto/type.hpp" | |
32 | |
0 | 33 // Portions of code courtesy of Clifford Click |
34 | |
35 class MultiNode; | |
36 class PhaseCCP; | |
37 class PhaseTransform; | |
38 | |
39 //------------------------------MemNode---------------------------------------- | |
40 // Load or Store, possibly throwing a NULL pointer exception | |
41 class MemNode : public Node { | |
42 protected: | |
43 #ifdef ASSERT | |
44 const TypePtr* _adr_type; // What kind of memory is being addressed? | |
45 #endif | |
46 virtual uint size_of() const; // Size is bigger (ASSERT only) | |
47 public: | |
48 enum { Control, // When is it safe to do this load? | |
49 Memory, // Chunk of memory is being loaded from | |
50 Address, // Actually address, derived from base | |
51 ValueIn, // Value to store | |
52 OopStore // Preceeding oop store, only in StoreCM | |
53 }; | |
14429
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
54 typedef enum { unordered = 0, |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
55 acquire, // Load has to acquire or be succeeded by MemBarAcquire. |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
56 release // Store has to release or be preceded by MemBarRelease. |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
57 } MemOrd; |
0 | 58 protected: |
59 MemNode( Node *c0, Node *c1, Node *c2, const TypePtr* at ) | |
60 : Node(c0,c1,c2 ) { | |
61 init_class_id(Class_Mem); | |
62 debug_only(_adr_type=at; adr_type();) | |
63 } | |
64 MemNode( Node *c0, Node *c1, Node *c2, const TypePtr* at, Node *c3 ) | |
65 : Node(c0,c1,c2,c3) { | |
66 init_class_id(Class_Mem); | |
67 debug_only(_adr_type=at; adr_type();) | |
68 } | |
69 MemNode( Node *c0, Node *c1, Node *c2, const TypePtr* at, Node *c3, Node *c4) | |
70 : Node(c0,c1,c2,c3,c4) { | |
71 init_class_id(Class_Mem); | |
72 debug_only(_adr_type=at; adr_type();) | |
73 } | |
74 | |
33 | 75 public: |
0 | 76 // Helpers for the optimizer. Documented in memnode.cpp. |
77 static bool detect_ptr_independence(Node* p1, AllocateNode* a1, | |
78 Node* p2, AllocateNode* a2, | |
79 PhaseTransform* phase); | |
80 static bool adr_phi_is_loop_invariant(Node* adr_phi, Node* cast); | |
81 | |
10278 | 82 static Node *optimize_simple_memory_chain(Node *mchain, const TypeOopPtr *t_oop, Node *load, PhaseGVN *phase); |
83 static Node *optimize_memory_chain(Node *mchain, const TypePtr *t_adr, Node *load, PhaseGVN *phase); | |
0 | 84 // This one should probably be a phase-specific function: |
85
f3b3fe64f59f
6692301: Side effect in NumberFormat tests with -server -Xcomp
kvn
parents:
74
diff
changeset
|
85 static bool all_controls_dominate(Node* dom, Node* sub); |
0 | 86 |
163 | 87 // Find any cast-away of null-ness and keep its control. |
88 static Node *Ideal_common_DU_postCCP( PhaseCCP *ccp, Node* n, Node* adr ); | |
0 | 89 virtual Node *Ideal_DU_postCCP( PhaseCCP *ccp ); |
90 | |
91 virtual const class TypePtr *adr_type() const; // returns bottom_type of address | |
92 | |
93 // Shared code for Ideal methods: | |
94 Node *Ideal_common(PhaseGVN *phase, bool can_reshape); // Return -1 for short-circuit NULL. | |
95 | |
96 // Helper function for adr_type() implementations. | |
97 static const TypePtr* calculate_adr_type(const Type* t, const TypePtr* cross_check = NULL); | |
98 | |
99 // Raw access function, to allow copying of adr_type efficiently in | |
100 // product builds and retain the debug info for debug builds. | |
101 const TypePtr *raw_adr_type() const { | |
102 #ifdef ASSERT | |
103 return _adr_type; | |
104 #else | |
105 return 0; | |
106 #endif | |
107 } | |
108 | |
109 // Map a load or store opcode to its corresponding store opcode. | |
110 // (Return -1 if unknown.) | |
111 virtual int store_Opcode() const { return -1; } | |
112 | |
113 // What is the type of the value in memory? (T_VOID mean "unspecified".) | |
114 virtual BasicType memory_type() const = 0; | |
29
d5fc211aea19
6633953: type2aelembytes{T_ADDRESS} should be 8 bytes in 64 bit VM
kvn
parents:
17
diff
changeset
|
115 virtual int memory_size() const { |
d5fc211aea19
6633953: type2aelembytes{T_ADDRESS} should be 8 bytes in 64 bit VM
kvn
parents:
17
diff
changeset
|
116 #ifdef ASSERT |
d5fc211aea19
6633953: type2aelembytes{T_ADDRESS} should be 8 bytes in 64 bit VM
kvn
parents:
17
diff
changeset
|
117 return type2aelembytes(memory_type(), true); |
d5fc211aea19
6633953: type2aelembytes{T_ADDRESS} should be 8 bytes in 64 bit VM
kvn
parents:
17
diff
changeset
|
118 #else |
d5fc211aea19
6633953: type2aelembytes{T_ADDRESS} should be 8 bytes in 64 bit VM
kvn
parents:
17
diff
changeset
|
119 return type2aelembytes(memory_type()); |
d5fc211aea19
6633953: type2aelembytes{T_ADDRESS} should be 8 bytes in 64 bit VM
kvn
parents:
17
diff
changeset
|
120 #endif |
d5fc211aea19
6633953: type2aelembytes{T_ADDRESS} should be 8 bytes in 64 bit VM
kvn
parents:
17
diff
changeset
|
121 } |
0 | 122 |
123 // Search through memory states which precede this node (load or store). | |
124 // Look for an exact match for the address, with no intervening | |
125 // aliased stores. | |
126 Node* find_previous_store(PhaseTransform* phase); | |
127 | |
128 // Can this node (load or store) accurately see a stored value in | |
129 // the given memory state? (The state may or may not be in(Memory).) | |
130 Node* can_see_stored_value(Node* st, PhaseTransform* phase) const; | |
131 | |
132 #ifndef PRODUCT | |
133 static void dump_adr_type(const Node* mem, const TypePtr* adr_type, outputStream *st); | |
134 virtual void dump_spec(outputStream *st) const; | |
135 #endif | |
136 }; | |
137 | |
138 //------------------------------LoadNode--------------------------------------- | |
139 // Load value; requires Memory and Address | |
140 class LoadNode : public MemNode { | |
23055
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
141 public: |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
142 // Some loads (from unsafe) should be pinned: they don't depend only |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
143 // on the dominating test. The boolean field _depends_only_on_test |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
144 // below records whether that node depends only on the dominating |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
145 // test. |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
146 // Methods used to build LoadNodes pass an argument of type enum |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
147 // ControlDependency instead of a boolean because those methods |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
148 // typically have multiple boolean parameters with default values: |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
149 // passing the wrong boolean to one of these parameters by mistake |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
150 // goes easily unnoticed. Using an enum, the compiler can check that |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
151 // the type of a value and the type of the parameter match. |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
152 enum ControlDependency { |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
153 Pinned, |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
154 DependsOnlyOnTest |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
155 }; |
14429
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
156 private: |
23055
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
157 // LoadNode::hash() doesn't take the _depends_only_on_test field |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
158 // into account: If the graph already has a non-pinned LoadNode and |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
159 // we add a pinned LoadNode with the same inputs, it's safe for GVN |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
160 // to replace the pinned LoadNode with the non-pinned LoadNode, |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
161 // otherwise it wouldn't be safe to have a non pinned LoadNode with |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
162 // those inputs in the first place. If the graph already has a |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
163 // pinned LoadNode and we add a non pinned LoadNode with the same |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
164 // inputs, it's safe (but suboptimal) for GVN to replace the |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
165 // non-pinned LoadNode by the pinned LoadNode. |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
166 bool _depends_only_on_test; |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
167 |
14429
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
168 // On platforms with weak memory ordering (e.g., PPC, Ia64) we distinguish |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
169 // loads that can be reordered, and such requiring acquire semantics to |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
170 // adhere to the Java specification. The required behaviour is stored in |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
171 // this field. |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
172 const MemOrd _mo; |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
173 |
0 | 174 protected: |
14429
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
175 virtual uint cmp(const Node &n) const; |
0 | 176 virtual uint size_of() const; // Size is bigger |
20627
e7b3d177adda
8057622: java/util/stream/test/org/openjdk/tests/java/util/stream/InfiniteStreamWithLimitOpTest: SEGV inside compiled code (sparc)
zmajo
parents:
14456
diff
changeset
|
177 // Should LoadNode::Ideal() attempt to remove control edges? |
e7b3d177adda
8057622: java/util/stream/test/org/openjdk/tests/java/util/stream/InfiniteStreamWithLimitOpTest: SEGV inside compiled code (sparc)
zmajo
parents:
14456
diff
changeset
|
178 virtual bool can_remove_control() const; |
0 | 179 const Type* const _type; // What kind of value is loaded? |
180 public: | |
181 | |
23055
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
182 LoadNode(Node *c, Node *mem, Node *adr, const TypePtr* at, const Type *rt, MemOrd mo, ControlDependency control_dependency) |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
183 : MemNode(c,mem,adr,at), _type(rt), _mo(mo), _depends_only_on_test(control_dependency == DependsOnlyOnTest) { |
0 | 184 init_class_id(Class_Load); |
185 } | |
14429
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
186 inline bool is_unordered() const { return !is_acquire(); } |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
187 inline bool is_acquire() const { |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
188 assert(_mo == unordered || _mo == acquire, "unexpected"); |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
189 return _mo == acquire; |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
190 } |
0 | 191 |
192 // Polymorphic factory method: | |
14429
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
193 static Node* make(PhaseGVN& gvn, Node *c, Node *mem, Node *adr, |
23055
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
194 const TypePtr* at, const Type *rt, BasicType bt, |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
195 MemOrd mo, ControlDependency control_dependency = DependsOnlyOnTest); |
0 | 196 |
197 virtual uint hash() const; // Check the type | |
198 | |
199 // Handle algebraic identities here. If we have an identity, return the Node | |
200 // we are equivalent to. We look for Load of a Store. | |
201 virtual Node *Identity( PhaseTransform *phase ); | |
202 | |
20627
e7b3d177adda
8057622: java/util/stream/test/org/openjdk/tests/java/util/stream/InfiniteStreamWithLimitOpTest: SEGV inside compiled code (sparc)
zmajo
parents:
14456
diff
changeset
|
203 // If the load is from Field memory and the pointer is non-null, it might be possible to |
0 | 204 // zero out the control input. |
20627
e7b3d177adda
8057622: java/util/stream/test/org/openjdk/tests/java/util/stream/InfiniteStreamWithLimitOpTest: SEGV inside compiled code (sparc)
zmajo
parents:
14456
diff
changeset
|
205 // If the offset is constant and the base is an object allocation, |
e7b3d177adda
8057622: java/util/stream/test/org/openjdk/tests/java/util/stream/InfiniteStreamWithLimitOpTest: SEGV inside compiled code (sparc)
zmajo
parents:
14456
diff
changeset
|
206 // try to hook me up to the exact initializing store. |
0 | 207 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
208 | |
163 | 209 // Split instance field load through Phi. |
210 Node* split_through_phi(PhaseGVN *phase); | |
211 | |
17
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
212 // Recover original value from boxed values |
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
213 Node *eliminate_autobox(PhaseGVN *phase); |
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
214 |
0 | 215 // Compute a new Type for this node. Basically we just do the pre-check, |
216 // then call the virtual add() to set the type. | |
217 virtual const Type *Value( PhaseTransform *phase ) const; | |
218 | |
164
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
219 // Common methods for LoadKlass and LoadNKlass nodes. |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
220 const Type *klass_value_common( PhaseTransform *phase ) const; |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
221 Node *klass_identity_common( PhaseTransform *phase ); |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
222 |
0 | 223 virtual uint ideal_reg() const; |
224 virtual const Type *bottom_type() const; | |
225 // Following method is copied from TypeNode: | |
226 void set_type(const Type* t) { | |
227 assert(t != NULL, "sanity"); | |
228 debug_only(uint check_hash = (VerifyHashTableKeys && _hash_lock) ? hash() : NO_HASH); | |
229 *(const Type**)&_type = t; // cast away const-ness | |
230 // If this node is in the hash table, make sure it doesn't need a rehash. | |
231 assert(check_hash == NO_HASH || check_hash == hash(), "type change must preserve hash code"); | |
232 } | |
233 const Type* type() const { assert(_type != NULL, "sanity"); return _type; }; | |
234 | |
235 // Do not match memory edge | |
236 virtual uint match_edge(uint idx) const; | |
237 | |
238 // Map a load opcode to its corresponding store opcode. | |
239 virtual int store_Opcode() const = 0; | |
240 | |
64
b8f5ba577b02
6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents:
33
diff
changeset
|
241 // Check if the load's memory input is a Phi node with the same control. |
b8f5ba577b02
6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents:
33
diff
changeset
|
242 bool is_instance_field_load_with_local_phi(Node* ctrl); |
b8f5ba577b02
6673473: (Escape Analysis) Add the instance's field information to PhiNode
kvn
parents:
33
diff
changeset
|
243 |
0 | 244 #ifndef PRODUCT |
245 virtual void dump_spec(outputStream *st) const; | |
246 #endif | |
1609 | 247 #ifdef ASSERT |
248 // Helper function to allow a raw load without control edge for some cases | |
249 static bool is_immutable_value(Node* adr); | |
250 #endif | |
0 | 251 protected: |
252 const Type* load_array_final_field(const TypeKlassPtr *tkls, | |
253 ciKlass* klass) const; | |
13045
94a83e0f9ce1
8017065: C2 allows safepoint checks to leak into G1 pre-barriers
iveresov
parents:
10278
diff
changeset
|
254 // depends_only_on_test is almost always true, and needs to be almost always |
94a83e0f9ce1
8017065: C2 allows safepoint checks to leak into G1 pre-barriers
iveresov
parents:
10278
diff
changeset
|
255 // true to enable key hoisting & commoning optimizations. However, for the |
94a83e0f9ce1
8017065: C2 allows safepoint checks to leak into G1 pre-barriers
iveresov
parents:
10278
diff
changeset
|
256 // special case of RawPtr loads from TLS top & end, and other loads performed by |
94a83e0f9ce1
8017065: C2 allows safepoint checks to leak into G1 pre-barriers
iveresov
parents:
10278
diff
changeset
|
257 // GC barriers, the control edge carries the dependence preventing hoisting past |
94a83e0f9ce1
8017065: C2 allows safepoint checks to leak into G1 pre-barriers
iveresov
parents:
10278
diff
changeset
|
258 // a Safepoint instead of the memory edge. (An unfortunate consequence of having |
94a83e0f9ce1
8017065: C2 allows safepoint checks to leak into G1 pre-barriers
iveresov
parents:
10278
diff
changeset
|
259 // Safepoints not set Raw Memory; itself an unfortunate consequence of having Nodes |
94a83e0f9ce1
8017065: C2 allows safepoint checks to leak into G1 pre-barriers
iveresov
parents:
10278
diff
changeset
|
260 // which produce results (new raw memory state) inside of loops preventing all |
94a83e0f9ce1
8017065: C2 allows safepoint checks to leak into G1 pre-barriers
iveresov
parents:
10278
diff
changeset
|
261 // manner of other optimizations). Basically, it's ugly but so is the alternative. |
94a83e0f9ce1
8017065: C2 allows safepoint checks to leak into G1 pre-barriers
iveresov
parents:
10278
diff
changeset
|
262 // See comment in macro.cpp, around line 125 expand_allocate_common(). |
23055
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
263 virtual bool depends_only_on_test() const { return adr_type() != TypeRawPtr::BOTTOM && _depends_only_on_test; } |
0 | 264 }; |
265 | |
266 //------------------------------LoadBNode-------------------------------------- | |
267 // Load a byte (8bits signed) from memory | |
268 class LoadBNode : public LoadNode { | |
269 public: | |
23055
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
270 LoadBNode(Node *c, Node *mem, Node *adr, const TypePtr* at, const TypeInt *ti, MemOrd mo, ControlDependency control_dependency = DependsOnlyOnTest) |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
271 : LoadNode(c, mem, adr, at, ti, mo, control_dependency) {} |
0 | 272 virtual int Opcode() const; |
273 virtual uint ideal_reg() const { return Op_RegI; } | |
274 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
4815 | 275 virtual const Type *Value(PhaseTransform *phase) const; |
0 | 276 virtual int store_Opcode() const { return Op_StoreB; } |
277 virtual BasicType memory_type() const { return T_BYTE; } | |
278 }; | |
279 | |
624 | 280 //------------------------------LoadUBNode------------------------------------- |
281 // Load a unsigned byte (8bits unsigned) from memory | |
282 class LoadUBNode : public LoadNode { | |
283 public: | |
23055
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
284 LoadUBNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const TypeInt* ti, MemOrd mo, ControlDependency control_dependency = DependsOnlyOnTest) |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
285 : LoadNode(c, mem, adr, at, ti, mo, control_dependency) {} |
624 | 286 virtual int Opcode() const; |
287 virtual uint ideal_reg() const { return Op_RegI; } | |
288 virtual Node* Ideal(PhaseGVN *phase, bool can_reshape); | |
4815 | 289 virtual const Type *Value(PhaseTransform *phase) const; |
624 | 290 virtual int store_Opcode() const { return Op_StoreB; } |
291 virtual BasicType memory_type() const { return T_BYTE; } | |
292 }; | |
293 | |
558
3b5ac9e7e6ea
6796746: rename LoadC (char) opcode class to LoadUS (unsigned short)
twisti
parents:
420
diff
changeset
|
294 //------------------------------LoadUSNode------------------------------------- |
3b5ac9e7e6ea
6796746: rename LoadC (char) opcode class to LoadUS (unsigned short)
twisti
parents:
420
diff
changeset
|
295 // Load an unsigned short/char (16bits unsigned) from memory |
3b5ac9e7e6ea
6796746: rename LoadC (char) opcode class to LoadUS (unsigned short)
twisti
parents:
420
diff
changeset
|
296 class LoadUSNode : public LoadNode { |
0 | 297 public: |
23055
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
298 LoadUSNode(Node *c, Node *mem, Node *adr, const TypePtr* at, const TypeInt *ti, MemOrd mo, ControlDependency control_dependency = DependsOnlyOnTest) |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
299 : LoadNode(c, mem, adr, at, ti, mo, control_dependency) {} |
0 | 300 virtual int Opcode() const; |
301 virtual uint ideal_reg() const { return Op_RegI; } | |
302 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
4815 | 303 virtual const Type *Value(PhaseTransform *phase) const; |
0 | 304 virtual int store_Opcode() const { return Op_StoreC; } |
305 virtual BasicType memory_type() const { return T_CHAR; } | |
306 }; | |
307 | |
4815 | 308 //------------------------------LoadSNode-------------------------------------- |
309 // Load a short (16bits signed) from memory | |
310 class LoadSNode : public LoadNode { | |
311 public: | |
23055
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
312 LoadSNode(Node *c, Node *mem, Node *adr, const TypePtr* at, const TypeInt *ti, MemOrd mo, ControlDependency control_dependency = DependsOnlyOnTest) |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
313 : LoadNode(c, mem, adr, at, ti, mo, control_dependency) {} |
4815 | 314 virtual int Opcode() const; |
315 virtual uint ideal_reg() const { return Op_RegI; } | |
316 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
317 virtual const Type *Value(PhaseTransform *phase) const; | |
318 virtual int store_Opcode() const { return Op_StoreC; } | |
319 virtual BasicType memory_type() const { return T_SHORT; } | |
320 }; | |
321 | |
0 | 322 //------------------------------LoadINode-------------------------------------- |
323 // Load an integer from memory | |
324 class LoadINode : public LoadNode { | |
325 public: | |
23055
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
326 LoadINode(Node *c, Node *mem, Node *adr, const TypePtr* at, const TypeInt *ti, MemOrd mo, ControlDependency control_dependency = DependsOnlyOnTest) |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
327 : LoadNode(c, mem, adr, at, ti, mo, control_dependency) {} |
0 | 328 virtual int Opcode() const; |
329 virtual uint ideal_reg() const { return Op_RegI; } | |
330 virtual int store_Opcode() const { return Op_StoreI; } | |
331 virtual BasicType memory_type() const { return T_INT; } | |
332 }; | |
333 | |
334 //------------------------------LoadRangeNode---------------------------------- | |
335 // Load an array length from the array | |
336 class LoadRangeNode : public LoadINode { | |
337 public: | |
14429
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
338 LoadRangeNode(Node *c, Node *mem, Node *adr, const TypeInt *ti = TypeInt::POS) |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
339 : LoadINode(c, mem, adr, TypeAryPtr::RANGE, ti, MemNode::unordered) {} |
0 | 340 virtual int Opcode() const; |
341 virtual const Type *Value( PhaseTransform *phase ) const; | |
342 virtual Node *Identity( PhaseTransform *phase ); | |
366
8261ee795323
6711100: 64bit fastdebug server vm crashes with assert(_base == Int,"Not an Int")
rasbold
parents:
253
diff
changeset
|
343 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
0 | 344 }; |
345 | |
346 //------------------------------LoadLNode-------------------------------------- | |
347 // Load a long from memory | |
348 class LoadLNode : public LoadNode { | |
349 virtual uint hash() const { return LoadNode::hash() + _require_atomic_access; } | |
350 virtual uint cmp( const Node &n ) const { | |
351 return _require_atomic_access == ((LoadLNode&)n)._require_atomic_access | |
352 && LoadNode::cmp(n); | |
353 } | |
354 virtual uint size_of() const { return sizeof(*this); } | |
355 const bool _require_atomic_access; // is piecewise load forbidden? | |
356 | |
357 public: | |
14429
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
358 LoadLNode(Node *c, Node *mem, Node *adr, const TypePtr* at, const TypeLong *tl, |
23055
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
359 MemOrd mo, ControlDependency control_dependency = DependsOnlyOnTest, bool require_atomic_access = false) |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
360 : LoadNode(c, mem, adr, at, tl, mo, control_dependency), _require_atomic_access(require_atomic_access) {} |
0 | 361 virtual int Opcode() const; |
362 virtual uint ideal_reg() const { return Op_RegL; } | |
363 virtual int store_Opcode() const { return Op_StoreL; } | |
364 virtual BasicType memory_type() const { return T_LONG; } | |
23054
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
365 bool require_atomic_access() const { return _require_atomic_access; } |
14429
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
366 static LoadLNode* make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, |
23055
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
367 const Type* rt, MemOrd mo, ControlDependency control_dependency = DependsOnlyOnTest); |
0 | 368 #ifndef PRODUCT |
369 virtual void dump_spec(outputStream *st) const { | |
370 LoadNode::dump_spec(st); | |
371 if (_require_atomic_access) st->print(" Atomic!"); | |
372 } | |
373 #endif | |
374 }; | |
375 | |
376 //------------------------------LoadL_unalignedNode---------------------------- | |
377 // Load a long from unaligned memory | |
378 class LoadL_unalignedNode : public LoadLNode { | |
379 public: | |
23055
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
380 LoadL_unalignedNode(Node *c, Node *mem, Node *adr, const TypePtr* at, MemOrd mo, ControlDependency control_dependency = DependsOnlyOnTest) |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
381 : LoadLNode(c, mem, adr, at, TypeLong::LONG, mo, control_dependency) {} |
0 | 382 virtual int Opcode() const; |
383 }; | |
384 | |
385 //------------------------------LoadFNode-------------------------------------- | |
386 // Load a float (64 bits) from memory | |
387 class LoadFNode : public LoadNode { | |
388 public: | |
23055
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
389 LoadFNode(Node *c, Node *mem, Node *adr, const TypePtr* at, const Type *t, MemOrd mo, ControlDependency control_dependency = DependsOnlyOnTest) |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
390 : LoadNode(c, mem, adr, at, t, mo, control_dependency) {} |
0 | 391 virtual int Opcode() const; |
392 virtual uint ideal_reg() const { return Op_RegF; } | |
393 virtual int store_Opcode() const { return Op_StoreF; } | |
394 virtual BasicType memory_type() const { return T_FLOAT; } | |
395 }; | |
396 | |
397 //------------------------------LoadDNode-------------------------------------- | |
398 // Load a double (64 bits) from memory | |
399 class LoadDNode : public LoadNode { | |
23054
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
400 virtual uint hash() const { return LoadNode::hash() + _require_atomic_access; } |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
401 virtual uint cmp( const Node &n ) const { |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
402 return _require_atomic_access == ((LoadDNode&)n)._require_atomic_access |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
403 && LoadNode::cmp(n); |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
404 } |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
405 virtual uint size_of() const { return sizeof(*this); } |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
406 const bool _require_atomic_access; // is piecewise load forbidden? |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
407 |
0 | 408 public: |
23054
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
409 LoadDNode(Node *c, Node *mem, Node *adr, const TypePtr* at, const Type *t, |
23055
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
410 MemOrd mo, ControlDependency control_dependency = DependsOnlyOnTest, bool require_atomic_access = false) |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
411 : LoadNode(c, mem, adr, at, t, mo, control_dependency), _require_atomic_access(require_atomic_access) {} |
0 | 412 virtual int Opcode() const; |
413 virtual uint ideal_reg() const { return Op_RegD; } | |
414 virtual int store_Opcode() const { return Op_StoreD; } | |
415 virtual BasicType memory_type() const { return T_DOUBLE; } | |
23054
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
416 bool require_atomic_access() const { return _require_atomic_access; } |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
417 static LoadDNode* make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, |
23055
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
418 const Type* rt, MemOrd mo, ControlDependency control_dependency = DependsOnlyOnTest); |
23054
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
419 #ifndef PRODUCT |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
420 virtual void dump_spec(outputStream *st) const { |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
421 LoadNode::dump_spec(st); |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
422 if (_require_atomic_access) st->print(" Atomic!"); |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
423 } |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
424 #endif |
0 | 425 }; |
426 | |
427 //------------------------------LoadD_unalignedNode---------------------------- | |
428 // Load a double from unaligned memory | |
429 class LoadD_unalignedNode : public LoadDNode { | |
430 public: | |
23055
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
431 LoadD_unalignedNode(Node *c, Node *mem, Node *adr, const TypePtr* at, MemOrd mo, ControlDependency control_dependency = DependsOnlyOnTest) |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
432 : LoadDNode(c, mem, adr, at, Type::DOUBLE, mo, control_dependency) {} |
0 | 433 virtual int Opcode() const; |
434 }; | |
435 | |
436 //------------------------------LoadPNode-------------------------------------- | |
437 // Load a pointer from memory (either object or array) | |
438 class LoadPNode : public LoadNode { | |
439 public: | |
23055
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
440 LoadPNode(Node *c, Node *mem, Node *adr, const TypePtr *at, const TypePtr* t, MemOrd mo, ControlDependency control_dependency = DependsOnlyOnTest) |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
441 : LoadNode(c, mem, adr, at, t, mo, control_dependency) {} |
0 | 442 virtual int Opcode() const; |
443 virtual uint ideal_reg() const { return Op_RegP; } | |
444 virtual int store_Opcode() const { return Op_StoreP; } | |
445 virtual BasicType memory_type() const { return T_ADDRESS; } | |
446 }; | |
447 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
74
diff
changeset
|
448 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
74
diff
changeset
|
449 //------------------------------LoadNNode-------------------------------------- |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
74
diff
changeset
|
450 // Load a narrow oop from memory (either object or array) |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
74
diff
changeset
|
451 class LoadNNode : public LoadNode { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
74
diff
changeset
|
452 public: |
23055
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
453 LoadNNode(Node *c, Node *mem, Node *adr, const TypePtr *at, const Type* t, MemOrd mo, ControlDependency control_dependency = DependsOnlyOnTest) |
c1c199dde5c9
8077504: Unsafe load can loose control dependency and cause crash
roland
parents:
23054
diff
changeset
|
454 : LoadNode(c, mem, adr, at, t, mo, control_dependency) {} |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
74
diff
changeset
|
455 virtual int Opcode() const; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
74
diff
changeset
|
456 virtual uint ideal_reg() const { return Op_RegN; } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
74
diff
changeset
|
457 virtual int store_Opcode() const { return Op_StoreN; } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
74
diff
changeset
|
458 virtual BasicType memory_type() const { return T_NARROWOOP; } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
74
diff
changeset
|
459 }; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
74
diff
changeset
|
460 |
0 | 461 //------------------------------LoadKlassNode---------------------------------- |
462 // Load a Klass from an object | |
463 class LoadKlassNode : public LoadPNode { | |
20627
e7b3d177adda
8057622: java/util/stream/test/org/openjdk/tests/java/util/stream/InfiniteStreamWithLimitOpTest: SEGV inside compiled code (sparc)
zmajo
parents:
14456
diff
changeset
|
464 protected: |
e7b3d177adda
8057622: java/util/stream/test/org/openjdk/tests/java/util/stream/InfiniteStreamWithLimitOpTest: SEGV inside compiled code (sparc)
zmajo
parents:
14456
diff
changeset
|
465 // In most cases, LoadKlassNode does not have the control input set. If the control |
e7b3d177adda
8057622: java/util/stream/test/org/openjdk/tests/java/util/stream/InfiniteStreamWithLimitOpTest: SEGV inside compiled code (sparc)
zmajo
parents:
14456
diff
changeset
|
466 // input is set, it must not be removed (by LoadNode::Ideal()). |
e7b3d177adda
8057622: java/util/stream/test/org/openjdk/tests/java/util/stream/InfiniteStreamWithLimitOpTest: SEGV inside compiled code (sparc)
zmajo
parents:
14456
diff
changeset
|
467 virtual bool can_remove_control() const; |
0 | 468 public: |
14429
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
469 LoadKlassNode(Node *c, Node *mem, Node *adr, const TypePtr *at, const TypeKlassPtr *tk, MemOrd mo) |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
470 : LoadPNode(c, mem, adr, at, tk, mo) {} |
0 | 471 virtual int Opcode() const; |
472 virtual const Type *Value( PhaseTransform *phase ) const; | |
473 virtual Node *Identity( PhaseTransform *phase ); | |
474 virtual bool depends_only_on_test() const { return true; } | |
164
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
475 |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
476 // Polymorphic factory method: |
20627
e7b3d177adda
8057622: java/util/stream/test/org/openjdk/tests/java/util/stream/InfiniteStreamWithLimitOpTest: SEGV inside compiled code (sparc)
zmajo
parents:
14456
diff
changeset
|
477 static Node* make(PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, const TypePtr* at, |
e7b3d177adda
8057622: java/util/stream/test/org/openjdk/tests/java/util/stream/InfiniteStreamWithLimitOpTest: SEGV inside compiled code (sparc)
zmajo
parents:
14456
diff
changeset
|
478 const TypeKlassPtr* tk = TypeKlassPtr::OBJECT); |
0 | 479 }; |
480 | |
164
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
481 //------------------------------LoadNKlassNode--------------------------------- |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
482 // Load a narrow Klass from an object. |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
483 class LoadNKlassNode : public LoadNNode { |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
484 public: |
14429
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
485 LoadNKlassNode(Node *c, Node *mem, Node *adr, const TypePtr *at, const TypeNarrowKlass *tk, MemOrd mo) |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
486 : LoadNNode(c, mem, adr, at, tk, mo) {} |
164
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
487 virtual int Opcode() const; |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
488 virtual uint ideal_reg() const { return Op_RegN; } |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6795
diff
changeset
|
489 virtual int store_Opcode() const { return Op_StoreNKlass; } |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6795
diff
changeset
|
490 virtual BasicType memory_type() const { return T_NARROWKLASS; } |
164
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
491 |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
492 virtual const Type *Value( PhaseTransform *phase ) const; |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
493 virtual Node *Identity( PhaseTransform *phase ); |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
494 virtual bool depends_only_on_test() const { return true; } |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
495 }; |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
496 |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
497 |
0 | 498 //------------------------------StoreNode-------------------------------------- |
499 // Store value; requires Store, Address and Value | |
500 class StoreNode : public MemNode { | |
14429
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
501 private: |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
502 // On platforms with weak memory ordering (e.g., PPC, Ia64) we distinguish |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
503 // stores that can be reordered, and such requiring release semantics to |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
504 // adhere to the Java specification. The required behaviour is stored in |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
505 // this field. |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
506 const MemOrd _mo; |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
507 // Needed for proper cloning. |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
508 virtual uint size_of() const { return sizeof(*this); } |
0 | 509 protected: |
510 virtual uint cmp( const Node &n ) const; | |
511 virtual bool depends_only_on_test() const { return false; } | |
512 | |
513 Node *Ideal_masked_input (PhaseGVN *phase, uint mask); | |
514 Node *Ideal_sign_extended_input(PhaseGVN *phase, int num_bits); | |
515 | |
516 public: | |
14429
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
517 // We must ensure that stores of object references will be visible |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
518 // only after the object's initialization. So the callers of this |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
519 // procedure must indicate that the store requires `release' |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
520 // semantics, if the stored value is an object reference that might |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
521 // point to a new object and may become externally visible. |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
522 StoreNode(Node *c, Node *mem, Node *adr, const TypePtr* at, Node *val, MemOrd mo) |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
523 : MemNode(c, mem, adr, at, val), _mo(mo) { |
0 | 524 init_class_id(Class_Store); |
525 } | |
14429
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
526 StoreNode(Node *c, Node *mem, Node *adr, const TypePtr* at, Node *val, Node *oop_store, MemOrd mo) |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
527 : MemNode(c, mem, adr, at, val, oop_store), _mo(mo) { |
0 | 528 init_class_id(Class_Store); |
529 } | |
530 | |
14429
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
531 inline bool is_unordered() const { return !is_release(); } |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
532 inline bool is_release() const { |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
533 assert((_mo == unordered || _mo == release), "unexpected"); |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
534 return _mo == release; |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
535 } |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
536 |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
537 // Conservatively release stores of object references in order to |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
538 // ensure visibility of object initialization. |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
539 static inline MemOrd release_if_reference(const BasicType t) { |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
540 const MemOrd mo = (t == T_ARRAY || |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
541 t == T_ADDRESS || // Might be the address of an object reference (`boxing'). |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
542 t == T_OBJECT) ? release : unordered; |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
543 return mo; |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
544 } |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
545 |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
546 // Polymorphic factory method |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
547 // |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
548 // We must ensure that stores of object references will be visible |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
549 // only after the object's initialization. So the callers of this |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
550 // procedure must indicate that the store requires `release' |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
551 // semantics, if the stored value is an object reference that might |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
552 // point to a new object and may become externally visible. |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
553 static StoreNode* make(PhaseGVN& gvn, Node *c, Node *mem, Node *adr, |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
554 const TypePtr* at, Node *val, BasicType bt, MemOrd mo); |
0 | 555 |
556 virtual uint hash() const; // Check the type | |
557 | |
558 // If the store is to Field memory and the pointer is non-null, we can | |
559 // zero out the control input. | |
560 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
561 | |
562 // Compute a new Type for this node. Basically we just do the pre-check, | |
563 // then call the virtual add() to set the type. | |
564 virtual const Type *Value( PhaseTransform *phase ) const; | |
565 | |
566 // Check for identity function on memory (Load then Store at same address) | |
567 virtual Node *Identity( PhaseTransform *phase ); | |
568 | |
569 // Do not match memory edge | |
570 virtual uint match_edge(uint idx) const; | |
571 | |
572 virtual const Type *bottom_type() const; // returns Type::MEMORY | |
573 | |
574 // Map a store opcode to its corresponding own opcode, trivially. | |
575 virtual int store_Opcode() const { return Opcode(); } | |
576 | |
577 // have all possible loads of the value stored been optimized away? | |
578 bool value_never_loaded(PhaseTransform *phase) const; | |
579 }; | |
580 | |
581 //------------------------------StoreBNode------------------------------------- | |
582 // Store byte to memory | |
583 class StoreBNode : public StoreNode { | |
584 public: | |
14429
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
585 StoreBNode(Node *c, Node *mem, Node *adr, const TypePtr* at, Node *val, MemOrd mo) |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
586 : StoreNode(c, mem, adr, at, val, mo) {} |
0 | 587 virtual int Opcode() const; |
588 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
589 virtual BasicType memory_type() const { return T_BYTE; } | |
590 }; | |
591 | |
592 //------------------------------StoreCNode------------------------------------- | |
593 // Store char/short to memory | |
594 class StoreCNode : public StoreNode { | |
595 public: | |
14429
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
596 StoreCNode(Node *c, Node *mem, Node *adr, const TypePtr* at, Node *val, MemOrd mo) |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
597 : StoreNode(c, mem, adr, at, val, mo) {} |
0 | 598 virtual int Opcode() const; |
599 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
600 virtual BasicType memory_type() const { return T_CHAR; } | |
601 }; | |
602 | |
603 //------------------------------StoreINode------------------------------------- | |
604 // Store int to memory | |
605 class StoreINode : public StoreNode { | |
606 public: | |
14429
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
607 StoreINode(Node *c, Node *mem, Node *adr, const TypePtr* at, Node *val, MemOrd mo) |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
608 : StoreNode(c, mem, adr, at, val, mo) {} |
0 | 609 virtual int Opcode() const; |
610 virtual BasicType memory_type() const { return T_INT; } | |
611 }; | |
612 | |
613 //------------------------------StoreLNode------------------------------------- | |
614 // Store long to memory | |
615 class StoreLNode : public StoreNode { | |
616 virtual uint hash() const { return StoreNode::hash() + _require_atomic_access; } | |
617 virtual uint cmp( const Node &n ) const { | |
618 return _require_atomic_access == ((StoreLNode&)n)._require_atomic_access | |
619 && StoreNode::cmp(n); | |
620 } | |
621 virtual uint size_of() const { return sizeof(*this); } | |
622 const bool _require_atomic_access; // is piecewise store forbidden? | |
623 | |
624 public: | |
14429
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
625 StoreLNode(Node *c, Node *mem, Node *adr, const TypePtr* at, Node *val, MemOrd mo, bool require_atomic_access = false) |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
626 : StoreNode(c, mem, adr, at, val, mo), _require_atomic_access(require_atomic_access) {} |
0 | 627 virtual int Opcode() const; |
628 virtual BasicType memory_type() const { return T_LONG; } | |
23054
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
629 bool require_atomic_access() const { return _require_atomic_access; } |
14429
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
630 static StoreLNode* make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, Node* val, MemOrd mo); |
0 | 631 #ifndef PRODUCT |
632 virtual void dump_spec(outputStream *st) const { | |
633 StoreNode::dump_spec(st); | |
634 if (_require_atomic_access) st->print(" Atomic!"); | |
635 } | |
636 #endif | |
637 }; | |
638 | |
639 //------------------------------StoreFNode------------------------------------- | |
640 // Store float to memory | |
641 class StoreFNode : public StoreNode { | |
642 public: | |
14429
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
643 StoreFNode(Node *c, Node *mem, Node *adr, const TypePtr* at, Node *val, MemOrd mo) |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
644 : StoreNode(c, mem, adr, at, val, mo) {} |
0 | 645 virtual int Opcode() const; |
646 virtual BasicType memory_type() const { return T_FLOAT; } | |
647 }; | |
648 | |
649 //------------------------------StoreDNode------------------------------------- | |
650 // Store double to memory | |
651 class StoreDNode : public StoreNode { | |
23054
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
652 virtual uint hash() const { return StoreNode::hash() + _require_atomic_access; } |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
653 virtual uint cmp( const Node &n ) const { |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
654 return _require_atomic_access == ((StoreDNode&)n)._require_atomic_access |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
655 && StoreNode::cmp(n); |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
656 } |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
657 virtual uint size_of() const { return sizeof(*this); } |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
658 const bool _require_atomic_access; // is piecewise store forbidden? |
0 | 659 public: |
23054
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
660 StoreDNode(Node *c, Node *mem, Node *adr, const TypePtr* at, Node *val, |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
661 MemOrd mo, bool require_atomic_access = false) |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
662 : StoreNode(c, mem, adr, at, val, mo), _require_atomic_access(require_atomic_access) {} |
0 | 663 virtual int Opcode() const; |
664 virtual BasicType memory_type() const { return T_DOUBLE; } | |
23054
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
665 bool require_atomic_access() const { return _require_atomic_access; } |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
666 static StoreDNode* make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, Node* val, MemOrd mo); |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
667 #ifndef PRODUCT |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
668 virtual void dump_spec(outputStream *st) const { |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
669 StoreNode::dump_spec(st); |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
670 if (_require_atomic_access) st->print(" Atomic!"); |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
671 } |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
672 #endif |
55d07ec5bde4
8036851: volatile double accesses are not explicitly atomic in C2
anoll
parents:
20627
diff
changeset
|
673 |
0 | 674 }; |
675 | |
676 //------------------------------StorePNode------------------------------------- | |
677 // Store pointer to memory | |
678 class StorePNode : public StoreNode { | |
679 public: | |
14429
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
680 StorePNode(Node *c, Node *mem, Node *adr, const TypePtr* at, Node *val, MemOrd mo) |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
681 : StoreNode(c, mem, adr, at, val, mo) {} |
0 | 682 virtual int Opcode() const; |
683 virtual BasicType memory_type() const { return T_ADDRESS; } | |
684 }; | |
685 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
74
diff
changeset
|
686 //------------------------------StoreNNode------------------------------------- |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
74
diff
changeset
|
687 // Store narrow oop to memory |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
74
diff
changeset
|
688 class StoreNNode : public StoreNode { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
74
diff
changeset
|
689 public: |
14429
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
690 StoreNNode(Node *c, Node *mem, Node *adr, const TypePtr* at, Node *val, MemOrd mo) |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
691 : StoreNode(c, mem, adr, at, val, mo) {} |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
74
diff
changeset
|
692 virtual int Opcode() const; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
74
diff
changeset
|
693 virtual BasicType memory_type() const { return T_NARROWOOP; } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
74
diff
changeset
|
694 }; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
74
diff
changeset
|
695 |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6795
diff
changeset
|
696 //------------------------------StoreNKlassNode-------------------------------------- |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6795
diff
changeset
|
697 // Store narrow klass to memory |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6795
diff
changeset
|
698 class StoreNKlassNode : public StoreNNode { |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6795
diff
changeset
|
699 public: |
14429
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
700 StoreNKlassNode(Node *c, Node *mem, Node *adr, const TypePtr* at, Node *val, MemOrd mo) |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
701 : StoreNNode(c, mem, adr, at, val, mo) {} |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6795
diff
changeset
|
702 virtual int Opcode() const; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6795
diff
changeset
|
703 virtual BasicType memory_type() const { return T_NARROWKLASS; } |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6795
diff
changeset
|
704 }; |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6795
diff
changeset
|
705 |
0 | 706 //------------------------------StoreCMNode----------------------------------- |
707 // Store card-mark byte to memory for CM | |
708 // The last StoreCM before a SafePoint must be preserved and occur after its "oop" store | |
709 // Preceeding equivalent StoreCMs may be eliminated. | |
710 class StoreCMNode : public StoreNode { | |
985
685e959d09ea
6877254: Server vm crashes with no branches off of store slice" when run with CMS and UseSuperWord(default)
cfang
parents:
681
diff
changeset
|
711 private: |
1198
8d9bfe6a446b
6920346: G1: "must avoid base_memory and AliasIdxTop"
never
parents:
1100
diff
changeset
|
712 virtual uint hash() const { return StoreNode::hash() + _oop_alias_idx; } |
8d9bfe6a446b
6920346: G1: "must avoid base_memory and AliasIdxTop"
never
parents:
1100
diff
changeset
|
713 virtual uint cmp( const Node &n ) const { |
8d9bfe6a446b
6920346: G1: "must avoid base_memory and AliasIdxTop"
never
parents:
1100
diff
changeset
|
714 return _oop_alias_idx == ((StoreCMNode&)n)._oop_alias_idx |
8d9bfe6a446b
6920346: G1: "must avoid base_memory and AliasIdxTop"
never
parents:
1100
diff
changeset
|
715 && StoreNode::cmp(n); |
8d9bfe6a446b
6920346: G1: "must avoid base_memory and AliasIdxTop"
never
parents:
1100
diff
changeset
|
716 } |
8d9bfe6a446b
6920346: G1: "must avoid base_memory and AliasIdxTop"
never
parents:
1100
diff
changeset
|
717 virtual uint size_of() const { return sizeof(*this); } |
985
685e959d09ea
6877254: Server vm crashes with no branches off of store slice" when run with CMS and UseSuperWord(default)
cfang
parents:
681
diff
changeset
|
718 int _oop_alias_idx; // The alias_idx of OopStore |
1198
8d9bfe6a446b
6920346: G1: "must avoid base_memory and AliasIdxTop"
never
parents:
1100
diff
changeset
|
719 |
0 | 720 public: |
1198
8d9bfe6a446b
6920346: G1: "must avoid base_memory and AliasIdxTop"
never
parents:
1100
diff
changeset
|
721 StoreCMNode( Node *c, Node *mem, Node *adr, const TypePtr* at, Node *val, Node *oop_store, int oop_alias_idx ) : |
14429
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
722 StoreNode(c, mem, adr, at, val, oop_store, MemNode::release), |
1198
8d9bfe6a446b
6920346: G1: "must avoid base_memory and AliasIdxTop"
never
parents:
1100
diff
changeset
|
723 _oop_alias_idx(oop_alias_idx) { |
8d9bfe6a446b
6920346: G1: "must avoid base_memory and AliasIdxTop"
never
parents:
1100
diff
changeset
|
724 assert(_oop_alias_idx >= Compile::AliasIdxRaw || |
8d9bfe6a446b
6920346: G1: "must avoid base_memory and AliasIdxTop"
never
parents:
1100
diff
changeset
|
725 _oop_alias_idx == Compile::AliasIdxBot && Compile::current()->AliasLevel() == 0, |
8d9bfe6a446b
6920346: G1: "must avoid base_memory and AliasIdxTop"
never
parents:
1100
diff
changeset
|
726 "bad oop alias idx"); |
8d9bfe6a446b
6920346: G1: "must avoid base_memory and AliasIdxTop"
never
parents:
1100
diff
changeset
|
727 } |
0 | 728 virtual int Opcode() const; |
729 virtual Node *Identity( PhaseTransform *phase ); | |
985
685e959d09ea
6877254: Server vm crashes with no branches off of store slice" when run with CMS and UseSuperWord(default)
cfang
parents:
681
diff
changeset
|
730 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
0 | 731 virtual const Type *Value( PhaseTransform *phase ) const; |
732 virtual BasicType memory_type() const { return T_VOID; } // unspecific | |
985
685e959d09ea
6877254: Server vm crashes with no branches off of store slice" when run with CMS and UseSuperWord(default)
cfang
parents:
681
diff
changeset
|
733 int oop_alias_idx() const { return _oop_alias_idx; } |
0 | 734 }; |
735 | |
736 //------------------------------LoadPLockedNode--------------------------------- | |
737 // Load-locked a pointer from memory (either object or array). | |
738 // On Sparc & Intel this is implemented as a normal pointer load. | |
739 // On PowerPC and friends it's a real load-locked. | |
740 class LoadPLockedNode : public LoadPNode { | |
741 public: | |
14429
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
742 LoadPLockedNode(Node *c, Node *mem, Node *adr, MemOrd mo) |
2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
goetz
parents:
10278
diff
changeset
|
743 : LoadPNode(c, mem, adr, TypeRawPtr::BOTTOM, TypeRawPtr::BOTTOM, mo) {} |
0 | 744 virtual int Opcode() const; |
745 virtual int store_Opcode() const { return Op_StorePConditional; } | |
746 virtual bool depends_only_on_test() const { return true; } | |
747 }; | |
748 | |
749 //------------------------------SCMemProjNode--------------------------------------- | |
750 // This class defines a projection of the memory state of a store conditional node. | |
751 // These nodes return a value, but also update memory. | |
752 class SCMemProjNode : public ProjNode { | |
753 public: | |
754 enum {SCMEMPROJCON = (uint)-2}; | |
755 SCMemProjNode( Node *src) : ProjNode( src, SCMEMPROJCON) { } | |
756 virtual int Opcode() const; | |
757 virtual bool is_CFG() const { return false; } | |
758 virtual const Type *bottom_type() const {return Type::MEMORY;} | |
759 virtual const TypePtr *adr_type() const { return in(0)->in(MemNode::Memory)->adr_type();} | |
760 virtual uint ideal_reg() const { return 0;} // memory projections don't have a register | |
761 virtual const Type *Value( PhaseTransform *phase ) const; | |
762 #ifndef PRODUCT | |
763 virtual void dump_spec(outputStream *st) const {}; | |
764 #endif | |
765 }; | |
766 | |
767 //------------------------------LoadStoreNode--------------------------- | |
253
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
196
diff
changeset
|
768 // Note: is_Mem() method returns 'true' for this class. |
0 | 769 class LoadStoreNode : public Node { |
6795
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
770 private: |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
771 const Type* const _type; // What kind of value is loaded? |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
772 const TypePtr* _adr_type; // What kind of memory is being addressed? |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
773 virtual uint size_of() const; // Size is bigger |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
774 public: |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
775 LoadStoreNode( Node *c, Node *mem, Node *adr, Node *val, const TypePtr* at, const Type* rt, uint required ); |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
776 virtual bool depends_only_on_test() const { return false; } |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
777 virtual uint match_edge(uint idx) const { return idx == MemNode::Address || idx == MemNode::ValueIn; } |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
778 |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
779 virtual const Type *bottom_type() const { return _type; } |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
780 virtual uint ideal_reg() const; |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
781 virtual const class TypePtr *adr_type() const { return _adr_type; } // returns bottom_type of address |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
782 |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
783 bool result_not_used() const; |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
784 }; |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
785 |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
786 class LoadStoreConditionalNode : public LoadStoreNode { |
0 | 787 public: |
788 enum { | |
789 ExpectedIn = MemNode::ValueIn+1 // One more input than MemNode | |
790 }; | |
6795
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
791 LoadStoreConditionalNode(Node *c, Node *mem, Node *adr, Node *val, Node *ex); |
0 | 792 }; |
793 | |
794 //------------------------------StorePConditionalNode--------------------------- | |
795 // Conditionally store pointer to memory, if no change since prior | |
796 // load-locked. Sets flags for success or failure of the store. | |
6795
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
797 class StorePConditionalNode : public LoadStoreConditionalNode { |
0 | 798 public: |
6795
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
799 StorePConditionalNode( Node *c, Node *mem, Node *adr, Node *val, Node *ll ) : LoadStoreConditionalNode(c, mem, adr, val, ll) { } |
0 | 800 virtual int Opcode() const; |
801 // Produces flags | |
802 virtual uint ideal_reg() const { return Op_RegFlags; } | |
803 }; | |
804 | |
420
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
366
diff
changeset
|
805 //------------------------------StoreIConditionalNode--------------------------- |
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
366
diff
changeset
|
806 // Conditionally store int to memory, if no change since prior |
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
366
diff
changeset
|
807 // load-locked. Sets flags for success or failure of the store. |
6795
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
808 class StoreIConditionalNode : public LoadStoreConditionalNode { |
420
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
366
diff
changeset
|
809 public: |
6795
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
810 StoreIConditionalNode( Node *c, Node *mem, Node *adr, Node *val, Node *ii ) : LoadStoreConditionalNode(c, mem, adr, val, ii) { } |
420
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
366
diff
changeset
|
811 virtual int Opcode() const; |
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
366
diff
changeset
|
812 // Produces flags |
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
366
diff
changeset
|
813 virtual uint ideal_reg() const { return Op_RegFlags; } |
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
366
diff
changeset
|
814 }; |
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
366
diff
changeset
|
815 |
0 | 816 //------------------------------StoreLConditionalNode--------------------------- |
817 // Conditionally store long to memory, if no change since prior | |
818 // load-locked. Sets flags for success or failure of the store. | |
6795
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
819 class StoreLConditionalNode : public LoadStoreConditionalNode { |
0 | 820 public: |
6795
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
821 StoreLConditionalNode( Node *c, Node *mem, Node *adr, Node *val, Node *ll ) : LoadStoreConditionalNode(c, mem, adr, val, ll) { } |
0 | 822 virtual int Opcode() const; |
420
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
366
diff
changeset
|
823 // Produces flags |
a1980da045cc
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
366
diff
changeset
|
824 virtual uint ideal_reg() const { return Op_RegFlags; } |
0 | 825 }; |
826 | |
827 | |
828 //------------------------------CompareAndSwapLNode--------------------------- | |
6795
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
829 class CompareAndSwapLNode : public LoadStoreConditionalNode { |
0 | 830 public: |
6795
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
831 CompareAndSwapLNode( Node *c, Node *mem, Node *adr, Node *val, Node *ex) : LoadStoreConditionalNode(c, mem, adr, val, ex) { } |
0 | 832 virtual int Opcode() const; |
833 }; | |
834 | |
835 | |
836 //------------------------------CompareAndSwapINode--------------------------- | |
6795
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
837 class CompareAndSwapINode : public LoadStoreConditionalNode { |
0 | 838 public: |
6795
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
839 CompareAndSwapINode( Node *c, Node *mem, Node *adr, Node *val, Node *ex) : LoadStoreConditionalNode(c, mem, adr, val, ex) { } |
0 | 840 virtual int Opcode() const; |
841 }; | |
842 | |
843 | |
844 //------------------------------CompareAndSwapPNode--------------------------- | |
6795
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
845 class CompareAndSwapPNode : public LoadStoreConditionalNode { |
0 | 846 public: |
6795
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
847 CompareAndSwapPNode( Node *c, Node *mem, Node *adr, Node *val, Node *ex) : LoadStoreConditionalNode(c, mem, adr, val, ex) { } |
0 | 848 virtual int Opcode() const; |
849 }; | |
850 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
74
diff
changeset
|
851 //------------------------------CompareAndSwapNNode--------------------------- |
6795
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
852 class CompareAndSwapNNode : public LoadStoreConditionalNode { |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
853 public: |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
854 CompareAndSwapNNode( Node *c, Node *mem, Node *adr, Node *val, Node *ex) : LoadStoreConditionalNode(c, mem, adr, val, ex) { } |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
855 virtual int Opcode() const; |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
856 }; |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
857 |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
858 //------------------------------GetAndAddINode--------------------------- |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
859 class GetAndAddINode : public LoadStoreNode { |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
860 public: |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
861 GetAndAddINode( Node *c, Node *mem, Node *adr, Node *val, const TypePtr* at ) : LoadStoreNode(c, mem, adr, val, at, TypeInt::INT, 4) { } |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
862 virtual int Opcode() const; |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
863 }; |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
864 |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
865 //------------------------------GetAndAddLNode--------------------------- |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
866 class GetAndAddLNode : public LoadStoreNode { |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
74
diff
changeset
|
867 public: |
6795
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
868 GetAndAddLNode( Node *c, Node *mem, Node *adr, Node *val, const TypePtr* at ) : LoadStoreNode(c, mem, adr, val, at, TypeLong::LONG, 4) { } |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
869 virtual int Opcode() const; |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
870 }; |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
871 |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
872 |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
873 //------------------------------GetAndSetINode--------------------------- |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
874 class GetAndSetINode : public LoadStoreNode { |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
875 public: |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
876 GetAndSetINode( Node *c, Node *mem, Node *adr, Node *val, const TypePtr* at ) : LoadStoreNode(c, mem, adr, val, at, TypeInt::INT, 4) { } |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
877 virtual int Opcode() const; |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
878 }; |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
879 |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
880 //------------------------------GetAndSetINode--------------------------- |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
881 class GetAndSetLNode : public LoadStoreNode { |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
882 public: |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
883 GetAndSetLNode( Node *c, Node *mem, Node *adr, Node *val, const TypePtr* at ) : LoadStoreNode(c, mem, adr, val, at, TypeLong::LONG, 4) { } |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
884 virtual int Opcode() const; |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
885 }; |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
886 |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
887 //------------------------------GetAndSetPNode--------------------------- |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
888 class GetAndSetPNode : public LoadStoreNode { |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
889 public: |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
890 GetAndSetPNode( Node *c, Node *mem, Node *adr, Node *val, const TypePtr* at, const Type* t ) : LoadStoreNode(c, mem, adr, val, at, t, 4) { } |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
891 virtual int Opcode() const; |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
892 }; |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
893 |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
894 //------------------------------GetAndSetNNode--------------------------- |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
895 class GetAndSetNNode : public LoadStoreNode { |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
896 public: |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6143
diff
changeset
|
897 GetAndSetNNode( Node *c, Node *mem, Node *adr, Node *val, const TypePtr* at, const Type* t ) : LoadStoreNode(c, mem, adr, val, at, t, 4) { } |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
74
diff
changeset
|
898 virtual int Opcode() const; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
74
diff
changeset
|
899 }; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
74
diff
changeset
|
900 |
0 | 901 //------------------------------ClearArray------------------------------------- |
902 class ClearArrayNode: public Node { | |
903 public: | |
1100
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
986
diff
changeset
|
904 ClearArrayNode( Node *ctrl, Node *arymem, Node *word_cnt, Node *base ) |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
986
diff
changeset
|
905 : Node(ctrl,arymem,word_cnt,base) { |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
986
diff
changeset
|
906 init_class_id(Class_ClearArray); |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
986
diff
changeset
|
907 } |
0 | 908 virtual int Opcode() const; |
909 virtual const Type *bottom_type() const { return Type::MEMORY; } | |
910 // ClearArray modifies array elements, and so affects only the | |
911 // array memory addressed by the bottom_type of its base address. | |
912 virtual const class TypePtr *adr_type() const; | |
913 virtual Node *Identity( PhaseTransform *phase ); | |
914 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
915 virtual uint match_edge(uint idx) const; | |
916 | |
917 // Clear the given area of an object or array. | |
918 // The start offset must always be aligned mod BytesPerInt. | |
919 // The end offset must always be aligned mod BytesPerLong. | |
920 // Return the new memory. | |
921 static Node* clear_memory(Node* control, Node* mem, Node* dest, | |
922 intptr_t start_offset, | |
923 intptr_t end_offset, | |
924 PhaseGVN* phase); | |
925 static Node* clear_memory(Node* control, Node* mem, Node* dest, | |
926 intptr_t start_offset, | |
927 Node* end_offset, | |
928 PhaseGVN* phase); | |
929 static Node* clear_memory(Node* control, Node* mem, Node* dest, | |
930 Node* start_offset, | |
931 Node* end_offset, | |
932 PhaseGVN* phase); | |
1100
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
986
diff
changeset
|
933 // Return allocation input memory edge if it is different instance |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
986
diff
changeset
|
934 // or itself if it is the one we are looking for. |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
986
diff
changeset
|
935 static bool step_through(Node** np, uint instance_id, PhaseTransform* phase); |
0 | 936 }; |
937 | |
2412
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
938 //------------------------------StrIntrinsic------------------------------- |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
939 // Base class for Ideal nodes used in String instrinsic code. |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
940 class StrIntrinsicNode: public Node { |
0 | 941 public: |
2412
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
942 StrIntrinsicNode(Node* control, Node* char_array_mem, |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
943 Node* s1, Node* c1, Node* s2, Node* c2): |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
944 Node(control, char_array_mem, s1, c1, s2, c2) { |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
945 } |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
946 |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
947 StrIntrinsicNode(Node* control, Node* char_array_mem, |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
948 Node* s1, Node* s2, Node* c): |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
949 Node(control, char_array_mem, s1, s2, c) { |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
950 } |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
951 |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
952 StrIntrinsicNode(Node* control, Node* char_array_mem, |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
953 Node* s1, Node* s2): |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
954 Node(control, char_array_mem, s1, s2) { |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
955 } |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
956 |
0 | 957 virtual bool depends_only_on_test() const { return false; } |
986
62001a362ce9
6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
985
diff
changeset
|
958 virtual const TypePtr* adr_type() const { return TypeAryPtr::CHARS; } |
0 | 959 virtual uint match_edge(uint idx) const; |
960 virtual uint ideal_reg() const { return Op_RegI; } | |
961 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
4115 | 962 virtual const Type *Value(PhaseTransform *phase) const; |
0 | 963 }; |
964 | |
2412
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
965 //------------------------------StrComp------------------------------------- |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
966 class StrCompNode: public StrIntrinsicNode { |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
967 public: |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
968 StrCompNode(Node* control, Node* char_array_mem, |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
969 Node* s1, Node* c1, Node* s2, Node* c2): |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
970 StrIntrinsicNode(control, char_array_mem, s1, c1, s2, c2) {}; |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
971 virtual int Opcode() const; |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
972 virtual const Type* bottom_type() const { return TypeInt::INT; } |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
973 }; |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
974 |
681 | 975 //------------------------------StrEquals------------------------------------- |
2412
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
976 class StrEqualsNode: public StrIntrinsicNode { |
681 | 977 public: |
986
62001a362ce9
6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
985
diff
changeset
|
978 StrEqualsNode(Node* control, Node* char_array_mem, |
2412
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
979 Node* s1, Node* s2, Node* c): |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
980 StrIntrinsicNode(control, char_array_mem, s1, s2, c) {}; |
681 | 981 virtual int Opcode() const; |
982 virtual const Type* bottom_type() const { return TypeInt::BOOL; } | |
983 }; | |
984 | |
985 //------------------------------StrIndexOf------------------------------------- | |
2412
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
986 class StrIndexOfNode: public StrIntrinsicNode { |
681 | 987 public: |
986
62001a362ce9
6827605: new String intrinsics may prevent EA scalar replacement
kvn
parents:
985
diff
changeset
|
988 StrIndexOfNode(Node* control, Node* char_array_mem, |
2412
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
989 Node* s1, Node* c1, Node* s2, Node* c2): |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
990 StrIntrinsicNode(control, char_array_mem, s1, c1, s2, c2) {}; |
681 | 991 virtual int Opcode() const; |
992 virtual const Type* bottom_type() const { return TypeInt::INT; } | |
993 }; | |
994 | |
169
9148c65abefc
6695049: (coll) Create an x86 intrinsic for Arrays.equals
rasbold
parents:
164
diff
changeset
|
995 //------------------------------AryEq--------------------------------------- |
2412
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
996 class AryEqNode: public StrIntrinsicNode { |
169
9148c65abefc
6695049: (coll) Create an x86 intrinsic for Arrays.equals
rasbold
parents:
164
diff
changeset
|
997 public: |
2412
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
998 AryEqNode(Node* control, Node* char_array_mem, Node* s1, Node* s2): |
f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
kvn
parents:
1972
diff
changeset
|
999 StrIntrinsicNode(control, char_array_mem, s1, s2) {}; |
169
9148c65abefc
6695049: (coll) Create an x86 intrinsic for Arrays.equals
rasbold
parents:
164
diff
changeset
|
1000 virtual int Opcode() const; |
9148c65abefc
6695049: (coll) Create an x86 intrinsic for Arrays.equals
rasbold
parents:
164
diff
changeset
|
1001 virtual const Type* bottom_type() const { return TypeInt::BOOL; } |
9148c65abefc
6695049: (coll) Create an x86 intrinsic for Arrays.equals
rasbold
parents:
164
diff
changeset
|
1002 }; |
9148c65abefc
6695049: (coll) Create an x86 intrinsic for Arrays.equals
rasbold
parents:
164
diff
changeset
|
1003 |
7637
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
6853
diff
changeset
|
1004 |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
6853
diff
changeset
|
1005 //------------------------------EncodeISOArray-------------------------------- |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
6853
diff
changeset
|
1006 // encode char[] to byte[] in ISO_8859_1 |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
6853
diff
changeset
|
1007 class EncodeISOArrayNode: public Node { |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
6853
diff
changeset
|
1008 public: |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
6853
diff
changeset
|
1009 EncodeISOArrayNode(Node *control, Node* arymem, Node* s1, Node* s2, Node* c): Node(control, arymem, s1, s2, c) {}; |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
6853
diff
changeset
|
1010 virtual int Opcode() const; |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
6853
diff
changeset
|
1011 virtual bool depends_only_on_test() const { return false; } |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
6853
diff
changeset
|
1012 virtual const Type* bottom_type() const { return TypeInt::INT; } |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
6853
diff
changeset
|
1013 virtual const TypePtr* adr_type() const { return TypePtr::BOTTOM; } |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
6853
diff
changeset
|
1014 virtual uint match_edge(uint idx) const; |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
6853
diff
changeset
|
1015 virtual uint ideal_reg() const { return Op_RegI; } |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
6853
diff
changeset
|
1016 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
6853
diff
changeset
|
1017 virtual const Type *Value(PhaseTransform *phase) const; |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
6853
diff
changeset
|
1018 }; |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
6853
diff
changeset
|
1019 |
0 | 1020 //------------------------------MemBar----------------------------------------- |
1021 // There are different flavors of Memory Barriers to match the Java Memory | |
1022 // Model. Monitor-enter and volatile-load act as Aquires: no following ref | |
1023 // can be moved to before them. We insert a MemBar-Acquire after a FastLock or | |
1024 // volatile-load. Monitor-exit and volatile-store act as Release: no | |
605 | 1025 // preceding ref can be moved to after them. We insert a MemBar-Release |
0 | 1026 // before a FastUnlock or volatile-store. All volatiles need to be |
1027 // serialized, so we follow all volatile-stores with a MemBar-Volatile to | |
605 | 1028 // separate it from any following volatile-load. |
0 | 1029 class MemBarNode: public MultiNode { |
1030 virtual uint hash() const ; // { return NO_HASH; } | |
1031 virtual uint cmp( const Node &n ) const ; // Always fail, except on self | |
1032 | |
1033 virtual uint size_of() const { return sizeof(*this); } | |
1034 // Memory type this node is serializing. Usually either rawptr or bottom. | |
1035 const TypePtr* _adr_type; | |
1036 | |
1037 public: | |
1038 enum { | |
1039 Precedent = TypeFunc::Parms // optional edge to force precedence | |
1040 }; | |
1041 MemBarNode(Compile* C, int alias_idx, Node* precedent); | |
1042 virtual int Opcode() const = 0; | |
1043 virtual const class TypePtr *adr_type() const { return _adr_type; } | |
1044 virtual const Type *Value( PhaseTransform *phase ) const; | |
1045 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
1046 virtual uint match_edge(uint idx) const { return 0; } | |
1047 virtual const Type *bottom_type() const { return TypeTuple::MEMBAR; } | |
1048 virtual Node *match( const ProjNode *proj, const Matcher *m ); | |
1049 // Factory method. Builds a wide or narrow membar. | |
1050 // Optional 'precedent' becomes an extra edge if not null. | |
1051 static MemBarNode* make(Compile* C, int opcode, | |
1052 int alias_idx = Compile::AliasIdxBot, | |
1053 Node* precedent = NULL); | |
1054 }; | |
1055 | |
1056 // "Acquire" - no following ref can move before (but earlier refs can | |
1057 // follow, like an early Load stalled in cache). Requires multi-cpu | |
3849
f1c12354c3f7
7074017: Introduce MemBarAcquireLock/MemBarReleaseLock nodes for monitor enter/exit code paths
roland
parents:
2426
diff
changeset
|
1058 // visibility. Inserted after a volatile load. |
0 | 1059 class MemBarAcquireNode: public MemBarNode { |
1060 public: | |
1061 MemBarAcquireNode(Compile* C, int alias_idx, Node* precedent) | |
1062 : MemBarNode(C, alias_idx, precedent) {} | |
1063 virtual int Opcode() const; | |
1064 }; | |
1065 | |
14439
50fdb38839eb
8028515: PPPC64 (part 113.2): opto: Introduce LoadFence/StoreFence.
goetz
parents:
14435
diff
changeset
|
1066 // "Acquire" - no following ref can move before (but earlier refs can |
50fdb38839eb
8028515: PPPC64 (part 113.2): opto: Introduce LoadFence/StoreFence.
goetz
parents:
14435
diff
changeset
|
1067 // follow, like an early Load stalled in cache). Requires multi-cpu |
50fdb38839eb
8028515: PPPC64 (part 113.2): opto: Introduce LoadFence/StoreFence.
goetz
parents:
14435
diff
changeset
|
1068 // visibility. Inserted independ of any load, as required |
50fdb38839eb
8028515: PPPC64 (part 113.2): opto: Introduce LoadFence/StoreFence.
goetz
parents:
14435
diff
changeset
|
1069 // for intrinsic sun.misc.Unsafe.loadFence(). |
50fdb38839eb
8028515: PPPC64 (part 113.2): opto: Introduce LoadFence/StoreFence.
goetz
parents:
14435
diff
changeset
|
1070 class LoadFenceNode: public MemBarNode { |
50fdb38839eb
8028515: PPPC64 (part 113.2): opto: Introduce LoadFence/StoreFence.
goetz
parents:
14435
diff
changeset
|
1071 public: |
50fdb38839eb
8028515: PPPC64 (part 113.2): opto: Introduce LoadFence/StoreFence.
goetz
parents:
14435
diff
changeset
|
1072 LoadFenceNode(Compile* C, int alias_idx, Node* precedent) |
50fdb38839eb
8028515: PPPC64 (part 113.2): opto: Introduce LoadFence/StoreFence.
goetz
parents:
14435
diff
changeset
|
1073 : MemBarNode(C, alias_idx, precedent) {} |
50fdb38839eb
8028515: PPPC64 (part 113.2): opto: Introduce LoadFence/StoreFence.
goetz
parents:
14435
diff
changeset
|
1074 virtual int Opcode() const; |
50fdb38839eb
8028515: PPPC64 (part 113.2): opto: Introduce LoadFence/StoreFence.
goetz
parents:
14435
diff
changeset
|
1075 }; |
50fdb38839eb
8028515: PPPC64 (part 113.2): opto: Introduce LoadFence/StoreFence.
goetz
parents:
14435
diff
changeset
|
1076 |
0 | 1077 // "Release" - no earlier ref can move after (but later refs can move |
1078 // up, like a speculative pipelined cache-hitting Load). Requires | |
3849
f1c12354c3f7
7074017: Introduce MemBarAcquireLock/MemBarReleaseLock nodes for monitor enter/exit code paths
roland
parents:
2426
diff
changeset
|
1079 // multi-cpu visibility. Inserted before a volatile store. |
0 | 1080 class MemBarReleaseNode: public MemBarNode { |
1081 public: | |
1082 MemBarReleaseNode(Compile* C, int alias_idx, Node* precedent) | |
1083 : MemBarNode(C, alias_idx, precedent) {} | |
1084 virtual int Opcode() const; | |
1085 }; | |
1086 | |
14439
50fdb38839eb
8028515: PPPC64 (part 113.2): opto: Introduce LoadFence/StoreFence.
goetz
parents:
14435
diff
changeset
|
1087 // "Release" - no earlier ref can move after (but later refs can move |
50fdb38839eb
8028515: PPPC64 (part 113.2): opto: Introduce LoadFence/StoreFence.
goetz
parents:
14435
diff
changeset
|
1088 // up, like a speculative pipelined cache-hitting Load). Requires |
50fdb38839eb
8028515: PPPC64 (part 113.2): opto: Introduce LoadFence/StoreFence.
goetz
parents:
14435
diff
changeset
|
1089 // multi-cpu visibility. Inserted independent of any store, as required |
50fdb38839eb
8028515: PPPC64 (part 113.2): opto: Introduce LoadFence/StoreFence.
goetz
parents:
14435
diff
changeset
|
1090 // for intrinsic sun.misc.Unsafe.storeFence(). |
50fdb38839eb
8028515: PPPC64 (part 113.2): opto: Introduce LoadFence/StoreFence.
goetz
parents:
14435
diff
changeset
|
1091 class StoreFenceNode: public MemBarNode { |
50fdb38839eb
8028515: PPPC64 (part 113.2): opto: Introduce LoadFence/StoreFence.
goetz
parents:
14435
diff
changeset
|
1092 public: |
50fdb38839eb
8028515: PPPC64 (part 113.2): opto: Introduce LoadFence/StoreFence.
goetz
parents:
14435
diff
changeset
|
1093 StoreFenceNode(Compile* C, int alias_idx, Node* precedent) |
50fdb38839eb
8028515: PPPC64 (part 113.2): opto: Introduce LoadFence/StoreFence.
goetz
parents:
14435
diff
changeset
|
1094 : MemBarNode(C, alias_idx, precedent) {} |
50fdb38839eb
8028515: PPPC64 (part 113.2): opto: Introduce LoadFence/StoreFence.
goetz
parents:
14435
diff
changeset
|
1095 virtual int Opcode() const; |
50fdb38839eb
8028515: PPPC64 (part 113.2): opto: Introduce LoadFence/StoreFence.
goetz
parents:
14435
diff
changeset
|
1096 }; |
50fdb38839eb
8028515: PPPC64 (part 113.2): opto: Introduce LoadFence/StoreFence.
goetz
parents:
14435
diff
changeset
|
1097 |
3849
f1c12354c3f7
7074017: Introduce MemBarAcquireLock/MemBarReleaseLock nodes for monitor enter/exit code paths
roland
parents:
2426
diff
changeset
|
1098 // "Acquire" - no following ref can move before (but earlier refs can |
f1c12354c3f7
7074017: Introduce MemBarAcquireLock/MemBarReleaseLock nodes for monitor enter/exit code paths
roland
parents:
2426
diff
changeset
|
1099 // follow, like an early Load stalled in cache). Requires multi-cpu |
f1c12354c3f7
7074017: Introduce MemBarAcquireLock/MemBarReleaseLock nodes for monitor enter/exit code paths
roland
parents:
2426
diff
changeset
|
1100 // visibility. Inserted after a FastLock. |
f1c12354c3f7
7074017: Introduce MemBarAcquireLock/MemBarReleaseLock nodes for monitor enter/exit code paths
roland
parents:
2426
diff
changeset
|
1101 class MemBarAcquireLockNode: public MemBarNode { |
f1c12354c3f7
7074017: Introduce MemBarAcquireLock/MemBarReleaseLock nodes for monitor enter/exit code paths
roland
parents:
2426
diff
changeset
|
1102 public: |
f1c12354c3f7
7074017: Introduce MemBarAcquireLock/MemBarReleaseLock nodes for monitor enter/exit code paths
roland
parents:
2426
diff
changeset
|
1103 MemBarAcquireLockNode(Compile* C, int alias_idx, Node* precedent) |
f1c12354c3f7
7074017: Introduce MemBarAcquireLock/MemBarReleaseLock nodes for monitor enter/exit code paths
roland
parents:
2426
diff
changeset
|
1104 : MemBarNode(C, alias_idx, precedent) {} |
f1c12354c3f7
7074017: Introduce MemBarAcquireLock/MemBarReleaseLock nodes for monitor enter/exit code paths
roland
parents:
2426
diff
changeset
|
1105 virtual int Opcode() const; |
f1c12354c3f7
7074017: Introduce MemBarAcquireLock/MemBarReleaseLock nodes for monitor enter/exit code paths
roland
parents:
2426
diff
changeset
|
1106 }; |
f1c12354c3f7
7074017: Introduce MemBarAcquireLock/MemBarReleaseLock nodes for monitor enter/exit code paths
roland
parents:
2426
diff
changeset
|
1107 |
f1c12354c3f7
7074017: Introduce MemBarAcquireLock/MemBarReleaseLock nodes for monitor enter/exit code paths
roland
parents:
2426
diff
changeset
|
1108 // "Release" - no earlier ref can move after (but later refs can move |
f1c12354c3f7
7074017: Introduce MemBarAcquireLock/MemBarReleaseLock nodes for monitor enter/exit code paths
roland
parents:
2426
diff
changeset
|
1109 // up, like a speculative pipelined cache-hitting Load). Requires |
f1c12354c3f7
7074017: Introduce MemBarAcquireLock/MemBarReleaseLock nodes for monitor enter/exit code paths
roland
parents:
2426
diff
changeset
|
1110 // multi-cpu visibility. Inserted before a FastUnLock. |
f1c12354c3f7
7074017: Introduce MemBarAcquireLock/MemBarReleaseLock nodes for monitor enter/exit code paths
roland
parents:
2426
diff
changeset
|
1111 class MemBarReleaseLockNode: public MemBarNode { |
f1c12354c3f7
7074017: Introduce MemBarAcquireLock/MemBarReleaseLock nodes for monitor enter/exit code paths
roland
parents:
2426
diff
changeset
|
1112 public: |
f1c12354c3f7
7074017: Introduce MemBarAcquireLock/MemBarReleaseLock nodes for monitor enter/exit code paths
roland
parents:
2426
diff
changeset
|
1113 MemBarReleaseLockNode(Compile* C, int alias_idx, Node* precedent) |
f1c12354c3f7
7074017: Introduce MemBarAcquireLock/MemBarReleaseLock nodes for monitor enter/exit code paths
roland
parents:
2426
diff
changeset
|
1114 : MemBarNode(C, alias_idx, precedent) {} |
f1c12354c3f7
7074017: Introduce MemBarAcquireLock/MemBarReleaseLock nodes for monitor enter/exit code paths
roland
parents:
2426
diff
changeset
|
1115 virtual int Opcode() const; |
f1c12354c3f7
7074017: Introduce MemBarAcquireLock/MemBarReleaseLock nodes for monitor enter/exit code paths
roland
parents:
2426
diff
changeset
|
1116 }; |
f1c12354c3f7
7074017: Introduce MemBarAcquireLock/MemBarReleaseLock nodes for monitor enter/exit code paths
roland
parents:
2426
diff
changeset
|
1117 |
4763
1dc233a8c7fe
7121140: Allocation paths require explicit memory synchronization operations for RMO systems
roland
parents:
4115
diff
changeset
|
1118 class MemBarStoreStoreNode: public MemBarNode { |
1dc233a8c7fe
7121140: Allocation paths require explicit memory synchronization operations for RMO systems
roland
parents:
4115
diff
changeset
|
1119 public: |
1dc233a8c7fe
7121140: Allocation paths require explicit memory synchronization operations for RMO systems
roland
parents:
4115
diff
changeset
|
1120 MemBarStoreStoreNode(Compile* C, int alias_idx, Node* precedent) |
1dc233a8c7fe
7121140: Allocation paths require explicit memory synchronization operations for RMO systems
roland
parents:
4115
diff
changeset
|
1121 : MemBarNode(C, alias_idx, precedent) { |
1dc233a8c7fe
7121140: Allocation paths require explicit memory synchronization operations for RMO systems
roland
parents:
4115
diff
changeset
|
1122 init_class_id(Class_MemBarStoreStore); |
1dc233a8c7fe
7121140: Allocation paths require explicit memory synchronization operations for RMO systems
roland
parents:
4115
diff
changeset
|
1123 } |
1dc233a8c7fe
7121140: Allocation paths require explicit memory synchronization operations for RMO systems
roland
parents:
4115
diff
changeset
|
1124 virtual int Opcode() const; |
1dc233a8c7fe
7121140: Allocation paths require explicit memory synchronization operations for RMO systems
roland
parents:
4115
diff
changeset
|
1125 }; |
1dc233a8c7fe
7121140: Allocation paths require explicit memory synchronization operations for RMO systems
roland
parents:
4115
diff
changeset
|
1126 |
0 | 1127 // Ordering between a volatile store and a following volatile load. |
1128 // Requires multi-CPU visibility? | |
1129 class MemBarVolatileNode: public MemBarNode { | |
1130 public: | |
1131 MemBarVolatileNode(Compile* C, int alias_idx, Node* precedent) | |
1132 : MemBarNode(C, alias_idx, precedent) {} | |
1133 virtual int Opcode() const; | |
1134 }; | |
1135 | |
1136 // Ordering within the same CPU. Used to order unsafe memory references | |
1137 // inside the compiler when we lack alias info. Not needed "outside" the | |
1138 // compiler because the CPU does all the ordering for us. | |
1139 class MemBarCPUOrderNode: public MemBarNode { | |
1140 public: | |
1141 MemBarCPUOrderNode(Compile* C, int alias_idx, Node* precedent) | |
1142 : MemBarNode(C, alias_idx, precedent) {} | |
1143 virtual int Opcode() const; | |
1144 virtual uint ideal_reg() const { return 0; } // not matched in the AD file | |
1145 }; | |
1146 | |
1147 // Isolation of object setup after an AllocateNode and before next safepoint. | |
1148 // (See comment in memnode.cpp near InitializeNode::InitializeNode for semantics.) | |
1149 class InitializeNode: public MemBarNode { | |
1150 friend class AllocateNode; | |
1151 | |
3961
a92cdbac8b9e
7081933: Use zeroing elimination optimization for large array
kvn
parents:
3854
diff
changeset
|
1152 enum { |
a92cdbac8b9e
7081933: Use zeroing elimination optimization for large array
kvn
parents:
3854
diff
changeset
|
1153 Incomplete = 0, |
a92cdbac8b9e
7081933: Use zeroing elimination optimization for large array
kvn
parents:
3854
diff
changeset
|
1154 Complete = 1, |
a92cdbac8b9e
7081933: Use zeroing elimination optimization for large array
kvn
parents:
3854
diff
changeset
|
1155 WithArraycopy = 2 |
a92cdbac8b9e
7081933: Use zeroing elimination optimization for large array
kvn
parents:
3854
diff
changeset
|
1156 }; |
a92cdbac8b9e
7081933: Use zeroing elimination optimization for large array
kvn
parents:
3854
diff
changeset
|
1157 int _is_complete; |
0 | 1158 |
4763
1dc233a8c7fe
7121140: Allocation paths require explicit memory synchronization operations for RMO systems
roland
parents:
4115
diff
changeset
|
1159 bool _does_not_escape; |
1dc233a8c7fe
7121140: Allocation paths require explicit memory synchronization operations for RMO systems
roland
parents:
4115
diff
changeset
|
1160 |
0 | 1161 public: |
1162 enum { | |
1163 Control = TypeFunc::Control, | |
1164 Memory = TypeFunc::Memory, // MergeMem for states affected by this op | |
1165 RawAddress = TypeFunc::Parms+0, // the newly-allocated raw address | |
1166 RawStores = TypeFunc::Parms+1 // zero or more stores (or TOP) | |
1167 }; | |
1168 | |
1169 InitializeNode(Compile* C, int adr_type, Node* rawoop); | |
1170 virtual int Opcode() const; | |
1171 virtual uint size_of() const { return sizeof(*this); } | |
1172 virtual uint ideal_reg() const { return 0; } // not matched in the AD file | |
1173 virtual const RegMask &in_RegMask(uint) const; // mask for RawAddress | |
1174 | |
1175 // Manage incoming memory edges via a MergeMem on in(Memory): | |
1176 Node* memory(uint alias_idx); | |
1177 | |
1178 // The raw memory edge coming directly from the Allocation. | |
1179 // The contents of this memory are *always* all-zero-bits. | |
1180 Node* zero_memory() { return memory(Compile::AliasIdxRaw); } | |
1181 | |
1182 // Return the corresponding allocation for this initialization (or null if none). | |
1183 // (Note: Both InitializeNode::allocation and AllocateNode::initialization | |
1184 // are defined in graphKit.cpp, which sets up the bidirectional relation.) | |
1185 AllocateNode* allocation(); | |
1186 | |
1187 // Anything other than zeroing in this init? | |
1188 bool is_non_zero(); | |
1189 | |
1190 // An InitializeNode must completed before macro expansion is done. | |
1191 // Completion requires that the AllocateNode must be followed by | |
1192 // initialization of the new memory to zero, then to any initializers. | |
3961
a92cdbac8b9e
7081933: Use zeroing elimination optimization for large array
kvn
parents:
3854
diff
changeset
|
1193 bool is_complete() { return _is_complete != Incomplete; } |
a92cdbac8b9e
7081933: Use zeroing elimination optimization for large array
kvn
parents:
3854
diff
changeset
|
1194 bool is_complete_with_arraycopy() { return (_is_complete & WithArraycopy) != 0; } |
0 | 1195 |
1196 // Mark complete. (Must not yet be complete.) | |
1197 void set_complete(PhaseGVN* phase); | |
3961
a92cdbac8b9e
7081933: Use zeroing elimination optimization for large array
kvn
parents:
3854
diff
changeset
|
1198 void set_complete_with_arraycopy() { _is_complete = Complete | WithArraycopy; } |
0 | 1199 |
4763
1dc233a8c7fe
7121140: Allocation paths require explicit memory synchronization operations for RMO systems
roland
parents:
4115
diff
changeset
|
1200 bool does_not_escape() { return _does_not_escape; } |
1dc233a8c7fe
7121140: Allocation paths require explicit memory synchronization operations for RMO systems
roland
parents:
4115
diff
changeset
|
1201 void set_does_not_escape() { _does_not_escape = true; } |
1dc233a8c7fe
7121140: Allocation paths require explicit memory synchronization operations for RMO systems
roland
parents:
4115
diff
changeset
|
1202 |
0 | 1203 #ifdef ASSERT |
1204 // ensure all non-degenerate stores are ordered and non-overlapping | |
1205 bool stores_are_sane(PhaseTransform* phase); | |
1206 #endif //ASSERT | |
1207 | |
1208 // See if this store can be captured; return offset where it initializes. | |
1209 // Return 0 if the store cannot be moved (any sort of problem). | |
8116
6931f425c517
8007294: ReduceFieldZeroing doesn't check for dependent load and can lead to incorrect execution
roland
parents:
7637
diff
changeset
|
1210 intptr_t can_capture_store(StoreNode* st, PhaseTransform* phase, bool can_reshape); |
0 | 1211 |
1212 // Capture another store; reformat it to write my internal raw memory. | |
1213 // Return the captured copy, else NULL if there is some sort of problem. | |
8116
6931f425c517
8007294: ReduceFieldZeroing doesn't check for dependent load and can lead to incorrect execution
roland
parents:
7637
diff
changeset
|
1214 Node* capture_store(StoreNode* st, intptr_t start, PhaseTransform* phase, bool can_reshape); |
0 | 1215 |
1216 // Find captured store which corresponds to the range [start..start+size). | |
1217 // Return my own memory projection (meaning the initial zero bits) | |
1218 // if there is no such store. Return NULL if there is a problem. | |
1219 Node* find_captured_store(intptr_t start, int size_in_bytes, PhaseTransform* phase); | |
1220 | |
1221 // Called when the associated AllocateNode is expanded into CFG. | |
1222 Node* complete_stores(Node* rawctl, Node* rawmem, Node* rawptr, | |
1223 intptr_t header_size, Node* size_in_bytes, | |
1224 PhaseGVN* phase); | |
1225 | |
1226 private: | |
1227 void remove_extra_zeroes(); | |
1228 | |
1229 // Find out where a captured store should be placed (or already is placed). | |
1230 int captured_store_insertion_point(intptr_t start, int size_in_bytes, | |
1231 PhaseTransform* phase); | |
1232 | |
1233 static intptr_t get_store_offset(Node* st, PhaseTransform* phase); | |
1234 | |
1235 Node* make_raw_address(intptr_t offset, PhaseTransform* phase); | |
1236 | |
10278 | 1237 bool detect_init_independence(Node* n, int& count); |
0 | 1238 |
1239 void coalesce_subword_stores(intptr_t header_size, Node* size_in_bytes, | |
1240 PhaseGVN* phase); | |
1241 | |
1242 intptr_t find_next_fullword_store(uint i, PhaseGVN* phase); | |
1243 }; | |
1244 | |
1245 //------------------------------MergeMem--------------------------------------- | |
1246 // (See comment in memnode.cpp near MergeMemNode::MergeMemNode for semantics.) | |
1247 class MergeMemNode: public Node { | |
1248 virtual uint hash() const ; // { return NO_HASH; } | |
1249 virtual uint cmp( const Node &n ) const ; // Always fail, except on self | |
1250 friend class MergeMemStream; | |
1251 MergeMemNode(Node* def); // clients use MergeMemNode::make | |
1252 | |
1253 public: | |
1254 // If the input is a whole memory state, clone it with all its slices intact. | |
1255 // Otherwise, make a new memory state with just that base memory input. | |
1256 // In either case, the result is a newly created MergeMem. | |
1257 static MergeMemNode* make(Compile* C, Node* base_memory); | |
1258 | |
1259 virtual int Opcode() const; | |
1260 virtual Node *Identity( PhaseTransform *phase ); | |
1261 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
1262 virtual uint ideal_reg() const { return NotAMachineReg; } | |
1263 virtual uint match_edge(uint idx) const { return 0; } | |
1264 virtual const RegMask &out_RegMask() const; | |
1265 virtual const Type *bottom_type() const { return Type::MEMORY; } | |
1266 virtual const TypePtr *adr_type() const { return TypePtr::BOTTOM; } | |
1267 // sparse accessors | |
1268 // Fetch the previously stored "set_memory_at", or else the base memory. | |
1269 // (Caller should clone it if it is a phi-nest.) | |
1270 Node* memory_at(uint alias_idx) const; | |
1271 // set the memory, regardless of its previous value | |
1272 void set_memory_at(uint alias_idx, Node* n); | |
1273 // the "base" is the memory that provides the non-finite support | |
1274 Node* base_memory() const { return in(Compile::AliasIdxBot); } | |
1275 // warning: setting the base can implicitly set any of the other slices too | |
1276 void set_base_memory(Node* def); | |
1277 // sentinel value which denotes a copy of the base memory: | |
1278 Node* empty_memory() const { return in(Compile::AliasIdxTop); } | |
1279 static Node* make_empty_memory(); // where the sentinel comes from | |
1280 bool is_empty_memory(Node* n) const { assert((n == empty_memory()) == n->is_top(), "sanity"); return n->is_top(); } | |
1281 // hook for the iterator, to perform any necessary setup | |
1282 void iteration_setup(const MergeMemNode* other = NULL); | |
1283 // push sentinels until I am at least as long as the other (semantic no-op) | |
1284 void grow_to_match(const MergeMemNode* other); | |
1285 bool verify_sparse() const PRODUCT_RETURN0; | |
1286 #ifndef PRODUCT | |
1287 virtual void dump_spec(outputStream *st) const; | |
1288 #endif | |
1289 }; | |
1290 | |
1291 class MergeMemStream : public StackObj { | |
1292 private: | |
1293 MergeMemNode* _mm; | |
1294 const MergeMemNode* _mm2; // optional second guy, contributes non-empty iterations | |
1295 Node* _mm_base; // loop-invariant base memory of _mm | |
1296 int _idx; | |
1297 int _cnt; | |
1298 Node* _mem; | |
1299 Node* _mem2; | |
1300 int _cnt2; | |
1301 | |
1302 void init(MergeMemNode* mm, const MergeMemNode* mm2 = NULL) { | |
1303 // subsume_node will break sparseness at times, whenever a memory slice | |
1304 // folds down to a copy of the base ("fat") memory. In such a case, | |
1305 // the raw edge will update to base, although it should be top. | |
1306 // This iterator will recognize either top or base_memory as an | |
1307 // "empty" slice. See is_empty, is_empty2, and next below. | |
1308 // | |
1309 // The sparseness property is repaired in MergeMemNode::Ideal. | |
1310 // As long as access to a MergeMem goes through this iterator | |
1311 // or the memory_at accessor, flaws in the sparseness will | |
1312 // never be observed. | |
1313 // | |
1314 // Also, iteration_setup repairs sparseness. | |
1315 assert(mm->verify_sparse(), "please, no dups of base"); | |
1316 assert(mm2==NULL || mm2->verify_sparse(), "please, no dups of base"); | |
1317 | |
1318 _mm = mm; | |
1319 _mm_base = mm->base_memory(); | |
1320 _mm2 = mm2; | |
1321 _cnt = mm->req(); | |
1322 _idx = Compile::AliasIdxBot-1; // start at the base memory | |
1323 _mem = NULL; | |
1324 _mem2 = NULL; | |
1325 } | |
1326 | |
1327 #ifdef ASSERT | |
1328 Node* check_memory() const { | |
1329 if (at_base_memory()) | |
1330 return _mm->base_memory(); | |
1331 else if ((uint)_idx < _mm->req() && !_mm->in(_idx)->is_top()) | |
1332 return _mm->memory_at(_idx); | |
1333 else | |
1334 return _mm_base; | |
1335 } | |
1336 Node* check_memory2() const { | |
1337 return at_base_memory()? _mm2->base_memory(): _mm2->memory_at(_idx); | |
1338 } | |
1339 #endif | |
1340 | |
1341 static bool match_memory(Node* mem, const MergeMemNode* mm, int idx) PRODUCT_RETURN0; | |
1342 void assert_synch() const { | |
1343 assert(!_mem || _idx >= _cnt || match_memory(_mem, _mm, _idx), | |
1344 "no side-effects except through the stream"); | |
1345 } | |
1346 | |
1347 public: | |
1348 | |
1349 // expected usages: | |
1350 // for (MergeMemStream mms(mem->is_MergeMem()); next_non_empty(); ) { ... } | |
1351 // for (MergeMemStream mms(mem1, mem2); next_non_empty2(); ) { ... } | |
1352 | |
1353 // iterate over one merge | |
1354 MergeMemStream(MergeMemNode* mm) { | |
1355 mm->iteration_setup(); | |
1356 init(mm); | |
1357 debug_only(_cnt2 = 999); | |
1358 } | |
1359 // iterate in parallel over two merges | |
1360 // only iterates through non-empty elements of mm2 | |
1361 MergeMemStream(MergeMemNode* mm, const MergeMemNode* mm2) { | |
1362 assert(mm2, "second argument must be a MergeMem also"); | |
1363 ((MergeMemNode*)mm2)->iteration_setup(); // update hidden state | |
1364 mm->iteration_setup(mm2); | |
1365 init(mm, mm2); | |
1366 _cnt2 = mm2->req(); | |
1367 } | |
1368 #ifdef ASSERT | |
1369 ~MergeMemStream() { | |
1370 assert_synch(); | |
1371 } | |
1372 #endif | |
1373 | |
1374 MergeMemNode* all_memory() const { | |
1375 return _mm; | |
1376 } | |
1377 Node* base_memory() const { | |
1378 assert(_mm_base == _mm->base_memory(), "no update to base memory, please"); | |
1379 return _mm_base; | |
1380 } | |
1381 const MergeMemNode* all_memory2() const { | |
1382 assert(_mm2 != NULL, ""); | |
1383 return _mm2; | |
1384 } | |
1385 bool at_base_memory() const { | |
1386 return _idx == Compile::AliasIdxBot; | |
1387 } | |
1388 int alias_idx() const { | |
1389 assert(_mem, "must call next 1st"); | |
1390 return _idx; | |
1391 } | |
1392 | |
1393 const TypePtr* adr_type() const { | |
1394 return Compile::current()->get_adr_type(alias_idx()); | |
1395 } | |
1396 | |
1397 const TypePtr* adr_type(Compile* C) const { | |
1398 return C->get_adr_type(alias_idx()); | |
1399 } | |
1400 bool is_empty() const { | |
1401 assert(_mem, "must call next 1st"); | |
1402 assert(_mem->is_top() == (_mem==_mm->empty_memory()), "correct sentinel"); | |
1403 return _mem->is_top(); | |
1404 } | |
1405 bool is_empty2() const { | |
1406 assert(_mem2, "must call next 1st"); | |
1407 assert(_mem2->is_top() == (_mem2==_mm2->empty_memory()), "correct sentinel"); | |
1408 return _mem2->is_top(); | |
1409 } | |
1410 Node* memory() const { | |
1411 assert(!is_empty(), "must not be empty"); | |
1412 assert_synch(); | |
1413 return _mem; | |
1414 } | |
1415 // get the current memory, regardless of empty or non-empty status | |
1416 Node* force_memory() const { | |
1417 assert(!is_empty() || !at_base_memory(), ""); | |
1418 // Use _mm_base to defend against updates to _mem->base_memory(). | |
1419 Node *mem = _mem->is_top() ? _mm_base : _mem; | |
1420 assert(mem == check_memory(), ""); | |
1421 return mem; | |
1422 } | |
1423 Node* memory2() const { | |
1424 assert(_mem2 == check_memory2(), ""); | |
1425 return _mem2; | |
1426 } | |
1427 void set_memory(Node* mem) { | |
1428 if (at_base_memory()) { | |
1429 // Note that this does not change the invariant _mm_base. | |
1430 _mm->set_base_memory(mem); | |
1431 } else { | |
1432 _mm->set_memory_at(_idx, mem); | |
1433 } | |
1434 _mem = mem; | |
1435 assert_synch(); | |
1436 } | |
1437 | |
1438 // Recover from a side effect to the MergeMemNode. | |
1439 void set_memory() { | |
1440 _mem = _mm->in(_idx); | |
1441 } | |
1442 | |
1443 bool next() { return next(false); } | |
1444 bool next2() { return next(true); } | |
1445 | |
1446 bool next_non_empty() { return next_non_empty(false); } | |
1447 bool next_non_empty2() { return next_non_empty(true); } | |
1448 // next_non_empty2 can yield states where is_empty() is true | |
1449 | |
1450 private: | |
1451 // find the next item, which might be empty | |
1452 bool next(bool have_mm2) { | |
1453 assert((_mm2 != NULL) == have_mm2, "use other next"); | |
1454 assert_synch(); | |
1455 if (++_idx < _cnt) { | |
1456 // Note: This iterator allows _mm to be non-sparse. | |
1457 // It behaves the same whether _mem is top or base_memory. | |
1458 _mem = _mm->in(_idx); | |
1459 if (have_mm2) | |
1460 _mem2 = _mm2->in((_idx < _cnt2) ? _idx : Compile::AliasIdxTop); | |
1461 return true; | |
1462 } | |
1463 return false; | |
1464 } | |
1465 | |
1466 // find the next non-empty item | |
1467 bool next_non_empty(bool have_mm2) { | |
1468 while (next(have_mm2)) { | |
1469 if (!is_empty()) { | |
1470 // make sure _mem2 is filled in sensibly | |
1471 if (have_mm2 && _mem2->is_top()) _mem2 = _mm2->base_memory(); | |
1472 return true; | |
1473 } else if (have_mm2 && !is_empty2()) { | |
1474 return true; // is_empty() == true | |
1475 } | |
1476 } | |
1477 return false; | |
1478 } | |
1479 }; | |
1480 | |
1481 //------------------------------Prefetch--------------------------------------- | |
1482 | |
1483 // Non-faulting prefetch load. Prefetch for many reads. | |
1484 class PrefetchReadNode : public Node { | |
1485 public: | |
1486 PrefetchReadNode(Node *abio, Node *adr) : Node(0,abio,adr) {} | |
1487 virtual int Opcode() const; | |
1488 virtual uint ideal_reg() const { return NotAMachineReg; } | |
1489 virtual uint match_edge(uint idx) const { return idx==2; } | |
1490 virtual const Type *bottom_type() const { return Type::ABIO; } | |
1491 }; | |
1492 | |
1493 // Non-faulting prefetch load. Prefetch for many reads & many writes. | |
1494 class PrefetchWriteNode : public Node { | |
1495 public: | |
1496 PrefetchWriteNode(Node *abio, Node *adr) : Node(0,abio,adr) {} | |
1497 virtual int Opcode() const; | |
1498 virtual uint ideal_reg() const { return NotAMachineReg; } | |
1499 virtual uint match_edge(uint idx) const { return idx==2; } | |
3854 | 1500 virtual const Type *bottom_type() const { return Type::ABIO; } |
1501 }; | |
1502 | |
1503 // Allocation prefetch which may fault, TLAB size have to be adjusted. | |
1504 class PrefetchAllocationNode : public Node { | |
1505 public: | |
1506 PrefetchAllocationNode(Node *mem, Node *adr) : Node(0,mem,adr) {} | |
1507 virtual int Opcode() const; | |
1508 virtual uint ideal_reg() const { return NotAMachineReg; } | |
1509 virtual uint match_edge(uint idx) const { return idx==2; } | |
1367
9e321dcfa5b7
6940726: Use BIS instruction for allocation prefetch on Sparc
kvn
parents:
1198
diff
changeset
|
1510 virtual const Type *bottom_type() const { return ( AllocatePrefetchStyle == 3 ) ? Type::MEMORY : Type::ABIO; } |
0 | 1511 }; |
1972 | 1512 |
1513 #endif // SHARE_VM_OPTO_MEMNODE_HPP |