src/share/vm/opto/escape.cpp
Print this page
rev 4505 : 8014189: JVM crash with SEGV in ConnectionGraph::record_for_escape_analysis()
Summary: Add NULL checks and asserts for Type::make_ptr() returned value.
Reviewed-by: kvn
*** 462,471 ****
--- 462,474 ----
case Op_CompareAndSwapP:
case Op_CompareAndSwapN: {
Node* adr = n->in(MemNode::Address);
const Type *adr_type = igvn->type(adr);
adr_type = adr_type->make_ptr();
+ if (adr_type == NULL) {
+ break; // skip dead nodes
+ }
if (adr_type->isa_oopptr() ||
(opcode == Op_StoreP || opcode == Op_StoreN) &&
(adr_type == TypeRawPtr::NOTNULL &&
adr->in(AddPNode::Address)->is_Proj() &&
adr->in(AddPNode::Address)->in(0)->is_Allocate())) {
*** 650,667 ****
case Op_CompareAndSwapP:
case Op_CompareAndSwapN:
case Op_GetAndSetP:
case Op_GetAndSetN: {
Node* adr = n->in(MemNode::Address);
if (opcode == Op_GetAndSetP || opcode == Op_GetAndSetN) {
- const Type* t = _igvn->type(n);
- if (t->make_ptr() != NULL) {
add_local_var_and_edge(n, PointsToNode::NoEscape, adr, NULL);
}
- }
- const Type *adr_type = _igvn->type(adr);
- adr_type = adr_type->make_ptr();
if (adr_type->isa_oopptr() ||
(opcode == Op_StoreP || opcode == Op_StoreN) &&
(adr_type == TypeRawPtr::NOTNULL &&
adr->in(AddPNode::Address)->is_Proj() &&
adr->in(AddPNode::Address)->in(0)->is_Allocate())) {
--- 653,674 ----
case Op_CompareAndSwapP:
case Op_CompareAndSwapN:
case Op_GetAndSetP:
case Op_GetAndSetN: {
Node* adr = n->in(MemNode::Address);
+ const Type *adr_type = _igvn->type(adr);
+ adr_type = adr_type->make_ptr();
+ #ifdef ASSERT
+ if (adr_type == NULL) {
+ n->dump(1);
+ assert(adr_type != NULL, "dead node should not be on list");
+ break;
+ }
+ #endif
if (opcode == Op_GetAndSetP || opcode == Op_GetAndSetN) {
add_local_var_and_edge(n, PointsToNode::NoEscape, adr, NULL);
}
if (adr_type->isa_oopptr() ||
(opcode == Op_StoreP || opcode == Op_StoreN) &&
(adr_type == TypeRawPtr::NOTNULL &&
adr->in(AddPNode::Address)->is_Proj() &&
adr->in(AddPNode::Address)->in(0)->is_Allocate())) {
*** 1780,1792 ****
jobj2 != NULL && jobj2 != phantom_obj &&
jobj1->ideal_node()->is_Con() &&
jobj2->ideal_node()->is_Con()) {
// Klass or String constants compare. Need to be careful with
// compressed pointers - compare types of ConN and ConP instead of nodes.
! const Type* t1 = jobj1->ideal_node()->bottom_type()->make_ptr();
! const Type* t2 = jobj2->ideal_node()->bottom_type()->make_ptr();
! assert(t1 != NULL && t2 != NULL, "sanity");
if (t1->make_ptr() == t2->make_ptr()) {
return _pcmp_eq;
} else {
return _pcmp_neq;
}
--- 1787,1798 ----
jobj2 != NULL && jobj2 != phantom_obj &&
jobj1->ideal_node()->is_Con() &&
jobj2->ideal_node()->is_Con()) {
// Klass or String constants compare. Need to be careful with
// compressed pointers - compare types of ConN and ConP instead of nodes.
! const Type* t1 = jobj1->ideal_node()->get_ptr_type();
! const Type* t2 = jobj2->ideal_node()->get_ptr_type();
if (t1->make_ptr() == t2->make_ptr()) {
return _pcmp_eq;
} else {
return _pcmp_neq;
}