diff src/share/vm/opto/connode.cpp @ 124:b130b98db9cf

6689060: Escape Analysis does not work with Compressed Oops Summary: 64-bits VM crashes with -XX:+AggresiveOpts (Escape Analysis + Compressed Oops) Reviewed-by: never, sgoldman
author kvn
date Wed, 23 Apr 2008 11:20:36 -0700
parents ba764ed4b6f2
children 885ed790ecf0
line wrap: on
line diff
--- a/src/share/vm/opto/connode.cpp	Thu Apr 17 07:16:03 2008 -0700
+++ b/src/share/vm/opto/connode.cpp	Wed Apr 23 11:20:36 2008 -0700
@@ -563,6 +563,26 @@
   return this;
 }
 
+const Type *DecodeNNode::Value( PhaseTransform *phase ) const {
+  if (phase->type( in(1) ) == TypeNarrowOop::NULL_PTR) {
+    return TypePtr::NULL_PTR;
+  }
+  return bottom_type();
+}
+
+Node* DecodeNNode::decode(PhaseGVN* phase, Node* value) {
+  if (value->Opcode() == Op_EncodeP) {
+    // (DecodeN (EncodeP p)) -> p
+    return value->in(1);
+  }
+  const Type* newtype = value->bottom_type();
+  if (newtype == TypeNarrowOop::NULL_PTR) {
+    return phase->transform(new (phase->C, 1) ConPNode(TypePtr::NULL_PTR));
+  } else {
+    return phase->transform(new (phase->C, 2) DecodeNNode(value, newtype->is_narrowoop()->make_oopptr()));
+  }
+}
+
 Node* EncodePNode::Identity(PhaseTransform* phase) {
   const Type *t = phase->type( in(1) );
   if( t == Type::TOP ) return in(1);
@@ -574,14 +594,26 @@
   return this;
 }
 
+const Type *EncodePNode::Value( PhaseTransform *phase ) const {
+  if (phase->type( in(1) ) == TypePtr::NULL_PTR) {
+    return TypeNarrowOop::NULL_PTR;
+  }
+  return bottom_type();
+}
 
 Node* EncodePNode::encode(PhaseGVN* phase, Node* value) {
+  if (value->Opcode() == Op_DecodeN) {
+    // (EncodeP (DecodeN p)) -> p
+    return value->in(1);
+  }
   const Type* newtype = value->bottom_type();
   if (newtype == TypePtr::NULL_PTR) {
     return phase->transform(new (phase->C, 1) ConNNode(TypeNarrowOop::NULL_PTR));
+  } else if (newtype->isa_oopptr()) {
+    return phase->transform(new (phase->C, 2) EncodePNode(value, newtype->is_oopptr()->make_narrowoop()));
   } else {
-    return phase->transform(new (phase->C, 2) EncodePNode(value,
-                                                          newtype->is_oopptr()->make_narrowoop()));
+    ShouldNotReachHere();
+    return NULL; // to make C++ compiler happy.
   }
 }