Mercurial > hg > graal-compiler
annotate src/share/vm/opto/escape.hpp @ 21814:5f07d936a14e
8058982: Better verification of an exceptional invokespecial
Summary: Throw VerifyError for illegal accesses
Reviewed-by: acorn, ahgross, coleenp
author | hseigel |
---|---|
date | Mon, 20 Oct 2014 15:14:56 -0400 |
parents | 7eca5de9e0b6 |
children | 90297adbda9d |
rev | line source |
---|---|
0 | 1 /* |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
2 * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1101
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1101
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1101
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 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 | |
0 | 32 // |
33 // Adaptation for C2 of the escape analysis algorithm described in: | |
34 // | |
65 | 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 | |
0 | 39 // |
40 // The flow-insensitive analysis described in the paper has been implemented. | |
41 // | |
65 | 42 // The analysis requires construction of a "connection graph" (CG) for |
43 // the method being analyzed. The nodes of the connection graph are: | |
0 | 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 // | |
65 | 51 // - PointsTo (-P>) {LV, OF} to JO |
52 // - Deferred (-D>) from {LV, OF} to {LV, OF} | |
0 | 53 // - Field (-F>) from JO to OF |
54 // | |
55 // The following utility functions is used by the algorithm: | |
56 // | |
65 | 57 // PointsTo(n) - n is any CG node, it returns the set of JO that n could |
58 // point to. | |
0 | 59 // |
65 | 60 // The algorithm describes how to construct the connection graph |
61 // in the following 4 cases: | |
0 | 62 // |
63 // Case Edges Created | |
64 // | |
65 | 65 // (1) p = new T() LV -P> JO |
66 // (2) p = q LV -D> LV | |
67 // (3) p.f = q JO -F> OF, OF -D> LV | |
68 // (4) p = q.f JO -F> OF, LV -D> OF | |
0 | 69 // |
65 | 70 // In all these cases, p and q are local variables. For static field |
71 // references, we can construct a local variable containing a reference | |
72 // to the static memory. | |
0 | 73 // |
74 // C2 does not have local variables. However for the purposes of constructing | |
75 // the connection graph, the following IR nodes are treated as local variables: | |
76 // Phi (pointer values) | |
4058
59e515ee9354
7059047: EA: can't find initializing store with several CheckCastPP
kvn
parents:
2249
diff
changeset
|
77 // LoadP, LoadN |
65 | 78 // Proj#5 (value returned from callnodes including allocations) |
79 // CheckCastPP, CastPP | |
0 | 80 // |
65 | 81 // The LoadP, Proj and CheckCastPP behave like variables assigned to only once. |
82 // Only a Phi can have multiple assignments. Each input to a Phi is treated | |
0 | 83 // as an assignment to it. |
84 // | |
65 | 85 // The following node types are JavaObject: |
0 | 86 // |
4058
59e515ee9354
7059047: EA: can't find initializing store with several CheckCastPP
kvn
parents:
2249
diff
changeset
|
87 // phantom_object (general globally escaped object) |
0 | 88 // Allocate |
89 // AllocateArray | |
90 // Parm (for incoming arguments) | |
65 | 91 // CastX2P ("unsafe" operations) |
0 | 92 // CreateEx |
93 // ConP | |
94 // LoadKlass | |
65 | 95 // ThreadLocal |
4058
59e515ee9354
7059047: EA: can't find initializing store with several CheckCastPP
kvn
parents:
2249
diff
changeset
|
96 // CallStaticJava (which returns Object) |
0 | 97 // |
98 // AddP nodes are fields. | |
99 // | |
100 // After building the graph, a pass is made over the nodes, deleting deferred | |
101 // nodes and copying the edges from the target of the deferred edge to the | |
102 // source. This results in a graph with no deferred edges, only: | |
103 // | |
104 // LV -P> JO | |
65 | 105 // OF -P> JO (the object whose oop is stored in the field) |
0 | 106 // JO -F> OF |
107 // | |
108 // Then, for each node which is GlobalEscape, anything it could point to | |
109 // is marked GlobalEscape. Finally, for any node marked ArgEscape, anything | |
110 // it could point to is marked ArgEscape. | |
111 // | |
112 | |
113 class Compile; | |
114 class Node; | |
115 class CallNode; | |
116 class PhiNode; | |
117 class PhaseTransform; | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
118 class PointsToNode; |
0 | 119 class Type; |
120 class TypePtr; | |
121 class VectorSet; | |
122 | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
123 class JavaObjectNode; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
124 class LocalVarNode; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
125 class FieldNode; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
126 class ArraycopyNode; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
127 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
128 // ConnectionGraph nodes |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
129 class PointsToNode : public ResourceObj { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
130 GrowableArray<PointsToNode*> _edges; // List of nodes this node points to |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
131 GrowableArray<PointsToNode*> _uses; // List of nodes which point to this node |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
132 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
133 const u1 _type; // NodeType |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
134 u1 _flags; // NodeFlags |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
135 u1 _escape; // EscapeState of object |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
136 u1 _fields_escape; // EscapeState of object's fields |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
137 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
138 Node* const _node; // Ideal node corresponding to this PointsTo node. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
139 const int _idx; // Cached ideal node's _idx |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
140 |
0 | 141 public: |
142 typedef enum { | |
65 | 143 UnknownType = 0, |
144 JavaObject = 1, | |
145 LocalVar = 2, | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
146 Field = 3, |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
147 Arraycopy = 4 |
0 | 148 } NodeType; |
149 | |
150 typedef enum { | |
151 UnknownEscape = 0, | |
4058
59e515ee9354
7059047: EA: can't find initializing store with several CheckCastPP
kvn
parents:
2249
diff
changeset
|
152 NoEscape = 1, // An object does not escape method or thread and it is |
59e515ee9354
7059047: EA: can't find initializing store with several CheckCastPP
kvn
parents:
2249
diff
changeset
|
153 // not passed to call. It could be replaced with scalar. |
59e515ee9354
7059047: EA: can't find initializing store with several CheckCastPP
kvn
parents:
2249
diff
changeset
|
154 ArgEscape = 2, // An object does not escape method or thread but it is |
59e515ee9354
7059047: EA: can't find initializing store with several CheckCastPP
kvn
parents:
2249
diff
changeset
|
155 // passed as argument to call or referenced by argument |
59e515ee9354
7059047: EA: can't find initializing store with several CheckCastPP
kvn
parents:
2249
diff
changeset
|
156 // and it does not escape during call. |
59e515ee9354
7059047: EA: can't find initializing store with several CheckCastPP
kvn
parents:
2249
diff
changeset
|
157 GlobalEscape = 3 // An object escapes the method or thread. |
0 | 158 } EscapeState; |
159 | |
160 typedef enum { | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
161 ScalarReplaceable = 1, // Not escaped object could be replaced with scalar |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
162 PointsToUnknown = 2, // Has edge to phantom_object |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
163 ArraycopySrc = 4, // Has edge from Arraycopy node |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
164 ArraycopyDst = 8 // Has edge to Arraycopy node |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
165 } NodeFlags; |
0 | 166 |
167 | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
168 PointsToNode(Compile *C, Node* n, EscapeState es, NodeType type): |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
169 _edges(C->comp_arena(), 2, 0, NULL), |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
170 _uses (C->comp_arena(), 2, 0, NULL), |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
171 _node(n), |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
172 _idx(n->_idx), |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
173 _type((u1)type), |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
174 _escape((u1)es), |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
175 _fields_escape((u1)es), |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
176 _flags(ScalarReplaceable) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
177 assert(n != NULL && es != UnknownEscape, "sanity"); |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
101
diff
changeset
|
178 } |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
101
diff
changeset
|
179 |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
180 Node* ideal_node() const { return _node; } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
181 int idx() const { return _idx; } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
182 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
183 bool is_JavaObject() const { return _type == (u1)JavaObject; } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
184 bool is_LocalVar() const { return _type == (u1)LocalVar; } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
185 bool is_Field() const { return _type == (u1)Field; } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
186 bool is_Arraycopy() const { return _type == (u1)Arraycopy; } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
187 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
188 JavaObjectNode* as_JavaObject() { assert(is_JavaObject(),""); return (JavaObjectNode*)this; } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
189 LocalVarNode* as_LocalVar() { assert(is_LocalVar(),""); return (LocalVarNode*)this; } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
190 FieldNode* as_Field() { assert(is_Field(),""); return (FieldNode*)this; } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
191 ArraycopyNode* as_Arraycopy() { assert(is_Arraycopy(),""); return (ArraycopyNode*)this; } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
192 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
193 EscapeState escape_state() const { return (EscapeState)_escape; } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
194 void set_escape_state(EscapeState state) { _escape = (u1)state; } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
195 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
196 EscapeState fields_escape_state() const { return (EscapeState)_fields_escape; } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
197 void set_fields_escape_state(EscapeState state) { _fields_escape = (u1)state; } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
198 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
199 bool has_unknown_ptr() const { return (_flags & PointsToUnknown) != 0; } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
200 void set_has_unknown_ptr() { _flags |= PointsToUnknown; } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
201 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
202 bool arraycopy_src() const { return (_flags & ArraycopySrc) != 0; } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
203 void set_arraycopy_src() { _flags |= ArraycopySrc; } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
204 bool arraycopy_dst() const { return (_flags & ArraycopyDst) != 0; } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
205 void set_arraycopy_dst() { _flags |= ArraycopyDst; } |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
101
diff
changeset
|
206 |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
207 bool scalar_replaceable() const { return (_flags & ScalarReplaceable) != 0;} |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
208 void set_scalar_replaceable(bool v) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
209 if (v) |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
210 _flags |= ScalarReplaceable; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
211 else |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
212 _flags &= ~ScalarReplaceable; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
213 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
214 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
215 int edge_count() const { return _edges.length(); } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
216 PointsToNode* edge(int e) const { return _edges.at(e); } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
217 bool add_edge(PointsToNode* edge) { return _edges.append_if_missing(edge); } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
218 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
219 int use_count() const { return _uses.length(); } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
220 PointsToNode* use(int e) const { return _uses.at(e); } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
221 bool add_use(PointsToNode* use) { return _uses.append_if_missing(use); } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
222 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
223 // Mark base edge use to distinguish from stored value edge. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
224 bool add_base_use(FieldNode* use) { return _uses.append_if_missing((PointsToNode*)((intptr_t)use + 1)); } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
225 static bool is_base_use(PointsToNode* use) { return (((intptr_t)use) & 1); } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
226 static PointsToNode* get_use_node(PointsToNode* use) { return (PointsToNode*)(((intptr_t)use) & ~1); } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
227 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
228 // Return true if this node points to specified node or nodes it points to. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
229 bool points_to(JavaObjectNode* ptn) const; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
230 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
231 // Return true if this node points only to non-escaping allocations. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
232 bool non_escaping_allocation(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
233 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
234 // Return true if one node points to an other. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
235 bool meet(PointsToNode* ptn); |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
101
diff
changeset
|
236 |
0 | 237 #ifndef PRODUCT |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
238 NodeType node_type() const { return (NodeType)_type;} |
253
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
245
diff
changeset
|
239 void dump(bool print_state=true) const; |
0 | 240 #endif |
241 | |
242 }; | |
243 | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
244 class LocalVarNode: public PointsToNode { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
245 public: |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
246 LocalVarNode(Compile *C, Node* n, EscapeState es): |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
247 PointsToNode(C, n, es, LocalVar) {} |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
248 }; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
249 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
250 class JavaObjectNode: public PointsToNode { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
251 public: |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
252 JavaObjectNode(Compile *C, Node* n, EscapeState es): |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
253 PointsToNode(C, n, es, JavaObject) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
254 if (es > NoEscape) |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
255 set_scalar_replaceable(false); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
256 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
257 }; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
258 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
259 class FieldNode: public PointsToNode { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
260 GrowableArray<PointsToNode*> _bases; // List of JavaObject nodes which point to this node |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
261 const int _offset; // Field's offset. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
262 const bool _is_oop; // Field points to object |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
263 bool _has_unknown_base; // Has phantom_object base |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
264 public: |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
265 FieldNode(Compile *C, Node* n, EscapeState es, int offs, bool is_oop): |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
266 PointsToNode(C, n, es, Field), |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
267 _offset(offs), _is_oop(is_oop), |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
268 _has_unknown_base(false) {} |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
269 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
270 int offset() const { return _offset;} |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
271 bool is_oop() const { return _is_oop;} |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
272 bool has_unknown_base() const { return _has_unknown_base; } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
273 void set_has_unknown_base() { _has_unknown_base = true; } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
274 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
275 int base_count() const { return _bases.length(); } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
276 PointsToNode* base(int e) const { return _bases.at(e); } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
277 bool add_base(PointsToNode* base) { return _bases.append_if_missing(base); } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
278 #ifdef ASSERT |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
279 // Return true if bases points to this java object. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
280 bool has_base(JavaObjectNode* ptn) const; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
281 #endif |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
282 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
283 }; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
284 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
285 class ArraycopyNode: public PointsToNode { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
286 public: |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
287 ArraycopyNode(Compile *C, Node* n, EscapeState es): |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
288 PointsToNode(C, n, es, Arraycopy) {} |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
289 }; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
290 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
291 // Iterators for PointsTo node's edges: |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
292 // for (EdgeIterator i(n); i.has_next(); i.next()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
293 // PointsToNode* u = i.get(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
294 class PointsToIterator: public StackObj { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
295 protected: |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
296 const PointsToNode* node; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
297 const int cnt; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
298 int i; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
299 public: |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
300 inline PointsToIterator(const PointsToNode* n, int cnt) : node(n), cnt(cnt), i(0) { } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
301 inline bool has_next() const { return i < cnt; } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
302 inline void next() { i++; } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
303 PointsToNode* get() const { ShouldNotCallThis(); return NULL; } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
304 }; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
305 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
306 class EdgeIterator: public PointsToIterator { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
307 public: |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
308 inline EdgeIterator(const PointsToNode* n) : PointsToIterator(n, n->edge_count()) { } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
309 inline PointsToNode* get() const { return node->edge(i); } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
310 }; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
311 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
312 class UseIterator: public PointsToIterator { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
313 public: |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
314 inline UseIterator(const PointsToNode* n) : PointsToIterator(n, n->use_count()) { } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
315 inline PointsToNode* get() const { return node->use(i); } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
316 }; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
317 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
318 class BaseIterator: public PointsToIterator { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
319 public: |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
320 inline BaseIterator(const FieldNode* n) : PointsToIterator(n, n->base_count()) { } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
321 inline PointsToNode* get() const { return ((PointsToNode*)node)->as_Field()->base(i); } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
322 }; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
323 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
324 |
0 | 325 class ConnectionGraph: public ResourceObj { |
326 private: | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
327 GrowableArray<PointsToNode*> _nodes; // Map from ideal nodes to |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
328 // ConnectionGraph nodes. |
65 | 329 |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
330 GrowableArray<PointsToNode*> _worklist; // Nodes to be processed |
1100
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
293
diff
changeset
|
331 |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
332 bool _collecting; // Indicates whether escape information |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
333 // is still being collected. If false, |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
334 // no new nodes will be processed. |
65 | 335 |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
336 bool _verify; // verify graph |
1921 | 337 |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
338 JavaObjectNode* phantom_obj; // Unknown object |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
339 JavaObjectNode* null_obj; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
340 Node* _pcmp_neq; // ConI(#CC_GT) |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
341 Node* _pcmp_eq; // ConI(#CC_EQ) |
65 | 342 |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
343 Compile* _compile; // Compile object for current compilation |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
344 PhaseIterGVN* _igvn; // Value numbering |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
345 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
346 Unique_Node_List ideal_nodes; // Used by CG construction and types splitting. |
0 | 347 |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
101
diff
changeset
|
348 // Address of an element in _nodes. Used when the element is to be modified |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
349 PointsToNode* ptnode_adr(int idx) const { |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
101
diff
changeset
|
350 // There should be no new ideal nodes during ConnectionGraph build, |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
351 // growableArray::at() will throw assert otherwise. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
352 return _nodes.at(idx); |
0 | 353 } |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
101
diff
changeset
|
354 uint nodes_size() const { return _nodes.length(); } |
0 | 355 |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
356 // Add nodes to ConnectionGraph. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
357 void add_local_var(Node* n, PointsToNode::EscapeState es); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
358 void add_java_object(Node* n, PointsToNode::EscapeState es); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
359 void add_field(Node* n, PointsToNode::EscapeState es, int offset); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
360 void add_arraycopy(Node* n, PointsToNode::EscapeState es, PointsToNode* src, PointsToNode* dst); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
361 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
362 // Compute the escape state for arguments to a call. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
363 void process_call_arguments(CallNode *call); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
364 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
365 // Add PointsToNode node corresponding to a call |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
366 void add_call_node(CallNode* call); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
367 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
368 // Map ideal node to existing PointsTo node (usually phantom_object). |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
369 void map_ideal_node(Node *n, PointsToNode* ptn) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
370 assert(ptn != NULL, "only existing PointsTo node"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
371 _nodes.at_put(n->_idx, ptn); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
372 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
373 |
6795
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6266
diff
changeset
|
374 // Utility function for nodes that load an object |
7eca5de9e0b6
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
6266
diff
changeset
|
375 void add_objload_to_connection_graph(Node *n, Unique_Node_List *delayed_worklist); |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
376 // Create PointsToNode node and add it to Connection Graph. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
377 void add_node_to_connection_graph(Node *n, Unique_Node_List *delayed_worklist); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
378 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
379 // Add final simple edges to graph. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
380 void add_final_edges(Node *n); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
381 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
382 // Finish Graph construction. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
383 bool complete_connection_graph(GrowableArray<PointsToNode*>& ptnodes_worklist, |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
384 GrowableArray<JavaObjectNode*>& non_escaped_worklist, |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
385 GrowableArray<JavaObjectNode*>& java_objects_worklist, |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
386 GrowableArray<FieldNode*>& oop_fields_worklist); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
387 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
388 #ifdef ASSERT |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
389 void verify_connection_graph(GrowableArray<PointsToNode*>& ptnodes_worklist, |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
390 GrowableArray<JavaObjectNode*>& non_escaped_worklist, |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
391 GrowableArray<JavaObjectNode*>& java_objects_worklist, |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
392 GrowableArray<Node*>& addp_worklist); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
393 #endif |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
394 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
395 // Add all references to this JavaObject node. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
396 int add_java_object_edges(JavaObjectNode* jobj, bool populate_worklist); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
397 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
398 // Put node on worklist if it is (or was) not there. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
399 void add_to_worklist(PointsToNode* pt) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
400 _worklist.push(pt); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
401 return; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
402 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
403 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
404 // Put on worklist all uses of this node. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
405 void add_uses_to_worklist(PointsToNode* pt) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
406 for (UseIterator i(pt); i.has_next(); i.next()) |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
407 _worklist.push(i.get()); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
408 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
409 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
410 // Put on worklist all field's uses and related field nodes. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
411 void add_field_uses_to_worklist(FieldNode* field); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
412 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
413 // Put on worklist all related field nodes. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
414 void add_fields_to_worklist(FieldNode* field, PointsToNode* base); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
415 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
416 // Find fields which have unknown value. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
417 int find_field_value(FieldNode* field); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
418 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
419 // Find fields initializing values for allocations. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
420 int find_init_values(JavaObjectNode* ptn, PointsToNode* init_val, PhaseTransform* phase); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
421 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
422 // Set the escape state of an object and its fields. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
423 void set_escape_state(PointsToNode* ptn, PointsToNode::EscapeState esc) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
424 // Don't change non-escaping state of NULL pointer. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
425 if (ptn != null_obj) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
426 if (ptn->escape_state() < esc) |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
427 ptn->set_escape_state(esc); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
428 if (ptn->fields_escape_state() < esc) |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
429 ptn->set_fields_escape_state(esc); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
430 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
431 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
432 void set_fields_escape_state(PointsToNode* ptn, PointsToNode::EscapeState esc) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
433 // Don't change non-escaping state of NULL pointer. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
434 if (ptn != null_obj) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
435 if (ptn->fields_escape_state() < esc) |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
436 ptn->set_fields_escape_state(esc); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
437 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
438 } |
4122
cc81b9c09bbb
7112478: after 7105605 JRuby bench_define_method_methods.rb fails with NPE
kvn
parents:
4113
diff
changeset
|
439 |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
440 // Propagate GlobalEscape and ArgEscape escape states to all nodes |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
441 // and check that we still have non-escaping java objects. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
442 bool find_non_escaped_objects(GrowableArray<PointsToNode*>& ptnodes_worklist, |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
443 GrowableArray<JavaObjectNode*>& non_escaped_worklist); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
444 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
445 // Adjust scalar_replaceable state after Connection Graph is built. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
446 void adjust_scalar_replaceable_state(JavaObjectNode* jobj); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
447 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
448 // Optimize ideal graph. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
449 void optimize_ideal_graph(GrowableArray<Node*>& ptr_cmp_worklist, |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
450 GrowableArray<Node*>& storestore_worklist); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
451 // Optimize objects compare. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
452 Node* optimize_ptr_compare(Node* n); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
453 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
454 // Returns unique corresponding java object or NULL. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
455 JavaObjectNode* unique_java_object(Node *n); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
456 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
457 // Add an edge of the specified type pointing to the specified target. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
458 bool add_edge(PointsToNode* from, PointsToNode* to) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
459 assert(!from->is_Field() || from->as_Field()->is_oop(), "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
460 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
461 if (to == phantom_obj) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
462 if (from->has_unknown_ptr()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
463 return false; // already points to phantom_obj |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
464 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
465 from->set_has_unknown_ptr(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
466 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
467 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
468 bool is_new = from->add_edge(to); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
469 assert(to != phantom_obj || is_new, "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
470 if (is_new) { // New edge? |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
471 assert(!_verify, "graph is incomplete"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
472 is_new = to->add_use(from); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
473 assert(is_new, "use should be also new"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
474 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
475 return is_new; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
476 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
477 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
478 // Add an edge from Field node to its base and back. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
479 bool add_base(FieldNode* from, PointsToNode* to) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
480 assert(!to->is_Arraycopy(), "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
481 if (to == phantom_obj) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
482 if (from->has_unknown_base()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
483 return false; // already has phantom_obj base |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
484 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
485 from->set_has_unknown_base(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
486 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
487 bool is_new = from->add_base(to); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
488 assert(to != phantom_obj || is_new, "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
489 if (is_new) { // New edge? |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
490 assert(!_verify, "graph is incomplete"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
491 if (to == null_obj) |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
492 return is_new; // Don't add fields to NULL pointer. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
493 if (to->is_JavaObject()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
494 is_new = to->add_edge(from); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
495 } else { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
496 is_new = to->add_base_use(from); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
497 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
498 assert(is_new, "use should be also new"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
499 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
500 return is_new; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
501 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
502 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
503 // Add LocalVar node and edge if possible |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
504 void add_local_var_and_edge(Node* n, PointsToNode::EscapeState es, Node* to, |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
505 Unique_Node_List *delayed_worklist) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
506 PointsToNode* ptn = ptnode_adr(to->_idx); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
507 if (delayed_worklist != NULL) { // First iteration of CG construction |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
508 add_local_var(n, es); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
509 if (ptn == NULL) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
510 delayed_worklist->push(n); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
511 return; // Process it later. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
512 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
513 } else { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
514 assert(ptn != NULL, "node should be registered"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
515 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
516 add_edge(ptnode_adr(n->_idx), ptn); |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
5948
diff
changeset
|
517 } |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
518 // Helper functions |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
5948
diff
changeset
|
519 bool is_oop_field(Node* n, int offset, bool* unsafe); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
5948
diff
changeset
|
520 static Node* get_addp_base(Node *addp); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
5948
diff
changeset
|
521 static Node* find_second_addp(Node* addp, Node* n); |
0 | 522 // offset of a field reference |
65 | 523 int address_offset(Node* adr, PhaseTransform *phase); |
0 | 524 |
525 | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
526 // Propagate unique types created for unescaped allocated objects |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
527 // through the graph |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
528 void split_unique_types(GrowableArray<Node *> &alloc_worklist); |
0 | 529 |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
530 // Helper methods for unique types split. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
531 bool split_AddP(Node *addp, Node *base); |
0 | 532 |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
533 PhiNode *create_split_phi(PhiNode *orig_phi, int alias_idx, GrowableArray<PhiNode *> &orig_phi_worklist, bool &new_created); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
534 PhiNode *split_memory_phi(PhiNode *orig_phi, int alias_idx, GrowableArray<PhiNode *> &orig_phi_worklist); |
0 | 535 |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
536 void move_inst_mem(Node* n, GrowableArray<PhiNode *> &orig_phis); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
537 Node* find_inst_mem(Node* mem, int alias_idx,GrowableArray<PhiNode *> &orig_phi_worklist); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
538 Node* step_through_mergemem(MergeMemNode *mmem, int alias_idx, const TypeOopPtr *toop); |
0 | 539 |
540 | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
541 GrowableArray<MergeMemNode*> _mergemem_worklist; // List of all MergeMem nodes |
0 | 542 |
543 Node_Array _node_map; // used for bookeeping during type splitting | |
544 // Used for the following purposes: | |
545 // Memory Phi - most recent unique Phi split out | |
546 // from this Phi | |
547 // MemNode - new memory input for this node | |
548 // ChecCastPP - allocation that this is a cast of | |
549 // allocation - CheckCastPP of the allocation | |
550 | |
551 // manage entries in _node_map | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
552 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
553 void set_map(Node* from, Node* to) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
554 ideal_nodes.push(from); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
555 _node_map.map(from->_idx, to); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
556 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
557 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
558 Node* get_map(int idx) { return _node_map[idx]; } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
559 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
560 PhiNode* get_map_phi(int idx) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
561 Node* phi = _node_map[idx]; |
0 | 562 return (phi == NULL) ? NULL : phi->as_Phi(); |
563 } | |
564 | |
565 // Notify optimizer that a node has been modified | |
566 void record_for_optimizer(Node *n) { | |
1634
60a14ad85270
6966411: escape.cpp:450 assert(base->Opcode() == Op_ConP
kvn
parents:
1552
diff
changeset
|
567 _igvn->_worklist.push(n); |
4122
cc81b9c09bbb
7112478: after 7105605 JRuby bench_define_method_methods.rb fails with NPE
kvn
parents:
4113
diff
changeset
|
568 _igvn->add_users_to_worklist(n); |
0 | 569 } |
570 | |
2249 | 571 // Compute the escape information |
572 bool compute_escape(); | |
1100
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
293
diff
changeset
|
573 |
0 | 574 public: |
1634
60a14ad85270
6966411: escape.cpp:450 assert(base->Opcode() == Op_ConP
kvn
parents:
1552
diff
changeset
|
575 ConnectionGraph(Compile *C, PhaseIterGVN *igvn); |
0 | 576 |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
101
diff
changeset
|
577 // Check for non-escaping candidates |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
101
diff
changeset
|
578 static bool has_candidates(Compile *C); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
101
diff
changeset
|
579 |
1634
60a14ad85270
6966411: escape.cpp:450 assert(base->Opcode() == Op_ConP
kvn
parents:
1552
diff
changeset
|
580 // Perform escape analysis |
60a14ad85270
6966411: escape.cpp:450 assert(base->Opcode() == Op_ConP
kvn
parents:
1552
diff
changeset
|
581 static void do_analysis(Compile *C, PhaseIterGVN *igvn); |
60a14ad85270
6966411: escape.cpp:450 assert(base->Opcode() == Op_ConP
kvn
parents:
1552
diff
changeset
|
582 |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
583 bool not_global_escape(Node *n); |
1634
60a14ad85270
6966411: escape.cpp:450 assert(base->Opcode() == Op_ConP
kvn
parents:
1552
diff
changeset
|
584 |
0 | 585 #ifndef PRODUCT |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
4122
diff
changeset
|
586 void dump(GrowableArray<PointsToNode*>& ptnodes_worklist); |
0 | 587 #endif |
588 }; | |
1972 | 589 |
590 #endif // SHARE_VM_OPTO_ESCAPE_HPP |