< prev index next >

src/hotspot/share/opto/phaseX.cpp

Print this page




1378             if (in->outcnt() == 0) { // Made input go dead?
1379               _stack.push(in, PROCESS_INPUTS); // Recursively remove
1380               recurse = true;
1381             } else if (in->outcnt() == 1 &&
1382                        in->has_special_unique_user()) {
1383               _worklist.push(in->unique_out());
1384             } else if (in->outcnt() <= 2 && dead->is_Phi()) {
1385               if (in->Opcode() == Op_Region) {
1386                 _worklist.push(in);
1387               } else if (in->is_Store()) {
1388                 DUIterator_Fast imax, i = in->fast_outs(imax);
1389                 _worklist.push(in->fast_out(i));
1390                 i++;
1391                 if (in->outcnt() == 2) {
1392                   _worklist.push(in->fast_out(i));
1393                   i++;
1394                 }
1395                 assert(!(i < imax), "sanity");
1396               }
1397             } else {
1398               BarrierSet::barrier_set()->barrier_set_c2()->enqueue_useful_gc_barrier(_worklist, in);
1399             }
1400             if (ReduceFieldZeroing && dead->is_Load() && i == MemNode::Memory &&
1401                 in->is_Proj() && in->in(0) != NULL && in->in(0)->is_Initialize()) {
1402               // A Load that directly follows an InitializeNode is
1403               // going away. The Stores that follow are candidates
1404               // again to be captured by the InitializeNode.
1405               for (DUIterator_Fast jmax, j = in->fast_outs(jmax); j < jmax; j++) {
1406                 Node *n = in->fast_out(j);
1407                 if (n->is_Store()) {
1408                   _worklist.push(n);
1409                 }
1410               }
1411             }
1412           } // if (in != NULL && in != C->top())
1413         } // for (uint i = 0; i < dead->req(); i++)
1414         if (recurse) {
1415           continue;
1416         }
1417       } // if (!dead->is_Con())
1418     } // if (progress_state == PROCESS_INPUTS)


1664     bool has_load_barriers = bs->has_load_barriers();
1665 
1666     if (use_op == Op_LoadP && use->bottom_type()->isa_rawptr()) {
1667       for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) {
1668         Node* u = use->fast_out(i2);
1669         const Type* ut = u->bottom_type();
1670         if (u->Opcode() == Op_LoadP && ut->isa_instptr()) {
1671           if (has_load_barriers) {
1672             // Search for load barriers behind the load
1673             for (DUIterator_Fast i3max, i3 = u->fast_outs(i3max); i3 < i3max; i3++) {
1674               Node* b = u->fast_out(i3);
1675               if (bs->is_gc_barrier_node(b)) {
1676                 _worklist.push(b);
1677               }
1678             }
1679           }
1680           _worklist.push(u);
1681         }
1682       }
1683     }








1684   }
1685 }
1686 
1687 /**
1688  * Remove the speculative part of all types that we know of
1689  */
1690 void PhaseIterGVN::remove_speculative_types()  {
1691   assert(UseTypeSpeculation, "speculation is off");
1692   for (uint i = 0; i < _types.Size(); i++)  {
1693     const Type* t = _types.fast_lookup(i);
1694     if (t != NULL) {
1695       _types.map(i, t->remove_speculative());
1696     }
1697   }
1698   _table.check_no_speculative_types();
1699 }
1700 
1701 //=============================================================================
1702 #ifndef PRODUCT
1703 uint PhaseCCP::_total_invokes   = 0;


2091         igvn->_worklist.push( old );
2092       break;
2093     case 1:
2094       if( old->is_Store() || old->has_special_unique_user() )
2095         igvn->add_users_to_worklist( old );
2096       break;
2097     case 2:
2098       if( old->is_Store() )
2099         igvn->add_users_to_worklist( old );
2100       if( old->Opcode() == Op_Region )
2101         igvn->_worklist.push(old);
2102       break;
2103     case 3:
2104       if( old->Opcode() == Op_Region ) {
2105         igvn->_worklist.push(old);
2106         igvn->add_users_to_worklist( old );
2107       }
2108       break;
2109     default:
2110       break;




2111     }
2112   }
2113 
2114 }
2115 
2116 //-------------------------------replace_by-----------------------------------
2117 // Using def-use info, replace one node for another.  Follow the def-use info
2118 // to all users of the OLD node.  Then make all uses point to the NEW node.
2119 void Node::replace_by(Node *new_node) {
2120   assert(!is_top(), "top node has no DU info");
2121   for (DUIterator_Last imin, i = last_outs(imin); i >= imin; ) {
2122     Node* use = last_out(i);
2123     uint uses_found = 0;
2124     for (uint j = 0; j < use->len(); j++) {
2125       if (use->in(j) == this) {
2126         if (j < use->req())
2127               use->set_req(j, new_node);
2128         else  use->set_prec(j, new_node);
2129         uses_found++;
2130       }




1378             if (in->outcnt() == 0) { // Made input go dead?
1379               _stack.push(in, PROCESS_INPUTS); // Recursively remove
1380               recurse = true;
1381             } else if (in->outcnt() == 1 &&
1382                        in->has_special_unique_user()) {
1383               _worklist.push(in->unique_out());
1384             } else if (in->outcnt() <= 2 && dead->is_Phi()) {
1385               if (in->Opcode() == Op_Region) {
1386                 _worklist.push(in);
1387               } else if (in->is_Store()) {
1388                 DUIterator_Fast imax, i = in->fast_outs(imax);
1389                 _worklist.push(in->fast_out(i));
1390                 i++;
1391                 if (in->outcnt() == 2) {
1392                   _worklist.push(in->fast_out(i));
1393                   i++;
1394                 }
1395                 assert(!(i < imax), "sanity");
1396               }
1397             } else {
1398               BarrierSet::barrier_set()->barrier_set_c2()->enqueue_useful_gc_barrier(this, in);
1399             }
1400             if (ReduceFieldZeroing && dead->is_Load() && i == MemNode::Memory &&
1401                 in->is_Proj() && in->in(0) != NULL && in->in(0)->is_Initialize()) {
1402               // A Load that directly follows an InitializeNode is
1403               // going away. The Stores that follow are candidates
1404               // again to be captured by the InitializeNode.
1405               for (DUIterator_Fast jmax, j = in->fast_outs(jmax); j < jmax; j++) {
1406                 Node *n = in->fast_out(j);
1407                 if (n->is_Store()) {
1408                   _worklist.push(n);
1409                 }
1410               }
1411             }
1412           } // if (in != NULL && in != C->top())
1413         } // for (uint i = 0; i < dead->req(); i++)
1414         if (recurse) {
1415           continue;
1416         }
1417       } // if (!dead->is_Con())
1418     } // if (progress_state == PROCESS_INPUTS)


1664     bool has_load_barriers = bs->has_load_barriers();
1665 
1666     if (use_op == Op_LoadP && use->bottom_type()->isa_rawptr()) {
1667       for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) {
1668         Node* u = use->fast_out(i2);
1669         const Type* ut = u->bottom_type();
1670         if (u->Opcode() == Op_LoadP && ut->isa_instptr()) {
1671           if (has_load_barriers) {
1672             // Search for load barriers behind the load
1673             for (DUIterator_Fast i3max, i3 = u->fast_outs(i3max); i3 < i3max; i3++) {
1674               Node* b = u->fast_out(i3);
1675               if (bs->is_gc_barrier_node(b)) {
1676                 _worklist.push(b);
1677               }
1678             }
1679           }
1680           _worklist.push(u);
1681         }
1682       }
1683     }
1684 
1685     // TODO: Needed after the block above?
1686     if (use->is_ShenandoahBarrier()) {
1687       Node* cmp = use->find_out_with(Op_CmpP);
1688       if (cmp != NULL) {
1689         _worklist.push(cmp);
1690       }
1691     }
1692   }
1693 }
1694 
1695 /**
1696  * Remove the speculative part of all types that we know of
1697  */
1698 void PhaseIterGVN::remove_speculative_types()  {
1699   assert(UseTypeSpeculation, "speculation is off");
1700   for (uint i = 0; i < _types.Size(); i++)  {
1701     const Type* t = _types.fast_lookup(i);
1702     if (t != NULL) {
1703       _types.map(i, t->remove_speculative());
1704     }
1705   }
1706   _table.check_no_speculative_types();
1707 }
1708 
1709 //=============================================================================
1710 #ifndef PRODUCT
1711 uint PhaseCCP::_total_invokes   = 0;


2099         igvn->_worklist.push( old );
2100       break;
2101     case 1:
2102       if( old->is_Store() || old->has_special_unique_user() )
2103         igvn->add_users_to_worklist( old );
2104       break;
2105     case 2:
2106       if( old->is_Store() )
2107         igvn->add_users_to_worklist( old );
2108       if( old->Opcode() == Op_Region )
2109         igvn->_worklist.push(old);
2110       break;
2111     case 3:
2112       if( old->Opcode() == Op_Region ) {
2113         igvn->_worklist.push(old);
2114         igvn->add_users_to_worklist( old );
2115       }
2116       break;
2117     default:
2118       break;
2119     }
2120     if (UseShenandoahGC) {
2121       // TODO: Should we call this for ZGC as well?
2122       BarrierSet::barrier_set()->barrier_set_c2()->enqueue_useful_gc_barrier(igvn, old);
2123     }
2124   }
2125 
2126 }
2127 
2128 //-------------------------------replace_by-----------------------------------
2129 // Using def-use info, replace one node for another.  Follow the def-use info
2130 // to all users of the OLD node.  Then make all uses point to the NEW node.
2131 void Node::replace_by(Node *new_node) {
2132   assert(!is_top(), "top node has no DU info");
2133   for (DUIterator_Last imin, i = last_outs(imin); i >= imin; ) {
2134     Node* use = last_out(i);
2135     uint uses_found = 0;
2136     for (uint j = 0; j < use->len(); j++) {
2137       if (use->in(j) == this) {
2138         if (j < use->req())
2139               use->set_req(j, new_node);
2140         else  use->set_prec(j, new_node);
2141         uses_found++;
2142       }


< prev index next >