diff src/share/vm/opto/connode.cpp @ 113:ba764ed4b6f2

6420645: Create a vm that uses compressed oops for up to 32gb heapsizes Summary: Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
author coleenp
date Sun, 13 Apr 2008 17:43:42 -0400
parents f34d9da7acb2
children b130b98db9cf
line wrap: on
line diff
--- a/src/share/vm/opto/connode.cpp	Fri Apr 11 09:56:35 2008 -0400
+++ b/src/share/vm/opto/connode.cpp	Sun Apr 13 17:43:42 2008 -0400
@@ -35,6 +35,7 @@
 
 //------------------------------make-------------------------------------------
 ConNode *ConNode::make( Compile* C, const Type *t ) {
+  if (t->isa_narrowoop()) return new (C, 1) ConNNode( t->is_narrowoop() );
   switch( t->basic_type() ) {
   case T_INT:       return new (C, 1) ConINode( t->is_int() );
   case T_ARRAY:     return new (C, 1) ConPNode( t->is_aryptr() );
@@ -461,7 +462,8 @@
     possible_alias = n->is_Phi() ||
         opc == Op_CheckCastPP ||
         opc == Op_StorePConditional ||
-        opc == Op_CompareAndSwapP;
+        opc == Op_CompareAndSwapP ||
+        opc == Op_CompareAndSwapN;
   }
   return possible_alias;
 }
@@ -549,6 +551,41 @@
   return (in(0) && remove_dead_region(phase, can_reshape)) ? this : NULL;
 }
 
+
+Node* DecodeNNode::Identity(PhaseTransform* phase) {
+  const Type *t = phase->type( in(1) );
+  if( t == Type::TOP ) return in(1);
+
+  if (in(1)->Opcode() == Op_EncodeP) {
+    // (DecodeN (EncodeP p)) -> p
+    return in(1)->in(1);
+  }
+  return this;
+}
+
+Node* EncodePNode::Identity(PhaseTransform* phase) {
+  const Type *t = phase->type( in(1) );
+  if( t == Type::TOP ) return in(1);
+
+  if (in(1)->Opcode() == Op_DecodeN) {
+    // (EncodeP (DecodeN p)) -> p
+    return in(1)->in(1);
+  }
+  return this;
+}
+
+
+Node* EncodePNode::encode(PhaseGVN* phase, Node* value) {
+  const Type* newtype = value->bottom_type();
+  if (newtype == TypePtr::NULL_PTR) {
+    return phase->transform(new (phase->C, 1) ConNNode(TypeNarrowOop::NULL_PTR));
+  } else {
+    return phase->transform(new (phase->C, 2) EncodePNode(value,
+                                                          newtype->is_oopptr()->make_narrowoop()));
+  }
+}
+
+
 //=============================================================================
 //------------------------------Identity---------------------------------------
 Node *Conv2BNode::Identity( PhaseTransform *phase ) {