448 // If not converting int->oop, throw away cast after constant propagation
449 Node *CastPPNode::Ideal_DU_postCCP( PhaseCCP *ccp ) {
450 const Type *t = ccp->type(in(1));
451 if (!t->isa_oop_ptr() || ((in(1)->is_DecodeN()) && Matcher::gen_narrow_oop_implicit_null_checks())) {
452 return NULL; // do not transform raw pointers or narrow oops
453 }
454 return ConstraintCastNode::Ideal_DU_postCCP(ccp);
455 }
456
457
458
459 //=============================================================================
460 //------------------------------Identity---------------------------------------
461 // If input is already higher or equal to cast type, then this is an identity.
462 Node *CheckCastPPNode::Identity( PhaseTransform *phase ) {
463 // Toned down to rescue meeting at a Phi 3 different oops all implementing
464 // the same interface. CompileTheWorld starting at 502, kd12rc1.zip.
465 return (phase->type(in(1)) == phase->type(this)) ? in(1) : this;
466 }
467
468 // Determine whether "n" is a node which can cause an alias of one of its inputs. Node types
469 // which can create aliases are: CheckCastPP, Phi, and any store (if there is also a load from
470 // the location.)
471 // Note: this checks for aliases created in this compilation, not ones which may
472 // be potentially created at call sites.
473 static bool can_cause_alias(Node *n, PhaseTransform *phase) {
474 bool possible_alias = false;
475
476 if (n->is_Store()) {
477 possible_alias = !n->as_Store()->value_never_loaded(phase);
478 } else {
479 int opc = n->Opcode();
480 possible_alias = n->is_Phi() ||
481 opc == Op_CheckCastPP ||
482 opc == Op_StorePConditional ||
483 opc == Op_CompareAndSwapP ||
484 opc == Op_CompareAndSwapN ||
485 opc == Op_GetAndSetP ||
486 opc == Op_GetAndSetN;
487 }
488 return possible_alias;
489 }
490
491 //------------------------------Value------------------------------------------
492 // Take 'join' of input and cast-up type, unless working with an Interface
493 const Type *CheckCastPPNode::Value( PhaseTransform *phase ) const {
494 if( in(0) && phase->type(in(0)) == Type::TOP ) return Type::TOP;
495
496 const Type *inn = phase->type(in(1));
497 if( inn == Type::TOP ) return Type::TOP; // No information yet
498
499 const TypePtr *in_type = inn->isa_ptr();
500 const TypePtr *my_type = _type->isa_ptr();
501 const Type *result = _type;
502 if( in_type != NULL && my_type != NULL ) {
503 TypePtr::PTR in_ptr = in_type->ptr();
504 if( in_ptr == TypePtr::Null ) {
505 result = in_type;
506 } else if( in_ptr == TypePtr::Constant ) {
507 // Casting a constant oop to an interface?
508 // (i.e., a String to a Comparable?)
509 // Then return the interface.
510 const TypeOopPtr *jptr = my_type->isa_oopptr();
|
448 // If not converting int->oop, throw away cast after constant propagation
449 Node *CastPPNode::Ideal_DU_postCCP( PhaseCCP *ccp ) {
450 const Type *t = ccp->type(in(1));
451 if (!t->isa_oop_ptr() || ((in(1)->is_DecodeN()) && Matcher::gen_narrow_oop_implicit_null_checks())) {
452 return NULL; // do not transform raw pointers or narrow oops
453 }
454 return ConstraintCastNode::Ideal_DU_postCCP(ccp);
455 }
456
457
458
459 //=============================================================================
460 //------------------------------Identity---------------------------------------
461 // If input is already higher or equal to cast type, then this is an identity.
462 Node *CheckCastPPNode::Identity( PhaseTransform *phase ) {
463 // Toned down to rescue meeting at a Phi 3 different oops all implementing
464 // the same interface. CompileTheWorld starting at 502, kd12rc1.zip.
465 return (phase->type(in(1)) == phase->type(this)) ? in(1) : this;
466 }
467
468 //------------------------------Value------------------------------------------
469 // Take 'join' of input and cast-up type, unless working with an Interface
470 const Type *CheckCastPPNode::Value( PhaseTransform *phase ) const {
471 if( in(0) && phase->type(in(0)) == Type::TOP ) return Type::TOP;
472
473 const Type *inn = phase->type(in(1));
474 if( inn == Type::TOP ) return Type::TOP; // No information yet
475
476 const TypePtr *in_type = inn->isa_ptr();
477 const TypePtr *my_type = _type->isa_ptr();
478 const Type *result = _type;
479 if( in_type != NULL && my_type != NULL ) {
480 TypePtr::PTR in_ptr = in_type->ptr();
481 if( in_ptr == TypePtr::Null ) {
482 result = in_type;
483 } else if( in_ptr == TypePtr::Constant ) {
484 // Casting a constant oop to an interface?
485 // (i.e., a String to a Comparable?)
486 // Then return the interface.
487 const TypeOopPtr *jptr = my_type->isa_oopptr();
|