8062258: compiler/debug/TraceIterativeGVN.java segfaults in trace_PhaseIterGVN
Reviewed-by: kvn
--- a/hotspot/src/share/vm/opto/machnode.cpp Mon Nov 17 12:57:49 2014 +0300
+++ b/hotspot/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/hotspot/src/share/vm/opto/memnode.cpp Mon Nov 17 12:57:49 2014 +0300
+++ b/hotspot/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/hotspot/src/share/vm/opto/memnode.hpp Mon Nov 17 12:57:49 2014 +0300
+++ b/hotspot/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/hotspot/src/share/vm/opto/multnode.cpp Mon Nov 17 12:57:49 2014 +0300
+++ b/hotspot/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");