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

Split Split Close
Expand all
Collapse all
          --- old/src/share/vm/opto/node.cpp
          +++ new/src/share/vm/opto/node.cpp
↓ open down ↓ 1375 lines elided ↑ open up ↑
1376 1376  const TypeLong* Node::find_long_type() const {
1377 1377    if (this->is_Type()) {
1378 1378      return this->as_Type()->type()->isa_long();
1379 1379    } else if (this->is_Con()) {
1380 1380      assert(is_Mach(), "should be ConNode(TypeNode) or else a MachNode");
1381 1381      return this->bottom_type()->isa_long();
1382 1382    }
1383 1383    return NULL;
1384 1384  }
1385 1385  
     1386 +
     1387 +/**
     1388 + * Return a ptr type for nodes which should have it.
     1389 + */
     1390 +const TypePtr* Node::get_ptr_type() const {
     1391 +  const TypePtr* tp = this->bottom_type()->make_ptr();
     1392 +#ifdef ASSERT
     1393 +  if (tp == NULL) {
     1394 +    this->dump(1);
     1395 +    assert((tp != NULL), "unexpected node type");
     1396 +  }
     1397 +#endif
     1398 +  return tp;
     1399 +}
     1400 +
1386 1401  // Get a double constant from a ConstNode.
1387 1402  // Returns the constant if it is a double ConstNode
1388 1403  jdouble Node::getd() const {
1389 1404    assert( Opcode() == Op_ConD, "" );
1390 1405    return ((ConDNode*)this)->type()->is_double_constant()->getd();
1391 1406  }
1392 1407  
1393 1408  // Get a float constant from a ConstNode.
1394 1409  // Returns the constant if it is a float ConstNode
1395 1410  jfloat Node::getf() const {
↓ open down ↓ 692 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX