diff src/share/vm/opto/callnode.cpp @ 20452:f8afcfbdbf1c

8046698: assert(false) failed: only Initialize or AddP expected macro.cpp:943 Summary: PhiNode inserted between AllocateNode and Initialization node confuses allocation elimination Reviewed-by: kvn
author roland
date Sat, 02 Aug 2014 07:06:08 +0200
parents 411e30e5fbb8
children 7848fc12602b 6e8e0bf87bbe
line wrap: on
line diff
--- a/src/share/vm/opto/callnode.cpp	Wed Sep 10 16:06:53 2014 -0700
+++ b/src/share/vm/opto/callnode.cpp	Sat Aug 02 07:06:08 2014 +0200
@@ -777,7 +777,7 @@
 }
 
 // Returns the unique CheckCastPP of a call
-// or 'this' if there are several CheckCastPP
+// or 'this' if there are several CheckCastPP or unexpected uses
 // or returns NULL if there is no one.
 Node *CallNode::result_cast() {
   Node *cast = NULL;
@@ -793,6 +793,13 @@
         return this;  // more than 1 CheckCastPP
       }
       cast = use;
+    } else if (!use->is_Initialize() &&
+               !use->is_AddP()) {
+      // Expected uses are restricted to a CheckCastPP, an Initialize
+      // node, and AddP nodes. If we encounter any other use (a Phi
+      // node can be seen in rare cases) return this to prevent
+      // incorrect optimizations.
+      return this;
     }
   }
   return cast;