changeset 7438:269dae261504

8062258: compiler/debug/TraceIterativeGVN.java segfaults in trace_PhaseIterGVN Reviewed-by: kvn
author vlivanov
date Mon, 17 Nov 2014 14:02:45 -0800
parents 9f14e2f457b3
children bfa95eeb0a33
files src/share/vm/opto/machnode.cpp src/share/vm/opto/memnode.cpp src/share/vm/opto/memnode.hpp src/share/vm/opto/multnode.cpp
diffstat 4 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/opto/machnode.cpp	Mon Nov 17 12:57:49 2014 +0300
+++ b/src/share/vm/opto/machnode.cpp	Mon Nov 17 14:02:45 2014 -0800
@@ -561,7 +561,9 @@
 const TypePtr *MachProjNode::adr_type() const {
   if (bottom_type() == Type::MEMORY) {
     // in(0) might be a narrow MemBar; otherwise we will report TypePtr::BOTTOM
-    const TypePtr* adr_type = in(0)->adr_type();
+    Node* ctrl = in(0);
+    if (ctrl == NULL)  return NULL; // node is dead
+    const TypePtr* adr_type = ctrl->adr_type();
     #ifdef ASSERT
     if (!is_error_reported() && !Node::in_dump())
       assert(adr_type != NULL, "source must have adr_type");
--- a/src/share/vm/opto/memnode.cpp	Mon Nov 17 12:57:49 2014 +0300
+++ b/src/share/vm/opto/memnode.cpp	Mon Nov 17 14:02:45 2014 -0800
@@ -52,6 +52,7 @@
 
 const TypePtr *MemNode::adr_type() const {
   Node* adr = in(Address);
+  if (adr == NULL)  return NULL; // node is dead
   const TypePtr* cross_check = NULL;
   DEBUG_ONLY(cross_check = _adr_type);
   return calculate_adr_type(adr->bottom_type(), cross_check);
@@ -2741,6 +2742,7 @@
 // Do we Match on this edge index or not?  Do not match memory
 const TypePtr* ClearArrayNode::adr_type() const {
   Node *adr = in(3);
+  if (adr == NULL)  return NULL; // node is dead
   return MemNode::calculate_adr_type(adr->bottom_type());
 }
 
--- a/src/share/vm/opto/memnode.hpp	Mon Nov 17 12:57:49 2014 +0300
+++ b/src/share/vm/opto/memnode.hpp	Mon Nov 17 14:02:45 2014 -0800
@@ -730,7 +730,11 @@
   virtual int Opcode() const;
   virtual bool      is_CFG() const  { return false; }
   virtual const Type *bottom_type() const {return Type::MEMORY;}
-  virtual const TypePtr *adr_type() const { return in(0)->in(MemNode::Memory)->adr_type();}
+  virtual const TypePtr *adr_type() const {
+    Node* ctrl = in(0);
+    if (ctrl == NULL)  return NULL; // node is dead
+    return ctrl->in(MemNode::Memory)->adr_type();
+  }
   virtual uint ideal_reg() const { return 0;} // memory projections don't have a register
   virtual const Type *Value( PhaseTransform *phase ) const;
 #ifndef PRODUCT
--- a/src/share/vm/opto/multnode.cpp	Mon Nov 17 12:57:49 2014 +0300
+++ b/src/share/vm/opto/multnode.cpp	Mon Nov 17 14:02:45 2014 -0800
@@ -102,7 +102,9 @@
 const TypePtr *ProjNode::adr_type() const {
   if (bottom_type() == Type::MEMORY) {
     // in(0) might be a narrow MemBar; otherwise we will report TypePtr::BOTTOM
-    const TypePtr* adr_type = in(0)->adr_type();
+    Node* ctrl = in(0);
+    if (ctrl == NULL)  return NULL; // node is dead
+    const TypePtr* adr_type = ctrl->adr_type();
     #ifdef ASSERT
     if (!is_error_reported() && !Node::in_dump())
       assert(adr_type != NULL, "source must have adr_type");