1 /* |
1 /* |
2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
266 void build_connection_graph(Node *n, PhaseTransform *phase); |
266 void build_connection_graph(Node *n, PhaseTransform *phase); |
267 |
267 |
268 // walk the connection graph starting at the node corresponding to "n" and |
268 // walk the connection graph starting at the node corresponding to "n" and |
269 // add the index of everything it could point to, to "ptset". This may cause |
269 // add the index of everything it could point to, to "ptset". This may cause |
270 // Phi's encountered to get (re)processed (which requires "phase".) |
270 // Phi's encountered to get (re)processed (which requires "phase".) |
271 void PointsTo(VectorSet &ptset, Node * n); |
271 VectorSet* PointsTo(Node * n); |
|
272 |
|
273 // Reused structures for PointsTo(). |
|
274 VectorSet pt_ptset; |
|
275 VectorSet pt_visited; |
|
276 GrowableArray<uint> pt_worklist; |
272 |
277 |
273 // Edge manipulation. The "from_i" and "to_i" arguments are the |
278 // Edge manipulation. The "from_i" and "to_i" arguments are the |
274 // node indices of the source and destination of the edge |
279 // node indices of the source and destination of the edge |
275 void add_pointsto_edge(uint from_i, uint to_i); |
280 void add_pointsto_edge(uint from_i, uint to_i); |
276 void add_deferred_edge(uint from_i, uint to_i); |
281 void add_deferred_edge(uint from_i, uint to_i); |
332 } |
337 } |
333 |
338 |
334 // Set the escape state of a node |
339 // Set the escape state of a node |
335 void set_escape_state(uint ni, PointsToNode::EscapeState es); |
340 void set_escape_state(uint ni, PointsToNode::EscapeState es); |
336 |
341 |
337 // Search for objects which are not scalar replaceable. |
342 // Adjust escape state after Connection Graph is built. |
338 void verify_escape_state(int nidx, VectorSet& ptset, PhaseTransform* phase); |
343 void adjust_escape_state(int nidx, PhaseTransform* phase); |
|
344 |
|
345 // Compute the escape information |
|
346 bool compute_escape(); |
339 |
347 |
340 public: |
348 public: |
341 ConnectionGraph(Compile *C, PhaseIterGVN *igvn); |
349 ConnectionGraph(Compile *C, PhaseIterGVN *igvn); |
342 |
350 |
343 // Check for non-escaping candidates |
351 // Check for non-escaping candidates |
344 static bool has_candidates(Compile *C); |
352 static bool has_candidates(Compile *C); |
345 |
353 |
346 // Perform escape analysis |
354 // Perform escape analysis |
347 static void do_analysis(Compile *C, PhaseIterGVN *igvn); |
355 static void do_analysis(Compile *C, PhaseIterGVN *igvn); |
348 |
|
349 // Compute the escape information |
|
350 bool compute_escape(); |
|
351 |
356 |
352 // escape state of a node |
357 // escape state of a node |
353 PointsToNode::EscapeState escape_state(Node *n); |
358 PointsToNode::EscapeState escape_state(Node *n); |
354 |
359 |
355 // other information we have collected |
360 // other information we have collected |