239 // let the subclass continue analyzing...
240 return NULL;
241 }
242
243 // Helper function for proving some simple control dominations.
244 // Attempt to prove that all control inputs of 'dom' dominate 'sub'.
245 // Already assumes that 'dom' is available at 'sub', and that 'sub'
246 // is not a constant (dominated by the method's StartNode).
247 // Used by MemNode::find_previous_store to prove that the
248 // control input of a memory operation predates (dominates)
249 // an allocation it wants to look past.
250 bool MemNode::all_controls_dominate(Node* dom, Node* sub) {
251 if (dom == NULL || dom->is_top() || sub == NULL || sub->is_top())
252 return false; // Conservative answer for dead code
253
254 // Check 'dom'.
255 dom = dom->find_exact_control(dom);
256 if (dom == NULL || dom->is_top())
257 return false; // Conservative answer for dead code
258
259 if (dom->is_Start() || dom->is_Root() || dom == sub)
260 return true;
261
262 // 'dom' dominates 'sub' if its control edge and control edges
263 // of all its inputs dominate or equal to sub's control edge.
264
265 // Currently 'sub' is either Allocate, Initialize or Start nodes.
266 assert(sub->is_Allocate() || sub->is_Initialize() || sub->is_Start(), "expecting only these nodes");
267
268 // Get control edge of 'sub'.
269 sub = sub->find_exact_control(sub->in(0));
270 if (sub == NULL || sub->is_top())
271 return false; // Conservative answer for dead code
272
273 assert(sub->is_CFG(), "expecting control");
274
275 if (sub == dom)
276 return true;
277
278 if (sub->is_Start() || sub->is_Root())
279 return false;
281 {
282 // Check all control edges of 'dom'.
283
284 ResourceMark rm;
285 Arena* arena = Thread::current()->resource_area();
286 Node_List nlist(arena);
287 Unique_Node_List dom_list(arena);
288
289 dom_list.push(dom);
290 bool only_dominating_controls = false;
291
292 for (uint next = 0; next < dom_list.size(); next++) {
293 Node* n = dom_list.at(next);
294 if (!n->is_CFG() && n->pinned()) {
295 // Check only own control edge for pinned non-control nodes.
296 n = n->find_exact_control(n->in(0));
297 if (n == NULL || n->is_top())
298 return false; // Conservative answer for dead code
299 assert(n->is_CFG(), "expecting control");
300 }
301 if (n->is_Start() || n->is_Root()) {
302 only_dominating_controls = true;
303 } else if (n->is_CFG()) {
304 if (n->dominates(sub, nlist))
305 only_dominating_controls = true;
306 else
307 return false;
308 } else {
309 // First, own control edge.
310 Node* m = n->find_exact_control(n->in(0));
311 if (m == NULL)
312 continue;
313 if (m->is_top())
314 return false; // Conservative answer for dead code
315 dom_list.push(m);
316
317 // Now, the rest of edges.
318 uint cnt = n->req();
319 for (uint i = 1; i < cnt; i++) {
320 m = n->find_exact_control(n->in(i));
321 if (m == NULL || m->is_top())
322 continue;
323 dom_list.push(m);
324 }
325 }
326 }
327 return only_dominating_controls;
328 }
329 }
330
331 //---------------------detect_ptr_independence---------------------------------
332 // Used by MemNode::find_previous_store to prove that two base
333 // pointers are never equal.
334 // The pointers are accompanied by their associated allocations,
335 // if any, which have been previously discovered by the caller.
336 bool MemNode::detect_ptr_independence(Node* p1, AllocateNode* a1,
|
239 // let the subclass continue analyzing...
240 return NULL;
241 }
242
243 // Helper function for proving some simple control dominations.
244 // Attempt to prove that all control inputs of 'dom' dominate 'sub'.
245 // Already assumes that 'dom' is available at 'sub', and that 'sub'
246 // is not a constant (dominated by the method's StartNode).
247 // Used by MemNode::find_previous_store to prove that the
248 // control input of a memory operation predates (dominates)
249 // an allocation it wants to look past.
250 bool MemNode::all_controls_dominate(Node* dom, Node* sub) {
251 if (dom == NULL || dom->is_top() || sub == NULL || sub->is_top())
252 return false; // Conservative answer for dead code
253
254 // Check 'dom'.
255 dom = dom->find_exact_control(dom);
256 if (dom == NULL || dom->is_top())
257 return false; // Conservative answer for dead code
258
259 if (dom->is_Con() || dom->is_Start() || dom->is_Root() || dom == sub)
260 return true;
261
262 // 'dom' dominates 'sub' if its control edge and control edges
263 // of all its inputs dominate or equal to sub's control edge.
264
265 // Currently 'sub' is either Allocate, Initialize or Start nodes.
266 assert(sub->is_Allocate() || sub->is_Initialize() || sub->is_Start(), "expecting only these nodes");
267
268 // Get control edge of 'sub'.
269 sub = sub->find_exact_control(sub->in(0));
270 if (sub == NULL || sub->is_top())
271 return false; // Conservative answer for dead code
272
273 assert(sub->is_CFG(), "expecting control");
274
275 if (sub == dom)
276 return true;
277
278 if (sub->is_Start() || sub->is_Root())
279 return false;
281 {
282 // Check all control edges of 'dom'.
283
284 ResourceMark rm;
285 Arena* arena = Thread::current()->resource_area();
286 Node_List nlist(arena);
287 Unique_Node_List dom_list(arena);
288
289 dom_list.push(dom);
290 bool only_dominating_controls = false;
291
292 for (uint next = 0; next < dom_list.size(); next++) {
293 Node* n = dom_list.at(next);
294 if (!n->is_CFG() && n->pinned()) {
295 // Check only own control edge for pinned non-control nodes.
296 n = n->find_exact_control(n->in(0));
297 if (n == NULL || n->is_top())
298 return false; // Conservative answer for dead code
299 assert(n->is_CFG(), "expecting control");
300 }
301 if (n->is_Con() || n->is_Start() || n->is_Root()) {
302 only_dominating_controls = true;
303 } else if (n->is_CFG()) {
304 if (n->dominates(sub, nlist))
305 only_dominating_controls = true;
306 else
307 return false;
308 } else {
309 // First, own control edge.
310 Node* m = n->find_exact_control(n->in(0));
311 if (m != NULL) {
312 if (m->is_top())
313 return false; // Conservative answer for dead code
314 dom_list.push(m);
315 }
316 // Now, the rest of edges.
317 uint cnt = n->req();
318 for (uint i = 1; i < cnt; i++) {
319 m = n->find_exact_control(n->in(i));
320 if (m == NULL || m->is_top())
321 continue;
322 dom_list.push(m);
323 }
324 }
325 }
326 return only_dominating_controls;
327 }
328 }
329
330 //---------------------detect_ptr_independence---------------------------------
331 // Used by MemNode::find_previous_store to prove that two base
332 // pointers are never equal.
333 // The pointers are accompanied by their associated allocations,
334 // if any, which have been previously discovered by the caller.
335 bool MemNode::detect_ptr_independence(Node* p1, AllocateNode* a1,
|