8071996: split_if accesses NULL region of ConstraintCast
authorgoetz
Fri, 30 Jan 2015 12:53:56 +0100
changeset 28927 48e4a707e777
parent 28926 ffde0c63da58
child 28928 e3815b017664
8071996: split_if accesses NULL region of ConstraintCast Reviewed-by: kvn
hotspot/src/share/vm/opto/ifnode.cpp
--- a/hotspot/src/share/vm/opto/ifnode.cpp	Tue Feb 03 09:56:21 2015 +0000
+++ b/hotspot/src/share/vm/opto/ifnode.cpp	Fri Jan 30 12:53:56 2015 +0100
@@ -145,10 +145,18 @@
       Node* v = u->fast_out(k); // User of the phi
       // CNC - Allow only really simple patterns.
       // In particular I disallow AddP of the Phi, a fairly common pattern
-      if( v == cmp ) continue;  // The compare is OK
-      if( (v->is_ConstraintCast()) &&
-          v->in(0)->in(0) == iff )
-        continue;               // CastPP/II of the IfNode is OK
+      if (v == cmp) continue;  // The compare is OK
+      if (v->is_ConstraintCast()) {
+        // If the cast is derived from data flow edges, it may not have a control edge.
+        // If so, it should be safe to split. But follow-up code can not deal with
+        // this (l. 359). So skip.
+        if (v->in(0) == NULL) {
+          return NULL;
+        }
+        if (v->in(0)->in(0) == iff) {
+          continue;               // CastPP/II of the IfNode is OK
+        }
+      }
       // Disabled following code because I cannot tell if exactly one
       // path dominates without a real dominator check. CNC 9/9/1999
       //uint vop = v->Opcode();