225 // are assumed to point to. |
225 // are assumed to point to. |
226 uint _oop_null; // ConP(#NULL) |
226 uint _oop_null; // ConP(#NULL) |
227 uint _noop_null; // ConN(#NULL) |
227 uint _noop_null; // ConN(#NULL) |
228 |
228 |
229 Compile * _compile; // Compile object for current compilation |
229 Compile * _compile; // Compile object for current compilation |
|
230 PhaseIterGVN * _igvn; // Value numbering |
230 |
231 |
231 // Address of an element in _nodes. Used when the element is to be modified |
232 // Address of an element in _nodes. Used when the element is to be modified |
232 PointsToNode *ptnode_adr(uint idx) const { |
233 PointsToNode *ptnode_adr(uint idx) const { |
233 // There should be no new ideal nodes during ConnectionGraph build, |
234 // There should be no new ideal nodes during ConnectionGraph build, |
234 // growableArray::adr_at() will throw assert otherwise. |
235 // growableArray::adr_at() will throw assert otherwise. |
255 void build_connection_graph(Node *n, PhaseTransform *phase); |
256 void build_connection_graph(Node *n, PhaseTransform *phase); |
256 |
257 |
257 // walk the connection graph starting at the node corresponding to "n" and |
258 // walk the connection graph starting at the node corresponding to "n" and |
258 // add the index of everything it could point to, to "ptset". This may cause |
259 // add the index of everything it could point to, to "ptset". This may cause |
259 // Phi's encountered to get (re)processed (which requires "phase".) |
260 // Phi's encountered to get (re)processed (which requires "phase".) |
260 void PointsTo(VectorSet &ptset, Node * n, PhaseTransform *phase); |
261 void PointsTo(VectorSet &ptset, Node * n); |
261 |
262 |
262 // Edge manipulation. The "from_i" and "to_i" arguments are the |
263 // Edge manipulation. The "from_i" and "to_i" arguments are the |
263 // node indices of the source and destination of the edge |
264 // node indices of the source and destination of the edge |
264 void add_pointsto_edge(uint from_i, uint to_i); |
265 void add_pointsto_edge(uint from_i, uint to_i); |
265 void add_deferred_edge(uint from_i, uint to_i); |
266 void add_deferred_edge(uint from_i, uint to_i); |
308 |
309 |
309 // Notify optimizer that a node has been modified |
310 // Notify optimizer that a node has been modified |
310 // Node: This assumes that escape analysis is run before |
311 // Node: This assumes that escape analysis is run before |
311 // PhaseIterGVN creation |
312 // PhaseIterGVN creation |
312 void record_for_optimizer(Node *n) { |
313 void record_for_optimizer(Node *n) { |
313 _compile->record_for_igvn(n); |
314 _igvn->_worklist.push(n); |
314 } |
315 } |
315 |
316 |
316 // Set the escape state of a node |
317 // Set the escape state of a node |
317 void set_escape_state(uint ni, PointsToNode::EscapeState es); |
318 void set_escape_state(uint ni, PointsToNode::EscapeState es); |
318 |
319 |
319 // Search for objects which are not scalar replaceable. |
320 // Search for objects which are not scalar replaceable. |
320 void verify_escape_state(int nidx, VectorSet& ptset, PhaseTransform* phase); |
321 void verify_escape_state(int nidx, VectorSet& ptset, PhaseTransform* phase); |
321 |
322 |
322 public: |
323 public: |
323 ConnectionGraph(Compile *C); |
324 ConnectionGraph(Compile *C, PhaseIterGVN *igvn); |
324 |
325 |
325 // Check for non-escaping candidates |
326 // Check for non-escaping candidates |
326 static bool has_candidates(Compile *C); |
327 static bool has_candidates(Compile *C); |
327 |
328 |
|
329 // Perform escape analysis |
|
330 static void do_analysis(Compile *C, PhaseIterGVN *igvn); |
|
331 |
328 // Compute the escape information |
332 // Compute the escape information |
329 bool compute_escape(); |
333 bool compute_escape(); |
330 |
334 |
331 // escape state of a node |
335 // escape state of a node |
332 PointsToNode::EscapeState escape_state(Node *n, PhaseTransform *phase); |
336 PointsToNode::EscapeState escape_state(Node *n); |
|
337 |
333 // other information we have collected |
338 // other information we have collected |
334 bool is_scalar_replaceable(Node *n) { |
339 bool is_scalar_replaceable(Node *n) { |
335 if (_collecting || (n->_idx >= nodes_size())) |
340 if (_collecting || (n->_idx >= nodes_size())) |
336 return false; |
341 return false; |
337 PointsToNode* ptn = ptnode_adr(n->_idx); |
342 PointsToNode* ptn = ptnode_adr(n->_idx); |