1366 } 1367 1368 // Get a narrow oop constant from a ConNNode. 1369 intptr_t Node::get_narrowcon() const { 1370 assert( Opcode() == Op_ConN, "" ); 1371 return ((ConNNode*)this)->type()->is_narrowoop()->get_con(); 1372 } 1373 1374 // Get a long constant from a ConNode. 1375 // Return a default value if there is no apparent constant here. 1376 const TypeLong* Node::find_long_type() const { 1377 if (this->is_Type()) { 1378 return this->as_Type()->type()->isa_long(); 1379 } else if (this->is_Con()) { 1380 assert(is_Mach(), "should be ConNode(TypeNode) or else a MachNode"); 1381 return this->bottom_type()->isa_long(); 1382 } 1383 return NULL; 1384 } 1385 1386 // Get a double constant from a ConstNode. 1387 // Returns the constant if it is a double ConstNode 1388 jdouble Node::getd() const { 1389 assert( Opcode() == Op_ConD, "" ); 1390 return ((ConDNode*)this)->type()->is_double_constant()->getd(); 1391 } 1392 1393 // Get a float constant from a ConstNode. 1394 // Returns the constant if it is a float ConstNode 1395 jfloat Node::getf() const { 1396 assert( Opcode() == Op_ConF, "" ); 1397 return ((ConFNode*)this)->type()->is_float_constant()->getf(); 1398 } 1399 1400 #ifndef PRODUCT 1401 1402 //----------------------------NotANode---------------------------------------- 1403 // Used in debugging code to avoid walking across dead or uninitialized edges. 1404 static inline bool NotANode(const Node* n) { 1405 if (n == NULL) return true; | 1366 } 1367 1368 // Get a narrow oop constant from a ConNNode. 1369 intptr_t Node::get_narrowcon() const { 1370 assert( Opcode() == Op_ConN, "" ); 1371 return ((ConNNode*)this)->type()->is_narrowoop()->get_con(); 1372 } 1373 1374 // Get a long constant from a ConNode. 1375 // Return a default value if there is no apparent constant here. 1376 const TypeLong* Node::find_long_type() const { 1377 if (this->is_Type()) { 1378 return this->as_Type()->type()->isa_long(); 1379 } else if (this->is_Con()) { 1380 assert(is_Mach(), "should be ConNode(TypeNode) or else a MachNode"); 1381 return this->bottom_type()->isa_long(); 1382 } 1383 return NULL; 1384 } 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 1401 // Get a double constant from a ConstNode. 1402 // Returns the constant if it is a double ConstNode 1403 jdouble Node::getd() const { 1404 assert( Opcode() == Op_ConD, "" ); 1405 return ((ConDNode*)this)->type()->is_double_constant()->getd(); 1406 } 1407 1408 // Get a float constant from a ConstNode. 1409 // Returns the constant if it is a float ConstNode 1410 jfloat Node::getf() const { 1411 assert( Opcode() == Op_ConF, "" ); 1412 return ((ConFNode*)this)->type()->is_float_constant()->getf(); 1413 } 1414 1415 #ifndef PRODUCT 1416 1417 //----------------------------NotANode---------------------------------------- 1418 // Used in debugging code to avoid walking across dead or uninitialized edges. 1419 static inline bool NotANode(const Node* n) { 1420 if (n == NULL) return true; |