109 virtual int store_Opcode() const { return -1; }
110
111 // What is the type of the value in memory? (T_VOID mean "unspecified".)
112 virtual BasicType memory_type() const = 0;
113 virtual int memory_size() const {
114 #ifdef ASSERT
115 return type2aelembytes(memory_type(), true);
116 #else
117 return type2aelembytes(memory_type());
118 #endif
119 }
120
121 // Search through memory states which precede this node (load or store).
122 // Look for an exact match for the address, with no intervening
123 // aliased stores.
124 Node* find_previous_store(PhaseTransform* phase);
125
126 // Can this node (load or store) accurately see a stored value in
127 // the given memory state? (The state may or may not be in(Memory).)
128 Node* can_see_stored_value(Node* st, PhaseTransform* phase) const;
129 Node* can_see_arraycopy_value(Node* st, PhaseTransform* phase) const;
130
131 #ifndef PRODUCT
132 static void dump_adr_type(const Node* mem, const TypePtr* adr_type, outputStream *st);
133 virtual void dump_spec(outputStream *st) const;
134 #endif
135 };
136
137 //------------------------------LoadNode---------------------------------------
138 // Load value; requires Memory and Address
139 class LoadNode : public MemNode {
140 public:
141 // Some loads (from unsafe) should be pinned: they don't depend only
142 // on the dominating test. The boolean field _depends_only_on_test
143 // below records whether that node depends only on the dominating
144 // test.
145 // Methods used to build LoadNodes pass an argument of type enum
146 // ControlDependency instead of a boolean because those methods
147 // typically have multiple boolean parameters with default values:
148 // passing the wrong boolean to one of these parameters by mistake
149 // goes easily unnoticed. Using an enum, the compiler can check that
235
236 // Do not match memory edge
237 virtual uint match_edge(uint idx) const;
238
239 // Map a load opcode to its corresponding store opcode.
240 virtual int store_Opcode() const = 0;
241
242 // Check if the load's memory input is a Phi node with the same control.
243 bool is_instance_field_load_with_local_phi(Node* ctrl);
244
245 #ifndef PRODUCT
246 virtual void dump_spec(outputStream *st) const;
247 #endif
248 #ifdef ASSERT
249 // Helper function to allow a raw load without control edge for some cases
250 static bool is_immutable_value(Node* adr);
251 #endif
252 protected:
253 const Type* load_array_final_field(const TypeKlassPtr *tkls,
254 ciKlass* klass) const;
255 // depends_only_on_test is almost always true, and needs to be almost always
256 // true to enable key hoisting & commoning optimizations. However, for the
257 // special case of RawPtr loads from TLS top & end, and other loads performed by
258 // GC barriers, the control edge carries the dependence preventing hoisting past
259 // a Safepoint instead of the memory edge. (An unfortunate consequence of having
260 // Safepoints not set Raw Memory; itself an unfortunate consequence of having Nodes
261 // which produce results (new raw memory state) inside of loops preventing all
262 // manner of other optimizations). Basically, it's ugly but so is the alternative.
263 // See comment in macro.cpp, around line 125 expand_allocate_common().
264 virtual bool depends_only_on_test() const { return adr_type() != TypeRawPtr::BOTTOM && _depends_only_on_test; }
265 };
266
267 //------------------------------LoadBNode--------------------------------------
268 // Load a byte (8bits signed) from memory
269 class LoadBNode : public LoadNode {
270 public:
271 LoadBNode(Node *c, Node *mem, Node *adr, const TypePtr* at, const TypeInt *ti, MemOrd mo, ControlDependency control_dependency = DependsOnlyOnTest)
272 : LoadNode(c, mem, adr, at, ti, mo, control_dependency) {}
273 virtual int Opcode() const;
274 virtual uint ideal_reg() const { return Op_RegI; }
|
109 virtual int store_Opcode() const { return -1; }
110
111 // What is the type of the value in memory? (T_VOID mean "unspecified".)
112 virtual BasicType memory_type() const = 0;
113 virtual int memory_size() const {
114 #ifdef ASSERT
115 return type2aelembytes(memory_type(), true);
116 #else
117 return type2aelembytes(memory_type());
118 #endif
119 }
120
121 // Search through memory states which precede this node (load or store).
122 // Look for an exact match for the address, with no intervening
123 // aliased stores.
124 Node* find_previous_store(PhaseTransform* phase);
125
126 // Can this node (load or store) accurately see a stored value in
127 // the given memory state? (The state may or may not be in(Memory).)
128 Node* can_see_stored_value(Node* st, PhaseTransform* phase) const;
129
130 #ifndef PRODUCT
131 static void dump_adr_type(const Node* mem, const TypePtr* adr_type, outputStream *st);
132 virtual void dump_spec(outputStream *st) const;
133 #endif
134 };
135
136 //------------------------------LoadNode---------------------------------------
137 // Load value; requires Memory and Address
138 class LoadNode : public MemNode {
139 public:
140 // Some loads (from unsafe) should be pinned: they don't depend only
141 // on the dominating test. The boolean field _depends_only_on_test
142 // below records whether that node depends only on the dominating
143 // test.
144 // Methods used to build LoadNodes pass an argument of type enum
145 // ControlDependency instead of a boolean because those methods
146 // typically have multiple boolean parameters with default values:
147 // passing the wrong boolean to one of these parameters by mistake
148 // goes easily unnoticed. Using an enum, the compiler can check that
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
241 // Check if the load's memory input is a Phi node with the same control.
242 bool is_instance_field_load_with_local_phi(Node* ctrl);
243
244 #ifndef PRODUCT
245 virtual void dump_spec(outputStream *st) const;
246 #endif
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
251 protected:
252 const Type* load_array_final_field(const TypeKlassPtr *tkls,
253 ciKlass* klass) const;
254
255 Node* can_see_arraycopy_value(Node* st, PhaseTransform* phase) const;
256
257 // depends_only_on_test is almost always true, and needs to be almost always
258 // true to enable key hoisting & commoning optimizations. However, for the
259 // special case of RawPtr loads from TLS top & end, and other loads performed by
260 // GC barriers, the control edge carries the dependence preventing hoisting past
261 // a Safepoint instead of the memory edge. (An unfortunate consequence of having
262 // Safepoints not set Raw Memory; itself an unfortunate consequence of having Nodes
263 // which produce results (new raw memory state) inside of loops preventing all
264 // manner of other optimizations). Basically, it's ugly but so is the alternative.
265 // See comment in macro.cpp, around line 125 expand_allocate_common().
266 virtual bool depends_only_on_test() const { return adr_type() != TypeRawPtr::BOTTOM && _depends_only_on_test; }
267 };
268
269 //------------------------------LoadBNode--------------------------------------
270 // Load a byte (8bits signed) from memory
271 class LoadBNode : public LoadNode {
272 public:
273 LoadBNode(Node *c, Node *mem, Node *adr, const TypePtr* at, const TypeInt *ti, MemOrd mo, ControlDependency control_dependency = DependsOnlyOnTest)
274 : LoadNode(c, mem, adr, at, ti, mo, control_dependency) {}
275 virtual int Opcode() const;
276 virtual uint ideal_reg() const { return Op_RegI; }
|