1 /*
2 * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 //
26 // Adaptation for C2 of the escape analysis algorithm described in:
27 //
28 // [Choi99] Jong-Deok Shoi, Manish Gupta, Mauricio Seffano,
29 // Vugranam C. Sreedhar, Sam Midkiff,
30 // "Escape Analysis for Java", Procedings of ACM SIGPLAN
31 // OOPSLA Conference, November 1, 1999
32 //
33 // The flow-insensitive analysis described in the paper has been implemented.
34 //
35 // The analysis requires construction of a "connection graph" (CG) for
36 // the method being analyzed. The nodes of the connection graph are:
37 //
38 // - Java objects (JO)
39 // - Local variables (LV)
40 // - Fields of an object (OF), these also include array elements
41 //
42 // The CG contains 3 types of edges:
43 //
44 // - PointsTo (-P>) {LV, OF} to JO
337
338 // other information we have collected
339 bool is_scalar_replaceable(Node *n) {
340 if (_collecting || (n->_idx >= nodes_size()))
341 return false;
342 PointsToNode* ptn = ptnode_adr(n->_idx);
343 return ptn->escape_state() == PointsToNode::NoEscape && ptn->_scalar_replaceable;
344 }
345
346 bool hidden_alias(Node *n) {
347 if (_collecting || (n->_idx >= nodes_size()))
348 return true;
349 PointsToNode* ptn = ptnode_adr(n->_idx);
350 return (ptn->escape_state() != PointsToNode::NoEscape) || ptn->_hidden_alias;
351 }
352
353 #ifndef PRODUCT
354 void dump();
355 #endif
356 };
|
1 /*
2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_OPTO_ESCAPE_HPP
26 #define SHARE_VM_OPTO_ESCAPE_HPP
27
28 #include "opto/addnode.hpp"
29 #include "opto/node.hpp"
30 #include "utilities/growableArray.hpp"
31
32 //
33 // Adaptation for C2 of the escape analysis algorithm described in:
34 //
35 // [Choi99] Jong-Deok Shoi, Manish Gupta, Mauricio Seffano,
36 // Vugranam C. Sreedhar, Sam Midkiff,
37 // "Escape Analysis for Java", Procedings of ACM SIGPLAN
38 // OOPSLA Conference, November 1, 1999
39 //
40 // The flow-insensitive analysis described in the paper has been implemented.
41 //
42 // The analysis requires construction of a "connection graph" (CG) for
43 // the method being analyzed. The nodes of the connection graph are:
44 //
45 // - Java objects (JO)
46 // - Local variables (LV)
47 // - Fields of an object (OF), these also include array elements
48 //
49 // The CG contains 3 types of edges:
50 //
51 // - PointsTo (-P>) {LV, OF} to JO
344
345 // other information we have collected
346 bool is_scalar_replaceable(Node *n) {
347 if (_collecting || (n->_idx >= nodes_size()))
348 return false;
349 PointsToNode* ptn = ptnode_adr(n->_idx);
350 return ptn->escape_state() == PointsToNode::NoEscape && ptn->_scalar_replaceable;
351 }
352
353 bool hidden_alias(Node *n) {
354 if (_collecting || (n->_idx >= nodes_size()))
355 return true;
356 PointsToNode* ptn = ptnode_adr(n->_idx);
357 return (ptn->escape_state() != PointsToNode::NoEscape) || ptn->_hidden_alias;
358 }
359
360 #ifndef PRODUCT
361 void dump();
362 #endif
363 };
364
365 #endif // SHARE_VM_OPTO_ESCAPE_HPP
|