src/share/vm/opto/cfgnode.cpp

changeset 563
a76240c8b133
parent 562
e0bd2e08e3d0
child 598
885ed790ecf0
equal deleted inserted replaced
557:ec73d88d5b43 563:a76240c8b133
1417 // itself (safe for dead loops). 1417 // itself (safe for dead loops).
1418 if (in != NULL && !in->is_dead_loop_safe()) { 1418 if (in != NULL && !in->is_dead_loop_safe()) {
1419 // Check inputs of phi's inputs also. 1419 // Check inputs of phi's inputs also.
1420 // It is much less expensive then full graph walk. 1420 // It is much less expensive then full graph walk.
1421 uint cnt = in->req(); 1421 uint cnt = in->req();
1422 for (uint i = 1; i < cnt; ++i) { 1422 uint i = (in->is_Proj() && !in->is_CFG()) ? 0 : 1;
1423 for (; i < cnt; ++i) {
1423 Node* m = in->in(i); 1424 Node* m = in->in(i);
1424 if (m == (Node*)this) 1425 if (m == (Node*)this)
1425 return UnsafeLoop; // Unsafe loop 1426 return UnsafeLoop; // Unsafe loop
1426 if (m != NULL && !m->is_dead_loop_safe()) { 1427 if (m != NULL && !m->is_dead_loop_safe()) {
1427 // Check the most common case (about 30% of all cases): 1428 // Check the most common case (about 30% of all cases):
1465 nstack.push(in); // Start with unique input. 1466 nstack.push(in); // Start with unique input.
1466 visited.set(in->_idx); 1467 visited.set(in->_idx);
1467 while (nstack.size() != 0) { 1468 while (nstack.size() != 0) {
1468 Node* n = nstack.pop(); 1469 Node* n = nstack.pop();
1469 uint cnt = n->req(); 1470 uint cnt = n->req();
1470 for (uint i = 1; i < cnt; i++) { // Only data paths 1471 uint i = (n->is_Proj() && !n->is_CFG()) ? 0 : 1;
1472 for (; i < cnt; i++) {
1471 Node* m = n->in(i); 1473 Node* m = n->in(i);
1472 if (m == (Node*)this) { 1474 if (m == (Node*)this) {
1473 return true; // Data loop 1475 return true; // Data loop
1474 } 1476 }
1475 if (m != NULL && !m->is_dead_loop_safe()) { // Only look for unsafe cases. 1477 if (m != NULL && !m->is_dead_loop_safe()) { // Only look for unsafe cases.
2015 ? this 2017 ? this
2016 : call->in(TypeFunc::Parms); 2018 : call->in(TypeFunc::Parms);
2017 } 2019 }
2018 2020
2019 //============================================================================= 2021 //=============================================================================
2022 //------------------------------Value------------------------------------------
2023 // Check for being unreachable.
2024 const Type *NeverBranchNode::Value( PhaseTransform *phase ) const {
2025 if (!in(0) || in(0)->is_top()) return Type::TOP;
2026 return bottom_type();
2027 }
2028
2029 //------------------------------Ideal------------------------------------------
2030 // Check for no longer being part of a loop
2031 Node *NeverBranchNode::Ideal(PhaseGVN *phase, bool can_reshape) {
2032 if (can_reshape && !in(0)->is_Loop()) {
2033 // Dead code elimination can sometimes delete this projection so
2034 // if it's not there, there's nothing to do.
2035 Node* fallthru = proj_out(0);
2036 if (fallthru != NULL) {
2037 phase->is_IterGVN()->subsume_node(fallthru, in(0));
2038 }
2039 return phase->C->top();
2040 }
2041 return NULL;
2042 }
2043
2020 #ifndef PRODUCT 2044 #ifndef PRODUCT
2021 void NeverBranchNode::format( PhaseRegAlloc *ra_, outputStream *st) const { 2045 void NeverBranchNode::format( PhaseRegAlloc *ra_, outputStream *st) const {
2022 st->print("%s", Name()); 2046 st->print("%s", Name());
2023 } 2047 }
2024 #endif 2048 #endif

mercurial