182 _processed.set(n->_idx);
183 }
184
185 PointsToNode::EscapeState ConnectionGraph::escape_state(Node *n, PhaseTransform *phase) {
186 uint idx = n->_idx;
187 PointsToNode::EscapeState es;
188
189 // If we are still collecting or there were no non-escaping allocations
190 // we don't know the answer yet
191 if (_collecting)
192 return PointsToNode::UnknownEscape;
193
194 // if the node was created after the escape computation, return
195 // UnknownEscape
196 if (idx >= nodes_size())
197 return PointsToNode::UnknownEscape;
198
199 es = ptnode_adr(idx)->escape_state();
200
201 // if we have already computed a value, return it
202 if (es != PointsToNode::UnknownEscape)
203 return es;
204
205 // PointsTo() calls n->uncast() which can return a new ideal node.
206 if (n->uncast()->_idx >= nodes_size())
207 return PointsToNode::UnknownEscape;
208
209 // compute max escape state of anything this node could point to
210 VectorSet ptset(Thread::current()->resource_area());
211 PointsTo(ptset, n, phase);
212 for(VectorSetI i(&ptset); i.test() && es != PointsToNode::GlobalEscape; ++i) {
213 uint pt = i.elem;
214 PointsToNode::EscapeState pes = ptnode_adr(pt)->escape_state();
215 if (pes > es)
216 es = pes;
217 }
218 // cache the computed escape state
219 assert(es != PointsToNode::UnknownEscape, "should have computed an escape state");
220 ptnode_adr(idx)->set_escape_state(es);
221 return es;
222 }
|
182 _processed.set(n->_idx);
183 }
184
185 PointsToNode::EscapeState ConnectionGraph::escape_state(Node *n, PhaseTransform *phase) {
186 uint idx = n->_idx;
187 PointsToNode::EscapeState es;
188
189 // If we are still collecting or there were no non-escaping allocations
190 // we don't know the answer yet
191 if (_collecting)
192 return PointsToNode::UnknownEscape;
193
194 // if the node was created after the escape computation, return
195 // UnknownEscape
196 if (idx >= nodes_size())
197 return PointsToNode::UnknownEscape;
198
199 es = ptnode_adr(idx)->escape_state();
200
201 // if we have already computed a value, return it
202 if (es != PointsToNode::UnknownEscape &&
203 ptnode_adr(idx)->node_type() == PointsToNode::JavaObject)
204 return es;
205
206 // PointsTo() calls n->uncast() which can return a new ideal node.
207 if (n->uncast()->_idx >= nodes_size())
208 return PointsToNode::UnknownEscape;
209
210 // compute max escape state of anything this node could point to
211 VectorSet ptset(Thread::current()->resource_area());
212 PointsTo(ptset, n, phase);
213 for(VectorSetI i(&ptset); i.test() && es != PointsToNode::GlobalEscape; ++i) {
214 uint pt = i.elem;
215 PointsToNode::EscapeState pes = ptnode_adr(pt)->escape_state();
216 if (pes > es)
217 es = pes;
218 }
219 // cache the computed escape state
220 assert(es != PointsToNode::UnknownEscape, "should have computed an escape state");
221 ptnode_adr(idx)->set_escape_state(es);
222 return es;
223 }
|