1.1 --- a/src/share/vm/opto/connode.cpp Wed Apr 23 06:35:28 2008 -0400 1.2 +++ b/src/share/vm/opto/connode.cpp Mon Apr 28 08:08:12 2008 -0700 1.3 @@ -563,6 +563,26 @@ 1.4 return this; 1.5 } 1.6 1.7 +const Type *DecodeNNode::Value( PhaseTransform *phase ) const { 1.8 + if (phase->type( in(1) ) == TypeNarrowOop::NULL_PTR) { 1.9 + return TypePtr::NULL_PTR; 1.10 + } 1.11 + return bottom_type(); 1.12 +} 1.13 + 1.14 +Node* DecodeNNode::decode(PhaseGVN* phase, Node* value) { 1.15 + if (value->Opcode() == Op_EncodeP) { 1.16 + // (DecodeN (EncodeP p)) -> p 1.17 + return value->in(1); 1.18 + } 1.19 + const Type* newtype = value->bottom_type(); 1.20 + if (newtype == TypeNarrowOop::NULL_PTR) { 1.21 + return phase->transform(new (phase->C, 1) ConPNode(TypePtr::NULL_PTR)); 1.22 + } else { 1.23 + return phase->transform(new (phase->C, 2) DecodeNNode(value, newtype->is_narrowoop()->make_oopptr())); 1.24 + } 1.25 +} 1.26 + 1.27 Node* EncodePNode::Identity(PhaseTransform* phase) { 1.28 const Type *t = phase->type( in(1) ); 1.29 if( t == Type::TOP ) return in(1); 1.30 @@ -574,14 +594,26 @@ 1.31 return this; 1.32 } 1.33 1.34 +const Type *EncodePNode::Value( PhaseTransform *phase ) const { 1.35 + if (phase->type( in(1) ) == TypePtr::NULL_PTR) { 1.36 + return TypeNarrowOop::NULL_PTR; 1.37 + } 1.38 + return bottom_type(); 1.39 +} 1.40 1.41 Node* EncodePNode::encode(PhaseGVN* phase, Node* value) { 1.42 + if (value->Opcode() == Op_DecodeN) { 1.43 + // (EncodeP (DecodeN p)) -> p 1.44 + return value->in(1); 1.45 + } 1.46 const Type* newtype = value->bottom_type(); 1.47 if (newtype == TypePtr::NULL_PTR) { 1.48 return phase->transform(new (phase->C, 1) ConNNode(TypeNarrowOop::NULL_PTR)); 1.49 + } else if (newtype->isa_oopptr()) { 1.50 + return phase->transform(new (phase->C, 2) EncodePNode(value, newtype->is_oopptr()->make_narrowoop())); 1.51 } else { 1.52 - return phase->transform(new (phase->C, 2) EncodePNode(value, 1.53 - newtype->is_oopptr()->make_narrowoop())); 1.54 + ShouldNotReachHere(); 1.55 + return NULL; // to make C++ compiler happy. 1.56 } 1.57 } 1.58