src/hotspot/share/opto/gcm.cpp
changeset 57721 4fbcbd248c52
parent 51078 fc6cfe40e32a
child 58962 2dcfc28a314d
equal deleted inserted replaced
57720:75375b6617e6 57721:4fbcbd248c52
   661         // Same for SafePoints: they read/write Raw but only read otherwise.
   661         // Same for SafePoints: they read/write Raw but only read otherwise.
   662         // This is basically a workaround for SafePoints only defining control
   662         // This is basically a workaround for SafePoints only defining control
   663         // instead of control + memory.
   663         // instead of control + memory.
   664         if (mstore->ideal_Opcode() == Op_SafePoint)
   664         if (mstore->ideal_Opcode() == Op_SafePoint)
   665           continue;
   665           continue;
       
   666 
       
   667         // Check if the store is a membar on which the load is control dependent.
       
   668         // Inserting an anti-dependency between that membar and the load would
       
   669         // create a cycle that causes local scheduling to fail.
       
   670         if (mstore->isa_MachMemBar()) {
       
   671           Node* dom = load->find_exact_control(load->in(0));
       
   672           while (dom != NULL && dom != dom->in(0) && dom != mstore) {
       
   673             dom = dom->in(0);
       
   674           }
       
   675           if (dom == mstore) {
       
   676             continue;
       
   677           }
       
   678         }
   666       } else {
   679       } else {
   667         // Some raw memory, such as the load of "top" at an allocation,
   680         // Some raw memory, such as the load of "top" at an allocation,
   668         // can be control dependent on the previous safepoint. See
   681         // can be control dependent on the previous safepoint. See
   669         // comments in GraphKit::allocate_heap() about control input.
   682         // comments in GraphKit::allocate_heap() about control input.
   670         // Inserting an anti-dep between such a safepoint and a use
   683         // Inserting an anti-dep between such a safepoint and a use
   745       }
   758       }
   746     } else {
   759     } else {
   747       // Found a possibly-interfering store in the load's 'early' block.
   760       // Found a possibly-interfering store in the load's 'early' block.
   748       // This means 'load' cannot sink at all in the dominator tree.
   761       // This means 'load' cannot sink at all in the dominator tree.
   749       // Add an anti-dep edge, and squeeze 'load' into the highest block.
   762       // Add an anti-dep edge, and squeeze 'load' into the highest block.
   750       assert(store != load->in(0), "dependence cycle found");
   763       assert(store != load->find_exact_control(load->in(0)), "dependence cycle found");
   751       if (verify) {
   764       if (verify) {
   752         assert(store->find_edge(load) != -1, "missing precedence edge");
   765         assert(store->find_edge(load) != -1, "missing precedence edge");
   753       } else {
   766       } else {
   754         store->add_prec(load);
   767         store->add_prec(load);
   755       }
   768       }
   785     while (non_early_stores.size() > 0) {
   798     while (non_early_stores.size() > 0) {
   786       Node* store = non_early_stores.pop();
   799       Node* store = non_early_stores.pop();
   787       Block* store_block = get_block_for_node(store);
   800       Block* store_block = get_block_for_node(store);
   788       if (store_block == LCA) {
   801       if (store_block == LCA) {
   789         // add anti_dependence from store to load in its own block
   802         // add anti_dependence from store to load in its own block
   790         assert(store != load->in(0), "dependence cycle found");
   803         assert(store != load->find_exact_control(load->in(0)), "dependence cycle found");
   791         if (verify) {
   804         if (verify) {
   792           assert(store->find_edge(load) != -1, "missing precedence edge");
   805           assert(store->find_edge(load) != -1, "missing precedence edge");
   793         } else {
   806         } else {
   794           store->add_prec(load);
   807           store->add_prec(load);
   795         }
   808         }