src/share/vm/opto/phaseX.cpp

Print this page




1306 
1307   // Move users of node to worklist
1308   for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
1309     Node* use = n->fast_out(i); // Get use
1310 
1311     if( use->is_Multi() ||      // Multi-definer?  Push projs on worklist
1312         use->is_Store() )       // Enable store/load same address
1313       add_users_to_worklist0(use);
1314 
1315     // If we changed the receiver type to a call, we need to revisit
1316     // the Catch following the call.  It's looking for a non-NULL
1317     // receiver to know when to enable the regular fall-through path
1318     // in addition to the NullPtrException path.
1319     if (use->is_CallDynamicJava() && n == use->in(TypeFunc::Parms)) {
1320       Node* p = use->as_CallDynamicJava()->proj_out(TypeFunc::Control);
1321       if (p != NULL) {
1322         add_users_to_worklist0(p);
1323       }
1324     }
1325 
1326     if( use->is_Cmp() ) {       // Enable CMP/BOOL optimization

1327       add_users_to_worklist(use); // Put Bool on worklist
1328       // Look for the 'is_x2logic' pattern: "x ? : 0 : 1" and put the
1329       // phi merging either 0 or 1 onto the worklist
1330       if (use->outcnt() > 0) {
1331         Node* bol = use->raw_out(0);
1332         if (bol->outcnt() > 0) {
1333           Node* iff = bol->raw_out(0);
1334           if (iff->outcnt() == 2) {













1335             Node* ifproj0 = iff->raw_out(0);
1336             Node* ifproj1 = iff->raw_out(1);
1337             if (ifproj0->outcnt() > 0 && ifproj1->outcnt() > 0) {
1338               Node* region0 = ifproj0->raw_out(0);
1339               Node* region1 = ifproj1->raw_out(0);
1340               if( region0 == region1 )
1341                 add_users_to_worklist0(region0);
1342             }
1343           }
1344         }
1345       }













1346     }





1347 
1348     uint use_op = use->Opcode();
1349     // If changed Cast input, check Phi users for simple cycles
1350     if( use->is_ConstraintCast() || use->is_CheckCastPP() ) {
1351       for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) {
1352         Node* u = use->fast_out(i2);
1353         if (u->is_Phi())
1354           _worklist.push(u);
1355       }
1356     }
1357     // If changed LShift inputs, check RShift users for useless sign-ext
1358     if( use_op == Op_LShiftI ) {
1359       for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) {
1360         Node* u = use->fast_out(i2);
1361         if (u->Opcode() == Op_RShiftI)
1362           _worklist.push(u);
1363       }
1364     }
1365     // If changed AddP inputs, check Stores for loop invariant
1366     if( use_op == Op_AddP ) {
1367       for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) {
1368         Node* u = use->fast_out(i2);




1306 
1307   // Move users of node to worklist
1308   for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
1309     Node* use = n->fast_out(i); // Get use
1310 
1311     if( use->is_Multi() ||      // Multi-definer?  Push projs on worklist
1312         use->is_Store() )       // Enable store/load same address
1313       add_users_to_worklist0(use);
1314 
1315     // If we changed the receiver type to a call, we need to revisit
1316     // the Catch following the call.  It's looking for a non-NULL
1317     // receiver to know when to enable the regular fall-through path
1318     // in addition to the NullPtrException path.
1319     if (use->is_CallDynamicJava() && n == use->in(TypeFunc::Parms)) {
1320       Node* p = use->as_CallDynamicJava()->proj_out(TypeFunc::Control);
1321       if (p != NULL) {
1322         add_users_to_worklist0(p);
1323       }
1324     }
1325 
1326     uint use_op = use->Opcode();
1327     if(use->is_Cmp()) {       // Enable CMP/BOOL optimization
1328       add_users_to_worklist(use); // Put Bool on worklist


1329       if (use->outcnt() > 0) {
1330         Node* bol = use->raw_out(0);
1331         if (bol->outcnt() > 0) {
1332           Node* iff = bol->raw_out(0);
1333           if (use_op == Op_CmpI &&
1334               iff->is_CountedLoopEnd()) {
1335             CountedLoopEndNode* cle = iff->as_CountedLoopEnd();
1336             if (cle->limit() == n && cle->phi() != NULL) {
1337               // If an opaque node feeds into the limit condition of a
1338               // CountedLoop, we need to process the Phi node for the
1339               // induction variable when the opaque node is removed:
1340               // the range of values taken by the Phi is now known and
1341               // so its type is also known.
1342               _worklist.push(cle->phi());
1343             }
1344           } else if (iff->outcnt() == 2) {
1345             // Look for the 'is_x2logic' pattern: "x ? : 0 : 1" and put the
1346             // phi merging either 0 or 1 onto the worklist
1347             Node* ifproj0 = iff->raw_out(0);
1348             Node* ifproj1 = iff->raw_out(1);
1349             if (ifproj0->outcnt() > 0 && ifproj1->outcnt() > 0) {
1350               Node* region0 = ifproj0->raw_out(0);
1351               Node* region1 = ifproj1->raw_out(0);
1352               if( region0 == region1 )
1353                 add_users_to_worklist0(region0);
1354             }
1355           }
1356         }
1357       }
1358       if (use_op == Op_CmpI) {
1359         Node* in1 = use->in(1);
1360         for (uint i = 0; i < in1->outcnt(); i++) {
1361           if (in1->raw_out(i)->Opcode() == Op_CastII) {
1362             Node* castii = in1->raw_out(i);
1363             if (castii->in(0) != NULL && castii->in(0)->in(0) != NULL && castii->in(0)->in(0)->is_If()) {
1364               Node* ifnode = castii->in(0)->in(0);
1365               if (ifnode->in(1) != NULL && ifnode->in(1)->in(1) == use) {
1366                 // Reprocess a CastII node that may depend on an
1367                 // opaque node value when the opaque node is
1368                 // removed. In case it carries a dependency we can do
1369                 // a better job of computing its type.
1370                 _worklist.push(castii);
1371               }
1372             }
1373           }
1374         }
1375       }
1376     }
1377 

1378     // If changed Cast input, check Phi users for simple cycles
1379     if( use->is_ConstraintCast() || use->is_CheckCastPP() ) {
1380       for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) {
1381         Node* u = use->fast_out(i2);
1382         if (u->is_Phi())
1383           _worklist.push(u);
1384       }
1385     }
1386     // If changed LShift inputs, check RShift users for useless sign-ext
1387     if( use_op == Op_LShiftI ) {
1388       for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) {
1389         Node* u = use->fast_out(i2);
1390         if (u->Opcode() == Op_RShiftI)
1391           _worklist.push(u);
1392       }
1393     }
1394     // If changed AddP inputs, check Stores for loop invariant
1395     if( use_op == Op_AddP ) {
1396       for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) {
1397         Node* u = use->fast_out(i2);