comparison src/share/vm/opto/escape.cpp @ 10279:70120f47d403

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: twisti
author kvn
date Thu, 09 May 2013 17:28:04 -0700
parents 6f3fd5150b67
children 1da5d70655e9
comparison
equal deleted inserted replaced
10278:6f3fd5150b67 10279:70120f47d403
482 case Op_CompareAndSwapP: 482 case Op_CompareAndSwapP:
483 case Op_CompareAndSwapN: { 483 case Op_CompareAndSwapN: {
484 Node* adr = n->in(MemNode::Address); 484 Node* adr = n->in(MemNode::Address);
485 const Type *adr_type = igvn->type(adr); 485 const Type *adr_type = igvn->type(adr);
486 adr_type = adr_type->make_ptr(); 486 adr_type = adr_type->make_ptr();
487 if (adr_type == NULL) {
488 break; // skip dead nodes
489 }
487 if (adr_type->isa_oopptr() || 490 if (adr_type->isa_oopptr() ||
488 (opcode == Op_StoreP || opcode == Op_StoreN || opcode == Op_StoreNKlass) && 491 (opcode == Op_StoreP || opcode == Op_StoreN || opcode == Op_StoreNKlass) &&
489 (adr_type == TypeRawPtr::NOTNULL && 492 (adr_type == TypeRawPtr::NOTNULL &&
490 adr->in(AddPNode::Address)->is_Proj() && 493 adr->in(AddPNode::Address)->is_Proj() &&
491 adr->in(AddPNode::Address)->in(0)->is_Allocate())) { 494 adr->in(AddPNode::Address)->in(0)->is_Allocate())) {
674 case Op_CompareAndSwapP: 677 case Op_CompareAndSwapP:
675 case Op_CompareAndSwapN: 678 case Op_CompareAndSwapN:
676 case Op_GetAndSetP: 679 case Op_GetAndSetP:
677 case Op_GetAndSetN: { 680 case Op_GetAndSetN: {
678 Node* adr = n->in(MemNode::Address); 681 Node* adr = n->in(MemNode::Address);
679 if (opcode == Op_GetAndSetP || opcode == Op_GetAndSetN) {
680 const Type* t = _igvn->type(n);
681 if (t->make_ptr() != NULL) {
682 add_local_var_and_edge(n, PointsToNode::NoEscape, adr, NULL);
683 }
684 }
685 const Type *adr_type = _igvn->type(adr); 682 const Type *adr_type = _igvn->type(adr);
686 adr_type = adr_type->make_ptr(); 683 adr_type = adr_type->make_ptr();
684 #ifdef ASSERT
685 if (adr_type == NULL) {
686 n->dump(1);
687 assert(adr_type != NULL, "dead node should not be on list");
688 break;
689 }
690 #endif
691 if (opcode == Op_GetAndSetP || opcode == Op_GetAndSetN) {
692 add_local_var_and_edge(n, PointsToNode::NoEscape, adr, NULL);
693 }
687 if (adr_type->isa_oopptr() || 694 if (adr_type->isa_oopptr() ||
688 (opcode == Op_StoreP || opcode == Op_StoreN || opcode == Op_StoreNKlass) && 695 (opcode == Op_StoreP || opcode == Op_StoreN || opcode == Op_StoreNKlass) &&
689 (adr_type == TypeRawPtr::NOTNULL && 696 (adr_type == TypeRawPtr::NOTNULL &&
690 adr->in(AddPNode::Address)->is_Proj() && 697 adr->in(AddPNode::Address)->is_Proj() &&
691 adr->in(AddPNode::Address)->in(0)->is_Allocate())) { 698 adr->in(AddPNode::Address)->in(0)->is_Allocate())) {
1811 jobj2 != NULL && jobj2 != phantom_obj && 1818 jobj2 != NULL && jobj2 != phantom_obj &&
1812 jobj1->ideal_node()->is_Con() && 1819 jobj1->ideal_node()->is_Con() &&
1813 jobj2->ideal_node()->is_Con()) { 1820 jobj2->ideal_node()->is_Con()) {
1814 // Klass or String constants compare. Need to be careful with 1821 // Klass or String constants compare. Need to be careful with
1815 // compressed pointers - compare types of ConN and ConP instead of nodes. 1822 // compressed pointers - compare types of ConN and ConP instead of nodes.
1816 const Type* t1 = jobj1->ideal_node()->bottom_type()->make_ptr(); 1823 const Type* t1 = jobj1->ideal_node()->get_ptr_type();
1817 const Type* t2 = jobj2->ideal_node()->bottom_type()->make_ptr(); 1824 const Type* t2 = jobj2->ideal_node()->get_ptr_type();
1818 assert(t1 != NULL && t2 != NULL, "sanity");
1819 if (t1->make_ptr() == t2->make_ptr()) { 1825 if (t1->make_ptr() == t2->make_ptr()) {
1820 return _pcmp_eq; 1826 return _pcmp_eq;
1821 } else { 1827 } else {
1822 return _pcmp_neq; 1828 return _pcmp_neq;
1823 } 1829 }