changeset 427:334969144810

6758445: loop heads that are exception entry points can crash during count_edges/mark_loops Reviewed-by: kvn, jrose
author never
date Tue, 11 Nov 2008 23:03:35 -0800
parents 577f3a2e0662
children 364141474b40
files src/share/vm/c1/c1_IR.cpp
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/c1/c1_IR.cpp	Fri Nov 07 13:55:14 2008 -0800
+++ b/src/share/vm/c1/c1_IR.cpp	Tue Nov 11 23:03:35 2008 -0800
@@ -574,12 +574,23 @@
     TRACE_LINEAR_SCAN(3, tty->print_cr("backward branch"));
     assert(is_visited(cur), "block must be visisted when block is active");
     assert(parent != NULL, "must have parent");
-    assert(parent->number_of_sux() == 1, "loop end blocks must have one successor (critical edges are split)");
 
     cur->set(BlockBegin::linear_scan_loop_header_flag);
     cur->set(BlockBegin::backward_branch_target_flag);
 
     parent->set(BlockBegin::linear_scan_loop_end_flag);
+
+    // When a loop header is also the start of an exception handler, then the backward branch is
+    // an exception edge. Because such edges are usually critical edges which cannot be split, the
+    // loop must be excluded here from processing.
+    if (cur->is_set(BlockBegin::exception_entry_flag)) {
+      // Make sure that dominators are correct in this weird situation
+      _iterative_dominators = true;
+      return;
+    }
+    assert(parent->number_of_sux() == 1 && parent->sux_at(0) == cur,
+           "loop end blocks must have one successor (critical edges are split)");
+
     _loop_end_blocks.append(parent);
     return;
   }