src/share/vm/opto/node.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
6701887 Cdiff src/share/vm/opto/node.cpp
src/share/vm/opto/node.cpp
Print this page
*** 1034,1050 ****
--- 1034,1055 ----
ctrl = ctrl->in(0);
return ctrl;
}
+ #define ITERATIONS_LIMIT 1000
+
//--------------------------dominates------------------------------------------
// Helper function for MemNode::all_controls_dominate().
// Check if 'this' control node dominates or equal to 'sub' control node.
bool Node::dominates(Node* sub, Node_List &nlist) {
assert(this->is_CFG(), "expecting control");
assert(sub != NULL && sub->is_CFG(), "expecting control");
+ // detect dead cycle without regions
+ int iterations_without_region_limit = ITERATIONS_LIMIT;
+
Node* orig_sub = sub;
nlist.clear();
bool this_dominates = false;
uint region_input = 0;
while (sub != NULL) { // walk 'sub' up the chain to 'this'
*** 1055,1064 ****
--- 1060,1070 ----
return true;
} else if (!this_dominates) {
// Region nodes were visited. Continue walk up to Start or Root
// to make sure that it did not walk in a cycle.
this_dominates = true; // first time meet
+ iterations_without_region_limit = ITERATIONS_LIMIT; // Reset
} else {
return false; // already met before: walk in a cycle
}
}
if (sub->is_Start() || sub->is_Root())
*** 1067,1089 ****
Node* up = sub->find_exact_control(sub->in(0));
if (up == NULL || up->is_top())
return false; // Conservative answer for dead code
if (sub == up && sub->is_Loop()) {
! up = sub->in(0); // in(LoopNode::EntryControl);
! } else if (sub == up && sub->is_Region()) {
uint i = 1;
! if (nlist.size() == 0) {
// No Region nodes (except Loops) were visited before.
// Take first valid path on the way up to 'this'.
! } else if (nlist.at(nlist.size() - 1) == sub) {
// This Region node was just visited. Take other path.
i = region_input + 1;
nlist.pop();
} else {
// Was this Region node visited before?
- uint size = nlist.size();
for (uint j = 0; j < size; j++) {
if (nlist.at(j) == sub) {
return false; // The Region node was visited before. Give up.
}
}
--- 1073,1096 ----
Node* up = sub->find_exact_control(sub->in(0));
if (up == NULL || up->is_top())
return false; // Conservative answer for dead code
if (sub == up && sub->is_Loop()) {
! up = sub->in(1); // in(LoopNode::EntryControl);
! } else if (sub == up && sub->is_Region() && sub->req() == 3) {
! iterations_without_region_limit = ITERATIONS_LIMIT; // Reset
uint i = 1;
! uint size = nlist.size();
! if (size == 0) {
// No Region nodes (except Loops) were visited before.
// Take first valid path on the way up to 'this'.
! } else if (nlist.at(size - 1) == sub) {
// This Region node was just visited. Take other path.
i = region_input + 1;
nlist.pop();
} else {
// Was this Region node visited before?
for (uint j = 0; j < size; j++) {
if (nlist.at(j) == sub) {
return false; // The Region node was visited before. Give up.
}
}
*** 1102,1114 ****
region_input = i;
}
}
if (sub == up)
return false; // some kind of tight cycle
- if (orig_sub == up)
- return false; // walk in a cycle
sub = up;
}
return false;
}
--- 1109,1122 ----
region_input = i;
}
}
if (sub == up)
return false; // some kind of tight cycle
+ if (--iterations_without_region_limit < 0)
+ return false; // dead cycle
+
sub = up;
}
return false;
}
src/share/vm/opto/node.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File