117 // paths to the RegionNode. For speed reasons (to avoid another pass) we |
117 // paths to the RegionNode. For speed reasons (to avoid another pass) we |
118 // can turn PhiNodes into copys in-place by NULL'ing out their RegionNode |
118 // can turn PhiNodes into copys in-place by NULL'ing out their RegionNode |
119 // input in slot 0. |
119 // input in slot 0. |
120 class PhiNode : public TypeNode { |
120 class PhiNode : public TypeNode { |
121 const TypePtr* const _adr_type; // non-null only for Type::MEMORY nodes. |
121 const TypePtr* const _adr_type; // non-null only for Type::MEMORY nodes. |
122 // The following fields are only used for data PhiNodes to indicate |
|
123 // that the PhiNode represents the value of a known instance field. |
|
124 int _inst_mem_id; // Instance memory id (node index of the memory Phi) |
|
125 const int _inst_id; // Instance id of the memory slice. |
122 const int _inst_id; // Instance id of the memory slice. |
126 const int _inst_index; // Alias index of the instance memory slice. |
123 const int _inst_index; // Alias index of the instance memory slice. |
127 // Array elements references have the same alias_idx but different offset. |
124 // Array elements references have the same alias_idx but different offset. |
128 const int _inst_offset; // Offset of the instance memory slice. |
125 const int _inst_offset; // Offset of the instance memory slice. |
129 // Size is bigger to hold the _adr_type field. |
126 // Size is bigger to hold the _adr_type field. |
139 enum { Region, // Control input is the Phi's region. |
136 enum { Region, // Control input is the Phi's region. |
140 Input // Input values are [1..len) |
137 Input // Input values are [1..len) |
141 }; |
138 }; |
142 |
139 |
143 PhiNode( Node *r, const Type *t, const TypePtr* at = NULL, |
140 PhiNode( Node *r, const Type *t, const TypePtr* at = NULL, |
144 const int imid = -1, |
|
145 const int iid = TypeOopPtr::InstanceTop, |
141 const int iid = TypeOopPtr::InstanceTop, |
146 const int iidx = Compile::AliasIdxTop, |
142 const int iidx = Compile::AliasIdxTop, |
147 const int ioffs = Type::OffsetTop ) |
143 const int ioffs = Type::OffsetTop ) |
148 : TypeNode(t,r->req()), |
144 : TypeNode(t,r->req()), |
149 _adr_type(at), |
145 _adr_type(at), |
150 _inst_mem_id(imid), |
|
151 _inst_id(iid), |
146 _inst_id(iid), |
152 _inst_index(iidx), |
147 _inst_index(iidx), |
153 _inst_offset(ioffs) |
148 _inst_offset(ioffs) |
154 { |
149 { |
155 init_class_id(Class_Phi); |
150 init_class_id(Class_Phi); |
190 int is_diamond_phi(bool check_control_only = false) const; |
185 int is_diamond_phi(bool check_control_only = false) const; |
191 virtual int Opcode() const; |
186 virtual int Opcode() const; |
192 virtual bool pinned() const { return in(0) != 0; } |
187 virtual bool pinned() const { return in(0) != 0; } |
193 virtual const TypePtr *adr_type() const { verify_adr_type(true); return _adr_type; } |
188 virtual const TypePtr *adr_type() const { verify_adr_type(true); return _adr_type; } |
194 |
189 |
195 void set_inst_mem_id(int inst_mem_id) { _inst_mem_id = inst_mem_id; } |
|
196 const int inst_mem_id() const { return _inst_mem_id; } |
|
197 const int inst_id() const { return _inst_id; } |
190 const int inst_id() const { return _inst_id; } |
198 const int inst_index() const { return _inst_index; } |
191 const int inst_index() const { return _inst_index; } |
199 const int inst_offset() const { return _inst_offset; } |
192 const int inst_offset() const { return _inst_offset; } |
200 bool is_same_inst_field(const Type* tp, int mem_id, int id, int index, int offset) { |
193 bool is_same_inst_field(const Type* tp, int id, int index, int offset) { |
201 return type()->basic_type() == tp->basic_type() && |
194 return type()->basic_type() == tp->basic_type() && |
202 inst_mem_id() == mem_id && |
|
203 inst_id() == id && |
195 inst_id() == id && |
204 inst_index() == index && |
196 inst_index() == index && |
205 inst_offset() == offset && |
197 inst_offset() == offset && |
206 type()->higher_equal(tp); |
198 type()->higher_equal(tp); |
207 } |
199 } |