< prev index next >

src/share/vm/opto/loopnode.cpp

Print this page
rev 10955 : undo
rev 11689 : 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
Summary: With UseCountedLoopSafepoints on do not convert loops to counted loop if they have a safepoint on the backedge
Reviewed-by:

@@ -277,12 +277,20 @@
   // Must also check for TOP when looking for a dead loop
   if (init_control->is_top() || back_control->is_top())
     return false;
 
   // Allow funny placement of Safepoint
-  if (back_control->Opcode() == Op_SafePoint)
+  if (back_control->Opcode() == Op_SafePoint) {
+    if (UseCountedLoopSafepoints) {
+      // Leaving the safepoint on the backedge and creating a
+      // CountedLoop will confuse optimizations. We can't move the
+      // safepoint around because its jvm state wouldn't match a new
+      // location. Give up on that loop.
+      return false;
+    }
     back_control = back_control->in(TypeFunc::Control);
+  }
 
   // Controlling test for loop
   Node *iftrue = back_control;
   uint iftrue_op = iftrue->Opcode();
   if (iftrue_op != Op_IfTrue &&
< prev index next >