< prev index next >

src/hotspot/share/opto/phaseX.cpp

Print this page




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


1656     bool has_load_barriers = bs->has_load_barriers();
1657 
1658     if (use_op == Op_LoadP && use->bottom_type()->isa_rawptr()) {
1659       for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) {
1660         Node* u = use->fast_out(i2);
1661         const Type* ut = u->bottom_type();
1662         if (u->Opcode() == Op_LoadP && ut->isa_instptr()) {
1663           if (has_load_barriers) {
1664             // Search for load barriers behind the load
1665             for (DUIterator_Fast i3max, i3 = u->fast_outs(i3max); i3 < i3max; i3++) {
1666               Node* b = u->fast_out(i3);
1667               if (bs->is_gc_barrier_node(b)) {
1668                 _worklist.push(b);
1669               }
1670             }
1671           }
1672           _worklist.push(u);
1673         }
1674       }
1675     }








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


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




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




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


1656     bool has_load_barriers = bs->has_load_barriers();
1657 
1658     if (use_op == Op_LoadP && use->bottom_type()->isa_rawptr()) {
1659       for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) {
1660         Node* u = use->fast_out(i2);
1661         const Type* ut = u->bottom_type();
1662         if (u->Opcode() == Op_LoadP && ut->isa_instptr()) {
1663           if (has_load_barriers) {
1664             // Search for load barriers behind the load
1665             for (DUIterator_Fast i3max, i3 = u->fast_outs(i3max); i3 < i3max; i3++) {
1666               Node* b = u->fast_out(i3);
1667               if (bs->is_gc_barrier_node(b)) {
1668                 _worklist.push(b);
1669               }
1670             }
1671           }
1672           _worklist.push(u);
1673         }
1674       }
1675     }
1676 
1677     // TODO: Needed after the block above?
1678     if (use->is_ShenandoahBarrier()) {
1679       Node* cmp = use->find_out_with(Op_CmpP);
1680       if (cmp != NULL) {
1681         _worklist.push(cmp);
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;


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


< prev index next >