src/share/vm/opto/memnode.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6714406 Sdiff src/share/vm/opto

src/share/vm/opto/memnode.cpp

Print this page




 236   if (mem != old_mem) {
 237     set_req(MemNode::Memory, mem);
 238     return this;
 239   }
 240 
 241   // let the subclass continue analyzing...
 242   return NULL;
 243 }
 244 
 245 // Helper function for proving some simple control dominations.
 246 // Attempt to prove that all control inputs of 'dom' dominate 'sub'.
 247 // Already assumes that 'dom' is available at 'sub', and that 'sub'
 248 // is not a constant (dominated by the method's StartNode).
 249 // Used by MemNode::find_previous_store to prove that the
 250 // control input of a memory operation predates (dominates)
 251 // an allocation it wants to look past.
 252 bool MemNode::all_controls_dominate(Node* dom, Node* sub) {
 253   if (dom == NULL || dom->is_top() || sub == NULL || sub->is_top())
 254     return false; // Conservative answer for dead code
 255 
 256   // Check 'dom'.
 257   dom = dom->find_exact_control(dom);
 258   if (dom == NULL || dom->is_top())
 259     return false; // Conservative answer for dead code
 260 






 261   if (dom->is_Con() || dom->is_Start() || dom->is_Root() || dom == sub)
 262     return true;
 263 
 264   // 'dom' dominates 'sub' if its control edge and control edges
 265   // of all its inputs dominate or equal to sub's control edge.
 266 
 267   // Currently 'sub' is either Allocate, Initialize or Start nodes.
 268   // Or Region for the check in LoadNode::Ideal();
 269   // 'sub' should have sub->in(0) != NULL.
 270   assert(sub->is_Allocate() || sub->is_Initialize() || sub->is_Start() ||
 271          sub->is_Region(), "expecting only these nodes");
 272 
 273   // Get control edge of 'sub'.

 274   sub = sub->find_exact_control(sub->in(0));
 275   if (sub == NULL || sub->is_top())
 276     return false; // Conservative answer for dead code
 277 
 278   assert(sub->is_CFG(), "expecting control");
 279 
 280   if (sub == dom)
 281     return true;
 282 
 283   if (sub->is_Start() || sub->is_Root())
 284     return false;
 285 
 286   {
 287     // Check all control edges of 'dom'.
 288 
 289     ResourceMark rm;
 290     Arena* arena = Thread::current()->resource_area();
 291     Node_List nlist(arena);
 292     Unique_Node_List dom_list(arena);
 293 
 294     dom_list.push(dom);
 295     bool only_dominating_controls = false;
 296 
 297     for (uint next = 0; next < dom_list.size(); next++) {
 298       Node* n = dom_list.at(next);


 299       if (!n->is_CFG() && n->pinned()) {
 300         // Check only own control edge for pinned non-control nodes.
 301         n = n->find_exact_control(n->in(0));
 302         if (n == NULL || n->is_top())
 303           return false; // Conservative answer for dead code
 304         assert(n->is_CFG(), "expecting control");
 305       }
 306       if (n->is_Con() || n->is_Start() || n->is_Root()) {
 307         only_dominating_controls = true;
 308       } else if (n->is_CFG()) {
 309         if (n->dominates(sub, nlist))
 310           only_dominating_controls = true;
 311         else
 312           return false;
 313       } else {
 314         // First, own control edge.
 315         Node* m = n->find_exact_control(n->in(0));
 316         if (m != NULL) {
 317           if (m->is_top())
 318             return false; // Conservative answer for dead code
 319           dom_list.push(m);
 320         }
 321         // Now, the rest of edges.
 322         uint cnt = n->req();
 323         for (uint i = 1; i < cnt; i++) {
 324           m = n->find_exact_control(n->in(i));
 325           if (m == NULL || m->is_top())
 326             continue;




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


src/share/vm/opto/memnode.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File