25 #include "precompiled.hpp"
26 #include "opto/narrowptrnode.hpp"
27 #include "opto/phaseX.hpp"
28
29 Node* DecodeNNode::Identity(PhaseGVN* phase) {
30 const Type *t = phase->type( in(1) );
31 if( t == Type::TOP ) return in(1);
32
33 if (in(1)->is_EncodeP()) {
34 // (DecodeN (EncodeP p)) -> p
35 return in(1)->in(1);
36 }
37 return this;
38 }
39
40 const Type* DecodeNNode::Value(PhaseGVN* phase) const {
41 const Type *t = phase->type( in(1) );
42 if (t == Type::TOP) return Type::TOP;
43 if (t == TypeNarrowOop::NULL_PTR) return TypePtr::NULL_PTR;
44
45 assert(t->isa_narrowoop(), "only narrowoop here");
46 return t->make_ptr();
47 }
48
49 Node* EncodePNode::Identity(PhaseGVN* phase) {
50 const Type *t = phase->type( in(1) );
51 if( t == Type::TOP ) return in(1);
52
53 if (in(1)->is_DecodeN()) {
54 // (EncodeP (DecodeN p)) -> p
55 return in(1)->in(1);
56 }
57 return this;
58 }
59
60 const Type* EncodePNode::Value(PhaseGVN* phase) const {
61 const Type *t = phase->type( in(1) );
62 if (t == Type::TOP) return Type::TOP;
63 if (t == TypePtr::NULL_PTR) return TypeNarrowOop::NULL_PTR;
64
65 assert(t->isa_oop_ptr(), "only oopptr here");
|
25 #include "precompiled.hpp"
26 #include "opto/narrowptrnode.hpp"
27 #include "opto/phaseX.hpp"
28
29 Node* DecodeNNode::Identity(PhaseGVN* phase) {
30 const Type *t = phase->type( in(1) );
31 if( t == Type::TOP ) return in(1);
32
33 if (in(1)->is_EncodeP()) {
34 // (DecodeN (EncodeP p)) -> p
35 return in(1)->in(1);
36 }
37 return this;
38 }
39
40 const Type* DecodeNNode::Value(PhaseGVN* phase) const {
41 const Type *t = phase->type( in(1) );
42 if (t == Type::TOP) return Type::TOP;
43 if (t == TypeNarrowOop::NULL_PTR) return TypePtr::NULL_PTR;
44
45 assert(t->isa_narrowoop(), "only narrowoop here");
46 return t->make_ptr();
47 }
48
49 Node* EncodePNode::Identity(PhaseGVN* phase) {
50 const Type *t = phase->type( in(1) );
51 if( t == Type::TOP ) return in(1);
52
53 if (in(1)->is_DecodeN()) {
54 // (EncodeP (DecodeN p)) -> p
55 return in(1)->in(1);
56 }
57 return this;
58 }
59
60 const Type* EncodePNode::Value(PhaseGVN* phase) const {
61 const Type *t = phase->type( in(1) );
62 if (t == Type::TOP) return Type::TOP;
63 if (t == TypePtr::NULL_PTR) return TypeNarrowOop::NULL_PTR;
64
65 assert(t->isa_oop_ptr(), "only oopptr here");
|