561 return in(1)->in(1); |
561 return in(1)->in(1); |
562 } |
562 } |
563 return this; |
563 return this; |
564 } |
564 } |
565 |
565 |
|
566 const Type *DecodeNNode::Value( PhaseTransform *phase ) const { |
|
567 if (phase->type( in(1) ) == TypeNarrowOop::NULL_PTR) { |
|
568 return TypePtr::NULL_PTR; |
|
569 } |
|
570 return bottom_type(); |
|
571 } |
|
572 |
|
573 Node* DecodeNNode::decode(PhaseGVN* phase, Node* value) { |
|
574 if (value->Opcode() == Op_EncodeP) { |
|
575 // (DecodeN (EncodeP p)) -> p |
|
576 return value->in(1); |
|
577 } |
|
578 const Type* newtype = value->bottom_type(); |
|
579 if (newtype == TypeNarrowOop::NULL_PTR) { |
|
580 return phase->transform(new (phase->C, 1) ConPNode(TypePtr::NULL_PTR)); |
|
581 } else { |
|
582 return phase->transform(new (phase->C, 2) DecodeNNode(value, newtype->is_narrowoop()->make_oopptr())); |
|
583 } |
|
584 } |
|
585 |
566 Node* EncodePNode::Identity(PhaseTransform* phase) { |
586 Node* EncodePNode::Identity(PhaseTransform* phase) { |
567 const Type *t = phase->type( in(1) ); |
587 const Type *t = phase->type( in(1) ); |
568 if( t == Type::TOP ) return in(1); |
588 if( t == Type::TOP ) return in(1); |
569 |
589 |
570 if (in(1)->Opcode() == Op_DecodeN) { |
590 if (in(1)->Opcode() == Op_DecodeN) { |
572 return in(1)->in(1); |
592 return in(1)->in(1); |
573 } |
593 } |
574 return this; |
594 return this; |
575 } |
595 } |
576 |
596 |
|
597 const Type *EncodePNode::Value( PhaseTransform *phase ) const { |
|
598 if (phase->type( in(1) ) == TypePtr::NULL_PTR) { |
|
599 return TypeNarrowOop::NULL_PTR; |
|
600 } |
|
601 return bottom_type(); |
|
602 } |
577 |
603 |
578 Node* EncodePNode::encode(PhaseGVN* phase, Node* value) { |
604 Node* EncodePNode::encode(PhaseGVN* phase, Node* value) { |
|
605 if (value->Opcode() == Op_DecodeN) { |
|
606 // (EncodeP (DecodeN p)) -> p |
|
607 return value->in(1); |
|
608 } |
579 const Type* newtype = value->bottom_type(); |
609 const Type* newtype = value->bottom_type(); |
580 if (newtype == TypePtr::NULL_PTR) { |
610 if (newtype == TypePtr::NULL_PTR) { |
581 return phase->transform(new (phase->C, 1) ConNNode(TypeNarrowOop::NULL_PTR)); |
611 return phase->transform(new (phase->C, 1) ConNNode(TypeNarrowOop::NULL_PTR)); |
|
612 } else if (newtype->isa_oopptr()) { |
|
613 return phase->transform(new (phase->C, 2) EncodePNode(value, newtype->is_oopptr()->make_narrowoop())); |
582 } else { |
614 } else { |
583 return phase->transform(new (phase->C, 2) EncodePNode(value, |
615 ShouldNotReachHere(); |
584 newtype->is_oopptr()->make_narrowoop())); |
616 return NULL; // to make C++ compiler happy. |
585 } |
617 } |
586 } |
618 } |
587 |
619 |
588 |
620 |
589 //============================================================================= |
621 //============================================================================= |