Mercurial > hg > truffle
annotate src/share/vm/opto/escape.cpp @ 246:9b66e6287f4a
6707044: uncommon_trap of ifnull bytecode leaves garbage on expression stack
Summary: Remove call to repush_if_args()
Reviewed-by: kvn, jrose
author | rasbold |
---|---|
date | Wed, 16 Jul 2008 10:08:57 -0700 |
parents | 4a4c365f777d |
children | 02a35ad4adf8 |
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 } | |
720 if (is_instance && result->is_Phi()) { | |
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) { | |
725 result = split_memory_phi(mphi, alias_idx, orig_phis, phase); | |
726 } | |
727 } | |
728 // the result is either MemNode, PhiNode, InitializeNode. | |
729 return result; | |
730 } | |
731 | |
732 | |
0 | 733 // |
734 // Convert the types of unescaped object to instance types where possible, | |
735 // propagate the new type information through the graph, and update memory | |
736 // edges and MergeMem inputs to reflect the new type. | |
737 // | |
738 // We start with allocations (and calls which may be allocations) on alloc_worklist. | |
739 // The processing is done in 4 phases: | |
740 // | |
741 // Phase 1: Process possible allocations from alloc_worklist. Create instance | |
742 // types for the CheckCastPP for allocations where possible. | |
743 // Propagate the the new types through users as follows: | |
744 // casts and Phi: push users on alloc_worklist | |
745 // AddP: cast Base and Address inputs to the instance type | |
746 // push any AddP users on alloc_worklist and push any memnode | |
747 // users onto memnode_worklist. | |
748 // Phase 2: Process MemNode's from memnode_worklist. compute new address type and | |
749 // search the Memory chain for a store with the appropriate type | |
750 // address type. If a Phi is found, create a new version with | |
751 // the approriate memory slices from each of the Phi inputs. | |
752 // For stores, process the users as follows: | |
753 // MemNode: push on memnode_worklist | |
754 // MergeMem: push on mergemem_worklist | |
755 // Phase 3: Process MergeMem nodes from mergemem_worklist. Walk each memory slice | |
756 // moving the first node encountered of each instance type to the | |
757 // the input corresponding to its alias index. | |
758 // appropriate memory slice. | |
759 // Phase 4: Update the inputs of non-instance memory Phis and the Memory input of memnodes. | |
760 // | |
761 // In the following example, the CheckCastPP nodes are the cast of allocation | |
762 // results and the allocation of node 29 is unescaped and eligible to be an | |
763 // instance type. | |
764 // | |
765 // We start with: | |
766 // | |
767 // 7 Parm #memory | |
768 // 10 ConI "12" | |
769 // 19 CheckCastPP "Foo" | |
770 // 20 AddP _ 19 19 10 Foo+12 alias_index=4 | |
771 // 29 CheckCastPP "Foo" | |
772 // 30 AddP _ 29 29 10 Foo+12 alias_index=4 | |
773 // | |
774 // 40 StoreP 25 7 20 ... alias_index=4 | |
775 // 50 StoreP 35 40 30 ... alias_index=4 | |
776 // 60 StoreP 45 50 20 ... alias_index=4 | |
777 // 70 LoadP _ 60 30 ... alias_index=4 | |
778 // 80 Phi 75 50 60 Memory alias_index=4 | |
779 // 90 LoadP _ 80 30 ... alias_index=4 | |
780 // 100 LoadP _ 80 20 ... alias_index=4 | |
781 // | |
782 // | |
783 // Phase 1 creates an instance type for node 29 assigning it an instance id of 24 | |
784 // and creating a new alias index for node 30. This gives: | |
785 // | |
786 // 7 Parm #memory | |
787 // 10 ConI "12" | |
788 // 19 CheckCastPP "Foo" | |
789 // 20 AddP _ 19 19 10 Foo+12 alias_index=4 | |
790 // 29 CheckCastPP "Foo" iid=24 | |
791 // 30 AddP _ 29 29 10 Foo+12 alias_index=6 iid=24 | |
792 // | |
793 // 40 StoreP 25 7 20 ... alias_index=4 | |
794 // 50 StoreP 35 40 30 ... alias_index=6 | |
795 // 60 StoreP 45 50 20 ... alias_index=4 | |
796 // 70 LoadP _ 60 30 ... alias_index=6 | |
797 // 80 Phi 75 50 60 Memory alias_index=4 | |
798 // 90 LoadP _ 80 30 ... alias_index=6 | |
799 // 100 LoadP _ 80 20 ... alias_index=4 | |
800 // | |
801 // In phase 2, new memory inputs are computed for the loads and stores, | |
802 // And a new version of the phi is created. In phase 4, the inputs to | |
803 // node 80 are updated and then the memory nodes are updated with the | |
804 // values computed in phase 2. This results in: | |
805 // | |
806 // 7 Parm #memory | |
807 // 10 ConI "12" | |
808 // 19 CheckCastPP "Foo" | |
809 // 20 AddP _ 19 19 10 Foo+12 alias_index=4 | |
810 // 29 CheckCastPP "Foo" iid=24 | |
811 // 30 AddP _ 29 29 10 Foo+12 alias_index=6 iid=24 | |
812 // | |
813 // 40 StoreP 25 7 20 ... alias_index=4 | |
814 // 50 StoreP 35 7 30 ... alias_index=6 | |
815 // 60 StoreP 45 40 20 ... alias_index=4 | |
816 // 70 LoadP _ 50 30 ... alias_index=6 | |
817 // 80 Phi 75 40 60 Memory alias_index=4 | |
818 // 120 Phi 75 50 50 Memory alias_index=6 | |
819 // 90 LoadP _ 120 30 ... alias_index=6 | |
820 // 100 LoadP _ 80 20 ... alias_index=4 | |
821 // | |
822 void ConnectionGraph::split_unique_types(GrowableArray<Node *> &alloc_worklist) { | |
823 GrowableArray<Node *> memnode_worklist; | |
824 GrowableArray<Node *> mergemem_worklist; | |
825 GrowableArray<PhiNode *> orig_phis; | |
826 PhaseGVN *igvn = _compile->initial_gvn(); | |
827 uint new_index_start = (uint) _compile->num_alias_types(); | |
828 VectorSet visited(Thread::current()->resource_area()); | |
829 VectorSet ptset(Thread::current()->resource_area()); | |
830 | |
65 | 831 |
832 // Phase 1: Process possible allocations from alloc_worklist. | |
833 // Create instance types for the CheckCastPP for allocations where possible. | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
834 // |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
835 // (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
|
836 // 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
|
837 // see the comment in find_second_addp().) |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
838 // |
0 | 839 while (alloc_worklist.length() != 0) { |
840 Node *n = alloc_worklist.pop(); | |
841 uint ni = n->_idx; | |
65 | 842 const TypeOopPtr* tinst = NULL; |
0 | 843 if (n->is_Call()) { |
844 CallNode *alloc = n->as_Call(); | |
845 // copy escape information to call node | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
846 PointsToNode* ptn = ptnode_adr(alloc->_idx); |
0 | 847 PointsToNode::EscapeState es = escape_state(alloc, igvn); |
65 | 848 // We have an allocation or call which returns a Java object, |
849 // see if it is unescaped. | |
850 if (es != PointsToNode::NoEscape || !ptn->_scalar_replaceable) | |
0 | 851 continue; |
39
76256d272075
6667612: (Escape Analysis) disable loop cloning if it has a scalar replaceable allocation
kvn
parents:
38
diff
changeset
|
852 if (alloc->is_Allocate()) { |
76256d272075
6667612: (Escape Analysis) disable loop cloning if it has a scalar replaceable allocation
kvn
parents:
38
diff
changeset
|
853 // 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
|
854 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
|
855 } |
65 | 856 // find CheckCastPP of call return value |
857 n = alloc->result_cast(); | |
858 if (n == NULL || // No uses accept Initialize or | |
859 !n->is_CheckCastPP()) // not unique CheckCastPP. | |
860 continue; | |
861 // The inline code for Object.clone() casts the allocation result to | |
862 // java.lang.Object and then to the the actual type of the allocated | |
863 // object. Detect this case and use the second cast. | |
864 if (alloc->is_Allocate() && n->as_Type()->type() == TypeInstPtr::NOTNULL | |
865 && igvn->type(alloc->in(AllocateNode::KlassNode)) != TypeKlassPtr::OBJECT) { | |
866 Node *cast2 = NULL; | |
867 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { | |
868 Node *use = n->fast_out(i); | |
869 if (use->is_CheckCastPP()) { | |
870 cast2 = use; | |
871 break; | |
872 } | |
873 } | |
874 if (cast2 != NULL) { | |
875 n = cast2; | |
876 } else { | |
877 continue; | |
878 } | |
879 } | |
880 set_escape_state(n->_idx, es); | |
881 // in order for an object to be stackallocatable, it must be: | |
882 // - a direct allocation (not a call returning an object) | |
883 // - non-escaping | |
884 // - eligible to be a unique type | |
885 // - not determined to be ineligible by escape analysis | |
0 | 886 set_map(alloc->_idx, n); |
887 set_map(n->_idx, alloc); | |
65 | 888 const TypeOopPtr *t = igvn->type(n)->isa_oopptr(); |
889 if (t == NULL) | |
0 | 890 continue; // not a TypeInstPtr |
223 | 891 tinst = t->cast_to_instance_id(ni); |
0 | 892 igvn->hash_delete(n); |
893 igvn->set_type(n, tinst); | |
894 n->raise_bottom_type(tinst); | |
895 igvn->hash_insert(n); | |
65 | 896 record_for_optimizer(n); |
897 if (alloc->is_Allocate() && ptn->_scalar_replaceable && | |
898 (t->isa_instptr() || t->isa_aryptr())) { | |
163 | 899 |
900 // First, put on the worklist all Field edges from Connection Graph | |
901 // which is more accurate then putting immediate users from Ideal Graph. | |
902 for (uint e = 0; e < ptn->edge_count(); e++) { | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
903 Node *use = ptnode_adr(ptn->edge_target(e))->_node; |
163 | 904 assert(ptn->edge_type(e) == PointsToNode::FieldEdge && use->is_AddP(), |
905 "only AddP nodes are Field edges in CG"); | |
906 if (use->outcnt() > 0) { // Don't process dead nodes | |
907 Node* addp2 = find_second_addp(use, use->in(AddPNode::Base)); | |
908 if (addp2 != NULL) { | |
909 assert(alloc->is_AllocateArray(),"array allocation was expected"); | |
910 alloc_worklist.append_if_missing(addp2); | |
911 } | |
912 alloc_worklist.append_if_missing(use); | |
913 } | |
914 } | |
915 | |
65 | 916 // An allocation may have an Initialize which has raw stores. Scan |
917 // the users of the raw allocation result and push AddP users | |
918 // on alloc_worklist. | |
919 Node *raw_result = alloc->proj_out(TypeFunc::Parms); | |
920 assert (raw_result != NULL, "must have an allocation result"); | |
921 for (DUIterator_Fast imax, i = raw_result->fast_outs(imax); i < imax; i++) { | |
922 Node *use = raw_result->fast_out(i); | |
923 if (use->is_AddP() && use->outcnt() > 0) { // Don't process dead nodes | |
924 Node* addp2 = find_second_addp(use, raw_result); | |
925 if (addp2 != NULL) { | |
926 assert(alloc->is_AllocateArray(),"array allocation was expected"); | |
927 alloc_worklist.append_if_missing(addp2); | |
928 } | |
929 alloc_worklist.append_if_missing(use); | |
930 } else if (use->is_Initialize()) { | |
931 memnode_worklist.append_if_missing(use); | |
932 } | |
933 } | |
934 } | |
0 | 935 } else if (n->is_AddP()) { |
936 ptset.Clear(); | |
65 | 937 PointsTo(ptset, get_addp_base(n), igvn); |
0 | 938 assert(ptset.Size() == 1, "AddP address is unique"); |
65 | 939 uint elem = ptset.getelem(); // Allocation node's index |
940 if (elem == _phantom_object) | |
941 continue; // Assume the value was set outside this method. | |
942 Node *base = get_map(elem); // CheckCastPP node | |
0 | 943 split_AddP(n, base, igvn); |
65 | 944 tinst = igvn->type(base)->isa_oopptr(); |
945 } else if (n->is_Phi() || | |
946 n->is_CheckCastPP() || | |
168
7793bd37a336
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
164
diff
changeset
|
947 n->is_EncodeP() || |
7793bd37a336
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
164
diff
changeset
|
948 n->is_DecodeN() || |
65 | 949 (n->is_ConstraintCast() && n->Opcode() == Op_CastPP)) { |
0 | 950 if (visited.test_set(n->_idx)) { |
951 assert(n->is_Phi(), "loops only through Phi's"); | |
952 continue; // already processed | |
953 } | |
954 ptset.Clear(); | |
955 PointsTo(ptset, n, igvn); | |
956 if (ptset.Size() == 1) { | |
65 | 957 uint elem = ptset.getelem(); // Allocation node's index |
958 if (elem == _phantom_object) | |
959 continue; // Assume the value was set outside this method. | |
960 Node *val = get_map(elem); // CheckCastPP node | |
0 | 961 TypeNode *tn = n->as_Type(); |
65 | 962 tinst = igvn->type(val)->isa_oopptr(); |
223 | 963 assert(tinst != NULL && tinst->is_known_instance() && |
964 (uint)tinst->instance_id() == elem , "instance type expected."); | |
163 | 965 |
966 const Type *tn_type = igvn->type(tn); | |
223 | 967 const TypeOopPtr *tn_t; |
968 if (tn_type->isa_narrowoop()) { | |
969 tn_t = tn_type->make_ptr()->isa_oopptr(); | |
970 } else { | |
971 tn_t = tn_type->isa_oopptr(); | |
972 } | |
0 | 973 |
65 | 974 if (tn_t != NULL && |
223 | 975 tinst->cast_to_instance_id(TypeOopPtr::InstanceBot)->higher_equal(tn_t)) { |
163 | 976 if (tn_type->isa_narrowoop()) { |
977 tn_type = tinst->make_narrowoop(); | |
978 } else { | |
979 tn_type = tinst; | |
980 } | |
0 | 981 igvn->hash_delete(tn); |
163 | 982 igvn->set_type(tn, tn_type); |
983 tn->set_type(tn_type); | |
0 | 984 igvn->hash_insert(tn); |
65 | 985 record_for_optimizer(n); |
0 | 986 } |
987 } | |
988 } else { | |
989 continue; | |
990 } | |
991 // push users on appropriate worklist | |
992 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { | |
993 Node *use = n->fast_out(i); | |
994 if(use->is_Mem() && use->in(MemNode::Address) == n) { | |
65 | 995 memnode_worklist.append_if_missing(use); |
996 } else if (use->is_Initialize()) { | |
997 memnode_worklist.append_if_missing(use); | |
998 } else if (use->is_MergeMem()) { | |
999 mergemem_worklist.append_if_missing(use); | |
1000 } else if (use->is_Call() && tinst != NULL) { | |
1001 // Look for MergeMem nodes for calls which reference unique allocation | |
1002 // (through CheckCastPP nodes) even for debug info. | |
1003 Node* m = use->in(TypeFunc::Memory); | |
1004 uint iid = tinst->instance_id(); | |
1005 while (m->is_Proj() && m->in(0)->is_Call() && | |
1006 m->in(0) != use && !m->in(0)->_idx != iid) { | |
1007 m = m->in(0)->in(TypeFunc::Memory); | |
1008 } | |
1009 if (m->is_MergeMem()) { | |
1010 mergemem_worklist.append_if_missing(m); | |
1011 } | |
1012 } else if (use->is_AddP() && use->outcnt() > 0) { // No dead nodes | |
1013 Node* addp2 = find_second_addp(use, n); | |
1014 if (addp2 != NULL) { | |
1015 alloc_worklist.append_if_missing(addp2); | |
1016 } | |
1017 alloc_worklist.append_if_missing(use); | |
1018 } else if (use->is_Phi() || | |
1019 use->is_CheckCastPP() || | |
168
7793bd37a336
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
164
diff
changeset
|
1020 use->is_EncodeP() || |
7793bd37a336
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
164
diff
changeset
|
1021 use->is_DecodeN() || |
65 | 1022 (use->is_ConstraintCast() && use->Opcode() == Op_CastPP)) { |
1023 alloc_worklist.append_if_missing(use); | |
0 | 1024 } |
1025 } | |
1026 | |
1027 } | |
65 | 1028 // New alias types were created in split_AddP(). |
0 | 1029 uint new_index_end = (uint) _compile->num_alias_types(); |
1030 | |
1031 // Phase 2: Process MemNode's from memnode_worklist. compute new address type and | |
1032 // compute new values for Memory inputs (the Memory inputs are not | |
1033 // actually updated until phase 4.) | |
1034 if (memnode_worklist.length() == 0) | |
1035 return; // nothing to do | |
1036 | |
1037 while (memnode_worklist.length() != 0) { | |
1038 Node *n = memnode_worklist.pop(); | |
65 | 1039 if (visited.test_set(n->_idx)) |
1040 continue; | |
0 | 1041 if (n->is_Phi()) { |
1042 assert(n->as_Phi()->adr_type() != TypePtr::BOTTOM, "narrow memory slice required"); | |
1043 // we don't need to do anything, but the users must be pushed if we haven't processed | |
1044 // this Phi before | |
65 | 1045 } else if (n->is_Initialize()) { |
1046 // we don't need to do anything, but the users of the memory projection must be pushed | |
1047 n = n->as_Initialize()->proj_out(TypeFunc::Memory); | |
1048 if (n == NULL) | |
0 | 1049 continue; |
1050 } else { | |
1051 assert(n->is_Mem(), "memory node required."); | |
1052 Node *addr = n->in(MemNode::Address); | |
65 | 1053 assert(addr->is_AddP(), "AddP required"); |
0 | 1054 const Type *addr_t = igvn->type(addr); |
1055 if (addr_t == Type::TOP) | |
1056 continue; | |
1057 assert (addr_t->isa_ptr() != NULL, "pointer type required."); | |
1058 int alias_idx = _compile->get_alias_index(addr_t->is_ptr()); | |
65 | 1059 assert ((uint)alias_idx < new_index_end, "wrong alias index"); |
1060 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
|
1061 if (_compile->failing()) { |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
1062 return; |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
1063 } |
65 | 1064 if (mem != n->in(MemNode::Memory)) { |
0 | 1065 set_map(n->_idx, mem); |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1066 ptnode_adr(n->_idx)->_node = n; |
65 | 1067 } |
0 | 1068 if (n->is_Load()) { |
1069 continue; // don't push users | |
1070 } else if (n->is_LoadStore()) { | |
1071 // get the memory projection | |
1072 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { | |
1073 Node *use = n->fast_out(i); | |
1074 if (use->Opcode() == Op_SCMemProj) { | |
1075 n = use; | |
1076 break; | |
1077 } | |
1078 } | |
1079 assert(n->Opcode() == Op_SCMemProj, "memory projection required"); | |
1080 } | |
1081 } | |
1082 // push user on appropriate worklist | |
1083 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { | |
1084 Node *use = n->fast_out(i); | |
1085 if (use->is_Phi()) { | |
65 | 1086 memnode_worklist.append_if_missing(use); |
0 | 1087 } else if(use->is_Mem() && use->in(MemNode::Memory) == n) { |
65 | 1088 memnode_worklist.append_if_missing(use); |
1089 } else if (use->is_Initialize()) { | |
1090 memnode_worklist.append_if_missing(use); | |
0 | 1091 } else if (use->is_MergeMem()) { |
65 | 1092 mergemem_worklist.append_if_missing(use); |
0 | 1093 } |
1094 } | |
1095 } | |
1096 | |
65 | 1097 // Phase 3: Process MergeMem nodes from mergemem_worklist. |
1098 // Walk each memory moving the first node encountered of each | |
1099 // instance type to the the input corresponding to its alias index. | |
0 | 1100 while (mergemem_worklist.length() != 0) { |
1101 Node *n = mergemem_worklist.pop(); | |
1102 assert(n->is_MergeMem(), "MergeMem node required."); | |
65 | 1103 if (visited.test_set(n->_idx)) |
1104 continue; | |
0 | 1105 MergeMemNode *nmm = n->as_MergeMem(); |
1106 // Note: we don't want to use MergeMemStream here because we only want to | |
65 | 1107 // scan inputs which exist at the start, not ones we add during processing. |
0 | 1108 uint nslices = nmm->req(); |
1109 igvn->hash_delete(nmm); | |
1110 for (uint i = Compile::AliasIdxRaw+1; i < nslices; i++) { | |
65 | 1111 Node* mem = nmm->in(i); |
1112 Node* cur = NULL; | |
0 | 1113 if (mem == NULL || mem->is_top()) |
1114 continue; | |
1115 while (mem->is_Mem()) { | |
1116 const Type *at = igvn->type(mem->in(MemNode::Address)); | |
1117 if (at != Type::TOP) { | |
1118 assert (at->isa_ptr() != NULL, "pointer type required."); | |
1119 uint idx = (uint)_compile->get_alias_index(at->is_ptr()); | |
1120 if (idx == i) { | |
1121 if (cur == NULL) | |
1122 cur = mem; | |
1123 } else { | |
1124 if (idx >= nmm->req() || nmm->is_empty_memory(nmm->in(idx))) { | |
1125 nmm->set_memory_at(idx, mem); | |
1126 } | |
1127 } | |
1128 } | |
1129 mem = mem->in(MemNode::Memory); | |
1130 } | |
1131 nmm->set_memory_at(i, (cur != NULL) ? cur : mem); | |
65 | 1132 // Find any instance of the current type if we haven't encountered |
1133 // a value of the instance along the chain. | |
1134 for (uint ni = new_index_start; ni < new_index_end; ni++) { | |
1135 if((uint)_compile->get_general_index(ni) == i) { | |
1136 Node *m = (ni >= nmm->req()) ? nmm->empty_memory() : nmm->in(ni); | |
1137 if (nmm->is_empty_memory(m)) { | |
1138 Node* result = find_inst_mem(mem, ni, orig_phis, igvn); | |
1139 if (_compile->failing()) { | |
1140 return; | |
1141 } | |
1142 nmm->set_memory_at(ni, result); | |
1143 } | |
1144 } | |
1145 } | |
1146 } | |
1147 // Find the rest of instances values | |
1148 for (uint ni = new_index_start; ni < new_index_end; ni++) { | |
1149 const TypeOopPtr *tinst = igvn->C->get_adr_type(ni)->isa_oopptr(); | |
1150 Node* result = step_through_mergemem(nmm, ni, tinst); | |
1151 if (result == nmm->base_memory()) { | |
1152 // Didn't find instance memory, search through general slice recursively. | |
1153 result = nmm->memory_at(igvn->C->get_general_index(ni)); | |
1154 result = find_inst_mem(result, ni, orig_phis, igvn); | |
1155 if (_compile->failing()) { | |
1156 return; | |
1157 } | |
1158 nmm->set_memory_at(ni, result); | |
1159 } | |
1160 } | |
1161 igvn->hash_insert(nmm); | |
1162 record_for_optimizer(nmm); | |
1163 | |
1164 // Propagate new memory slices to following MergeMem nodes. | |
1165 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { | |
1166 Node *use = n->fast_out(i); | |
1167 if (use->is_Call()) { | |
1168 CallNode* in = use->as_Call(); | |
1169 if (in->proj_out(TypeFunc::Memory) != NULL) { | |
1170 Node* m = in->proj_out(TypeFunc::Memory); | |
1171 for (DUIterator_Fast jmax, j = m->fast_outs(jmax); j < jmax; j++) { | |
1172 Node* mm = m->fast_out(j); | |
1173 if (mm->is_MergeMem()) { | |
1174 mergemem_worklist.append_if_missing(mm); | |
1175 } | |
1176 } | |
1177 } | |
1178 if (use->is_Allocate()) { | |
1179 use = use->as_Allocate()->initialization(); | |
1180 if (use == NULL) { | |
1181 continue; | |
1182 } | |
1183 } | |
1184 } | |
1185 if (use->is_Initialize()) { | |
1186 InitializeNode* in = use->as_Initialize(); | |
1187 if (in->proj_out(TypeFunc::Memory) != NULL) { | |
1188 Node* m = in->proj_out(TypeFunc::Memory); | |
1189 for (DUIterator_Fast jmax, j = m->fast_outs(jmax); j < jmax; j++) { | |
1190 Node* mm = m->fast_out(j); | |
1191 if (mm->is_MergeMem()) { | |
1192 mergemem_worklist.append_if_missing(mm); | |
0 | 1193 } |
1194 } | |
1195 } | |
1196 } | |
1197 } | |
1198 } | |
1199 | |
65 | 1200 // Phase 4: Update the inputs of non-instance memory Phis and |
1201 // the Memory input of memnodes | |
0 | 1202 // First update the inputs of any non-instance Phi's from |
1203 // which we split out an instance Phi. Note we don't have | |
1204 // to recursively process Phi's encounted on the input memory | |
1205 // chains as is done in split_memory_phi() since they will | |
1206 // also be processed here. | |
1207 while (orig_phis.length() != 0) { | |
1208 PhiNode *phi = orig_phis.pop(); | |
1209 int alias_idx = _compile->get_alias_index(phi->adr_type()); | |
1210 igvn->hash_delete(phi); | |
1211 for (uint i = 1; i < phi->req(); i++) { | |
1212 Node *mem = phi->in(i); | |
65 | 1213 Node *new_mem = find_inst_mem(mem, alias_idx, orig_phis, igvn); |
1214 if (_compile->failing()) { | |
1215 return; | |
1216 } | |
0 | 1217 if (mem != new_mem) { |
1218 phi->set_req(i, new_mem); | |
1219 } | |
1220 } | |
1221 igvn->hash_insert(phi); | |
1222 record_for_optimizer(phi); | |
1223 } | |
1224 | |
1225 // Update the memory inputs of MemNodes with the value we computed | |
1226 // in Phase 2. | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1227 for (uint i = 0; i < nodes_size(); i++) { |
0 | 1228 Node *nmem = get_map(i); |
1229 if (nmem != NULL) { | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1230 Node *n = ptnode_adr(i)->_node; |
0 | 1231 if (n != NULL && n->is_Mem()) { |
1232 igvn->hash_delete(n); | |
1233 n->set_req(MemNode::Memory, nmem); | |
1234 igvn->hash_insert(n); | |
1235 record_for_optimizer(n); | |
1236 } | |
1237 } | |
1238 } | |
1239 } | |
1240 | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1241 bool ConnectionGraph::has_candidates(Compile *C) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1242 // 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
|
1243 // are represented by ideal Macro nodes. |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1244 int cnt = C->macro_count(); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1245 for( int i=0; i < cnt; i++ ) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1246 Node *n = C->macro_node(i); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1247 if ( n->is_Allocate() ) |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1248 return true; |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1249 if( n->is_Lock() ) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1250 Node* obj = n->as_Lock()->obj_node()->uncast(); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1251 if( !(obj->is_Parm() || obj->is_Con()) ) |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1252 return true; |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1253 } |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1254 } |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1255 return false; |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1256 } |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1257 |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1258 bool ConnectionGraph::compute_escape() { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1259 Compile* C = _compile; |
65 | 1260 |
163 | 1261 // 1. Populate Connection Graph (CG) with Ideal nodes. |
65 | 1262 |
1263 Unique_Node_List worklist_init; | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1264 worklist_init.map(C->unique(), NULL); // preallocate space |
65 | 1265 |
1266 // Initialize worklist | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1267 if (C->root() != NULL) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1268 worklist_init.push(C->root()); |
65 | 1269 } |
1270 | |
1271 GrowableArray<int> cg_worklist; | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1272 PhaseGVN* igvn = C->initial_gvn(); |
65 | 1273 bool has_allocations = false; |
1274 | |
1275 // Push all useful nodes onto CG list and set their type. | |
1276 for( uint next = 0; next < worklist_init.size(); ++next ) { | |
1277 Node* n = worklist_init.at(next); | |
1278 record_for_escape_analysis(n, igvn); | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1279 // Only allocations and java static calls results are checked |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1280 // for an escape status. See process_call_result() below. |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1281 if (n->is_Allocate() || n->is_CallStaticJava() && |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1282 ptnode_adr(n->_idx)->node_type() == PointsToNode::JavaObject) { |
65 | 1283 has_allocations = true; |
1284 } | |
1285 if(n->is_AddP()) | |
1286 cg_worklist.append(n->_idx); | |
1287 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { | |
1288 Node* m = n->fast_out(i); // Get user | |
1289 worklist_init.push(m); | |
1290 } | |
1291 } | |
0 | 1292 |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1293 if (!has_allocations) { |
65 | 1294 _collecting = false; |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1295 return false; // Nothing to do. |
65 | 1296 } |
1297 | |
1298 // 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
|
1299 uint delayed_size = _delayed_worklist.size(); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1300 for( uint next = 0; next < delayed_size; ++next ) { |
65 | 1301 Node* n = _delayed_worklist.at(next); |
1302 build_connection_graph(n, igvn); | |
1303 } | |
0 | 1304 |
65 | 1305 // 3. Pass to create fields edges (Allocate -F-> AddP). |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1306 uint cg_length = cg_worklist.length(); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1307 for( uint next = 0; next < cg_length; ++next ) { |
65 | 1308 int ni = cg_worklist.at(next); |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1309 build_connection_graph(ptnode_adr(ni)->_node, igvn); |
65 | 1310 } |
1311 | |
1312 cg_worklist.clear(); | |
1313 cg_worklist.append(_phantom_object); | |
1314 | |
1315 // 4. Build Connection Graph which need | |
1316 // to walk the connection graph. | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1317 for (uint ni = 0; ni < nodes_size(); ni++) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1318 PointsToNode* ptn = ptnode_adr(ni); |
65 | 1319 Node *n = ptn->_node; |
1320 if (n != NULL) { // Call, AddP, LoadP, StoreP | |
1321 build_connection_graph(n, igvn); | |
1322 if (ptn->node_type() != PointsToNode::UnknownType) | |
1323 cg_worklist.append(n->_idx); // Collect CG nodes | |
1324 } | |
0 | 1325 } |
1326 | |
1327 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
|
1328 GrowableArray<uint> deferred_edges; |
a6cb86dd209b
6681577: PIT: some VM tests fails with -XX:+AggressiveOpts in 6u5p b01
kvn
parents:
65
diff
changeset
|
1329 VectorSet visited(Thread::current()->resource_area()); |
0 | 1330 |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1331 // 5. Remove deferred edges from the graph and collect |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1332 // information needed for type splitting. |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1333 cg_length = cg_worklist.length(); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1334 for( uint next = 0; next < cg_length; ++next ) { |
65 | 1335 int ni = cg_worklist.at(next); |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1336 PointsToNode* ptn = ptnode_adr(ni); |
0 | 1337 PointsToNode::NodeType nt = ptn->node_type(); |
1338 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
|
1339 remove_deferred(ni, &deferred_edges, &visited); |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1340 Node *n = ptn->_node; |
0 | 1341 if (n->is_AddP()) { |
65 | 1342 // If this AddP computes an address which may point to more that one |
163 | 1343 // object or more then one field (array's element), nothing the address |
1344 // points to can be scalar replaceable. | |
65 | 1345 Node *base = get_addp_base(n); |
0 | 1346 ptset.Clear(); |
1347 PointsTo(ptset, base, igvn); | |
163 | 1348 if (ptset.Size() > 1 || |
1349 (ptset.Size() != 0 && ptn->offset() == Type::OffsetBot)) { | |
0 | 1350 for( VectorSetI j(&ptset); j.test(); ++j ) { |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1351 ptnode_adr(j.elem)->_scalar_replaceable = false; |
0 | 1352 } |
1353 } | |
1354 } | |
1355 } | |
1356 } | |
65 | 1357 |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1358 // 6. Propagate escape states. |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1359 GrowableArray<int> worklist; |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1360 bool has_non_escaping_obj = false; |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1361 |
0 | 1362 // push all GlobalEscape nodes on the worklist |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1363 for( uint next = 0; next < cg_length; ++next ) { |
65 | 1364 int nk = cg_worklist.at(next); |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1365 if (ptnode_adr(nk)->escape_state() == PointsToNode::GlobalEscape) |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1366 worklist.push(nk); |
0 | 1367 } |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1368 // mark all nodes reachable from GlobalEscape nodes |
0 | 1369 while(worklist.length() > 0) { |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1370 PointsToNode* ptn = ptnode_adr(worklist.pop()); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1371 uint e_cnt = ptn->edge_count(); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1372 for (uint ei = 0; ei < e_cnt; ei++) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1373 uint npi = ptn->edge_target(ei); |
0 | 1374 PointsToNode *np = ptnode_adr(npi); |
65 | 1375 if (np->escape_state() < PointsToNode::GlobalEscape) { |
0 | 1376 np->set_escape_state(PointsToNode::GlobalEscape); |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1377 worklist.push(npi); |
0 | 1378 } |
1379 } | |
1380 } | |
1381 | |
1382 // push all ArgEscape nodes on the worklist | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1383 for( uint next = 0; next < cg_length; ++next ) { |
65 | 1384 int nk = cg_worklist.at(next); |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1385 if (ptnode_adr(nk)->escape_state() == PointsToNode::ArgEscape) |
0 | 1386 worklist.push(nk); |
1387 } | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1388 // mark all nodes reachable from ArgEscape nodes |
0 | 1389 while(worklist.length() > 0) { |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1390 PointsToNode* ptn = ptnode_adr(worklist.pop()); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1391 if (ptn->node_type() == PointsToNode::JavaObject) |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1392 has_non_escaping_obj = true; // Non GlobalEscape |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1393 uint e_cnt = ptn->edge_count(); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1394 for (uint ei = 0; ei < e_cnt; ei++) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1395 uint npi = ptn->edge_target(ei); |
0 | 1396 PointsToNode *np = ptnode_adr(npi); |
65 | 1397 if (np->escape_state() < PointsToNode::ArgEscape) { |
0 | 1398 np->set_escape_state(PointsToNode::ArgEscape); |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1399 worklist.push(npi); |
0 | 1400 } |
1401 } | |
1402 } | |
65 | 1403 |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1404 GrowableArray<Node*> alloc_worklist; |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1405 |
65 | 1406 // push all NoEscape nodes on the worklist |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1407 for( uint next = 0; next < cg_length; ++next ) { |
65 | 1408 int nk = cg_worklist.at(next); |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1409 if (ptnode_adr(nk)->escape_state() == PointsToNode::NoEscape) |
65 | 1410 worklist.push(nk); |
1411 } | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1412 // mark all nodes reachable from NoEscape nodes |
65 | 1413 while(worklist.length() > 0) { |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1414 PointsToNode* ptn = ptnode_adr(worklist.pop()); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1415 if (ptn->node_type() == PointsToNode::JavaObject) |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1416 has_non_escaping_obj = true; // Non GlobalEscape |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1417 Node* n = ptn->_node; |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1418 if (n->is_Allocate() && ptn->_scalar_replaceable ) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1419 // Push scalar replaceable alocations on alloc_worklist |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1420 // for processing in split_unique_types(). |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1421 alloc_worklist.append(n); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1422 } |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1423 uint e_cnt = ptn->edge_count(); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1424 for (uint ei = 0; ei < e_cnt; ei++) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1425 uint npi = ptn->edge_target(ei); |
65 | 1426 PointsToNode *np = ptnode_adr(npi); |
1427 if (np->escape_state() < PointsToNode::NoEscape) { | |
1428 np->set_escape_state(PointsToNode::NoEscape); | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1429 worklist.push(npi); |
65 | 1430 } |
1431 } | |
1432 } | |
1433 | |
0 | 1434 _collecting = false; |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1435 assert(C->unique() == nodes_size(), "there should be no new ideal nodes during ConnectionGraph build"); |
0 | 1436 |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1437 bool has_scalar_replaceable_candidates = alloc_worklist.length() > 0; |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1438 if ( has_scalar_replaceable_candidates && |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1439 C->AliasLevel() >= 3 && EliminateAllocations ) { |
0 | 1440 |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1441 // Now use the escape information to create unique types for |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1442 // scalar replaceable objects. |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1443 split_unique_types(alloc_worklist); |
0 | 1444 |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1445 if (C->failing()) return false; |
0 | 1446 |
65 | 1447 // Clean up after split unique types. |
1448 ResourceMark rm; | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1449 PhaseRemoveUseless pru(C->initial_gvn(), C->for_igvn()); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1450 |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1451 C->print_method("After Escape Analysis", 2); |
0 | 1452 |
65 | 1453 #ifdef ASSERT |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1454 } else if (Verbose && (PrintEscapeAnalysis || PrintEliminateAllocations)) { |
65 | 1455 tty->print("=== No allocations eliminated for "); |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1456 C->method()->print_short_name(); |
65 | 1457 if(!EliminateAllocations) { |
1458 tty->print(" since EliminateAllocations is off ==="); | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1459 } else if(!has_scalar_replaceable_candidates) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1460 tty->print(" since there are no scalar replaceable candidates ==="); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1461 } else if(C->AliasLevel() < 3) { |
65 | 1462 tty->print(" since AliasLevel < 3 ==="); |
0 | 1463 } |
65 | 1464 tty->cr(); |
1465 #endif | |
0 | 1466 } |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1467 return has_non_escaping_obj; |
0 | 1468 } |
1469 | |
1470 void ConnectionGraph::process_call_arguments(CallNode *call, PhaseTransform *phase) { | |
1471 | |
1472 switch (call->Opcode()) { | |
65 | 1473 #ifdef ASSERT |
0 | 1474 case Op_Allocate: |
1475 case Op_AllocateArray: | |
1476 case Op_Lock: | |
1477 case Op_Unlock: | |
65 | 1478 assert(false, "should be done already"); |
0 | 1479 break; |
65 | 1480 #endif |
1481 case Op_CallLeafNoFP: | |
1482 { | |
1483 // Stub calls, objects do not escape but they are not scale replaceable. | |
1484 // Adjust escape state for outgoing arguments. | |
1485 const TypeTuple * d = call->tf()->domain(); | |
1486 VectorSet ptset(Thread::current()->resource_area()); | |
1487 for (uint i = TypeFunc::Parms; i < d->cnt(); i++) { | |
1488 const Type* at = d->field_at(i); | |
1489 Node *arg = call->in(i)->uncast(); | |
1490 const Type *aat = phase->type(arg); | |
1491 if (!arg->is_top() && at->isa_ptr() && aat->isa_ptr()) { | |
1492 assert(aat == Type::TOP || aat == TypePtr::NULL_PTR || | |
1493 aat->isa_ptr() != NULL, "expecting an Ptr"); | |
1494 set_escape_state(arg->_idx, PointsToNode::ArgEscape); | |
1495 if (arg->is_AddP()) { | |
1496 // | |
1497 // The inline_native_clone() case when the arraycopy stub is called | |
1498 // after the allocation before Initialize and CheckCastPP nodes. | |
1499 // | |
1500 // Set AddP's base (Allocate) as not scalar replaceable since | |
1501 // pointer to the base (with offset) is passed as argument. | |
1502 // | |
1503 arg = get_addp_base(arg); | |
1504 } | |
1505 ptset.Clear(); | |
1506 PointsTo(ptset, arg, phase); | |
1507 for( VectorSetI j(&ptset); j.test(); ++j ) { | |
1508 uint pt = j.elem; | |
1509 set_escape_state(pt, PointsToNode::ArgEscape); | |
1510 } | |
1511 } | |
1512 } | |
1513 break; | |
1514 } | |
0 | 1515 |
1516 case Op_CallStaticJava: | |
1517 // For a static call, we know exactly what method is being called. | |
1518 // Use bytecode estimator to record the call's escape affects | |
1519 { | |
1520 ciMethod *meth = call->as_CallJava()->method(); | |
65 | 1521 BCEscapeAnalyzer *call_analyzer = (meth !=NULL) ? meth->get_bcea() : NULL; |
1522 // fall-through if not a Java method or no analyzer information | |
1523 if (call_analyzer != NULL) { | |
0 | 1524 const TypeTuple * d = call->tf()->domain(); |
1525 VectorSet ptset(Thread::current()->resource_area()); | |
65 | 1526 bool copy_dependencies = false; |
0 | 1527 for (uint i = TypeFunc::Parms; i < d->cnt(); i++) { |
1528 const Type* at = d->field_at(i); | |
1529 int k = i - TypeFunc::Parms; | |
1530 | |
1531 if (at->isa_oopptr() != NULL) { | |
65 | 1532 Node *arg = call->in(i)->uncast(); |
0 | 1533 |
65 | 1534 bool global_escapes = false; |
1535 bool fields_escapes = false; | |
1536 if (!call_analyzer->is_arg_stack(k)) { | |
1537 // The argument global escapes, mark everything it could point to | |
1538 set_escape_state(arg->_idx, PointsToNode::GlobalEscape); | |
1539 global_escapes = true; | |
1540 } else { | |
1541 if (!call_analyzer->is_arg_local(k)) { | |
1542 // The argument itself doesn't escape, but any fields might | |
1543 fields_escapes = true; | |
0 | 1544 } |
65 | 1545 set_escape_state(arg->_idx, PointsToNode::ArgEscape); |
1546 copy_dependencies = true; | |
1547 } | |
1548 | |
1549 ptset.Clear(); | |
1550 PointsTo(ptset, arg, phase); | |
1551 for( VectorSetI j(&ptset); j.test(); ++j ) { | |
1552 uint pt = j.elem; | |
1553 if (global_escapes) { | |
1554 //The argument global escapes, mark everything it could point to | |
1555 set_escape_state(pt, PointsToNode::GlobalEscape); | |
1556 } else { | |
1557 if (fields_escapes) { | |
1558 // The argument itself doesn't escape, but any fields might | |
1559 add_edge_from_fields(pt, _phantom_object, Type::OffsetBot); | |
1560 } | |
1561 set_escape_state(pt, PointsToNode::ArgEscape); | |
0 | 1562 } |
1563 } | |
1564 } | |
1565 } | |
65 | 1566 if (copy_dependencies) |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1567 call_analyzer->copy_dependencies(_compile->dependencies()); |
0 | 1568 break; |
1569 } | |
1570 } | |
1571 | |
1572 default: | |
65 | 1573 // Fall-through here if not a Java method or no analyzer information |
1574 // or some other type of call, assume the worst case: all arguments | |
0 | 1575 // globally escape. |
1576 { | |
1577 // adjust escape state for outgoing arguments | |
1578 const TypeTuple * d = call->tf()->domain(); | |
1579 VectorSet ptset(Thread::current()->resource_area()); | |
1580 for (uint i = TypeFunc::Parms; i < d->cnt(); i++) { | |
1581 const Type* at = d->field_at(i); | |
1582 if (at->isa_oopptr() != NULL) { | |
65 | 1583 Node *arg = call->in(i)->uncast(); |
1584 set_escape_state(arg->_idx, PointsToNode::GlobalEscape); | |
0 | 1585 ptset.Clear(); |
1586 PointsTo(ptset, arg, phase); | |
1587 for( VectorSetI j(&ptset); j.test(); ++j ) { | |
1588 uint pt = j.elem; | |
1589 set_escape_state(pt, PointsToNode::GlobalEscape); | |
1590 } | |
1591 } | |
1592 } | |
1593 } | |
1594 } | |
1595 } | |
1596 void ConnectionGraph::process_call_result(ProjNode *resproj, PhaseTransform *phase) { | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1597 CallNode *call = resproj->in(0)->as_Call(); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1598 uint call_idx = call->_idx; |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1599 uint resproj_idx = resproj->_idx; |
0 | 1600 |
1601 switch (call->Opcode()) { | |
1602 case Op_Allocate: | |
1603 { | |
1604 Node *k = call->in(AllocateNode::KlassNode); | |
1605 const TypeKlassPtr *kt; | |
1606 if (k->Opcode() == Op_LoadKlass) { | |
1607 kt = k->as_Load()->type()->isa_klassptr(); | |
1608 } else { | |
164
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
1609 // Also works for DecodeN(LoadNKlass). |
0 | 1610 kt = k->as_Type()->type()->isa_klassptr(); |
1611 } | |
1612 assert(kt != NULL, "TypeKlassPtr required."); | |
1613 ciKlass* cik = kt->klass(); | |
1614 ciInstanceKlass* ciik = cik->as_instance_klass(); | |
1615 | |
65 | 1616 PointsToNode::EscapeState es; |
1617 uint edge_to; | |
0 | 1618 if (cik->is_subclass_of(_compile->env()->Thread_klass()) || ciik->has_finalizer()) { |
65 | 1619 es = PointsToNode::GlobalEscape; |
1620 edge_to = _phantom_object; // Could not be worse | |
0 | 1621 } else { |
65 | 1622 es = PointsToNode::NoEscape; |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1623 edge_to = call_idx; |
0 | 1624 } |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1625 set_escape_state(call_idx, es); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1626 add_pointsto_edge(resproj_idx, edge_to); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1627 _processed.set(resproj_idx); |
0 | 1628 break; |
1629 } | |
1630 | |
1631 case Op_AllocateArray: | |
1632 { | |
65 | 1633 int length = call->in(AllocateNode::ALength)->find_int_con(-1); |
1634 if (length < 0 || length > EliminateAllocationArraySizeLimit) { | |
1635 // 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
|
1636 ptnode_adr(call_idx)->_scalar_replaceable = false; |
65 | 1637 } |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1638 set_escape_state(call_idx, PointsToNode::NoEscape); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1639 add_pointsto_edge(resproj_idx, call_idx); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1640 _processed.set(resproj_idx); |
0 | 1641 break; |
1642 } | |
1643 | |
1644 case Op_CallStaticJava: | |
1645 // For a static call, we know exactly what method is being called. | |
1646 // Use bytecode estimator to record whether the call's return value escapes | |
1647 { | |
65 | 1648 bool done = true; |
0 | 1649 const TypeTuple *r = call->tf()->range(); |
1650 const Type* ret_type = NULL; | |
1651 | |
1652 if (r->cnt() > TypeFunc::Parms) | |
1653 ret_type = r->field_at(TypeFunc::Parms); | |
1654 | |
1655 // Note: we use isa_ptr() instead of isa_oopptr() here because the | |
1656 // _multianewarray functions return a TypeRawPtr. | |
65 | 1657 if (ret_type == NULL || ret_type->isa_ptr() == NULL) { |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1658 _processed.set(resproj_idx); |
0 | 1659 break; // doesn't return a pointer type |
65 | 1660 } |
0 | 1661 ciMethod *meth = call->as_CallJava()->method(); |
65 | 1662 const TypeTuple * d = call->tf()->domain(); |
0 | 1663 if (meth == NULL) { |
1664 // not a Java method, assume global escape | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1665 set_escape_state(call_idx, PointsToNode::GlobalEscape); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1666 add_pointsto_edge(resproj_idx, _phantom_object); |
0 | 1667 } else { |
65 | 1668 BCEscapeAnalyzer *call_analyzer = meth->get_bcea(); |
1669 bool copy_dependencies = false; | |
0 | 1670 |
65 | 1671 if (call_analyzer->is_return_allocated()) { |
1672 // Returns a newly allocated unescaped object, simply | |
1673 // update dependency information. | |
1674 // Mark it as NoEscape so that objects referenced by | |
1675 // it's fields will be marked as NoEscape at least. | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1676 set_escape_state(call_idx, PointsToNode::NoEscape); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1677 add_pointsto_edge(resproj_idx, call_idx); |
65 | 1678 copy_dependencies = true; |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1679 } else if (call_analyzer->is_return_local()) { |
0 | 1680 // determine whether any arguments are returned |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1681 set_escape_state(call_idx, PointsToNode::NoEscape); |
0 | 1682 for (uint i = TypeFunc::Parms; i < d->cnt(); i++) { |
1683 const Type* at = d->field_at(i); | |
1684 | |
1685 if (at->isa_oopptr() != NULL) { | |
65 | 1686 Node *arg = call->in(i)->uncast(); |
0 | 1687 |
65 | 1688 if (call_analyzer->is_arg_returned(i - TypeFunc::Parms)) { |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1689 PointsToNode *arg_esp = ptnode_adr(arg->_idx); |
65 | 1690 if (arg_esp->node_type() == PointsToNode::UnknownType) |
1691 done = false; | |
1692 else if (arg_esp->node_type() == PointsToNode::JavaObject) | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1693 add_pointsto_edge(resproj_idx, arg->_idx); |
0 | 1694 else |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1695 add_deferred_edge(resproj_idx, arg->_idx); |
0 | 1696 arg_esp->_hidden_alias = true; |
1697 } | |
1698 } | |
1699 } | |
65 | 1700 copy_dependencies = true; |
0 | 1701 } else { |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1702 set_escape_state(call_idx, PointsToNode::GlobalEscape); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1703 add_pointsto_edge(resproj_idx, _phantom_object); |
65 | 1704 for (uint i = TypeFunc::Parms; i < d->cnt(); i++) { |
1705 const Type* at = d->field_at(i); | |
1706 if (at->isa_oopptr() != NULL) { | |
1707 Node *arg = call->in(i)->uncast(); | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1708 PointsToNode *arg_esp = ptnode_adr(arg->_idx); |
65 | 1709 arg_esp->_hidden_alias = true; |
1710 } | |
1711 } | |
0 | 1712 } |
65 | 1713 if (copy_dependencies) |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1714 call_analyzer->copy_dependencies(_compile->dependencies()); |
0 | 1715 } |
65 | 1716 if (done) |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1717 _processed.set(resproj_idx); |
0 | 1718 break; |
1719 } | |
1720 | |
1721 default: | |
1722 // Some other type of call, assume the worst case that the | |
1723 // returned value, if any, globally escapes. | |
1724 { | |
1725 const TypeTuple *r = call->tf()->range(); | |
1726 if (r->cnt() > TypeFunc::Parms) { | |
1727 const Type* ret_type = r->field_at(TypeFunc::Parms); | |
1728 | |
1729 // Note: we use isa_ptr() instead of isa_oopptr() here because the | |
1730 // _multianewarray functions return a TypeRawPtr. | |
1731 if (ret_type->isa_ptr() != NULL) { | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1732 set_escape_state(call_idx, PointsToNode::GlobalEscape); |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1733 add_pointsto_edge(resproj_idx, _phantom_object); |
0 | 1734 } |
1735 } | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1736 _processed.set(resproj_idx); |
0 | 1737 } |
1738 } | |
1739 } | |
1740 | |
65 | 1741 // Populate Connection Graph with Ideal nodes and create simple |
1742 // connection graph edges (do not need to check the node_type of inputs | |
1743 // or to call PointsTo() to walk the connection graph). | |
1744 void ConnectionGraph::record_for_escape_analysis(Node *n, PhaseTransform *phase) { | |
1745 if (_processed.test(n->_idx)) | |
1746 return; // No need to redefine node's state. | |
1747 | |
1748 if (n->is_Call()) { | |
1749 // Arguments to allocation and locking don't escape. | |
1750 if (n->is_Allocate()) { | |
1751 add_node(n, PointsToNode::JavaObject, PointsToNode::UnknownEscape, true); | |
1752 record_for_optimizer(n); | |
1753 } else if (n->is_Lock() || n->is_Unlock()) { | |
1754 // Put Lock and Unlock nodes on IGVN worklist to process them during | |
1755 // the first IGVN optimization when escape information is still available. | |
1756 record_for_optimizer(n); | |
1757 _processed.set(n->_idx); | |
1758 } else { | |
1759 // Have to process call's arguments first. | |
1760 PointsToNode::NodeType nt = PointsToNode::UnknownType; | |
1761 | |
1762 // Check if a call returns an object. | |
1763 const TypeTuple *r = n->as_Call()->tf()->range(); | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1764 if (n->is_CallStaticJava() && r->cnt() > TypeFunc::Parms && |
65 | 1765 n->as_Call()->proj_out(TypeFunc::Parms) != NULL) { |
1766 // Note: use isa_ptr() instead of isa_oopptr() here because | |
1767 // the _multianewarray functions return a TypeRawPtr. | |
1768 if (r->field_at(TypeFunc::Parms)->isa_ptr() != NULL) { | |
1769 nt = PointsToNode::JavaObject; | |
1770 } | |
1771 } | |
1772 add_node(n, nt, PointsToNode::UnknownEscape, false); | |
1773 } | |
1774 return; | |
1775 } | |
1776 | |
1777 // Using isa_ptr() instead of isa_oopptr() for LoadP and Phi because | |
1778 // ThreadLocal has RawPrt type. | |
1779 switch (n->Opcode()) { | |
1780 case Op_AddP: | |
1781 { | |
1782 add_node(n, PointsToNode::Field, PointsToNode::UnknownEscape, false); | |
1783 break; | |
1784 } | |
1785 case Op_CastX2P: | |
1786 { // "Unsafe" memory access. | |
1787 add_node(n, PointsToNode::JavaObject, PointsToNode::GlobalEscape, true); | |
1788 break; | |
1789 } | |
1790 case Op_CastPP: | |
1791 case Op_CheckCastPP: | |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
1792 case Op_EncodeP: |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
1793 case Op_DecodeN: |
65 | 1794 { |
1795 add_node(n, PointsToNode::LocalVar, PointsToNode::UnknownEscape, false); | |
1796 int ti = n->in(1)->_idx; | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1797 PointsToNode::NodeType nt = ptnode_adr(ti)->node_type(); |
65 | 1798 if (nt == PointsToNode::UnknownType) { |
1799 _delayed_worklist.push(n); // Process it later. | |
1800 break; | |
1801 } else if (nt == PointsToNode::JavaObject) { | |
1802 add_pointsto_edge(n->_idx, ti); | |
1803 } else { | |
1804 add_deferred_edge(n->_idx, ti); | |
1805 } | |
1806 _processed.set(n->_idx); | |
1807 break; | |
1808 } | |
1809 case Op_ConP: | |
1810 { | |
1811 // assume all pointer constants globally escape except for null | |
1812 PointsToNode::EscapeState es; | |
1813 if (phase->type(n) == TypePtr::NULL_PTR) | |
1814 es = PointsToNode::NoEscape; | |
1815 else | |
1816 es = PointsToNode::GlobalEscape; | |
0 | 1817 |
65 | 1818 add_node(n, PointsToNode::JavaObject, es, true); |
1819 break; | |
1820 } | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1821 case Op_ConN: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1822 { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1823 // 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
|
1824 PointsToNode::EscapeState es; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1825 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
|
1826 es = PointsToNode::NoEscape; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1827 else |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1828 es = PointsToNode::GlobalEscape; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1829 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1830 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
|
1831 break; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1832 } |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
1833 case Op_CreateEx: |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
1834 { |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
1835 // assume that all exception objects globally escape |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
1836 add_node(n, PointsToNode::JavaObject, PointsToNode::GlobalEscape, true); |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
1837 break; |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
1838 } |
65 | 1839 case Op_LoadKlass: |
164
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
1840 case Op_LoadNKlass: |
65 | 1841 { |
1842 add_node(n, PointsToNode::JavaObject, PointsToNode::GlobalEscape, true); | |
1843 break; | |
1844 } | |
1845 case Op_LoadP: | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1846 case Op_LoadN: |
65 | 1847 { |
1848 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
|
1849 if (!t->isa_narrowoop() && t->isa_ptr() == NULL) { |
65 | 1850 _processed.set(n->_idx); |
1851 return; | |
1852 } | |
1853 add_node(n, PointsToNode::LocalVar, PointsToNode::UnknownEscape, false); | |
1854 break; | |
1855 } | |
1856 case Op_Parm: | |
1857 { | |
1858 _processed.set(n->_idx); // No need to redefine it state. | |
1859 uint con = n->as_Proj()->_con; | |
1860 if (con < TypeFunc::Parms) | |
1861 return; | |
1862 const Type *t = n->in(0)->as_Start()->_domain->field_at(con); | |
1863 if (t->isa_ptr() == NULL) | |
1864 return; | |
1865 // We have to assume all input parameters globally escape | |
1866 // (Note: passing 'false' since _processed is already set). | |
1867 add_node(n, PointsToNode::JavaObject, PointsToNode::GlobalEscape, false); | |
1868 break; | |
1869 } | |
1870 case Op_Phi: | |
1871 { | |
1872 if (n->as_Phi()->type()->isa_ptr() == NULL) { | |
1873 // nothing to do if not an oop | |
1874 _processed.set(n->_idx); | |
1875 return; | |
1876 } | |
1877 add_node(n, PointsToNode::LocalVar, PointsToNode::UnknownEscape, false); | |
1878 uint i; | |
1879 for (i = 1; i < n->req() ; i++) { | |
1880 Node* in = n->in(i); | |
1881 if (in == NULL) | |
1882 continue; // ignore NULL | |
1883 in = in->uncast(); | |
1884 if (in->is_top() || in == n) | |
1885 continue; // ignore top or inputs which go back this node | |
1886 int ti = in->_idx; | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1887 PointsToNode::NodeType nt = ptnode_adr(ti)->node_type(); |
65 | 1888 if (nt == PointsToNode::UnknownType) { |
1889 break; | |
1890 } else if (nt == PointsToNode::JavaObject) { | |
1891 add_pointsto_edge(n->_idx, ti); | |
1892 } else { | |
1893 add_deferred_edge(n->_idx, ti); | |
1894 } | |
1895 } | |
1896 if (i >= n->req()) | |
1897 _processed.set(n->_idx); | |
1898 else | |
1899 _delayed_worklist.push(n); | |
1900 break; | |
1901 } | |
1902 case Op_Proj: | |
1903 { | |
1904 // we are only interested in the result projection from a call | |
1905 if (n->as_Proj()->_con == TypeFunc::Parms && n->in(0)->is_Call() ) { | |
1906 add_node(n, PointsToNode::LocalVar, PointsToNode::UnknownEscape, false); | |
1907 process_call_result(n->as_Proj(), phase); | |
1908 if (!_processed.test(n->_idx)) { | |
1909 // The call's result may need to be processed later if the call | |
1910 // returns it's argument and the argument is not processed yet. | |
1911 _delayed_worklist.push(n); | |
1912 } | |
1913 } else { | |
1914 _processed.set(n->_idx); | |
1915 } | |
1916 break; | |
1917 } | |
1918 case Op_Return: | |
1919 { | |
1920 if( n->req() > TypeFunc::Parms && | |
1921 phase->type(n->in(TypeFunc::Parms))->isa_oopptr() ) { | |
1922 // Treat Return value as LocalVar with GlobalEscape escape state. | |
1923 add_node(n, PointsToNode::LocalVar, PointsToNode::GlobalEscape, false); | |
1924 int ti = n->in(TypeFunc::Parms)->_idx; | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1925 PointsToNode::NodeType nt = ptnode_adr(ti)->node_type(); |
65 | 1926 if (nt == PointsToNode::UnknownType) { |
1927 _delayed_worklist.push(n); // Process it later. | |
1928 break; | |
1929 } else if (nt == PointsToNode::JavaObject) { | |
1930 add_pointsto_edge(n->_idx, ti); | |
1931 } else { | |
1932 add_deferred_edge(n->_idx, ti); | |
1933 } | |
1934 } | |
1935 _processed.set(n->_idx); | |
1936 break; | |
1937 } | |
1938 case Op_StoreP: | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1939 case Op_StoreN: |
65 | 1940 { |
1941 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
|
1942 adr_type = adr_type->make_ptr(); |
65 | 1943 if (adr_type->isa_oopptr()) { |
1944 add_node(n, PointsToNode::UnknownType, PointsToNode::UnknownEscape, false); | |
1945 } else { | |
1946 Node* adr = n->in(MemNode::Address); | |
1947 if (adr->is_AddP() && phase->type(adr) == TypeRawPtr::NOTNULL && | |
1948 adr->in(AddPNode::Address)->is_Proj() && | |
1949 adr->in(AddPNode::Address)->in(0)->is_Allocate()) { | |
1950 add_node(n, PointsToNode::UnknownType, PointsToNode::UnknownEscape, false); | |
1951 // We are computing a raw address for a store captured | |
1952 // by an Initialize compute an appropriate address type. | |
1953 int offs = (int)phase->find_intptr_t_con(adr->in(AddPNode::Offset), Type::OffsetBot); | |
1954 assert(offs != Type::OffsetBot, "offset must be a constant"); | |
1955 } else { | |
1956 _processed.set(n->_idx); | |
1957 return; | |
1958 } | |
1959 } | |
1960 break; | |
1961 } | |
1962 case Op_StorePConditional: | |
1963 case Op_CompareAndSwapP: | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
1964 case Op_CompareAndSwapN: |
65 | 1965 { |
1966 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
|
1967 adr_type = adr_type->make_ptr(); |
65 | 1968 if (adr_type->isa_oopptr()) { |
1969 add_node(n, PointsToNode::UnknownType, PointsToNode::UnknownEscape, false); | |
1970 } else { | |
1971 _processed.set(n->_idx); | |
1972 return; | |
1973 } | |
1974 break; | |
1975 } | |
1976 case Op_ThreadLocal: | |
1977 { | |
1978 add_node(n, PointsToNode::JavaObject, PointsToNode::ArgEscape, true); | |
1979 break; | |
1980 } | |
1981 default: | |
1982 ; | |
1983 // nothing to do | |
1984 } | |
1985 return; | |
1986 } | |
1987 | |
1988 void ConnectionGraph::build_connection_graph(Node *n, PhaseTransform *phase) { | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1989 uint n_idx = n->_idx; |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1990 |
65 | 1991 // Don't set processed bit for AddP, LoadP, StoreP since |
1992 // they may need more then one pass to process. | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1993 if (_processed.test(n_idx)) |
65 | 1994 return; // No need to redefine node's state. |
1995 | |
0 | 1996 if (n->is_Call()) { |
1997 CallNode *call = n->as_Call(); | |
1998 process_call_arguments(call, phase); | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
1999 _processed.set(n_idx); |
0 | 2000 return; |
2001 } | |
2002 | |
65 | 2003 switch (n->Opcode()) { |
0 | 2004 case Op_AddP: |
2005 { | |
65 | 2006 Node *base = get_addp_base(n); |
2007 // Create a field edge to this node from everything base could point to. | |
0 | 2008 VectorSet ptset(Thread::current()->resource_area()); |
2009 PointsTo(ptset, base, phase); | |
2010 for( VectorSetI i(&ptset); i.test(); ++i ) { | |
2011 uint pt = i.elem; | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2012 add_field_edge(pt, n_idx, address_offset(n, phase)); |
65 | 2013 } |
2014 break; | |
2015 } | |
2016 case Op_CastX2P: | |
2017 { | |
2018 assert(false, "Op_CastX2P"); | |
2019 break; | |
2020 } | |
2021 case Op_CastPP: | |
2022 case Op_CheckCastPP: | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
2023 case Op_EncodeP: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
102
diff
changeset
|
2024 case Op_DecodeN: |
65 | 2025 { |
2026 int ti = n->in(1)->_idx; | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2027 if (ptnode_adr(ti)->node_type() == PointsToNode::JavaObject) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2028 add_pointsto_edge(n_idx, ti); |
65 | 2029 } else { |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2030 add_deferred_edge(n_idx, ti); |
65 | 2031 } |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2032 _processed.set(n_idx); |
65 | 2033 break; |
2034 } | |
2035 case Op_ConP: | |
2036 { | |
2037 assert(false, "Op_ConP"); | |
2038 break; | |
2039 } | |
163 | 2040 case Op_ConN: |
2041 { | |
2042 assert(false, "Op_ConN"); | |
2043 break; | |
2044 } | |
65 | 2045 case Op_CreateEx: |
2046 { | |
2047 assert(false, "Op_CreateEx"); | |
2048 break; | |
2049 } | |
2050 case Op_LoadKlass: | |
164
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
2051 case Op_LoadNKlass: |
65 | 2052 { |
2053 assert(false, "Op_LoadKlass"); | |
2054 break; | |
2055 } | |
2056 case Op_LoadP: | |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
2057 case Op_LoadN: |
65 | 2058 { |
2059 const Type *t = phase->type(n); | |
2060 #ifdef ASSERT | |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
2061 if (!t->isa_narrowoop() && t->isa_ptr() == NULL) |
65 | 2062 assert(false, "Op_LoadP"); |
2063 #endif | |
2064 | |
2065 Node* adr = n->in(MemNode::Address)->uncast(); | |
2066 const Type *adr_type = phase->type(adr); | |
2067 Node* adr_base; | |
2068 if (adr->is_AddP()) { | |
2069 adr_base = get_addp_base(adr); | |
2070 } else { | |
2071 adr_base = adr; | |
2072 } | |
2073 | |
2074 // For everything "adr_base" could point to, create a deferred edge from | |
2075 // this node to each field with the same offset. | |
2076 VectorSet ptset(Thread::current()->resource_area()); | |
2077 PointsTo(ptset, adr_base, phase); | |
2078 int offset = address_offset(adr, phase); | |
2079 for( VectorSetI i(&ptset); i.test(); ++i ) { | |
2080 uint pt = i.elem; | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2081 add_deferred_edge_to_fields(n_idx, pt, offset); |
0 | 2082 } |
2083 break; | |
2084 } | |
2085 case Op_Parm: | |
2086 { | |
65 | 2087 assert(false, "Op_Parm"); |
0 | 2088 break; |
2089 } | |
2090 case Op_Phi: | |
2091 { | |
65 | 2092 #ifdef ASSERT |
2093 if (n->as_Phi()->type()->isa_ptr() == NULL) | |
2094 assert(false, "Op_Phi"); | |
2095 #endif | |
2096 for (uint i = 1; i < n->req() ; i++) { | |
2097 Node* in = n->in(i); | |
2098 if (in == NULL) | |
2099 continue; // ignore NULL | |
2100 in = in->uncast(); | |
2101 if (in->is_top() || in == n) | |
2102 continue; // ignore top or inputs which go back this node | |
2103 int ti = in->_idx; | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2104 if (ptnode_adr(in->_idx)->node_type() == PointsToNode::JavaObject) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2105 add_pointsto_edge(n_idx, ti); |
65 | 2106 } else { |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2107 add_deferred_edge(n_idx, ti); |
65 | 2108 } |
2109 } | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2110 _processed.set(n_idx); |
0 | 2111 break; |
2112 } | |
65 | 2113 case Op_Proj: |
0 | 2114 { |
65 | 2115 // we are only interested in the result projection from a call |
2116 if (n->as_Proj()->_con == TypeFunc::Parms && n->in(0)->is_Call() ) { | |
2117 process_call_result(n->as_Proj(), phase); | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2118 assert(_processed.test(n_idx), "all call results should be processed"); |
65 | 2119 } else { |
2120 assert(false, "Op_Proj"); | |
2121 } | |
0 | 2122 break; |
2123 } | |
65 | 2124 case Op_Return: |
0 | 2125 { |
65 | 2126 #ifdef ASSERT |
2127 if( n->req() <= TypeFunc::Parms || | |
2128 !phase->type(n->in(TypeFunc::Parms))->isa_oopptr() ) { | |
2129 assert(false, "Op_Return"); | |
0 | 2130 } |
65 | 2131 #endif |
2132 int ti = n->in(TypeFunc::Parms)->_idx; | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2133 if (ptnode_adr(ti)->node_type() == PointsToNode::JavaObject) { |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2134 add_pointsto_edge(n_idx, ti); |
65 | 2135 } else { |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2136 add_deferred_edge(n_idx, ti); |
65 | 2137 } |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2138 _processed.set(n_idx); |
0 | 2139 break; |
2140 } | |
2141 case Op_StoreP: | |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
2142 case Op_StoreN: |
0 | 2143 case Op_StorePConditional: |
2144 case Op_CompareAndSwapP: | |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
2145 case Op_CompareAndSwapN: |
0 | 2146 { |
2147 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
|
2148 const Type *adr_type = phase->type(adr)->make_ptr(); |
65 | 2149 #ifdef ASSERT |
0 | 2150 if (!adr_type->isa_oopptr()) |
65 | 2151 assert(phase->type(adr) == TypeRawPtr::NOTNULL, "Op_StoreP"); |
2152 #endif | |
0 | 2153 |
65 | 2154 assert(adr->is_AddP(), "expecting an AddP"); |
2155 Node *adr_base = get_addp_base(adr); | |
2156 Node *val = n->in(MemNode::ValueIn)->uncast(); | |
2157 // For everything "adr_base" could point to, create a deferred edge | |
2158 // to "val" from each field with the same offset. | |
0 | 2159 VectorSet ptset(Thread::current()->resource_area()); |
2160 PointsTo(ptset, adr_base, phase); | |
2161 for( VectorSetI i(&ptset); i.test(); ++i ) { | |
2162 uint pt = i.elem; | |
65 | 2163 add_edge_from_fields(pt, val->_idx, address_offset(adr, phase)); |
0 | 2164 } |
2165 break; | |
2166 } | |
65 | 2167 case Op_ThreadLocal: |
0 | 2168 { |
65 | 2169 assert(false, "Op_ThreadLocal"); |
0 | 2170 break; |
2171 } | |
2172 default: | |
2173 ; | |
2174 // nothing to do | |
2175 } | |
2176 } | |
2177 | |
2178 #ifndef PRODUCT | |
2179 void ConnectionGraph::dump() { | |
2180 PhaseGVN *igvn = _compile->initial_gvn(); | |
2181 bool first = true; | |
2182 | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2183 uint size = nodes_size(); |
65 | 2184 for (uint ni = 0; ni < size; ni++) { |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2185 PointsToNode *ptn = ptnode_adr(ni); |
65 | 2186 PointsToNode::NodeType ptn_type = ptn->node_type(); |
2187 | |
2188 if (ptn_type != PointsToNode::JavaObject || ptn->_node == NULL) | |
0 | 2189 continue; |
65 | 2190 PointsToNode::EscapeState es = escape_state(ptn->_node, igvn); |
2191 if (ptn->_node->is_Allocate() && (es == PointsToNode::NoEscape || Verbose)) { | |
2192 if (first) { | |
2193 tty->cr(); | |
2194 tty->print("======== Connection graph for "); | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2195 _compile->method()->print_short_name(); |
65 | 2196 tty->cr(); |
2197 first = false; | |
2198 } | |
2199 tty->print("%6d ", ni); | |
2200 ptn->dump(); | |
2201 // Print all locals which reference this allocation | |
2202 for (uint li = ni; li < size; li++) { | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2203 PointsToNode *ptn_loc = ptnode_adr(li); |
65 | 2204 PointsToNode::NodeType ptn_loc_type = ptn_loc->node_type(); |
2205 if ( ptn_loc_type == PointsToNode::LocalVar && ptn_loc->_node != NULL && | |
2206 ptn_loc->edge_count() == 1 && ptn_loc->edge_target(0) == ni ) { | |
2207 tty->print("%6d LocalVar [[%d]]", li, ni); | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2208 ptnode_adr(li)->_node->dump(); |
0 | 2209 } |
2210 } | |
65 | 2211 if (Verbose) { |
2212 // Print all fields which reference this allocation | |
2213 for (uint i = 0; i < ptn->edge_count(); i++) { | |
2214 uint ei = ptn->edge_target(i); | |
2215 tty->print("%6d Field [[%d]]", ei, ni); | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2216 ptnode_adr(ei)->_node->dump(); |
65 | 2217 } |
2218 } | |
2219 tty->cr(); | |
0 | 2220 } |
2221 } | |
2222 } | |
2223 #endif |