src/share/vm/opto/cfgnode.hpp

changeset 499
b8f5ba577b02
parent 452
ff5961f4c095
child 509
2a9af0b9cb1c
equal deleted inserted replaced
498:eac007780a58 499:b8f5ba577b02
108 // paths to the RegionNode. For speed reasons (to avoid another pass) we 108 // paths to the RegionNode. For speed reasons (to avoid another pass) we
109 // can turn PhiNodes into copys in-place by NULL'ing out their RegionNode 109 // can turn PhiNodes into copys in-place by NULL'ing out their RegionNode
110 // input in slot 0. 110 // input in slot 0.
111 class PhiNode : public TypeNode { 111 class PhiNode : public TypeNode {
112 const TypePtr* const _adr_type; // non-null only for Type::MEMORY nodes. 112 const TypePtr* const _adr_type; // non-null only for Type::MEMORY nodes.
113 const int _inst_id; // Instance id of the memory slice.
114 const int _inst_index; // Alias index of the instance memory slice.
115 // Array elements references have the same alias_idx but different offset.
116 const int _inst_offset; // Offset of the instance memory slice.
113 // Size is bigger to hold the _adr_type field. 117 // Size is bigger to hold the _adr_type field.
114 virtual uint hash() const; // Check the type 118 virtual uint hash() const; // Check the type
115 virtual uint cmp( const Node &n ) const; 119 virtual uint cmp( const Node &n ) const;
116 virtual uint size_of() const { return sizeof(*this); } 120 virtual uint size_of() const { return sizeof(*this); }
117 121
118 // Determine a unique non-trivial input, if any.
119 // Ignore casts if it helps. Return NULL on failure.
120 Node* unique_input(PhaseTransform *phase);
121 // Determine if CMoveNode::is_cmove_id can be used at this join point. 122 // Determine if CMoveNode::is_cmove_id can be used at this join point.
122 Node* is_cmove_id(PhaseTransform* phase, int true_path); 123 Node* is_cmove_id(PhaseTransform* phase, int true_path);
123 124
124 public: 125 public:
125 // Node layout (parallels RegionNode): 126 // Node layout (parallels RegionNode):
126 enum { Region, // Control input is the Phi's region. 127 enum { Region, // Control input is the Phi's region.
127 Input // Input values are [1..len) 128 Input // Input values are [1..len)
128 }; 129 };
129 130
130 PhiNode( Node *r, const Type *t, const TypePtr* at = NULL ) 131 PhiNode( Node *r, const Type *t, const TypePtr* at = NULL,
131 : TypeNode(t,r->req()), _adr_type(at) { 132 const int iid = TypeOopPtr::UNKNOWN_INSTANCE,
133 const int iidx = Compile::AliasIdxTop,
134 const int ioffs = Type::OffsetTop )
135 : TypeNode(t,r->req()),
136 _adr_type(at),
137 _inst_id(iid),
138 _inst_index(iidx),
139 _inst_offset(ioffs)
140 {
132 init_class_id(Class_Phi); 141 init_class_id(Class_Phi);
133 init_req(0, r); 142 init_req(0, r);
134 verify_adr_type(); 143 verify_adr_type();
135 } 144 }
136 // create a new phi with in edges matching r and set (initially) to x 145 // create a new phi with in edges matching r and set (initially) to x
150 DEBUG_ONLY(const Node* r = _in[Region];) 159 DEBUG_ONLY(const Node* r = _in[Region];)
151 assert(r != NULL && r->is_Region(), "Not valid control"); 160 assert(r != NULL && r->is_Region(), "Not valid control");
152 return NULL; // not a copy! 161 return NULL; // not a copy!
153 } 162 }
154 163
164 // Determine a unique non-trivial input, if any.
165 // Ignore casts if it helps. Return NULL on failure.
166 Node* unique_input(PhaseTransform *phase);
167
155 // Check for a simple dead loop. 168 // Check for a simple dead loop.
156 enum LoopSafety { Safe = 0, Unsafe, UnsafeLoop }; 169 enum LoopSafety { Safe = 0, Unsafe, UnsafeLoop };
157 LoopSafety simple_data_loop_check(Node *in) const; 170 LoopSafety simple_data_loop_check(Node *in) const;
158 // Is it unsafe data loop? It becomes a dead loop if this phi node removed. 171 // Is it unsafe data loop? It becomes a dead loop if this phi node removed.
159 bool is_unsafe_data_reference(Node *in) const; 172 bool is_unsafe_data_reference(Node *in) const;
160 int is_diamond_phi() const; 173 int is_diamond_phi() const;
161 virtual int Opcode() const; 174 virtual int Opcode() const;
162 virtual bool pinned() const { return in(0) != 0; } 175 virtual bool pinned() const { return in(0) != 0; }
163 virtual const TypePtr *adr_type() const { verify_adr_type(true); return _adr_type; } 176 virtual const TypePtr *adr_type() const { verify_adr_type(true); return _adr_type; }
177
178 const int inst_id() const { return _inst_id; }
179 const int inst_index() const { return _inst_index; }
180 const int inst_offset() const { return _inst_offset; }
181 bool is_same_inst_field(const Type* tp, int id, int index, int offset) {
182 return type()->basic_type() == tp->basic_type() &&
183 inst_id() == id &&
184 inst_index() == index &&
185 inst_offset() == offset &&
186 type()->higher_equal(tp);
187 }
188
164 virtual const Type *Value( PhaseTransform *phase ) const; 189 virtual const Type *Value( PhaseTransform *phase ) const;
165 virtual Node *Identity( PhaseTransform *phase ); 190 virtual Node *Identity( PhaseTransform *phase );
166 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 191 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
167 virtual const RegMask &out_RegMask() const; 192 virtual const RegMask &out_RegMask() const;
168 virtual const RegMask &in_RegMask(uint) const; 193 virtual const RegMask &in_RegMask(uint) const;

mercurial