src/share/vm/opto/node.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6714406 Sdiff src/share/vm/opto

src/share/vm/opto/node.cpp

Print this page




1056       if (nlist.size() == 0) {
1057         // No Region nodes except loops were visited before and the EntryControl
1058         // path was taken for loops: it did not walk in a cycle.
1059         result = true;
1060         break;
1061       } else if (this_dominates) {
1062         result = false;          // already met before: walk in a cycle
1063         break;
1064       } else {
1065         // Region nodes were visited. Continue walk up to Start or Root
1066         // to make sure that it did not walk in a cycle.
1067         this_dominates = true; // first time meet
1068         iterations_without_region_limit = DominatorSearchLimit; // Reset
1069      }
1070     }
1071     if (sub->is_Start() || sub->is_Root()) {
1072       result = this_dominates;
1073       break;
1074     }
1075     Node* up = sub->find_exact_control(sub->in(0));
1076     if (up == NULL || up->is_top()) {
1077       result = false; // Conservative answer for dead code
1078       break;
1079     }
1080     if (sub == up && (sub->is_Loop() || sub->is_Region() && sub->req() != 3)) {
1081       // Take first valid path on the way up to 'this'.
1082       up = sub->in(1); // in(LoopNode::EntryControl);
1083     } else if (sub == up && sub->is_Region()) {
1084       assert(sub->req() == 3, "sanity");
1085       iterations_without_region_limit = DominatorSearchLimit; // Reset
1086 
1087       // Try both paths for such Regions.
1088       // It is not accurate without regions dominating information.
1089       // With such information the other path should be checked for
1090       // the most dominating Region which was visited before.
1091       bool region_was_visited_before = false;
1092       uint i = 1;
1093       uint size = nlist.size();
1094       if (size == 0) {
1095         // No such Region nodes were visited before.
1096         // Take first valid path on the way up to 'this'.
1097       } else {
1098         // Was this Region node visited before?
1099         intptr_t ni;


1123           break;
1124         }
1125         // The Region node was not visited before.
1126       }
1127       for (; i < sub->req(); i++) {
1128         Node* in = sub->in(i);
1129         if (in != NULL && !in->is_top() && in != sub) {
1130           break;
1131         }
1132       }
1133       if (i < sub->req()) {
1134         up = sub->in(i);
1135         if (region_was_visited_before && sub != up) {
1136           // Set 0 bit to indicate that both paths were taken.
1137           nlist.push((Node*)((intptr_t)sub + 1));
1138         } else {
1139           nlist.push(sub);
1140         }
1141       }
1142     }
1143     if (sub == up) {
1144       result = false;    // some kind of tight cycle
1145       break;
1146     }









1147     if (--iterations_without_region_limit < 0) {
1148       result = false;    // dead cycle
1149       break;
1150     }
1151     sub = up;
1152   }
1153   return result;
1154 }
1155 
1156 //------------------------------remove_dead_region-----------------------------
1157 // This control node is dead.  Follow the subgraph below it making everything
1158 // using it dead as well.  This will happen normally via the usual IterGVN
1159 // worklist but this call is more efficient.  Do not update use-def info
1160 // inside the dead region, just at the borders.
1161 static bool kill_dead_code( Node *dead, PhaseIterGVN *igvn ) {
1162   // Con's are a popular node to re-hit in the hash table again.
1163   if( dead->is_Con() ) return false;
1164 
1165   // Can't put ResourceMark here since igvn->_worklist uses the same arena
1166   // for verify pass with +VerifyOpto and we add/remove elements in it here.




1056       if (nlist.size() == 0) {
1057         // No Region nodes except loops were visited before and the EntryControl
1058         // path was taken for loops: it did not walk in a cycle.
1059         result = true;
1060         break;
1061       } else if (this_dominates) {
1062         result = false;          // already met before: walk in a cycle
1063         break;
1064       } else {
1065         // Region nodes were visited. Continue walk up to Start or Root
1066         // to make sure that it did not walk in a cycle.
1067         this_dominates = true; // first time meet
1068         iterations_without_region_limit = DominatorSearchLimit; // Reset
1069      }
1070     }
1071     if (sub->is_Start() || sub->is_Root()) {
1072       result = this_dominates;
1073       break;
1074     }
1075     Node* up = sub->find_exact_control(sub->in(0));




1076     if (sub == up && (sub->is_Loop() || sub->is_Region() && sub->req() != 3)) {
1077       // Take first valid path on the way up to 'this'.
1078       up = sub->in(1); // in(LoopNode::EntryControl);
1079     } else if (sub == up && sub->is_Region()) {
1080       assert(sub->req() == 3, "sanity");
1081       iterations_without_region_limit = DominatorSearchLimit; // Reset
1082 
1083       // Try both paths for such Regions.
1084       // It is not accurate without regions dominating information.
1085       // With such information the other path should be checked for
1086       // the most dominating Region which was visited before.
1087       bool region_was_visited_before = false;
1088       uint i = 1;
1089       uint size = nlist.size();
1090       if (size == 0) {
1091         // No such Region nodes were visited before.
1092         // Take first valid path on the way up to 'this'.
1093       } else {
1094         // Was this Region node visited before?
1095         intptr_t ni;


1119           break;
1120         }
1121         // The Region node was not visited before.
1122       }
1123       for (; i < sub->req(); i++) {
1124         Node* in = sub->in(i);
1125         if (in != NULL && !in->is_top() && in != sub) {
1126           break;
1127         }
1128       }
1129       if (i < sub->req()) {
1130         up = sub->in(i);
1131         if (region_was_visited_before && sub != up) {
1132           // Set 0 bit to indicate that both paths were taken.
1133           nlist.push((Node*)((intptr_t)sub + 1));
1134         } else {
1135           nlist.push(sub);
1136         }
1137       }
1138     }
1139     if (up == sub) {
1140       result = false;    // some kind of tight cycle
1141       break;
1142     }
1143     if (up == orig_sub && this_dominates) {
1144       // returned back after visiting 'this' node
1145       result = false;    // some kind of cycle
1146       break;
1147     }
1148     if (up == NULL || up->is_top()) {
1149       result = false; // Conservative answer for dead code
1150       break;
1151     }
1152     if (--iterations_without_region_limit < 0) {
1153       result = false;    // dead cycle
1154       break;
1155     }
1156     sub = up;
1157   }
1158   return result;
1159 }
1160 
1161 //------------------------------remove_dead_region-----------------------------
1162 // This control node is dead.  Follow the subgraph below it making everything
1163 // using it dead as well.  This will happen normally via the usual IterGVN
1164 // worklist but this call is more efficient.  Do not update use-def info
1165 // inside the dead region, just at the borders.
1166 static bool kill_dead_code( Node *dead, PhaseIterGVN *igvn ) {
1167   // Con's are a popular node to re-hit in the hash table again.
1168   if( dead->is_Con() ) return false;
1169 
1170   // Can't put ResourceMark here since igvn->_worklist uses the same arena
1171   // for verify pass with +VerifyOpto and we add/remove elements in it here.


src/share/vm/opto/node.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File