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 {
141 private:
142 // On platforms with weak memory ordering (e.g., PPC, Ia64) we distinguish
143 // loads that can be reordered, and such requiring acquire semantics to
144 // adhere to the Java specification. The required behaviour is stored in
145 // this field.
146 const MemOrd _mo;
147
148 protected:
149 virtual uint cmp(const Node &n) const;
150 virtual uint size_of() const; // Size is bigger
151 const Type* const _type; // What kind of value is loaded?
152 public:
153
154 LoadNode(Node *c, Node *mem, Node *adr, const TypePtr* at, const Type *rt, MemOrd mo)
155 : MemNode(c,mem,adr,at), _type(rt), _mo(mo) {
156 init_class_id(Class_Load);
157 }
158 inline bool is_unordered() const { return !is_acquire(); }
159 inline bool is_acquire() const {
160 assert(_mo == unordered || _mo == acquire, "unexpected");
161 return _mo == acquire;
162 }
163
164 // Polymorphic factory method:
165 static Node* make(PhaseGVN& gvn, Node *c, Node *mem, Node *adr,
166 const TypePtr* at, const Type *rt, BasicType bt, MemOrd mo);
167
168 virtual uint hash() const; // Check the type
169
170 // Handle algebraic identities here. If we have an identity, return the Node
171 // we are equivalent to. We look for Load of a Store.
172 virtual Node *Identity( PhaseTransform *phase );
173
174 // If the load is from Field memory and the pointer is non-null, we can
175 // zero out the control input.
176 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
177
178 // Split instance field load through Phi.
179 Node* split_through_phi(PhaseGVN *phase);
180
181 // Recover original value from boxed values
182 Node *eliminate_autobox(PhaseGVN *phase);
183
184 // Compute a new Type for this node. Basically we just do the pre-check,
185 // then call the virtual add() to set the type.
186 virtual const Type *Value( PhaseTransform *phase ) const;
187
188 // Common methods for LoadKlass and LoadNKlass nodes.
189 const Type *klass_value_common( PhaseTransform *phase ) const;
190 Node *klass_identity_common( PhaseTransform *phase );
191
192 virtual uint ideal_reg() const;
193 virtual const Type *bottom_type() const;
194 // Following method is copied from TypeNode:
195 void set_type(const Type* t) {
396 virtual int store_Opcode() const { return Op_StoreP; }
397 virtual BasicType memory_type() const { return T_ADDRESS; }
398 };
399
400
401 //------------------------------LoadNNode--------------------------------------
402 // Load a narrow oop from memory (either object or array)
403 class LoadNNode : public LoadNode {
404 public:
405 LoadNNode(Node *c, Node *mem, Node *adr, const TypePtr *at, const Type* t, MemOrd mo)
406 : LoadNode(c, mem, adr, at, t, mo) {}
407 virtual int Opcode() const;
408 virtual uint ideal_reg() const { return Op_RegN; }
409 virtual int store_Opcode() const { return Op_StoreN; }
410 virtual BasicType memory_type() const { return T_NARROWOOP; }
411 };
412
413 //------------------------------LoadKlassNode----------------------------------
414 // Load a Klass from an object
415 class LoadKlassNode : public LoadPNode {
416 public:
417 LoadKlassNode(Node *c, Node *mem, Node *adr, const TypePtr *at, const TypeKlassPtr *tk, MemOrd mo)
418 : LoadPNode(c, mem, adr, at, tk, mo) {}
419 virtual int Opcode() const;
420 virtual const Type *Value( PhaseTransform *phase ) const;
421 virtual Node *Identity( PhaseTransform *phase );
422 virtual bool depends_only_on_test() const { return true; }
423
424 // Polymorphic factory method:
425 static Node* make( PhaseGVN& gvn, Node *mem, Node *adr, const TypePtr* at,
426 const TypeKlassPtr *tk = TypeKlassPtr::OBJECT );
427 };
428
429 //------------------------------LoadNKlassNode---------------------------------
430 // Load a narrow Klass from an object.
431 class LoadNKlassNode : public LoadNNode {
432 public:
433 LoadNKlassNode(Node *c, Node *mem, Node *adr, const TypePtr *at, const TypeNarrowKlass *tk, MemOrd mo)
434 : LoadNNode(c, mem, adr, at, tk, mo) {}
435 virtual int Opcode() const;
436 virtual uint ideal_reg() const { return Op_RegN; }
437 virtual int store_Opcode() const { return Op_StoreNKlass; }
438 virtual BasicType memory_type() const { return T_NARROWKLASS; }
439
440 virtual const Type *Value( PhaseTransform *phase ) const;
441 virtual Node *Identity( PhaseTransform *phase );
442 virtual bool depends_only_on_test() const { return true; }
443 };
444
445
446 //------------------------------StoreNode--------------------------------------
|
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 {
141 private:
142 // On platforms with weak memory ordering (e.g., PPC, Ia64) we distinguish
143 // loads that can be reordered, and such requiring acquire semantics to
144 // adhere to the Java specification. The required behaviour is stored in
145 // this field.
146 const MemOrd _mo;
147
148 protected:
149 virtual uint cmp(const Node &n) const;
150 virtual uint size_of() const; // Size is bigger
151 // Should LoadNode::Ideal() attempt to remove control edges?
152 virtual bool can_remove_control() const;
153 const Type* const _type; // What kind of value is loaded?
154 public:
155
156 LoadNode(Node *c, Node *mem, Node *adr, const TypePtr* at, const Type *rt, MemOrd mo)
157 : MemNode(c,mem,adr,at), _type(rt), _mo(mo) {
158 init_class_id(Class_Load);
159 }
160 inline bool is_unordered() const { return !is_acquire(); }
161 inline bool is_acquire() const {
162 assert(_mo == unordered || _mo == acquire, "unexpected");
163 return _mo == acquire;
164 }
165
166 // Polymorphic factory method:
167 static Node* make(PhaseGVN& gvn, Node *c, Node *mem, Node *adr,
168 const TypePtr* at, const Type *rt, BasicType bt, MemOrd mo);
169
170 virtual uint hash() const; // Check the type
171
172 // Handle algebraic identities here. If we have an identity, return the Node
173 // we are equivalent to. We look for Load of a Store.
174 virtual Node *Identity( PhaseTransform *phase );
175
176 // If the load is from Field memory and the pointer is non-null, it might be possible to
177 // zero out the control input.
178 // If the offset is constant and the base is an object allocation,
179 // try to hook me up to the exact initializing store.
180 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
181
182 // Split instance field load through Phi.
183 Node* split_through_phi(PhaseGVN *phase);
184
185 // Recover original value from boxed values
186 Node *eliminate_autobox(PhaseGVN *phase);
187
188 // Compute a new Type for this node. Basically we just do the pre-check,
189 // then call the virtual add() to set the type.
190 virtual const Type *Value( PhaseTransform *phase ) const;
191
192 // Common methods for LoadKlass and LoadNKlass nodes.
193 const Type *klass_value_common( PhaseTransform *phase ) const;
194 Node *klass_identity_common( PhaseTransform *phase );
195
196 virtual uint ideal_reg() const;
197 virtual const Type *bottom_type() const;
198 // Following method is copied from TypeNode:
199 void set_type(const Type* t) {
400 virtual int store_Opcode() const { return Op_StoreP; }
401 virtual BasicType memory_type() const { return T_ADDRESS; }
402 };
403
404
405 //------------------------------LoadNNode--------------------------------------
406 // Load a narrow oop from memory (either object or array)
407 class LoadNNode : public LoadNode {
408 public:
409 LoadNNode(Node *c, Node *mem, Node *adr, const TypePtr *at, const Type* t, MemOrd mo)
410 : LoadNode(c, mem, adr, at, t, mo) {}
411 virtual int Opcode() const;
412 virtual uint ideal_reg() const { return Op_RegN; }
413 virtual int store_Opcode() const { return Op_StoreN; }
414 virtual BasicType memory_type() const { return T_NARROWOOP; }
415 };
416
417 //------------------------------LoadKlassNode----------------------------------
418 // Load a Klass from an object
419 class LoadKlassNode : public LoadPNode {
420 protected:
421 // In most cases, LoadKlassNode does not have the control input set. If the control
422 // input is set, it must not be removed (by LoadNode::Ideal()).
423 virtual bool can_remove_control() const;
424 public:
425 LoadKlassNode(Node *c, Node *mem, Node *adr, const TypePtr *at, const TypeKlassPtr *tk, MemOrd mo)
426 : LoadPNode(c, mem, adr, at, tk, mo) {}
427 virtual int Opcode() const;
428 virtual const Type *Value( PhaseTransform *phase ) const;
429 virtual Node *Identity( PhaseTransform *phase );
430 virtual bool depends_only_on_test() const { return true; }
431
432 // Polymorphic factory method:
433 static Node* make(PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, const TypePtr* at,
434 const TypeKlassPtr* tk = TypeKlassPtr::OBJECT);
435 };
436
437 //------------------------------LoadNKlassNode---------------------------------
438 // Load a narrow Klass from an object.
439 class LoadNKlassNode : public LoadNNode {
440 public:
441 LoadNKlassNode(Node *c, Node *mem, Node *adr, const TypePtr *at, const TypeNarrowKlass *tk, MemOrd mo)
442 : LoadNNode(c, mem, adr, at, tk, mo) {}
443 virtual int Opcode() const;
444 virtual uint ideal_reg() const { return Op_RegN; }
445 virtual int store_Opcode() const { return Op_StoreNKlass; }
446 virtual BasicType memory_type() const { return T_NARROWKLASS; }
447
448 virtual const Type *Value( PhaseTransform *phase ) const;
449 virtual Node *Identity( PhaseTransform *phase );
450 virtual bool depends_only_on_test() const { return true; }
451 };
452
453
454 //------------------------------StoreNode--------------------------------------
|