158 EscapeState _escape; |
158 EscapeState _escape; |
159 GrowableArray<uint>* _edges; // outgoing edges |
159 GrowableArray<uint>* _edges; // outgoing edges |
160 Node* _node; // Ideal node corresponding to this PointsTo node. |
160 Node* _node; // Ideal node corresponding to this PointsTo node. |
161 int _offset; // Object fields offsets. |
161 int _offset; // Object fields offsets. |
162 bool _scalar_replaceable; // Not escaped object could be replaced with scalar |
162 bool _scalar_replaceable; // Not escaped object could be replaced with scalar |
|
163 bool _has_unknown_ptr; // Has edge to phantom_object |
163 |
164 |
164 public: |
165 public: |
165 PointsToNode(): |
166 PointsToNode(): |
166 _type(UnknownType), |
167 _type(UnknownType), |
167 _escape(UnknownEscape), |
168 _escape(UnknownEscape), |
168 _edges(NULL), |
169 _edges(NULL), |
169 _node(NULL), |
170 _node(NULL), |
170 _offset(-1), |
171 _offset(-1), |
|
172 _has_unknown_ptr(false), |
171 _scalar_replaceable(true) {} |
173 _scalar_replaceable(true) {} |
172 |
174 |
173 |
175 |
174 EscapeState escape_state() const { return _escape; } |
176 EscapeState escape_state() const { return _escape; } |
175 NodeType node_type() const { return _type;} |
177 NodeType node_type() const { return _type;} |
176 int offset() { return _offset;} |
178 int offset() { return _offset;} |
177 bool scalar_replaceable() { return _scalar_replaceable;} |
179 bool scalar_replaceable() { return _scalar_replaceable;} |
|
180 bool has_unknown_ptr() { return _has_unknown_ptr;} |
178 |
181 |
179 void set_offset(int offs) { _offset = offs;} |
182 void set_offset(int offs) { _offset = offs;} |
180 void set_escape_state(EscapeState state) { _escape = state; } |
183 void set_escape_state(EscapeState state) { _escape = state; } |
181 void set_node_type(NodeType ntype) { |
184 void set_node_type(NodeType ntype) { |
182 assert(_type == UnknownType || _type == ntype, "Can't change node type"); |
185 assert(_type == UnknownType || _type == ntype, "Can't change node type"); |
183 _type = ntype; |
186 _type = ntype; |
184 } |
187 } |
185 void set_scalar_replaceable(bool v) { _scalar_replaceable = v; } |
188 void set_scalar_replaceable(bool v) { _scalar_replaceable = v; } |
|
189 void set_has_unknown_ptr() { _has_unknown_ptr = true; } |
186 |
190 |
187 // count of outgoing edges |
191 // count of outgoing edges |
188 uint edge_count() const { return (_edges == NULL) ? 0 : _edges->length(); } |
192 uint edge_count() const { return (_edges == NULL) ? 0 : _edges->length(); } |
189 |
193 |
190 // node index of target of outgoing edge "e" |
194 // node index of target of outgoing edge "e" |
247 // There should be no new ideal nodes during ConnectionGraph build, |
251 // There should be no new ideal nodes during ConnectionGraph build, |
248 // growableArray::adr_at() will throw assert otherwise. |
252 // growableArray::adr_at() will throw assert otherwise. |
249 return _nodes.adr_at(idx); |
253 return _nodes.adr_at(idx); |
250 } |
254 } |
251 uint nodes_size() const { return _nodes.length(); } |
255 uint nodes_size() const { return _nodes.length(); } |
|
256 |
|
257 bool is_null_ptr(uint idx) const { return (idx == _noop_null || idx == _oop_null); } |
252 |
258 |
253 // Add node to ConnectionGraph. |
259 // Add node to ConnectionGraph. |
254 void add_node(Node *n, PointsToNode::NodeType nt, PointsToNode::EscapeState es, bool done); |
260 void add_node(Node *n, PointsToNode::NodeType nt, PointsToNode::EscapeState es, bool done); |
255 |
261 |
256 // offset of a field reference |
262 // offset of a field reference |
331 Node *phi = _node_map[idx]; |
337 Node *phi = _node_map[idx]; |
332 return (phi == NULL) ? NULL : phi->as_Phi(); |
338 return (phi == NULL) ? NULL : phi->as_Phi(); |
333 } |
339 } |
334 |
340 |
335 // Notify optimizer that a node has been modified |
341 // Notify optimizer that a node has been modified |
336 // Node: This assumes that escape analysis is run before |
|
337 // PhaseIterGVN creation |
|
338 void record_for_optimizer(Node *n) { |
342 void record_for_optimizer(Node *n) { |
339 _igvn->_worklist.push(n); |
343 _igvn->_worklist.push(n); |
|
344 _igvn->add_users_to_worklist(n); |
340 } |
345 } |
341 |
346 |
342 // Set the escape state of a node |
347 // Set the escape state of a node |
343 void set_escape_state(uint ni, PointsToNode::EscapeState es); |
348 void set_escape_state(uint ni, PointsToNode::EscapeState es); |
344 |
349 |