Mercurial > hg > graal-jvmci-8
annotate src/share/vm/opto/escape.cpp @ 247:02a35ad4adf8
6723160: Nightly failure: Error: meet not symmetric
Summary: Add missing _instance_id settings and other EA fixes.
Reviewed-by: rasbold
author | kvn |
---|---|
date | Wed, 16 Jul 2008 16:04:39 -0700 |
parents | 4a4c365f777d |
children | b0fe4deeb9fb |
rev | line source |
---|---|
0 | 1 /* |
196 | 2 * Copyright 2005-2008 Sun Microsystems, Inc. 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 * | |
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
20 * CA 95054 USA or visit www.sun.com if you need additional information or | |
21 * have any questions. | |
22 * | |
23 */ | |
24 | |
25 #include "incls/_precompiled.incl" | |
26 #include "incls/_escape.cpp.incl" | |
27 | |
28 void PointsToNode::add_edge(uint targIdx, PointsToNode::EdgeType et) { | |
29 uint v = (targIdx << EdgeShift) + ((uint) et); | |
30 if (_edges == NULL) { | |
31 Arena *a = Compile::current()->comp_arena(); | |
32 _edges = new(a) GrowableArray<uint>(a, INITIAL_EDGE_COUNT, 0, 0); | |
33 } | |
34 _edges->append_if_missing(v); | |
35 } | |
36 | |
37 void PointsToNode::remove_edge(uint targIdx, PointsToNode::EdgeType et) { | |
38 uint v = (targIdx << EdgeShift) + ((uint) et); | |
39 | |
40 _edges->remove(v); | |
41 } | |
42 | |
43 #ifndef PRODUCT | |
77 | 44 static const char *node_type_names[] = { |
0 | 45 "UnknownType", |
46 "JavaObject", | |
47 "LocalVar", | |
48 "Field" | |
49 }; | |
50 | |
77 | 51 static const char *esc_names[] = { |
0 | 52 "UnknownEscape", |
65 | 53 "NoEscape", |
54 "ArgEscape", | |
55 "GlobalEscape" | |
0 | 56 }; |
57 | |
77 | 58 static const char *edge_type_suffix[] = { |
0 | 59 "?", // UnknownEdge |
60 "P", // PointsToEdge | |
61 "D", // DeferredEdge | |
62 "F" // FieldEdge | |
63 }; | |
64 | |
65 void PointsToNode::dump() const { | |
66 NodeType nt = node_type(); | |
67 EscapeState es = escape_state(); | |
65 | 68 tty->print("%s %s %s [[", node_type_names[(int) nt], esc_names[(int) es], _scalar_replaceable ? "" : "NSR"); |
0 | 69 for (uint i = 0; i < edge_count(); i++) { |
70 tty->print(" %d%s", edge_target(i), edge_type_suffix[(int) edge_type(i)]); | |
71 } | |
72 tty->print("]] "); | |
73 if (_node == NULL) | |
74 tty->print_cr("<null>"); | |
75 else | |
76 _node->dump(); | |
77 } | |
78 #endif | |
79 | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
80 ConnectionGraph::ConnectionGraph(Compile * C) : |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
81 _nodes(C->comp_arena(), C->unique(), C->unique(), PointsToNode()), |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
82 _processed(C->comp_arena()), |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
83 _collecting(true), |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
84 _compile(C), |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
85 _node_map(C->comp_arena()) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
86 |
0 | 87 _phantom_object = C->top()->_idx; |
88 PointsToNode *phn = ptnode_adr(_phantom_object); | |
65 | 89 phn->_node = C->top(); |
0 | 90 phn->set_node_type(PointsToNode::JavaObject); |
91 phn->set_escape_state(PointsToNode::GlobalEscape); | |
92 } | |
93 | |
94 void ConnectionGraph::add_pointsto_edge(uint from_i, uint to_i) { | |
95 PointsToNode *f = ptnode_adr(from_i); | |
96 PointsToNode *t = ptnode_adr(to_i); | |
97 | |
98 assert(f->node_type() != PointsToNode::UnknownType && t->node_type() != PointsToNode::UnknownType, "node types must be set"); | |
99 assert(f->node_type() == PointsToNode::LocalVar || f->node_type() == PointsToNode::Field, "invalid source of PointsTo edge"); | |
100 assert(t->node_type() == PointsToNode::JavaObject, "invalid destination of PointsTo edge"); | |
101 f->add_edge(to_i, PointsToNode::PointsToEdge); | |
102 } | |
103 | |
104 void ConnectionGraph::add_deferred_edge(uint from_i, uint to_i) { | |
105 PointsToNode *f = ptnode_adr(from_i); | |
106 PointsToNode *t = ptnode_adr(to_i); | |
107 | |
108 assert(f->node_type() != PointsToNode::UnknownType && t->node_type() != PointsToNode::UnknownType, "node types must be set"); | |
109 assert(f->node_type() == PointsToNode::LocalVar || f->node_type() == PointsToNode::Field, "invalid source of Deferred edge"); | |
110 assert(t->node_type() == PointsToNode::LocalVar || t->node_type() == PointsToNode::Field, "invalid destination of Deferred edge"); | |
111 // don't add a self-referential edge, this can occur during removal of | |
112 // deferred edges | |
113 if (from_i != to_i) | |
114 f->add_edge(to_i, PointsToNode::DeferredEdge); | |
115 } | |
116 | |
65 | 117 int ConnectionGraph::address_offset(Node* adr, PhaseTransform *phase) { |
118 const Type *adr_type = phase->type(adr); | |
119 if (adr->is_AddP() && adr_type->isa_oopptr() == NULL && | |
120 adr->in(AddPNode::Address)->is_Proj() && | |
121 adr->in(AddPNode::Address)->in(0)->is_Allocate()) { | |
122 // We are computing a raw address for a store captured by an Initialize | |
123 // compute an appropriate address type. AddP cases #3 and #5 (see below). | |
124 int offs = (int)phase->find_intptr_t_con(adr->in(AddPNode::Offset), Type::OffsetBot); | |
125 assert(offs != Type::OffsetBot || | |
126 adr->in(AddPNode::Address)->in(0)->is_AllocateArray(), | |
127 "offset must be a constant or it is initialization of array"); | |
128 return offs; | |
129 } | |
130 const TypePtr *t_ptr = adr_type->isa_ptr(); | |
0 | 131 assert(t_ptr != NULL, "must be a pointer type"); |
132 return t_ptr->offset(); | |
133 } | |
134 | |
135 void ConnectionGraph::add_field_edge(uint from_i, uint to_i, int offset) { | |
136 PointsToNode *f = ptnode_adr(from_i); | |
137 PointsToNode *t = ptnode_adr(to_i); | |
138 | |
139 assert(f->node_type() != PointsToNode::UnknownType && t->node_type() != PointsToNode::UnknownType, "node types must be set"); | |
140 assert(f->node_type() == PointsToNode::JavaObject, "invalid destination of Field edge"); | |
141 assert(t->node_type() == PointsToNode::Field, "invalid destination of Field edge"); | |
142 assert (t->offset() == -1 || t->offset() == offset, "conflicting field offsets"); | |
143 t->set_offset(offset); | |
144 | |
145 f->add_edge(to_i, PointsToNode::FieldEdge); | |
146 } | |
147 | |
148 void ConnectionGraph::set_escape_state(uint ni, PointsToNode::EscapeState es) { | |
149 PointsToNode *npt = ptnode_adr(ni); | |
150 PointsToNode::EscapeState old_es = npt->escape_state(); | |
151 if (es > old_es) | |
152 npt->set_escape_state(es); | |
153 } | |
154 | |
65 | 155 void ConnectionGraph::add_node(Node *n, PointsToNode::NodeType nt, |
156 PointsToNode::EscapeState es, bool done) { | |
157 PointsToNode* ptadr = ptnode_adr(n->_idx); | |
158 ptadr->_node = n; | |
159 ptadr->set_node_type(nt); | |
160 | |
161 // inline set_escape_state(idx, es); | |
162 PointsToNode::EscapeState old_es = ptadr->escape_state(); | |
163 if (es > old_es) | |
164 ptadr->set_escape_state(es); | |
165 | |
166 if (done) | |
167 _processed.set(n->_idx); | |
168 } | |
169 | |
0 | 170 PointsToNode::EscapeState ConnectionGraph::escape_state(Node *n, PhaseTransform *phase) { |
171 uint idx = n->_idx; | |
172 PointsToNode::EscapeState es; | |
173 | |
65 | 174 // If we are still collecting or there were no non-escaping allocations |
175 // we don't know the answer yet | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
176 if (_collecting) |
0 | 177 return PointsToNode::UnknownEscape; |
178 | |
179 // if the node was created after the escape computation, return | |
180 // UnknownEscape | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
181 if (idx >= nodes_size()) |
0 | 182 return PointsToNode::UnknownEscape; |
183 | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
184 es = ptnode_adr(idx)->escape_state(); |
0 | 185 |
186 // if we have already computed a value, return it | |
187 if (es != PointsToNode::UnknownEscape) | |
188 return es; | |
189 | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
190 // PointsTo() calls n->uncast() which can return a new ideal node. |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
191 if (n->uncast()->_idx >= nodes_size()) |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
192 return PointsToNode::UnknownEscape; |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
193 |
0 | 194 // compute max escape state of anything this node could point to |
195 VectorSet ptset(Thread::current()->resource_area()); | |
196 PointsTo(ptset, n, phase); | |
65 | 197 for(VectorSetI i(&ptset); i.test() && es != PointsToNode::GlobalEscape; ++i) { |
0 | 198 uint pt = i.elem; |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
199 PointsToNode::EscapeState pes = ptnode_adr(pt)->escape_state(); |
0 | 200 if (pes > es) |
201 es = pes; | |
202 } | |
203 // cache the computed escape state | |
204 assert(es != PointsToNode::UnknownEscape, "should have computed an escape state"); | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
205 ptnode_adr(idx)->set_escape_state(es); |
0 | 206 return es; |
207 } | |
208 | |
209 void ConnectionGraph::PointsTo(VectorSet &ptset, Node * n, PhaseTransform *phase) { | |
210 VectorSet visited(Thread::current()->resource_area()); | |
211 GrowableArray<uint> worklist; | |
212 | |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
213 #ifdef ASSERT |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
214 Node *orig_n = n; |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
215 #endif |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
216 |
65 | 217 n = n->uncast(); |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
218 PointsToNode* npt = ptnode_adr(n->_idx); |
0 | 219 |
220 // If we have a JavaObject, return just that object | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
221 if (npt->node_type() == PointsToNode::JavaObject) { |
0 | 222 ptset.set(n->_idx); |
223 return; | |
224 } | |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
225 #ifdef ASSERT |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
226 if (npt->_node == NULL) { |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
227 if (orig_n != n) |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
228 orig_n->dump(); |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
229 n->dump(); |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
230 assert(npt->_node != NULL, "unregistered node"); |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
231 } |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
232 #endif |
0 | 233 worklist.push(n->_idx); |
234 while(worklist.length() > 0) { | |
235 int ni = worklist.pop(); | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
236 if (visited.test_set(ni)) |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
237 continue; |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
238 |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
239 PointsToNode* pn = ptnode_adr(ni); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
240 // ensure that all inputs of a Phi have been processed |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
241 assert(!_collecting || !pn->_node->is_Phi() || _processed.test(ni),""); |
0 | 242 |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
243 int edges_processed = 0; |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
244 uint e_cnt = pn->edge_count(); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
245 for (uint e = 0; e < e_cnt; e++) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
246 uint etgt = pn->edge_target(e); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
247 PointsToNode::EdgeType et = pn->edge_type(e); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
248 if (et == PointsToNode::PointsToEdge) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
249 ptset.set(etgt); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
250 edges_processed++; |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
251 } else if (et == PointsToNode::DeferredEdge) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
252 worklist.push(etgt); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
253 edges_processed++; |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
254 } else { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
255 assert(false,"neither PointsToEdge or DeferredEdge"); |
0 | 256 } |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
257 } |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
258 if (edges_processed == 0) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
259 // no deferred or pointsto edges found. Assume the value was set |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
260 // outside this method. Add the phantom object to the pointsto set. |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
261 ptset.set(_phantom_object); |
0 | 262 } |
263 } | |
264 } | |
265 | |
101
a6cb86dd209b
6681577: PIT: some VM tests fails with -XX:+AggressiveOpts in 6u5p b01
kvn
parents:
65
diff
changeset
|
266 void ConnectionGraph::remove_deferred(uint ni, GrowableArray<uint>* deferred_edges, VectorSet* visited) { |
a6cb86dd209b
6681577: PIT: some VM tests fails with -XX:+AggressiveOpts in 6u5p b01
kvn
parents:
65
diff
changeset
|
267 // This method is most expensive during ConnectionGraph construction. |
a6cb86dd209b
6681577: PIT: some VM tests fails with -XX:+AggressiveOpts in 6u5p b01
kvn
parents:
65
diff
changeset
|
268 // Reuse vectorSet and an additional growable array for deferred edges. |
a6cb86dd209b
6681577: PIT: some VM tests fails with -XX:+AggressiveOpts in 6u5p b01
kvn
parents:
65
diff
changeset
|
269 deferred_edges->clear(); |
a6cb86dd209b
6681577: PIT: some VM tests fails with -XX:+AggressiveOpts in 6u5p b01
kvn
parents:
65
diff
changeset
|
270 visited->Clear(); |
0 | 271 |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
272 visited->set(ni); |
0 | 273 PointsToNode *ptn = ptnode_adr(ni); |
274 | |
101
a6cb86dd209b
6681577: PIT: some VM tests fails with -XX:+AggressiveOpts in 6u5p b01
kvn
parents:
65
diff
changeset
|
275 // Mark current edges as visited and move deferred edges to separate array. |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
276 for (uint i = 0; i < ptn->edge_count(); ) { |
65 | 277 uint t = ptn->edge_target(i); |
101
a6cb86dd209b
6681577: PIT: some VM tests fails with -XX:+AggressiveOpts in 6u5p b01
kvn
parents:
65
diff
changeset
|
278 #ifdef ASSERT |
a6cb86dd209b
6681577: PIT: some VM tests fails with -XX:+AggressiveOpts in 6u5p b01
kvn
parents:
65
diff
changeset
|
279 assert(!visited->test_set(t), "expecting no duplications"); |
a6cb86dd209b
6681577: PIT: some VM tests fails with -XX:+AggressiveOpts in 6u5p b01
kvn
parents:
65
diff
changeset
|
280 #else |
a6cb86dd209b
6681577: PIT: some VM tests fails with -XX:+AggressiveOpts in 6u5p b01
kvn
parents:
65
diff
changeset
|
281 visited->set(t); |
a6cb86dd209b
6681577: PIT: some VM tests fails with -XX:+AggressiveOpts in 6u5p b01
kvn
parents:
65
diff
changeset
|
282 #endif |
a6cb86dd209b
6681577: PIT: some VM tests fails with -XX:+AggressiveOpts in 6u5p b01
kvn
parents:
65
diff
changeset
|
283 if (ptn->edge_type(i) == PointsToNode::DeferredEdge) { |
0 | 284 ptn->remove_edge(t, PointsToNode::DeferredEdge); |
101
a6cb86dd209b
6681577: PIT: some VM tests fails with -XX:+AggressiveOpts in 6u5p b01
kvn
parents:
65
diff
changeset
|
285 deferred_edges->append(t); |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
286 } else { |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
287 i++; |
101
a6cb86dd209b
6681577: PIT: some VM tests fails with -XX:+AggressiveOpts in 6u5p b01
kvn
parents:
65
diff
changeset
|
288 } |
a6cb86dd209b
6681577: PIT: some VM tests fails with -XX:+AggressiveOpts in 6u5p b01
kvn
parents:
65
diff
changeset
|
289 } |
a6cb86dd209b
6681577: PIT: some VM tests fails with -XX:+AggressiveOpts in 6u5p b01
kvn
parents:
65
diff
changeset
|
290 for (int next = 0; next < deferred_edges->length(); ++next) { |
a6cb86dd209b
6681577: PIT: some VM tests fails with -XX:+AggressiveOpts in 6u5p b01
kvn
parents:
65
diff
changeset
|
291 uint t = deferred_edges->at(next); |
a6cb86dd209b
6681577: PIT: some VM tests fails with -XX:+AggressiveOpts in 6u5p b01
kvn
parents:
65
diff
changeset
|
292 PointsToNode *ptt = ptnode_adr(t); |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
293 uint e_cnt = ptt->edge_count(); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
294 for (uint e = 0; e < e_cnt; e++) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
295 uint etgt = ptt->edge_target(e); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
296 if (visited->test_set(etgt)) |
101
a6cb86dd209b
6681577: PIT: some VM tests fails with -XX:+AggressiveOpts in 6u5p b01
kvn
parents:
65
diff
changeset
|
297 continue; |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
298 |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
299 PointsToNode::EdgeType et = ptt->edge_type(e); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
300 if (et == PointsToNode::PointsToEdge) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
301 add_pointsto_edge(ni, etgt); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
302 if(etgt == _phantom_object) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
303 // Special case - field set outside (globally escaping). |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
304 ptn->set_escape_state(PointsToNode::GlobalEscape); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
305 } |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
306 } else if (et == PointsToNode::DeferredEdge) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
307 deferred_edges->append(etgt); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
308 } else { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
309 assert(false,"invalid connection graph"); |
0 | 310 } |
311 } | |
312 } | |
313 } | |
314 | |
315 | |
316 // Add an edge to node given by "to_i" from any field of adr_i whose offset | |
317 // matches "offset" A deferred edge is added if to_i is a LocalVar, and | |
318 // a pointsto edge is added if it is a JavaObject | |
319 | |
320 void ConnectionGraph::add_edge_from_fields(uint adr_i, uint to_i, int offs) { | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
321 PointsToNode* an = ptnode_adr(adr_i); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
322 PointsToNode* to = ptnode_adr(to_i); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
323 bool deferred = (to->node_type() == PointsToNode::LocalVar); |
0 | 324 |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
325 for (uint fe = 0; fe < an->edge_count(); fe++) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
326 assert(an->edge_type(fe) == PointsToNode::FieldEdge, "expecting a field edge"); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
327 int fi = an->edge_target(fe); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
328 PointsToNode* pf = ptnode_adr(fi); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
329 int po = pf->offset(); |
0 | 330 if (po == offs || po == Type::OffsetBot || offs == Type::OffsetBot) { |
331 if (deferred) | |
332 add_deferred_edge(fi, to_i); | |
333 else | |
334 add_pointsto_edge(fi, to_i); | |
335 } | |
336 } | |
337 } | |
338 | |
65 | 339 // Add a deferred edge from node given by "from_i" to any field of adr_i |
340 // whose offset matches "offset". | |
0 | 341 void ConnectionGraph::add_deferred_edge_to_fields(uint from_i, uint adr_i, int offs) { |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
342 PointsToNode* an = ptnode_adr(adr_i); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
343 for (uint fe = 0; fe < an->edge_count(); fe++) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
344 assert(an->edge_type(fe) == PointsToNode::FieldEdge, "expecting a field edge"); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
345 int fi = an->edge_target(fe); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
346 PointsToNode* pf = ptnode_adr(fi); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
347 int po = pf->offset(); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
348 if (pf->edge_count() == 0) { |
0 | 349 // we have not seen any stores to this field, assume it was set outside this method |
350 add_pointsto_edge(fi, _phantom_object); | |
351 } | |
352 if (po == offs || po == Type::OffsetBot || offs == Type::OffsetBot) { | |
353 add_deferred_edge(from_i, fi); | |
354 } | |
355 } | |
356 } | |
357 | |
65 | 358 // Helper functions |
359 | |
360 static Node* get_addp_base(Node *addp) { | |
361 assert(addp->is_AddP(), "must be AddP"); | |
362 // | |
363 // AddP cases for Base and Address inputs: | |
364 // case #1. Direct object's field reference: | |
365 // Allocate | |
366 // | | |
367 // Proj #5 ( oop result ) | |
368 // | | |
369 // CheckCastPP (cast to instance type) | |
370 // | | | |
371 // AddP ( base == address ) | |
372 // | |
373 // case #2. Indirect object's field reference: | |
374 // Phi | |
375 // | | |
376 // CastPP (cast to instance type) | |
377 // | | | |
378 // AddP ( base == address ) | |
379 // | |
380 // case #3. Raw object's field reference for Initialize node: | |
381 // Allocate | |
382 // | | |
383 // Proj #5 ( oop result ) | |
384 // top | | |
385 // \ | | |
386 // AddP ( base == top ) | |
387 // | |
388 // case #4. Array's element reference: | |
389 // {CheckCastPP | CastPP} | |
390 // | | | | |
391 // | AddP ( array's element offset ) | |
392 // | | | |
393 // AddP ( array's offset ) | |
394 // | |
395 // case #5. Raw object's field reference for arraycopy stub call: | |
396 // The inline_native_clone() case when the arraycopy stub is called | |
397 // after the allocation before Initialize and CheckCastPP nodes. | |
398 // Allocate | |
399 // | | |
400 // Proj #5 ( oop result ) | |
401 // | | | |
402 // AddP ( base == address ) | |
403 // | |
77 | 404 // case #6. Constant Pool, ThreadLocal, CastX2P or |
405 // Raw object's field reference: | |
406 // {ConP, ThreadLocal, CastX2P, raw Load} | |
65 | 407 // top | |
408 // \ | | |
409 // AddP ( base == top ) | |
410 // | |
77 | 411 // case #7. Klass's field reference. |
412 // LoadKlass | |
413 // | | | |
414 // AddP ( base == address ) | |
415 // | |
164
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
416 // case #8. narrow Klass's field reference. |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
417 // LoadNKlass |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
418 // | |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
419 // DecodeN |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
420 // | | |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
421 // AddP ( base == address ) |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
422 // |
65 | 423 Node *base = addp->in(AddPNode::Base)->uncast(); |
424 if (base->is_top()) { // The AddP case #3 and #6. | |
425 base = addp->in(AddPNode::Address)->uncast(); | |
426 assert(base->Opcode() == Op_ConP || base->Opcode() == Op_ThreadLocal || | |
168
7793bd37a336
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
164
diff
changeset
|
427 base->Opcode() == Op_CastX2P || base->is_DecodeN() || |
77 | 428 (base->is_Mem() && base->bottom_type() == TypeRawPtr::NOTNULL) || |
429 (base->is_Proj() && base->in(0)->is_Allocate()), "sanity"); | |
0 | 430 } |
65 | 431 return base; |
432 } | |
433 | |
434 static Node* find_second_addp(Node* addp, Node* n) { | |
435 assert(addp->is_AddP() && addp->outcnt() > 0, "Don't process dead nodes"); | |
436 | |
437 Node* addp2 = addp->raw_out(0); | |
438 if (addp->outcnt() == 1 && addp2->is_AddP() && | |
439 addp2->in(AddPNode::Base) == n && | |
440 addp2->in(AddPNode::Address) == addp) { | |
441 | |
442 assert(addp->in(AddPNode::Base) == n, "expecting the same base"); | |
443 // | |
444 // Find array's offset to push it on worklist first and | |
445 // as result process an array's element offset first (pushed second) | |
446 // to avoid CastPP for the array's offset. | |
447 // Otherwise the inserted CastPP (LocalVar) will point to what | |
448 // the AddP (Field) points to. Which would be wrong since | |
449 // the algorithm expects the CastPP has the same point as | |
450 // as AddP's base CheckCastPP (LocalVar). | |
451 // | |
452 // ArrayAllocation | |
453 // | | |
454 // CheckCastPP | |
455 // | | |
456 // memProj (from ArrayAllocation CheckCastPP) | |
457 // | || | |
458 // | || Int (element index) | |
459 // | || | ConI (log(element size)) | |
460 // | || | / | |
461 // | || LShift | |
462 // | || / | |
463 // | AddP (array's element offset) | |
464 // | | | |
465 // | | ConI (array's offset: #12(32-bits) or #24(64-bits)) | |
466 // | / / | |
467 // AddP (array's offset) | |
468 // | | |
469 // Load/Store (memory operation on array's element) | |
470 // | |
471 return addp2; | |
472 } | |
473 return NULL; | |
0 | 474 } |
475 | |
476 // | |
477 // Adjust the type and inputs of an AddP which computes the | |
478 // address of a field of an instance | |
479 // | |
480 void ConnectionGraph::split_AddP(Node *addp, Node *base, PhaseGVN *igvn) { | |
65 | 481 const TypeOopPtr *base_t = igvn->type(base)->isa_oopptr(); |
223 | 482 assert(base_t != NULL && base_t->is_known_instance(), "expecting instance oopptr"); |
0 | 483 const TypeOopPtr *t = igvn->type(addp)->isa_oopptr(); |
65 | 484 if (t == NULL) { |
485 // We are computing a raw address for a store captured by an Initialize | |
486 // compute an appropriate address type. | |
487 assert(igvn->type(addp) == TypeRawPtr::NOTNULL, "must be raw pointer"); | |
488 assert(addp->in(AddPNode::Address)->is_Proj(), "base of raw address must be result projection from allocation"); | |
489 int offs = (int)igvn->find_intptr_t_con(addp->in(AddPNode::Offset), Type::OffsetBot); | |
490 assert(offs != Type::OffsetBot, "offset must be a constant"); | |
491 t = base_t->add_offset(offs)->is_oopptr(); | |
492 } | |
223 | 493 int inst_id = base_t->instance_id(); |
494 assert(!t->is_known_instance() || t->instance_id() == inst_id, | |
0 | 495 "old type must be non-instance or match new type"); |
496 const TypeOopPtr *tinst = base_t->add_offset(t->offset())->is_oopptr(); | |
65 | 497 // Do NOT remove the next call: ensure an new alias index is allocated |
498 // for the instance type | |
0 | 499 int alias_idx = _compile->get_alias_index(tinst); |
500 igvn->set_type(addp, tinst); | |
501 // record the allocation in the node map | |
502 set_map(addp->_idx, get_map(base->_idx)); | |
65 | 503 // if the Address input is not the appropriate instance type |
504 // (due to intervening casts,) insert a cast | |
0 | 505 Node *adr = addp->in(AddPNode::Address); |
506 const TypeOopPtr *atype = igvn->type(adr)->isa_oopptr(); | |
65 | 507 if (atype != NULL && atype->instance_id() != inst_id) { |
223 | 508 assert(!atype->is_known_instance(), "no conflicting instances"); |
0 | 509 const TypeOopPtr *new_atype = base_t->add_offset(atype->offset())->isa_oopptr(); |
510 Node *acast = new (_compile, 2) CastPPNode(adr, new_atype); | |
511 acast->set_req(0, adr->in(0)); | |
512 igvn->set_type(acast, new_atype); | |
513 record_for_optimizer(acast); | |
514 Node *bcast = acast; | |
515 Node *abase = addp->in(AddPNode::Base); | |
516 if (abase != adr) { | |
517 bcast = new (_compile, 2) CastPPNode(abase, base_t); | |
518 bcast->set_req(0, abase->in(0)); | |
519 igvn->set_type(bcast, base_t); | |
520 record_for_optimizer(bcast); | |
521 } | |
522 igvn->hash_delete(addp); | |
523 addp->set_req(AddPNode::Base, bcast); | |
524 addp->set_req(AddPNode::Address, acast); | |
525 igvn->hash_insert(addp); | |
526 } | |
65 | 527 // Put on IGVN worklist since at least addp's type was changed above. |
528 record_for_optimizer(addp); | |
0 | 529 } |
530 | |
531 // | |
532 // Create a new version of orig_phi if necessary. Returns either the newly | |
533 // created phi or an existing phi. Sets create_new to indicate wheter a new | |
534 // phi was created. Cache the last newly created phi in the node map. | |
535 // | |
536 PhiNode *ConnectionGraph::create_split_phi(PhiNode *orig_phi, int alias_idx, GrowableArray<PhiNode *> &orig_phi_worklist, PhaseGVN *igvn, bool &new_created) { | |
537 Compile *C = _compile; | |
538 new_created = false; | |
539 int phi_alias_idx = C->get_alias_index(orig_phi->adr_type()); | |
540 // nothing to do if orig_phi is bottom memory or matches alias_idx | |
65 | 541 if (phi_alias_idx == alias_idx) { |
0 | 542 return orig_phi; |
543 } | |
544 // have we already created a Phi for this alias index? | |
545 PhiNode *result = get_map_phi(orig_phi->_idx); | |
546 if (result != NULL && C->get_alias_index(result->adr_type()) == alias_idx) { | |
547 return result; | |
548 } | |
38
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
549 if ((int)C->unique() + 2*NodeLimitFudgeFactor > MaxNodeLimit) { |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
550 if (C->do_escape_analysis() == true && !C->failing()) { |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
551 // Retry compilation without escape analysis. |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
552 // If this is the first failure, the sentinel string will "stick" |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
553 // to the Compile object, and the C2Compiler will see it and retry. |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
554 C->record_failure(C2Compiler::retry_no_escape_analysis()); |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
555 } |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
556 return NULL; |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
557 } |
0 | 558 orig_phi_worklist.append_if_missing(orig_phi); |
65 | 559 const TypePtr *atype = C->get_adr_type(alias_idx); |
0 | 560 result = PhiNode::make(orig_phi->in(0), NULL, Type::MEMORY, atype); |
561 set_map_phi(orig_phi->_idx, result); | |
562 igvn->set_type(result, result->bottom_type()); | |
563 record_for_optimizer(result); | |
564 new_created = true; | |
565 return result; | |
566 } | |
567 | |
568 // | |
569 // Return a new version of Memory Phi "orig_phi" with the inputs having the | |
570 // specified alias index. | |
571 // | |
572 PhiNode *ConnectionGraph::split_memory_phi(PhiNode *orig_phi, int alias_idx, GrowableArray<PhiNode *> &orig_phi_worklist, PhaseGVN *igvn) { | |
573 | |
574 assert(alias_idx != Compile::AliasIdxBot, "can't split out bottom memory"); | |
575 Compile *C = _compile; | |
576 bool new_phi_created; | |
65 | 577 PhiNode *result = create_split_phi(orig_phi, alias_idx, orig_phi_worklist, igvn, new_phi_created); |
0 | 578 if (!new_phi_created) { |
579 return result; | |
580 } | |
581 | |
582 GrowableArray<PhiNode *> phi_list; | |
583 GrowableArray<uint> cur_input; | |
584 | |
585 PhiNode *phi = orig_phi; | |
586 uint idx = 1; | |
587 bool finished = false; | |
588 while(!finished) { | |
589 while (idx < phi->req()) { | |
65 | 590 Node *mem = find_inst_mem(phi->in(idx), alias_idx, orig_phi_worklist, igvn); |
0 | 591 if (mem != NULL && mem->is_Phi()) { |
65 | 592 PhiNode *newphi = create_split_phi(mem->as_Phi(), alias_idx, orig_phi_worklist, igvn, new_phi_created); |
0 | 593 if (new_phi_created) { |
594 // found an phi for which we created a new split, push current one on worklist and begin | |
595 // processing new one | |
596 phi_list.push(phi); | |
597 cur_input.push(idx); | |
598 phi = mem->as_Phi(); | |
65 | 599 result = newphi; |
0 | 600 idx = 1; |
601 continue; | |
602 } else { | |
65 | 603 mem = newphi; |
0 | 604 } |
605 } | |
38
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
606 if (C->failing()) { |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
607 return NULL; |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
608 } |
0 | 609 result->set_req(idx++, mem); |
610 } | |
611 #ifdef ASSERT | |
612 // verify that the new Phi has an input for each input of the original | |
613 assert( phi->req() == result->req(), "must have same number of inputs."); | |
614 assert( result->in(0) != NULL && result->in(0) == phi->in(0), "regions must match"); | |
65 | 615 #endif |
616 // Check if all new phi's inputs have specified alias index. | |
617 // Otherwise use old phi. | |
0 | 618 for (uint i = 1; i < phi->req(); i++) { |
65 | 619 Node* in = result->in(i); |
620 assert((phi->in(i) == NULL) == (in == NULL), "inputs must correspond."); | |
0 | 621 } |
622 // we have finished processing a Phi, see if there are any more to do | |
623 finished = (phi_list.length() == 0 ); | |
624 if (!finished) { | |
625 phi = phi_list.pop(); | |
626 idx = cur_input.pop(); | |
65 | 627 PhiNode *prev_result = get_map_phi(phi->_idx); |
628 prev_result->set_req(idx++, result); | |
629 result = prev_result; | |
0 | 630 } |
631 } | |
632 return result; | |
633 } | |
634 | |
65 | 635 |
636 // | |
637 // The next methods are derived from methods in MemNode. | |
638 // | |
639 static Node *step_through_mergemem(MergeMemNode *mmem, int alias_idx, const TypeOopPtr *tinst) { | |
640 Node *mem = mmem; | |
641 // TypeInstPtr::NOTNULL+any is an OOP with unknown offset - generally | |
642 // means an array I have not precisely typed yet. Do not do any | |
643 // alias stuff with it any time soon. | |
644 if( tinst->base() != Type::AnyPtr && | |
645 !(tinst->klass()->is_java_lang_Object() && | |
646 tinst->offset() == Type::OffsetBot) ) { | |
647 mem = mmem->memory_at(alias_idx); | |
648 // Update input if it is progress over what we have now | |
649 } | |
650 return mem; | |
651 } | |
652 | |
653 // | |
654 // Search memory chain of "mem" to find a MemNode whose address | |
655 // is the specified alias index. | |
656 // | |
657 Node* ConnectionGraph::find_inst_mem(Node *orig_mem, int alias_idx, GrowableArray<PhiNode *> &orig_phis, PhaseGVN *phase) { | |
658 if (orig_mem == NULL) | |
659 return orig_mem; | |
660 Compile* C = phase->C; | |
661 const TypeOopPtr *tinst = C->get_adr_type(alias_idx)->isa_oopptr(); | |
223 | 662 bool is_instance = (tinst != NULL) && tinst->is_known_instance(); |
65 | 663 Node *prev = NULL; |
664 Node *result = orig_mem; | |
665 while (prev != result) { | |
666 prev = result; | |
667 if (result->is_Mem()) { | |
668 MemNode *mem = result->as_Mem(); | |
669 const Type *at = phase->type(mem->in(MemNode::Address)); | |
670 if (at != Type::TOP) { | |
671 assert (at->isa_ptr() != NULL, "pointer type required."); | |
672 int idx = C->get_alias_index(at->is_ptr()); | |
673 if (idx == alias_idx) | |
674 break; | |
675 } | |
676 result = mem->in(MemNode::Memory); | |
677 } | |
678 if (!is_instance) | |
679 continue; // don't search further for non-instance types | |
680 // skip over a call which does not affect this memory slice | |
681 if (result->is_Proj() && result->as_Proj()->_con == TypeFunc::Memory) { | |
682 Node *proj_in = result->in(0); | |
683 if (proj_in->is_Call()) { | |
684 CallNode *call = proj_in->as_Call(); | |
685 if (!call->may_modify(tinst, phase)) { | |
686 result = call->in(TypeFunc::Memory); | |
687 } | |
688 } else if (proj_in->is_Initialize()) { | |
689 AllocateNode* alloc = proj_in->as_Initialize()->allocation(); | |
690 // Stop if this is the initialization for the object instance which | |
691 // which contains this memory slice, otherwise skip over it. | |
223 | 692 if (alloc == NULL || alloc->_idx != (uint)tinst->instance_id()) { |
65 | 693 result = proj_in->in(TypeFunc::Memory); |
694 } | |
695 } else if (proj_in->is_MemBar()) { | |
696 result = proj_in->in(TypeFunc::Memory); | |
697 } | |
698 } else if (result->is_MergeMem()) { | |
699 MergeMemNode *mmem = result->as_MergeMem(); | |
700 result = step_through_mergemem(mmem, alias_idx, tinst); | |
701 if (result == mmem->base_memory()) { | |
702 // Didn't find instance memory, search through general slice recursively. | |
703 result = mmem->memory_at(C->get_general_index(alias_idx)); | |
704 result = find_inst_mem(result, alias_idx, orig_phis, phase); | |
705 if (C->failing()) { | |
706 return NULL; | |
707 } | |
708 mmem->set_memory_at(alias_idx, result); | |
709 } | |
710 } else if (result->is_Phi() && | |
711 C->get_alias_index(result->as_Phi()->adr_type()) != alias_idx) { | |
712 Node *un = result->as_Phi()->unique_input(phase); | |
713 if (un != NULL) { | |
714 result = un; | |
715 } else { | |
716 break; | |
717 } | |
718 } | |
719 } | |
247 | 720 if (result->is_Phi()) { |
65 | 721 PhiNode *mphi = result->as_Phi(); |
722 assert(mphi->bottom_type() == Type::MEMORY, "memory phi required"); | |
723 const TypePtr *t = mphi->adr_type(); | |
724 if (C->get_alias_index(t) != alias_idx) { | |
247 | 725 // Create a new Phi with the specified alias index type. |
65 | 726 result = split_memory_phi(mphi, alias_idx, orig_phis, phase); |
247 | 727 } else if (!is_instance) { |
728 // Push all non-instance Phis on the orig_phis worklist to update inputs | |
729 // during Phase 4 if needed. | |
730 orig_phis.append_if_missing(mphi); | |
65 | 731 } |
732 } | |
733 // the result is either MemNode, PhiNode, InitializeNode. | |
734 return result; | |
735 } | |
736 | |
737 | |
0 | 738 // |
739 // Convert the types of unescaped object to instance types where possible, | |
740 // propagate the new type information through the graph, and update memory | |
741 // edges and MergeMem inputs to reflect the new type. | |
742 // | |
743 // We start with allocations (and calls which may be allocations) on alloc_worklist. | |
744 // The processing is done in 4 phases: | |
745 // | |
746 // Phase 1: Process possible allocations from alloc_worklist. Create instance | |
747 // types for the CheckCastPP for allocations where possible. | |
748 // Propagate the the new types through users as follows: | |
749 // casts and Phi: push users on alloc_worklist | |
750 // AddP: cast Base and Address inputs to the instance type | |
751 // push any AddP users on alloc_worklist and push any memnode | |
752 // users onto memnode_worklist. | |
753 // Phase 2: Process MemNode's from memnode_worklist. compute new address type and | |
754 // search the Memory chain for a store with the appropriate type | |
755 // address type. If a Phi is found, create a new version with | |
756 // the approriate memory slices from each of the Phi inputs. | |
757 // For stores, process the users as follows: | |
758 // MemNode: push on memnode_worklist | |
759 // MergeMem: push on mergemem_worklist | |
760 // Phase 3: Process MergeMem nodes from mergemem_worklist. Walk each memory slice | |
761 // moving the first node encountered of each instance type to the | |
762 // the input corresponding to its alias index. | |
763 // appropriate memory slice. | |
764 // Phase 4: Update the inputs of non-instance memory Phis and the Memory input of memnodes. | |
765 // | |
766 // In the following example, the CheckCastPP nodes are the cast of allocation | |
767 // results and the allocation of node 29 is unescaped and eligible to be an | |
768 // instance type. | |
769 // | |
770 // We start with: | |
771 // | |
772 // 7 Parm #memory | |
773 // 10 ConI "12" | |
774 // 19 CheckCastPP "Foo" | |
775 // 20 AddP _ 19 19 10 Foo+12 alias_index=4 | |
776 // 29 CheckCastPP "Foo" | |
777 // 30 AddP _ 29 29 10 Foo+12 alias_index=4 | |
778 // | |
779 // 40 StoreP 25 7 20 ... alias_index=4 | |
780 // 50 StoreP 35 40 30 ... alias_index=4 | |
781 // 60 StoreP 45 50 20 ... alias_index=4 | |
782 // 70 LoadP _ 60 30 ... alias_index=4 | |
783 // 80 Phi 75 50 60 Memory alias_index=4 | |
784 // 90 LoadP _ 80 30 ... alias_index=4 | |
785 // 100 LoadP _ 80 20 ... alias_index=4 | |
786 // | |
787 // | |
788 // Phase 1 creates an instance type for node 29 assigning it an instance id of 24 | |
789 // and creating a new alias index for node 30. This gives: | |
790 // | |
791 // 7 Parm #memory | |
792 // 10 ConI "12" | |
793 // 19 CheckCastPP "Foo" | |
794 // 20 AddP _ 19 19 10 Foo+12 alias_index=4 | |
795 // 29 CheckCastPP "Foo" iid=24 | |
796 // 30 AddP _ 29 29 10 Foo+12 alias_index=6 iid=24 | |
797 // | |
798 // 40 StoreP 25 7 20 ... alias_index=4 | |
799 // 50 StoreP 35 40 30 ... alias_index=6 | |
800 // 60 StoreP 45 50 20 ... alias_index=4 | |
801 // 70 LoadP _ 60 30 ... alias_index=6 | |
802 // 80 Phi 75 50 60 Memory alias_index=4 | |
803 // 90 LoadP _ 80 30 ... alias_index=6 | |
804 // 100 LoadP _ 80 20 ... alias_index=4 | |
805 // | |
806 // In phase 2, new memory inputs are computed for the loads and stores, | |
807 // And a new version of the phi is created. In phase 4, the inputs to | |
808 // node 80 are updated and then the memory nodes are updated with the | |
809 // values computed in phase 2. This results in: | |
810 // | |
811 // 7 Parm #memory | |
812 // 10 ConI "12" | |
813 // 19 CheckCastPP "Foo" | |
814 // 20 AddP _ 19 19 10 Foo+12 alias_index=4 | |
815 // 29 CheckCastPP "Foo" iid=24 | |
816 // 30 AddP _ 29 29 10 Foo+12 alias_index=6 iid=24 | |
817 // | |
818 // 40 StoreP 25 7 20 ... alias_index=4 | |
819 // 50 StoreP 35 7 30 ... alias_index=6 | |
820 // 60 StoreP 45 40 20 ... alias_index=4 | |
821 // 70 LoadP _ 50 30 ... alias_index=6 | |
822 // 80 Phi 75 40 60 Memory alias_index=4 | |
823 // 120 Phi 75 50 50 Memory alias_index=6 | |
824 // 90 LoadP _ 120 30 ... alias_index=6 | |
825 // 100 LoadP _ 80 20 ... alias_index=4 | |
826 // | |
827 void ConnectionGraph::split_unique_types(GrowableArray<Node *> &alloc_worklist) { | |
828 GrowableArray<Node *> memnode_worklist; | |
829 GrowableArray<Node *> mergemem_worklist; | |
830 GrowableArray<PhiNode *> orig_phis; | |
831 PhaseGVN *igvn = _compile->initial_gvn(); | |
832 uint new_index_start = (uint) _compile->num_alias_types(); | |
833 VectorSet visited(Thread::current()->resource_area()); | |
834 VectorSet ptset(Thread::current()->resource_area()); | |
835 | |
65 | 836 |
837 // Phase 1: Process possible allocations from alloc_worklist. | |
838 // Create instance types for the CheckCastPP for allocations where possible. | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
839 // |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
840 // (Note: don't forget to change the order of the second AddP node on |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
841 // the alloc_worklist if the order of the worklist processing is changed, |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
842 // see the comment in find_second_addp().) |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
843 // |
0 | 844 while (alloc_worklist.length() != 0) { |
845 Node *n = alloc_worklist.pop(); | |
846 uint ni = n->_idx; | |
65 | 847 const TypeOopPtr* tinst = NULL; |
0 | 848 if (n->is_Call()) { |
849 CallNode *alloc = n->as_Call(); | |
850 // copy escape information to call node | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
851 PointsToNode* ptn = ptnode_adr(alloc->_idx); |
0 | 852 PointsToNode::EscapeState es = escape_state(alloc, igvn); |
65 | 853 // We have an allocation or call which returns a Java object, |
854 // see if it is unescaped. | |
855 if (es != PointsToNode::NoEscape || !ptn->_scalar_replaceable) | |
0 | 856 continue; |
39
76256d272075
6667612: (Escape Analysis) disable loop cloning if it has a scalar replaceable allocation
kvn
parents:
38
diff
changeset
|
857 if (alloc->is_Allocate()) { |
76256d272075
6667612: (Escape Analysis) disable loop cloning if it has a scalar replaceable allocation
kvn
parents:
38
diff
changeset
|
858 // Set the scalar_replaceable flag before the next check. |
76256d272075
6667612: (Escape Analysis) disable loop cloning if it has a scalar replaceable allocation
kvn
parents:
38
diff
changeset
|
859 alloc->as_Allocate()->_is_scalar_replaceable = true; |
76256d272075
6667612: (Escape Analysis) disable loop cloning if it has a scalar replaceable allocation
kvn
parents:
38
diff
changeset
|
860 } |
65 | 861 // find CheckCastPP of call return value |
862 n = alloc->result_cast(); | |
863 if (n == NULL || // No uses accept Initialize or | |
864 !n->is_CheckCastPP()) // not unique CheckCastPP. | |
865 continue; | |
866 // The inline code for Object.clone() casts the allocation result to | |
247 | 867 // java.lang.Object and then to the actual type of the allocated |
65 | 868 // object. Detect this case and use the second cast. |
247 | 869 // Also detect j.l.reflect.Array.newInstance(jobject, jint) case when |
870 // the allocation result is cast to java.lang.Object and then | |
871 // to the actual Array type. | |
65 | 872 if (alloc->is_Allocate() && n->as_Type()->type() == TypeInstPtr::NOTNULL |
247 | 873 && (alloc->is_AllocateArray() || |
874 igvn->type(alloc->in(AllocateNode::KlassNode)) != TypeKlassPtr::OBJECT)) { | |
65 | 875 Node *cast2 = NULL; |
876 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { | |
877 Node *use = n->fast_out(i); | |
878 if (use->is_CheckCastPP()) { | |
879 cast2 = use; | |
880 break; | |
881 } | |
882 } | |
883 if (cast2 != NULL) { | |
884 n = cast2; | |
885 } else { | |
886 continue; | |
887 } | |
888 } | |
889 set_escape_state(n->_idx, es); | |
247 | 890 // in order for an object to be scalar-replaceable, it must be: |
65 | 891 // - a direct allocation (not a call returning an object) |
892 // - non-escaping | |
893 // - eligible to be a unique type | |
894 // - not determined to be ineligible by escape analysis | |
0 | 895 set_map(alloc->_idx, n); |
896 set_map(n->_idx, alloc); | |
65 | 897 const TypeOopPtr *t = igvn->type(n)->isa_oopptr(); |
898 if (t == NULL) | |
0 | 899 continue; // not a TypeInstPtr |
247 | 900 tinst = t->cast_to_exactness(true)->is_oopptr()->cast_to_instance_id(ni); |
0 | 901 igvn->hash_delete(n); |
902 igvn->set_type(n, tinst); | |
903 n->raise_bottom_type(tinst); | |
904 igvn->hash_insert(n); | |
65 | 905 record_for_optimizer(n); |
906 if (alloc->is_Allocate() && ptn->_scalar_replaceable && | |
907 (t->isa_instptr() || t->isa_aryptr())) { | |
163 | 908 |
909 // First, put on the worklist all Field edges from Connection Graph | |
910 // which is more accurate then putting immediate users from Ideal Graph. | |
911 for (uint e = 0; e < ptn->edge_count(); e++) { | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
912 Node *use = ptnode_adr(ptn->edge_target(e))->_node; |
163 | 913 assert(ptn->edge_type(e) == PointsToNode::FieldEdge && use->is_AddP(), |
914 "only AddP nodes are Field edges in CG"); | |
915 if (use->outcnt() > 0) { // Don't process dead nodes | |
916 Node* addp2 = find_second_addp(use, use->in(AddPNode::Base)); | |
917 if (addp2 != NULL) { | |
918 assert(alloc->is_AllocateArray(),"array allocation was expected"); | |
919 alloc_worklist.append_if_missing(addp2); | |
920 } | |
921 alloc_worklist.append_if_missing(use); | |
922 } | |
923 } | |
924 | |
65 | 925 // An allocation may have an Initialize which has raw stores. Scan |
926 // the users of the raw allocation result and push AddP users | |
927 // on alloc_worklist. | |
928 Node *raw_result = alloc->proj_out(TypeFunc::Parms); | |
929 assert (raw_result != NULL, "must have an allocation result"); | |
930 for (DUIterator_Fast imax, i = raw_result->fast_outs(imax); i < imax; i++) { | |
931 Node *use = raw_result->fast_out(i); | |
932 if (use->is_AddP() && use->outcnt() > 0) { // Don't process dead nodes | |
933 Node* addp2 = find_second_addp(use, raw_result); | |
934 if (addp2 != NULL) { | |
935 assert(alloc->is_AllocateArray(),"array allocation was expected"); | |
936 alloc_worklist.append_if_missing(addp2); | |
937 } | |
938 alloc_worklist.append_if_missing(use); | |
939 } else if (use->is_Initialize()) { | |
940 memnode_worklist.append_if_missing(use); | |
941 } | |
942 } | |
943 } | |
0 | 944 } else if (n->is_AddP()) { |
945 ptset.Clear(); | |
65 | 946 PointsTo(ptset, get_addp_base(n), igvn); |
0 | 947 assert(ptset.Size() == 1, "AddP address is unique"); |
65 | 948 uint elem = ptset.getelem(); // Allocation node's index |
949 if (elem == _phantom_object) | |
950 continue; // Assume the value was set outside this method. | |
951 Node *base = get_map(elem); // CheckCastPP node | |
0 | 952 split_AddP(n, base, igvn); |
65 | 953 tinst = igvn->type(base)->isa_oopptr(); |
954 } else if (n->is_Phi() || | |
955 n->is_CheckCastPP() || | |
168
7793bd37a336
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
164
diff
changeset
|
956 n->is_EncodeP() || |
7793bd37a336
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
164
diff
changeset
|
957 n->is_DecodeN() || |
65 | 958 (n->is_ConstraintCast() && n->Opcode() == Op_CastPP)) { |
0 | 959 if (visited.test_set(n->_idx)) { |
960 assert(n->is_Phi(), "loops only through Phi's"); | |
961 continue; // already processed | |
962 } | |
963 ptset.Clear(); | |
964 PointsTo(ptset, n, igvn); | |
965 if (ptset.Size() == 1) { | |
65 | 966 uint elem = ptset.getelem(); // Allocation node's index |
967 if (elem == _phantom_object) | |
968 continue; // Assume the value was set outside this method. | |
969 Node *val = get_map(elem); // CheckCastPP node | |
0 | 970 TypeNode *tn = n->as_Type(); |
65 | 971 tinst = igvn->type(val)->isa_oopptr(); |
223 | 972 assert(tinst != NULL && tinst->is_known_instance() && |
973 (uint)tinst->instance_id() == elem , "instance type expected."); | |
163 | 974 |
975 const Type *tn_type = igvn->type(tn); | |
223 | 976 const TypeOopPtr *tn_t; |
977 if (tn_type->isa_narrowoop()) { | |
978 tn_t = tn_type->make_ptr()->isa_oopptr(); | |
979 } else { | |
980 tn_t = tn_type->isa_oopptr(); | |
981 } | |
0 | 982 |
65 | 983 if (tn_t != NULL && |
223 | 984 tinst->cast_to_instance_id(TypeOopPtr::InstanceBot)->higher_equal(tn_t)) { |
163 | 985 if (tn_type->isa_narrowoop()) { |
986 tn_type = tinst->make_narrowoop(); | |
987 } else { | |
988 tn_type = tinst; | |
989 } | |
0 | 990 igvn->hash_delete(tn); |
163 | 991 igvn->set_type(tn, tn_type); |
992 tn->set_type(tn_type); | |
0 | 993 igvn->hash_insert(tn); |
65 | 994 record_for_optimizer(n); |
0 | 995 } |
996 } | |
997 } else { | |
998 continue; | |
999 } | |
1000 // push users on appropriate worklist | |
1001 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { | |
1002 Node *use = n->fast_out(i); | |
1003 if(use->is_Mem() && use->in(MemNode::Address) == n) { | |
65 | 1004 memnode_worklist.append_if_missing(use); |
1005 } else if (use->is_Initialize()) { | |
1006 memnode_worklist.append_if_missing(use); | |
1007 } else if (use->is_MergeMem()) { | |
1008 mergemem_worklist.append_if_missing(use); | |
1009 } else if (use->is_Call() && tinst != NULL) { | |
1010 // Look for MergeMem nodes for calls which reference unique allocation | |
1011 // (through CheckCastPP nodes) even for debug info. | |
1012 Node* m = use->in(TypeFunc::Memory); | |
1013 uint iid = tinst->instance_id(); | |
1014 while (m->is_Proj() && m->in(0)->is_Call() && | |
1015 m->in(0) != use && !m->in(0)->_idx != iid) { | |
1016 m = m->in(0)->in(TypeFunc::Memory); | |
1017 } | |
1018 if (m->is_MergeMem()) { | |
1019 mergemem_worklist.append_if_missing(m); | |
1020 } | |
1021 } else if (use->is_AddP() && use->outcnt() > 0) { // No dead nodes | |
1022 Node* addp2 = find_second_addp(use, n); | |
1023 if (addp2 != NULL) { | |
1024 alloc_worklist.append_if_missing(addp2); | |
1025 } | |
1026 alloc_worklist.append_if_missing(use); | |
1027 } else if (use->is_Phi() || | |
1028 use->is_CheckCastPP() || | |
168
7793bd37a336
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
164
diff
changeset
|
1029 use->is_EncodeP() || |
7793bd37a336
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
164
diff
changeset
|
1030 use->is_DecodeN() || |
65 | 1031 (use->is_ConstraintCast() && use->Opcode() == Op_CastPP)) { |
1032 alloc_worklist.append_if_missing(use); | |
0 | 1033 } |
1034 } | |
1035 | |
1036 } | |
65 | 1037 // New alias types were created in split_AddP(). |
0 | 1038 uint new_index_end = (uint) _compile->num_alias_types(); |
1039 | |
1040 // Phase 2: Process MemNode's from memnode_worklist. compute new address type and | |
1041 // compute new values for Memory inputs (the Memory inputs are not | |
1042 // actually updated until phase 4.) | |
1043 if (memnode_worklist.length() == 0) | |
1044 return; // nothing to do | |
1045 | |
1046 while (memnode_worklist.length() != 0) { | |
1047 Node *n = memnode_worklist.pop(); | |
65 | 1048 if (visited.test_set(n->_idx)) |
1049 continue; | |
0 | 1050 if (n->is_Phi()) { |
1051 assert(n->as_Phi()->adr_type() != TypePtr::BOTTOM, "narrow memory slice required"); | |
1052 // we don't need to do anything, but the users must be pushed if we haven't processed | |
1053 // this Phi before | |
65 | 1054 } else if (n->is_Initialize()) { |
1055 // we don't need to do anything, but the users of the memory projection must be pushed | |
1056 n = n->as_Initialize()->proj_out(TypeFunc::Memory); | |
1057 if (n == NULL) | |
0 | 1058 continue; |
1059 } else { | |
1060 assert(n->is_Mem(), "memory node required."); | |
1061 Node *addr = n->in(MemNode::Address); | |
65 | 1062 assert(addr->is_AddP(), "AddP required"); |
0 | 1063 const Type *addr_t = igvn->type(addr); |
1064 if (addr_t == Type::TOP) | |
1065 continue; | |
1066 assert (addr_t->isa_ptr() != NULL, "pointer type required."); | |
1067 int alias_idx = _compile->get_alias_index(addr_t->is_ptr()); | |
65 | 1068 assert ((uint)alias_idx < new_index_end, "wrong alias index"); |
1069 Node *mem = find_inst_mem(n->in(MemNode::Memory), alias_idx, orig_phis, igvn); | |
38
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
1070 if (_compile->failing()) { |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
1071 return; |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
1072 } |
65 | 1073 if (mem != n->in(MemNode::Memory)) { |
0 | 1074 set_map(n->_idx, mem); |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1075 ptnode_adr(n->_idx)->_node = n; |
65 | 1076 } |
0 | 1077 if (n->is_Load()) { |
1078 continue; // don't push users | |
1079 } else if (n->is_LoadStore()) { | |
1080 // get the memory projection | |
1081 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { | |
1082 Node *use = n->fast_out(i); | |
1083 if (use->Opcode() == Op_SCMemProj) { | |
1084 n = use; | |
1085 break; | |
1086 } | |
1087 } | |
1088 assert(n->Opcode() == Op_SCMemProj, "memory projection required"); | |
1089 } | |
1090 } | |
1091 // push user on appropriate worklist | |
1092 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { | |
1093 Node *use = n->fast_out(i); | |
1094 if (use->is_Phi()) { | |
65 | 1095 memnode_worklist.append_if_missing(use); |
0 | 1096 } else if(use->is_Mem() && use->in(MemNode::Memory) == n) { |
65 | 1097 memnode_worklist.append_if_missing(use); |
1098 } else if (use->is_Initialize()) { | |
1099 memnode_worklist.append_if_missing(use); | |
0 | 1100 } else if (use->is_MergeMem()) { |
65 | 1101 mergemem_worklist.append_if_missing(use); |
0 | 1102 } |
1103 } | |
1104 } | |
1105 | |
65 | 1106 // Phase 3: Process MergeMem nodes from mergemem_worklist. |
1107 // Walk each memory moving the first node encountered of each | |
1108 // instance type to the the input corresponding to its alias index. | |
0 | 1109 while (mergemem_worklist.length() != 0) { |
1110 Node *n = mergemem_worklist.pop(); | |
1111 assert(n->is_MergeMem(), "MergeMem node required."); | |
65 | 1112 if (visited.test_set(n->_idx)) |
1113 continue; | |
0 | 1114 MergeMemNode *nmm = n->as_MergeMem(); |
1115 // Note: we don't want to use MergeMemStream here because we only want to | |
65 | 1116 // scan inputs which exist at the start, not ones we add during processing. |
0 | 1117 uint nslices = nmm->req(); |
1118 igvn->hash_delete(nmm); | |
1119 for (uint i = Compile::AliasIdxRaw+1; i < nslices; i++) { | |
65 | 1120 Node* mem = nmm->in(i); |
1121 Node* cur = NULL; | |
0 | 1122 if (mem == NULL || mem->is_top()) |
1123 continue; | |
1124 while (mem->is_Mem()) { | |
1125 const Type *at = igvn->type(mem->in(MemNode::Address)); | |
1126 if (at != Type::TOP) { | |
1127 assert (at->isa_ptr() != NULL, "pointer type required."); | |
1128 uint idx = (uint)_compile->get_alias_index(at->is_ptr()); | |
1129 if (idx == i) { | |
1130 if (cur == NULL) | |
1131 cur = mem; | |
1132 } else { | |
1133 if (idx >= nmm->req() || nmm->is_empty_memory(nmm->in(idx))) { | |
1134 nmm->set_memory_at(idx, mem); | |
1135 } | |
1136 } | |
1137 } | |
1138 mem = mem->in(MemNode::Memory); | |
1139 } | |
1140 nmm->set_memory_at(i, (cur != NULL) ? cur : mem); | |
65 | 1141 // Find any instance of the current type if we haven't encountered |
1142 // a value of the instance along the chain. | |
1143 for (uint ni = new_index_start; ni < new_index_end; ni++) { | |
1144 if((uint)_compile->get_general_index(ni) == i) { | |
1145 Node *m = (ni >= nmm->req()) ? nmm->empty_memory() : nmm->in(ni); | |
1146 if (nmm->is_empty_memory(m)) { | |
1147 Node* result = find_inst_mem(mem, ni, orig_phis, igvn); | |
1148 if (_compile->failing()) { | |
1149 return; | |
1150 } | |
1151 nmm->set_memory_at(ni, result); | |
1152 } | |
1153 } | |
1154 } | |
1155 } | |
1156 // Find the rest of instances values | |
1157 for (uint ni = new_index_start; ni < new_index_end; ni++) { | |
1158 const TypeOopPtr *tinst = igvn->C->get_adr_type(ni)->isa_oopptr(); | |
1159 Node* result = step_through_mergemem(nmm, ni, tinst); | |
1160 if (result == nmm->base_memory()) { | |
1161 // Didn't find instance memory, search through general slice recursively. | |
1162 result = nmm->memory_at(igvn->C->get_general_index(ni)); | |
1163 result = find_inst_mem(result, ni, orig_phis, igvn); | |
1164 if (_compile->failing()) { | |
1165 return; | |
1166 } | |
1167 nmm->set_memory_at(ni, result); | |
1168 } | |
1169 } | |
1170 igvn->hash_insert(nmm); | |
1171 record_for_optimizer(nmm); | |
1172 | |
1173 // Propagate new memory slices to following MergeMem nodes. | |
1174 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { | |
1175 Node *use = n->fast_out(i); | |
1176 if (use->is_Call()) { | |
1177 CallNode* in = use->as_Call(); | |
1178 if (in->proj_out(TypeFunc::Memory) != NULL) { | |
1179 Node* m = in->proj_out(TypeFunc::Memory); | |
1180 for (DUIterator_Fast jmax, j = m->fast_outs(jmax); j < jmax; j++) { | |
1181 Node* mm = m->fast_out(j); | |
1182 if (mm->is_MergeMem()) { | |
1183 mergemem_worklist.append_if_missing(mm); | |
1184 } | |
1185 } | |
1186 } | |
1187 if (use->is_Allocate()) { | |
1188 use = use->as_Allocate()->initialization(); | |
1189 if (use == NULL) { | |
1190 continue; | |
1191 } | |
1192 } | |
1193 } | |
1194 if (use->is_Initialize()) { | |
1195 InitializeNode* in = use->as_Initialize(); | |
1196 if (in->proj_out(TypeFunc::Memory) != NULL) { | |
1197 Node* m = in->proj_out(TypeFunc::Memory); | |
1198 for (DUIterator_Fast jmax, j = m->fast_outs(jmax); j < jmax; j++) { | |
1199 Node* mm = m->fast_out(j); | |
1200 if (mm->is_MergeMem()) { | |
1201 mergemem_worklist.append_if_missing(mm); | |
0 | 1202 } |
1203 } | |
1204 } | |
1205 } | |
1206 } | |
1207 } | |
1208 | |
65 | 1209 // Phase 4: Update the inputs of non-instance memory Phis and |
1210 // the Memory input of memnodes | |
0 | 1211 // First update the inputs of any non-instance Phi's from |
1212 // which we split out an instance Phi. Note we don't have | |
1213 // to recursively process Phi's encounted on the input memory | |
1214 // chains as is done in split_memory_phi() since they will | |
1215 // also be processed here. | |
247 | 1216 for (int j = 0; j < orig_phis.length(); j++) { |
1217 PhiNode *phi = orig_phis.at(j); | |
0 | 1218 int alias_idx = _compile->get_alias_index(phi->adr_type()); |
1219 igvn->hash_delete(phi); | |
1220 for (uint i = 1; i < phi->req(); i++) { | |
1221 Node *mem = phi->in(i); | |
65 | 1222 Node *new_mem = find_inst_mem(mem, alias_idx, orig_phis, igvn); |
1223 if (_compile->failing()) { | |
1224 return; | |
1225 } | |
0 | 1226 if (mem != new_mem) { |
1227 phi->set_req(i, new_mem); | |
1228 } | |
1229 } | |
1230 igvn->hash_insert(phi); | |
1231 record_for_optimizer(phi); | |
1232 } | |
1233 | |
1234 // Update the memory inputs of MemNodes with the value we computed | |
1235 // in Phase 2. | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1236 for (uint i = 0; i < nodes_size(); i++) { |
0 | 1237 Node *nmem = get_map(i); |
1238 if (nmem != NULL) { | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1239 Node *n = ptnode_adr(i)->_node; |
0 | 1240 if (n != NULL && n->is_Mem()) { |
1241 igvn->hash_delete(n); | |
1242 n->set_req(MemNode::Memory, nmem); | |
1243 igvn->hash_insert(n); | |
1244 record_for_optimizer(n); | |
1245 } | |
1246 } | |
1247 } | |
1248 } | |
1249 | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1250 bool ConnectionGraph::has_candidates(Compile *C) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1251 // EA brings benefits only when the code has allocations and/or locks which |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1252 // are represented by ideal Macro nodes. |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1253 int cnt = C->macro_count(); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1254 for( int i=0; i < cnt; i++ ) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1255 Node *n = C->macro_node(i); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1256 if ( n->is_Allocate() ) |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1257 return true; |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1258 if( n->is_Lock() ) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1259 Node* obj = n->as_Lock()->obj_node()->uncast(); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1260 if( !(obj->is_Parm() || obj->is_Con()) ) |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1261 return true; |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1262 } |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1263 } |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1264 return false; |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1265 } |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1266 |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1267 bool ConnectionGraph::compute_escape() { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1268 Compile* C = _compile; |
65 | 1269 |
163 | 1270 // 1. Populate Connection Graph (CG) with Ideal nodes. |
65 | 1271 |
1272 Unique_Node_List worklist_init; | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1273 worklist_init.map(C->unique(), NULL); // preallocate space |
65 | 1274 |
1275 // Initialize worklist | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1276 if (C->root() != NULL) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1277 worklist_init.push(C->root()); |
65 | 1278 } |
1279 | |
1280 GrowableArray<int> cg_worklist; | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1281 PhaseGVN* igvn = C->initial_gvn(); |
65 | 1282 bool has_allocations = false; |
1283 | |
1284 // Push all useful nodes onto CG list and set their type. | |
1285 for( uint next = 0; next < worklist_init.size(); ++next ) { | |
1286 Node* n = worklist_init.at(next); | |
1287 record_for_escape_analysis(n, igvn); | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1288 // Only allocations and java static calls results are checked |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1289 // for an escape status. See process_call_result() below. |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1290 if (n->is_Allocate() || n->is_CallStaticJava() && |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1291 ptnode_adr(n->_idx)->node_type() == PointsToNode::JavaObject) { |
65 | 1292 has_allocations = true; |
1293 } | |
1294 if(n->is_AddP()) | |
1295 cg_worklist.append(n->_idx); | |
1296 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { | |
1297 Node* m = n->fast_out(i); // Get user | |
1298 worklist_init.push(m); | |
1299 } | |
1300 } | |
0 | 1301 |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1302 if (!has_allocations) { |
65 | 1303 _collecting = false; |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1304 return false; // Nothing to do. |
65 | 1305 } |
1306 | |
1307 // 2. First pass to create simple CG edges (doesn't require to walk CG). | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1308 uint delayed_size = _delayed_worklist.size(); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1309 for( uint next = 0; next < delayed_size; ++next ) { |
65 | 1310 Node* n = _delayed_worklist.at(next); |
1311 build_connection_graph(n, igvn); | |
1312 } | |
0 | 1313 |
65 | 1314 // 3. Pass to create fields edges (Allocate -F-> AddP). |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1315 uint cg_length = cg_worklist.length(); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1316 for( uint next = 0; next < cg_length; ++next ) { |
65 | 1317 int ni = cg_worklist.at(next); |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1318 build_connection_graph(ptnode_adr(ni)->_node, igvn); |
65 | 1319 } |
1320 | |
1321 cg_worklist.clear(); | |
1322 cg_worklist.append(_phantom_object); | |
1323 | |
1324 // 4. Build Connection Graph which need | |
1325 // to walk the connection graph. | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1326 for (uint ni = 0; ni < nodes_size(); ni++) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1327 PointsToNode* ptn = ptnode_adr(ni); |
65 | 1328 Node *n = ptn->_node; |
1329 if (n != NULL) { // Call, AddP, LoadP, StoreP | |
1330 build_connection_graph(n, igvn); | |
1331 if (ptn->node_type() != PointsToNode::UnknownType) | |
1332 cg_worklist.append(n->_idx); // Collect CG nodes | |
1333 } | |
0 | 1334 } |
1335 | |
1336 VectorSet ptset(Thread::current()->resource_area()); | |
101
a6cb86dd209b
6681577: PIT: some VM tests fails with -XX:+AggressiveOpts in 6u5p b01
kvn
parents:
65
diff
changeset
|
1337 GrowableArray<uint> deferred_edges; |
a6cb86dd209b
6681577: PIT: some VM tests fails with -XX:+AggressiveOpts in 6u5p b01
kvn
parents:
65
diff
changeset
|
1338 VectorSet visited(Thread::current()->resource_area()); |
0 | 1339 |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1340 // 5. Remove deferred edges from the graph and collect |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1341 // information needed for type splitting. |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1342 cg_length = cg_worklist.length(); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1343 for( uint next = 0; next < cg_length; ++next ) { |
65 | 1344 int ni = cg_worklist.at(next); |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1345 PointsToNode* ptn = ptnode_adr(ni); |
0 | 1346 PointsToNode::NodeType nt = ptn->node_type(); |
1347 if (nt == PointsToNode::LocalVar || nt == PointsToNode::Field) { | |
101
a6cb86dd209b
6681577: PIT: some VM tests fails with -XX:+AggressiveOpts in 6u5p b01
kvn
parents:
65
diff
changeset
|
1348 remove_deferred(ni, &deferred_edges, &visited); |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1349 Node *n = ptn->_node; |
0 | 1350 if (n->is_AddP()) { |
65 | 1351 // If this AddP computes an address which may point to more that one |
163 | 1352 // object or more then one field (array's element), nothing the address |
1353 // points to can be scalar replaceable. | |
65 | 1354 Node *base = get_addp_base(n); |
0 | 1355 ptset.Clear(); |
1356 PointsTo(ptset, base, igvn); | |
163 | 1357 if (ptset.Size() > 1 || |
1358 (ptset.Size() != 0 && ptn->offset() == Type::OffsetBot)) { | |
0 | 1359 for( VectorSetI j(&ptset); j.test(); ++j ) { |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1360 ptnode_adr(j.elem)->_scalar_replaceable = false; |
0 | 1361 } |
1362 } | |
1363 } | |
1364 } | |
1365 } | |
65 | 1366 |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1367 // 6. Propagate escape states. |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1368 GrowableArray<int> worklist; |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1369 bool has_non_escaping_obj = false; |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1370 |
0 | 1371 // push all GlobalEscape nodes on the worklist |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1372 for( uint next = 0; next < cg_length; ++next ) { |
65 | 1373 int nk = cg_worklist.at(next); |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1374 if (ptnode_adr(nk)->escape_state() == PointsToNode::GlobalEscape) |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1375 worklist.push(nk); |
0 | 1376 } |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1377 // mark all nodes reachable from GlobalEscape nodes |
0 | 1378 while(worklist.length() > 0) { |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1379 PointsToNode* ptn = ptnode_adr(worklist.pop()); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1380 uint e_cnt = ptn->edge_count(); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1381 for (uint ei = 0; ei < e_cnt; ei++) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1382 uint npi = ptn->edge_target(ei); |
0 | 1383 PointsToNode *np = ptnode_adr(npi); |
65 | 1384 if (np->escape_state() < PointsToNode::GlobalEscape) { |
0 | 1385 np->set_escape_state(PointsToNode::GlobalEscape); |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1386 worklist.push(npi); |
0 | 1387 } |
1388 } | |
1389 } | |
1390 | |
1391 // push all ArgEscape nodes on the worklist | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1392 for( uint next = 0; next < cg_length; ++next ) { |
65 | 1393 int nk = cg_worklist.at(next); |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1394 if (ptnode_adr(nk)->escape_state() == PointsToNode::ArgEscape) |
0 | 1395 worklist.push(nk); |
1396 } | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1397 // mark all nodes reachable from ArgEscape nodes |
0 | 1398 while(worklist.length() > 0) { |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1399 PointsToNode* ptn = ptnode_adr(worklist.pop()); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1400 if (ptn->node_type() == PointsToNode::JavaObject) |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1401 has_non_escaping_obj = true; // Non GlobalEscape |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1402 uint e_cnt = ptn->edge_count(); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1403 for (uint ei = 0; ei < e_cnt; ei++) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1404 uint npi = ptn->edge_target(ei); |
0 | 1405 PointsToNode *np = ptnode_adr(npi); |
65 | 1406 if (np->escape_state() < PointsToNode::ArgEscape) { |
0 | 1407 np->set_escape_state(PointsToNode::ArgEscape); |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1408 worklist.push(npi); |
0 | 1409 } |
1410 } | |
1411 } | |
65 | 1412 |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1413 GrowableArray<Node*> alloc_worklist; |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1414 |
65 | 1415 // push all NoEscape nodes on the worklist |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1416 for( uint next = 0; next < cg_length; ++next ) { |
65 | 1417 int nk = cg_worklist.at(next); |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1418 if (ptnode_adr(nk)->escape_state() == PointsToNode::NoEscape) |
65 | 1419 worklist.push(nk); |
1420 } | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1421 // mark all nodes reachable from NoEscape nodes |
65 | 1422 while(worklist.length() > 0) { |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1423 PointsToNode* ptn = ptnode_adr(worklist.pop()); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1424 if (ptn->node_type() == PointsToNode::JavaObject) |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1425 has_non_escaping_obj = true; // Non GlobalEscape |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1426 Node* n = ptn->_node; |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1427 if (n->is_Allocate() && ptn->_scalar_replaceable ) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1428 // Push scalar replaceable alocations on alloc_worklist |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1429 // for processing in split_unique_types(). |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1430 alloc_worklist.append(n); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1431 } |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1432 uint e_cnt = ptn->edge_count(); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1433 for (uint ei = 0; ei < e_cnt; ei++) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1434 uint npi = ptn->edge_target(ei); |
65 | 1435 PointsToNode *np = ptnode_adr(npi); |
1436 if (np->escape_state() < PointsToNode::NoEscape) { | |
1437 np->set_escape_state(PointsToNode::NoEscape); | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1438 worklist.push(npi); |
65 | 1439 } |
1440 } | |
1441 } | |
1442 | |
0 | 1443 _collecting = false; |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1444 assert(C->unique() == nodes_size(), "there should be no new ideal nodes during ConnectionGraph build"); |
0 | 1445 |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1446 bool has_scalar_replaceable_candidates = alloc_worklist.length() > 0; |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1447 if ( has_scalar_replaceable_candidates && |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1448 C->AliasLevel() >= 3 && EliminateAllocations ) { |
0 | 1449 |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1450 // Now use the escape information to create unique types for |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1451 // scalar replaceable objects. |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1452 split_unique_types(alloc_worklist); |
0 | 1453 |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1454 if (C->failing()) return false; |
0 | 1455 |
65 | 1456 // Clean up after split unique types. |
1457 ResourceMark rm; | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1458 PhaseRemoveUseless pru(C->initial_gvn(), C->for_igvn()); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1459 |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1460 C->print_method("After Escape Analysis", 2); |
0 | 1461 |
65 | 1462 #ifdef ASSERT |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1463 } else if (Verbose && (PrintEscapeAnalysis || PrintEliminateAllocations)) { |
65 | 1464 tty->print("=== No allocations eliminated for "); |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1465 C->method()->print_short_name(); |
65 | 1466 if(!EliminateAllocations) { |
1467 tty->print(" since EliminateAllocations is off ==="); | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1468 } else if(!has_scalar_replaceable_candidates) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1469 tty->print(" since there are no scalar replaceable candidates ==="); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1470 } else if(C->AliasLevel() < 3) { |
65 | 1471 tty->print(" since AliasLevel < 3 ==="); |
0 | 1472 } |
65 | 1473 tty->cr(); |
1474 #endif | |
0 | 1475 } |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1476 return has_non_escaping_obj; |
0 | 1477 } |
1478 | |
1479 void ConnectionGraph::process_call_arguments(CallNode *call, PhaseTransform *phase) { | |
1480 | |
1481 switch (call->Opcode()) { | |
65 | 1482 #ifdef ASSERT |
0 | 1483 case Op_Allocate: |
1484 case Op_AllocateArray: | |
1485 case Op_Lock: | |
1486 case Op_Unlock: | |
65 | 1487 assert(false, "should be done already"); |
0 | 1488 break; |
65 | 1489 #endif |
1490 case Op_CallLeafNoFP: | |
1491 { | |
1492 // Stub calls, objects do not escape but they are not scale replaceable. | |
1493 // Adjust escape state for outgoing arguments. | |
1494 const TypeTuple * d = call->tf()->domain(); | |
1495 VectorSet ptset(Thread::current()->resource_area()); | |
1496 for (uint i = TypeFunc::Parms; i < d->cnt(); i++) { | |
1497 const Type* at = d->field_at(i); | |
1498 Node *arg = call->in(i)->uncast(); | |
1499 const Type *aat = phase->type(arg); | |
1500 if (!arg->is_top() && at->isa_ptr() && aat->isa_ptr()) { | |
1501 assert(aat == Type::TOP || aat == TypePtr::NULL_PTR || | |
1502 aat->isa_ptr() != NULL, "expecting an Ptr"); | |
1503 set_escape_state(arg->_idx, PointsToNode::ArgEscape); | |
1504 if (arg->is_AddP()) { | |
1505 // | |
1506 // The inline_native_clone() case when the arraycopy stub is called | |
1507 // after the allocation before Initialize and CheckCastPP nodes. | |
1508 // | |
1509 // Set AddP's base (Allocate) as not scalar replaceable since | |
1510 // pointer to the base (with offset) is passed as argument. | |
1511 // | |
1512 arg = get_addp_base(arg); | |
1513 } | |
1514 ptset.Clear(); | |
1515 PointsTo(ptset, arg, phase); | |
1516 for( VectorSetI j(&ptset); j.test(); ++j ) { | |
1517 uint pt = j.elem; | |
1518 set_escape_state(pt, PointsToNode::ArgEscape); | |
1519 } | |
1520 } | |
1521 } | |
1522 break; | |
1523 } | |
0 | 1524 |
1525 case Op_CallStaticJava: | |
1526 // For a static call, we know exactly what method is being called. | |
1527 // Use bytecode estimator to record the call's escape affects | |
1528 { | |
1529 ciMethod *meth = call->as_CallJava()->method(); | |
65 | 1530 BCEscapeAnalyzer *call_analyzer = (meth !=NULL) ? meth->get_bcea() : NULL; |
1531 // fall-through if not a Java method or no analyzer information | |
1532 if (call_analyzer != NULL) { | |
0 | 1533 const TypeTuple * d = call->tf()->domain(); |
1534 VectorSet ptset(Thread::current()->resource_area()); | |
65 | 1535 bool copy_dependencies = false; |
0 | 1536 for (uint i = TypeFunc::Parms; i < d->cnt(); i++) { |
1537 const Type* at = d->field_at(i); | |
1538 int k = i - TypeFunc::Parms; | |
1539 | |
1540 if (at->isa_oopptr() != NULL) { | |
65 | 1541 Node *arg = call->in(i)->uncast(); |
0 | 1542 |
65 | 1543 bool global_escapes = false; |
1544 bool fields_escapes = false; | |
1545 if (!call_analyzer->is_arg_stack(k)) { | |
1546 // The argument global escapes, mark everything it could point to | |
1547 set_escape_state(arg->_idx, PointsToNode::GlobalEscape); | |
1548 global_escapes = true; | |
1549 } else { | |
1550 if (!call_analyzer->is_arg_local(k)) { | |
1551 // The argument itself doesn't escape, but any fields might | |
1552 fields_escapes = true; | |
0 | 1553 } |
65 | 1554 set_escape_state(arg->_idx, PointsToNode::ArgEscape); |
1555 copy_dependencies = true; | |
1556 } | |
1557 | |
1558 ptset.Clear(); | |
1559 PointsTo(ptset, arg, phase); | |
1560 for( VectorSetI j(&ptset); j.test(); ++j ) { | |
1561 uint pt = j.elem; | |
1562 if (global_escapes) { | |
1563 //The argument global escapes, mark everything it could point to | |
1564 set_escape_state(pt, PointsToNode::GlobalEscape); | |
1565 } else { | |
1566 if (fields_escapes) { | |
1567 // The argument itself doesn't escape, but any fields might | |
1568 add_edge_from_fields(pt, _phantom_object, Type::OffsetBot); | |
1569 } | |
1570 set_escape_state(pt, PointsToNode::ArgEscape); | |
0 | 1571 } |
1572 } | |
1573 } | |
1574 } | |
65 | 1575 if (copy_dependencies) |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1576 call_analyzer->copy_dependencies(_compile->dependencies()); |
0 | 1577 break; |
1578 } | |
1579 } | |
1580 | |
1581 default: | |
65 | 1582 // Fall-through here if not a Java method or no analyzer information |
1583 // or some other type of call, assume the worst case: all arguments | |
0 | 1584 // globally escape. |
1585 { | |
1586 // adjust escape state for outgoing arguments | |
1587 const TypeTuple * d = call->tf()->domain(); | |
1588 VectorSet ptset(Thread::current()->resource_area()); | |
1589 for (uint i = TypeFunc::Parms; i < d->cnt(); i++) { | |
1590 const Type* at = d->field_at(i); | |
1591 if (at->isa_oopptr() != NULL) { | |
65 | 1592 Node *arg = call->in(i)->uncast(); |
1593 set_escape_state(arg->_idx, PointsToNode::GlobalEscape); | |
0 | 1594 ptset.Clear(); |
1595 PointsTo(ptset, arg, phase); | |
1596 for( VectorSetI j(&ptset); j.test(); ++j ) { | |
1597 uint pt = j.elem; | |
1598 set_escape_state(pt, PointsToNode::GlobalEscape); | |
1599 } | |
1600 } | |
1601 } | |
1602 } | |
1603 } | |
1604 } | |
1605 void ConnectionGraph::process_call_result(ProjNode *resproj, PhaseTransform *phase) { | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1606 CallNode *call = resproj->in(0)->as_Call(); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1607 uint call_idx = call->_idx; |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1608 uint resproj_idx = resproj->_idx; |
0 | 1609 |
1610 switch (call->Opcode()) { | |
1611 case Op_Allocate: | |
1612 { | |
1613 Node *k = call->in(AllocateNode::KlassNode); | |
1614 const TypeKlassPtr *kt; | |
1615 if (k->Opcode() == Op_LoadKlass) { | |
1616 kt = k->as_Load()->type()->isa_klassptr(); | |
1617 } else { | |
164
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
1618 // Also works for DecodeN(LoadNKlass). |
0 | 1619 kt = k->as_Type()->type()->isa_klassptr(); |
1620 } | |
1621 assert(kt != NULL, "TypeKlassPtr required."); | |
1622 ciKlass* cik = kt->klass(); | |
1623 ciInstanceKlass* ciik = cik->as_instance_klass(); | |
1624 | |
65 | 1625 PointsToNode::EscapeState es; |
1626 uint edge_to; | |
0 | 1627 if (cik->is_subclass_of(_compile->env()->Thread_klass()) || ciik->has_finalizer()) { |
65 | 1628 es = PointsToNode::GlobalEscape; |
1629 edge_to = _phantom_object; // Could not be worse | |
0 | 1630 } else { |
65 | 1631 es = PointsToNode::NoEscape; |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1632 edge_to = call_idx; |
0 | 1633 } |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1634 set_escape_state(call_idx, es); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1635 add_pointsto_edge(resproj_idx, edge_to); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1636 _processed.set(resproj_idx); |
0 | 1637 break; |
1638 } | |
1639 | |
1640 case Op_AllocateArray: | |
1641 { | |
65 | 1642 int length = call->in(AllocateNode::ALength)->find_int_con(-1); |
1643 if (length < 0 || length > EliminateAllocationArraySizeLimit) { | |
1644 // Not scalar replaceable if the length is not constant or too big. | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1645 ptnode_adr(call_idx)->_scalar_replaceable = false; |
65 | 1646 } |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1647 set_escape_state(call_idx, PointsToNode::NoEscape); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1648 add_pointsto_edge(resproj_idx, call_idx); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1649 _processed.set(resproj_idx); |
0 | 1650 break; |
1651 } | |
1652 | |
1653 case Op_CallStaticJava: | |
1654 // For a static call, we know exactly what method is being called. | |
1655 // Use bytecode estimator to record whether the call's return value escapes | |
1656 { | |
65 | 1657 bool done = true; |
0 | 1658 const TypeTuple *r = call->tf()->range(); |
1659 const Type* ret_type = NULL; | |
1660 | |
1661 if (r->cnt() > TypeFunc::Parms) | |
1662 ret_type = r->field_at(TypeFunc::Parms); | |
1663 | |
1664 // Note: we use isa_ptr() instead of isa_oopptr() here because the | |
1665 // _multianewarray functions return a TypeRawPtr. | |
65 | 1666 if (ret_type == NULL || ret_type->isa_ptr() == NULL) { |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1667 _processed.set(resproj_idx); |
0 | 1668 break; // doesn't return a pointer type |
65 | 1669 } |
0 | 1670 ciMethod *meth = call->as_CallJava()->method(); |
65 | 1671 const TypeTuple * d = call->tf()->domain(); |
0 | 1672 if (meth == NULL) { |
1673 // not a Java method, assume global escape | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1674 set_escape_state(call_idx, PointsToNode::GlobalEscape); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1675 add_pointsto_edge(resproj_idx, _phantom_object); |
0 | 1676 } else { |
65 | 1677 BCEscapeAnalyzer *call_analyzer = meth->get_bcea(); |
1678 bool copy_dependencies = false; | |
0 | 1679 |
65 | 1680 if (call_analyzer->is_return_allocated()) { |
1681 // Returns a newly allocated unescaped object, simply | |
1682 // update dependency information. | |
1683 // Mark it as NoEscape so that objects referenced by | |
1684 // it's fields will be marked as NoEscape at least. | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1685 set_escape_state(call_idx, PointsToNode::NoEscape); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1686 add_pointsto_edge(resproj_idx, call_idx); |
65 | 1687 copy_dependencies = true; |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1688 } else if (call_analyzer->is_return_local()) { |
0 | 1689 // determine whether any arguments are returned |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1690 set_escape_state(call_idx, PointsToNode::NoEscape); |
0 | 1691 for (uint i = TypeFunc::Parms; i < d->cnt(); i++) { |
1692 const Type* at = d->field_at(i); | |
1693 | |
1694 if (at->isa_oopptr() != NULL) { | |
65 | 1695 Node *arg = call->in(i)->uncast(); |
0 | 1696 |
65 | 1697 if (call_analyzer->is_arg_returned(i - TypeFunc::Parms)) { |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1698 PointsToNode *arg_esp = ptnode_adr(arg->_idx); |
65 | 1699 if (arg_esp->node_type() == PointsToNode::UnknownType) |
1700 done = false; | |
1701 else if (arg_esp->node_type() == PointsToNode::JavaObject) | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1702 add_pointsto_edge(resproj_idx, arg->_idx); |
0 | 1703 else |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1704 add_deferred_edge(resproj_idx, arg->_idx); |
0 | 1705 arg_esp->_hidden_alias = true; |
1706 } | |
1707 } | |
1708 } | |
65 | 1709 copy_dependencies = true; |
0 | 1710 } else { |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1711 set_escape_state(call_idx, PointsToNode::GlobalEscape); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1712 add_pointsto_edge(resproj_idx, _phantom_object); |
65 | 1713 for (uint i = TypeFunc::Parms; i < d->cnt(); i++) { |
1714 const Type* at = d->field_at(i); | |
1715 if (at->isa_oopptr() != NULL) { | |
1716 Node *arg = call->in(i)->uncast(); | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1717 PointsToNode *arg_esp = ptnode_adr(arg->_idx); |
65 | 1718 arg_esp->_hidden_alias = true; |
1719 } | |
1720 } | |
0 | 1721 } |
65 | 1722 if (copy_dependencies) |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1723 call_analyzer->copy_dependencies(_compile->dependencies()); |
0 | 1724 } |
65 | 1725 if (done) |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1726 _processed.set(resproj_idx); |
0 | 1727 break; |
1728 } | |
1729 | |
1730 default: | |
1731 // Some other type of call, assume the worst case that the | |
1732 // returned value, if any, globally escapes. | |
1733 { | |
1734 const TypeTuple *r = call->tf()->range(); | |
1735 if (r->cnt() > TypeFunc::Parms) { | |
1736 const Type* ret_type = r->field_at(TypeFunc::Parms); | |
1737 | |
1738 // Note: we use isa_ptr() instead of isa_oopptr() here because the | |
1739 // _multianewarray functions return a TypeRawPtr. | |
1740 if (ret_type->isa_ptr() != NULL) { | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1741 set_escape_state(call_idx, PointsToNode::GlobalEscape); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1742 add_pointsto_edge(resproj_idx, _phantom_object); |
0 | 1743 } |
1744 } | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1745 _processed.set(resproj_idx); |
0 | 1746 } |
1747 } | |
1748 } | |
1749 | |
65 | 1750 // Populate Connection Graph with Ideal nodes and create simple |
1751 // connection graph edges (do not need to check the node_type of inputs | |
1752 // or to call PointsTo() to walk the connection graph). | |
1753 void ConnectionGraph::record_for_escape_analysis(Node *n, PhaseTransform *phase) { | |
1754 if (_processed.test(n->_idx)) | |
1755 return; // No need to redefine node's state. | |
1756 | |
1757 if (n->is_Call()) { | |
1758 // Arguments to allocation and locking don't escape. | |
1759 if (n->is_Allocate()) { | |
1760 add_node(n, PointsToNode::JavaObject, PointsToNode::UnknownEscape, true); | |
1761 record_for_optimizer(n); | |
1762 } else if (n->is_Lock() || n->is_Unlock()) { | |
1763 // Put Lock and Unlock nodes on IGVN worklist to process them during | |
1764 // the first IGVN optimization when escape information is still available. | |
1765 record_for_optimizer(n); | |
1766 _processed.set(n->_idx); | |
1767 } else { | |
1768 // Have to process call's arguments first. | |
1769 PointsToNode::NodeType nt = PointsToNode::UnknownType; | |
1770 | |
1771 // Check if a call returns an object. | |
1772 const TypeTuple *r = n->as_Call()->tf()->range(); | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1773 if (n->is_CallStaticJava() && r->cnt() > TypeFunc::Parms && |
65 | 1774 n->as_Call()->proj_out(TypeFunc::Parms) != NULL) { |
1775 // Note: use isa_ptr() instead of isa_oopptr() here because | |
1776 // the _multianewarray functions return a TypeRawPtr. | |
1777 if (r->field_at(TypeFunc::Parms)->isa_ptr() != NULL) { | |
1778 nt = PointsToNode::JavaObject; | |
1779 } | |
1780 } | |
1781 add_node(n, nt, PointsToNode::UnknownEscape, false); | |
1782 } | |
1783 return; | |
1784 } | |
1785 | |
1786 // Using isa_ptr() instead of isa_oopptr() for LoadP and Phi because | |
1787 // ThreadLocal has RawPrt type. | |
1788 switch (n->Opcode()) { | |
1789 case Op_AddP: | |
1790 { | |
1791 add_node(n, PointsToNode::Field, PointsToNode::UnknownEscape, false); | |
1792 break; | |
1793 } | |
1794 case Op_CastX2P: | |
1795 { // "Unsafe" memory access. | |
1796 add_node(n, PointsToNode::JavaObject, PointsToNode::GlobalEscape, true); | |
1797 break; | |
1798 } | |
1799 case Op_CastPP: | |
1800 case Op_CheckCastPP: | |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
1801 case Op_EncodeP: |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
1802 case Op_DecodeN: |
65 | 1803 { |
1804 add_node(n, PointsToNode::LocalVar, PointsToNode::UnknownEscape, false); | |
1805 int ti = n->in(1)->_idx; | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1806 PointsToNode::NodeType nt = ptnode_adr(ti)->node_type(); |
65 | 1807 if (nt == PointsToNode::UnknownType) { |
1808 _delayed_worklist.push(n); // Process it later. | |
1809 break; | |
1810 } else if (nt == PointsToNode::JavaObject) { | |
1811 add_pointsto_edge(n->_idx, ti); | |
1812 } else { | |
1813 add_deferred_edge(n->_idx, ti); | |
1814 } | |
1815 _processed.set(n->_idx); | |
1816 break; | |
1817 } | |
1818 case Op_ConP: | |
1819 { | |
1820 // assume all pointer constants globally escape except for null | |
1821 PointsToNode::EscapeState es; | |
1822 if (phase->type(n) == TypePtr::NULL_PTR) | |
1823 es = PointsToNode::NoEscape; | |
1824 else | |
1825 es = PointsToNode::GlobalEscape; | |
0 | 1826 |
65 | 1827 add_node(n, PointsToNode::JavaObject, es, true); |
1828 break; | |
1829 } | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1830 case Op_ConN: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1831 { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1832 // assume all narrow oop constants globally escape except for null |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1833 PointsToNode::EscapeState es; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1834 if (phase->type(n) == TypeNarrowOop::NULL_PTR) |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1835 es = PointsToNode::NoEscape; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1836 else |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1837 es = PointsToNode::GlobalEscape; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1838 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1839 add_node(n, PointsToNode::JavaObject, es, true); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1840 break; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1841 } |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
1842 case Op_CreateEx: |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
1843 { |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
1844 // assume that all exception objects globally escape |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
1845 add_node(n, PointsToNode::JavaObject, PointsToNode::GlobalEscape, true); |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
1846 break; |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
1847 } |
65 | 1848 case Op_LoadKlass: |
164
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
1849 case Op_LoadNKlass: |
65 | 1850 { |
1851 add_node(n, PointsToNode::JavaObject, PointsToNode::GlobalEscape, true); | |
1852 break; | |
1853 } | |
1854 case Op_LoadP: | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1855 case Op_LoadN: |
65 | 1856 { |
1857 const Type *t = phase->type(n); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1858 if (!t->isa_narrowoop() && t->isa_ptr() == NULL) { |
65 | 1859 _processed.set(n->_idx); |
1860 return; | |
1861 } | |
1862 add_node(n, PointsToNode::LocalVar, PointsToNode::UnknownEscape, false); | |
1863 break; | |
1864 } | |
1865 case Op_Parm: | |
1866 { | |
1867 _processed.set(n->_idx); // No need to redefine it state. | |
1868 uint con = n->as_Proj()->_con; | |
1869 if (con < TypeFunc::Parms) | |
1870 return; | |
1871 const Type *t = n->in(0)->as_Start()->_domain->field_at(con); | |
1872 if (t->isa_ptr() == NULL) | |
1873 return; | |
1874 // We have to assume all input parameters globally escape | |
1875 // (Note: passing 'false' since _processed is already set). | |
1876 add_node(n, PointsToNode::JavaObject, PointsToNode::GlobalEscape, false); | |
1877 break; | |
1878 } | |
1879 case Op_Phi: | |
1880 { | |
1881 if (n->as_Phi()->type()->isa_ptr() == NULL) { | |
1882 // nothing to do if not an oop | |
1883 _processed.set(n->_idx); | |
1884 return; | |
1885 } | |
1886 add_node(n, PointsToNode::LocalVar, PointsToNode::UnknownEscape, false); | |
1887 uint i; | |
1888 for (i = 1; i < n->req() ; i++) { | |
1889 Node* in = n->in(i); | |
1890 if (in == NULL) | |
1891 continue; // ignore NULL | |
1892 in = in->uncast(); | |
1893 if (in->is_top() || in == n) | |
1894 continue; // ignore top or inputs which go back this node | |
1895 int ti = in->_idx; | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1896 PointsToNode::NodeType nt = ptnode_adr(ti)->node_type(); |
65 | 1897 if (nt == PointsToNode::UnknownType) { |
1898 break; | |
1899 } else if (nt == PointsToNode::JavaObject) { | |
1900 add_pointsto_edge(n->_idx, ti); | |
1901 } else { | |
1902 add_deferred_edge(n->_idx, ti); | |
1903 } | |
1904 } | |
1905 if (i >= n->req()) | |
1906 _processed.set(n->_idx); | |
1907 else | |
1908 _delayed_worklist.push(n); | |
1909 break; | |
1910 } | |
1911 case Op_Proj: | |
1912 { | |
1913 // we are only interested in the result projection from a call | |
1914 if (n->as_Proj()->_con == TypeFunc::Parms && n->in(0)->is_Call() ) { | |
1915 add_node(n, PointsToNode::LocalVar, PointsToNode::UnknownEscape, false); | |
1916 process_call_result(n->as_Proj(), phase); | |
1917 if (!_processed.test(n->_idx)) { | |
1918 // The call's result may need to be processed later if the call | |
1919 // returns it's argument and the argument is not processed yet. | |
1920 _delayed_worklist.push(n); | |
1921 } | |
1922 } else { | |
1923 _processed.set(n->_idx); | |
1924 } | |
1925 break; | |
1926 } | |
1927 case Op_Return: | |
1928 { | |
1929 if( n->req() > TypeFunc::Parms && | |
1930 phase->type(n->in(TypeFunc::Parms))->isa_oopptr() ) { | |
1931 // Treat Return value as LocalVar with GlobalEscape escape state. | |
1932 add_node(n, PointsToNode::LocalVar, PointsToNode::GlobalEscape, false); | |
1933 int ti = n->in(TypeFunc::Parms)->_idx; | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1934 PointsToNode::NodeType nt = ptnode_adr(ti)->node_type(); |
65 | 1935 if (nt == PointsToNode::UnknownType) { |
1936 _delayed_worklist.push(n); // Process it later. | |
1937 break; | |
1938 } else if (nt == PointsToNode::JavaObject) { | |
1939 add_pointsto_edge(n->_idx, ti); | |
1940 } else { | |
1941 add_deferred_edge(n->_idx, ti); | |
1942 } | |
1943 } | |
1944 _processed.set(n->_idx); | |
1945 break; | |
1946 } | |
1947 case Op_StoreP: | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1948 case Op_StoreN: |
65 | 1949 { |
1950 const Type *adr_type = phase->type(n->in(MemNode::Address)); | |
221
1e026f8da827
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
168
diff
changeset
|
1951 adr_type = adr_type->make_ptr(); |
65 | 1952 if (adr_type->isa_oopptr()) { |
1953 add_node(n, PointsToNode::UnknownType, PointsToNode::UnknownEscape, false); | |
1954 } else { | |
1955 Node* adr = n->in(MemNode::Address); | |
1956 if (adr->is_AddP() && phase->type(adr) == TypeRawPtr::NOTNULL && | |
1957 adr->in(AddPNode::Address)->is_Proj() && | |
1958 adr->in(AddPNode::Address)->in(0)->is_Allocate()) { | |
1959 add_node(n, PointsToNode::UnknownType, PointsToNode::UnknownEscape, false); | |
1960 // We are computing a raw address for a store captured | |
1961 // by an Initialize compute an appropriate address type. | |
1962 int offs = (int)phase->find_intptr_t_con(adr->in(AddPNode::Offset), Type::OffsetBot); | |
1963 assert(offs != Type::OffsetBot, "offset must be a constant"); | |
1964 } else { | |
1965 _processed.set(n->_idx); | |
1966 return; | |
1967 } | |
1968 } | |
1969 break; | |
1970 } | |
1971 case Op_StorePConditional: | |
1972 case Op_CompareAndSwapP: | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1973 case Op_CompareAndSwapN: |
65 | 1974 { |
1975 const Type *adr_type = phase->type(n->in(MemNode::Address)); | |
221
1e026f8da827
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
168
diff
changeset
|
1976 adr_type = adr_type->make_ptr(); |
65 | 1977 if (adr_type->isa_oopptr()) { |
1978 add_node(n, PointsToNode::UnknownType, PointsToNode::UnknownEscape, false); | |
1979 } else { | |
1980 _processed.set(n->_idx); | |
1981 return; | |
1982 } | |
1983 break; | |
1984 } | |
1985 case Op_ThreadLocal: | |
1986 { | |
1987 add_node(n, PointsToNode::JavaObject, PointsToNode::ArgEscape, true); | |
1988 break; | |
1989 } | |
1990 default: | |
1991 ; | |
1992 // nothing to do | |
1993 } | |
1994 return; | |
1995 } | |
1996 | |
1997 void ConnectionGraph::build_connection_graph(Node *n, PhaseTransform *phase) { | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1998 uint n_idx = n->_idx; |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1999 |
65 | 2000 // Don't set processed bit for AddP, LoadP, StoreP since |
2001 // they may need more then one pass to process. | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2002 if (_processed.test(n_idx)) |
65 | 2003 return; // No need to redefine node's state. |
2004 | |
0 | 2005 if (n->is_Call()) { |
2006 CallNode *call = n->as_Call(); | |
2007 process_call_arguments(call, phase); | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2008 _processed.set(n_idx); |
0 | 2009 return; |
2010 } | |
2011 | |
65 | 2012 switch (n->Opcode()) { |
0 | 2013 case Op_AddP: |
2014 { | |
65 | 2015 Node *base = get_addp_base(n); |
2016 // Create a field edge to this node from everything base could point to. | |
0 | 2017 VectorSet ptset(Thread::current()->resource_area()); |
2018 PointsTo(ptset, base, phase); | |
2019 for( VectorSetI i(&ptset); i.test(); ++i ) { | |
2020 uint pt = i.elem; | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2021 add_field_edge(pt, n_idx, address_offset(n, phase)); |
65 | 2022 } |
2023 break; | |
2024 } | |
2025 case Op_CastX2P: | |
2026 { | |
2027 assert(false, "Op_CastX2P"); | |
2028 break; | |
2029 } | |
2030 case Op_CastPP: | |
2031 case Op_CheckCastPP: | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
2032 case Op_EncodeP: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
2033 case Op_DecodeN: |
65 | 2034 { |
2035 int ti = n->in(1)->_idx; | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2036 if (ptnode_adr(ti)->node_type() == PointsToNode::JavaObject) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2037 add_pointsto_edge(n_idx, ti); |
65 | 2038 } else { |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2039 add_deferred_edge(n_idx, ti); |
65 | 2040 } |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2041 _processed.set(n_idx); |
65 | 2042 break; |
2043 } | |
2044 case Op_ConP: | |
2045 { | |
2046 assert(false, "Op_ConP"); | |
2047 break; | |
2048 } | |
163 | 2049 case Op_ConN: |
2050 { | |
2051 assert(false, "Op_ConN"); | |
2052 break; | |
2053 } | |
65 | 2054 case Op_CreateEx: |
2055 { | |
2056 assert(false, "Op_CreateEx"); | |
2057 break; | |
2058 } | |
2059 case Op_LoadKlass: | |
164
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
2060 case Op_LoadNKlass: |
65 | 2061 { |
2062 assert(false, "Op_LoadKlass"); | |
2063 break; | |
2064 } | |
2065 case Op_LoadP: | |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
2066 case Op_LoadN: |
65 | 2067 { |
2068 const Type *t = phase->type(n); | |
2069 #ifdef ASSERT | |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
2070 if (!t->isa_narrowoop() && t->isa_ptr() == NULL) |
65 | 2071 assert(false, "Op_LoadP"); |
2072 #endif | |
2073 | |
2074 Node* adr = n->in(MemNode::Address)->uncast(); | |
2075 const Type *adr_type = phase->type(adr); | |
2076 Node* adr_base; | |
2077 if (adr->is_AddP()) { | |
2078 adr_base = get_addp_base(adr); | |
2079 } else { | |
2080 adr_base = adr; | |
2081 } | |
2082 | |
2083 // For everything "adr_base" could point to, create a deferred edge from | |
2084 // this node to each field with the same offset. | |
2085 VectorSet ptset(Thread::current()->resource_area()); | |
2086 PointsTo(ptset, adr_base, phase); | |
2087 int offset = address_offset(adr, phase); | |
2088 for( VectorSetI i(&ptset); i.test(); ++i ) { | |
2089 uint pt = i.elem; | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2090 add_deferred_edge_to_fields(n_idx, pt, offset); |
0 | 2091 } |
2092 break; | |
2093 } | |
2094 case Op_Parm: | |
2095 { | |
65 | 2096 assert(false, "Op_Parm"); |
0 | 2097 break; |
2098 } | |
2099 case Op_Phi: | |
2100 { | |
65 | 2101 #ifdef ASSERT |
2102 if (n->as_Phi()->type()->isa_ptr() == NULL) | |
2103 assert(false, "Op_Phi"); | |
2104 #endif | |
2105 for (uint i = 1; i < n->req() ; i++) { | |
2106 Node* in = n->in(i); | |
2107 if (in == NULL) | |
2108 continue; // ignore NULL | |
2109 in = in->uncast(); | |
2110 if (in->is_top() || in == n) | |
2111 continue; // ignore top or inputs which go back this node | |
2112 int ti = in->_idx; | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2113 if (ptnode_adr(in->_idx)->node_type() == PointsToNode::JavaObject) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2114 add_pointsto_edge(n_idx, ti); |
65 | 2115 } else { |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2116 add_deferred_edge(n_idx, ti); |
65 | 2117 } |
2118 } | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2119 _processed.set(n_idx); |
0 | 2120 break; |
2121 } | |
65 | 2122 case Op_Proj: |
0 | 2123 { |
65 | 2124 // we are only interested in the result projection from a call |
2125 if (n->as_Proj()->_con == TypeFunc::Parms && n->in(0)->is_Call() ) { | |
2126 process_call_result(n->as_Proj(), phase); | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2127 assert(_processed.test(n_idx), "all call results should be processed"); |
65 | 2128 } else { |
2129 assert(false, "Op_Proj"); | |
2130 } | |
0 | 2131 break; |
2132 } | |
65 | 2133 case Op_Return: |
0 | 2134 { |
65 | 2135 #ifdef ASSERT |
2136 if( n->req() <= TypeFunc::Parms || | |
2137 !phase->type(n->in(TypeFunc::Parms))->isa_oopptr() ) { | |
2138 assert(false, "Op_Return"); | |
0 | 2139 } |
65 | 2140 #endif |
2141 int ti = n->in(TypeFunc::Parms)->_idx; | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2142 if (ptnode_adr(ti)->node_type() == PointsToNode::JavaObject) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2143 add_pointsto_edge(n_idx, ti); |
65 | 2144 } else { |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2145 add_deferred_edge(n_idx, ti); |
65 | 2146 } |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2147 _processed.set(n_idx); |
0 | 2148 break; |
2149 } | |
2150 case Op_StoreP: | |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
2151 case Op_StoreN: |
0 | 2152 case Op_StorePConditional: |
2153 case Op_CompareAndSwapP: | |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
2154 case Op_CompareAndSwapN: |
0 | 2155 { |
2156 Node *adr = n->in(MemNode::Address); | |
221
1e026f8da827
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
168
diff
changeset
|
2157 const Type *adr_type = phase->type(adr)->make_ptr(); |
65 | 2158 #ifdef ASSERT |
0 | 2159 if (!adr_type->isa_oopptr()) |
65 | 2160 assert(phase->type(adr) == TypeRawPtr::NOTNULL, "Op_StoreP"); |
2161 #endif | |
0 | 2162 |
65 | 2163 assert(adr->is_AddP(), "expecting an AddP"); |
2164 Node *adr_base = get_addp_base(adr); | |
2165 Node *val = n->in(MemNode::ValueIn)->uncast(); | |
2166 // For everything "adr_base" could point to, create a deferred edge | |
2167 // to "val" from each field with the same offset. | |
0 | 2168 VectorSet ptset(Thread::current()->resource_area()); |
2169 PointsTo(ptset, adr_base, phase); | |
2170 for( VectorSetI i(&ptset); i.test(); ++i ) { | |
2171 uint pt = i.elem; | |
65 | 2172 add_edge_from_fields(pt, val->_idx, address_offset(adr, phase)); |
0 | 2173 } |
2174 break; | |
2175 } | |
65 | 2176 case Op_ThreadLocal: |
0 | 2177 { |
65 | 2178 assert(false, "Op_ThreadLocal"); |
0 | 2179 break; |
2180 } | |
2181 default: | |
2182 ; | |
2183 // nothing to do | |
2184 } | |
2185 } | |
2186 | |
2187 #ifndef PRODUCT | |
2188 void ConnectionGraph::dump() { | |
2189 PhaseGVN *igvn = _compile->initial_gvn(); | |
2190 bool first = true; | |
2191 | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2192 uint size = nodes_size(); |
65 | 2193 for (uint ni = 0; ni < size; ni++) { |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2194 PointsToNode *ptn = ptnode_adr(ni); |
65 | 2195 PointsToNode::NodeType ptn_type = ptn->node_type(); |
2196 | |
2197 if (ptn_type != PointsToNode::JavaObject || ptn->_node == NULL) | |
0 | 2198 continue; |
65 | 2199 PointsToNode::EscapeState es = escape_state(ptn->_node, igvn); |
2200 if (ptn->_node->is_Allocate() && (es == PointsToNode::NoEscape || Verbose)) { | |
2201 if (first) { | |
2202 tty->cr(); | |
2203 tty->print("======== Connection graph for "); | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2204 _compile->method()->print_short_name(); |
65 | 2205 tty->cr(); |
2206 first = false; | |
2207 } | |
2208 tty->print("%6d ", ni); | |
2209 ptn->dump(); | |
2210 // Print all locals which reference this allocation | |
2211 for (uint li = ni; li < size; li++) { | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2212 PointsToNode *ptn_loc = ptnode_adr(li); |
65 | 2213 PointsToNode::NodeType ptn_loc_type = ptn_loc->node_type(); |
2214 if ( ptn_loc_type == PointsToNode::LocalVar && ptn_loc->_node != NULL && | |
2215 ptn_loc->edge_count() == 1 && ptn_loc->edge_target(0) == ni ) { | |
2216 tty->print("%6d LocalVar [[%d]]", li, ni); | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2217 ptnode_adr(li)->_node->dump(); |
0 | 2218 } |
2219 } | |
65 | 2220 if (Verbose) { |
2221 // Print all fields which reference this allocation | |
2222 for (uint i = 0; i < ptn->edge_count(); i++) { | |
2223 uint ei = ptn->edge_target(i); | |
2224 tty->print("%6d Field [[%d]]", ei, ni); | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2225 ptnode_adr(ei)->_node->dump(); |
65 | 2226 } |
2227 } | |
2228 tty->cr(); | |
0 | 2229 } |
2230 } | |
2231 } | |
2232 #endif |