hotspot/src/share/vm/opto/memnode.cpp
changeset 13969 d2a189b83b87
parent 13895 f6dfe4123709
child 13974 791cba24758f
--- a/hotspot/src/share/vm/opto/memnode.cpp	Mon Oct 08 17:04:00 2012 -0700
+++ b/hotspot/src/share/vm/opto/memnode.cpp	Tue Oct 09 10:11:38 2012 +0200
@@ -714,10 +714,12 @@
         continue;
 
       case Op_DecodeN:         // No change to NULL-ness, so peek thru
+      case Op_DecodeNKlass:
         adr = adr->in(1);
         continue;
 
       case Op_EncodeP:
+      case Op_EncodePKlass:
         // EncodeP node's control edge could be set by this method
         // when EncodeP node depends on CastPP node.
         //
@@ -794,6 +796,7 @@
       case Op_LoadNKlass:       // Loading from within a klass
       case Op_ConP:             // Loading from a klass
       case Op_ConN:             // Loading from a klass
+      case Op_ConNKlass:        // Loading from a klass
       case Op_CreateEx:         // Sucking up the guts of an exception oop
       case Op_Con:              // Reading from TLS
       case Op_CMoveP:           // CMoveP is pinned
@@ -900,7 +903,7 @@
     } else
 #endif
     {
-      assert(!adr->bottom_type()->is_ptr_to_narrowoop(), "should have got back a narrow oop");
+      assert(!adr->bottom_type()->is_ptr_to_narrowoop() && !adr->bottom_type()->is_ptr_to_narrowklass(), "should have got back a narrow oop");
       return new (C) LoadPNode(ctl, mem, adr, adr_type, rt->is_oopptr());
     }
   }
@@ -1894,13 +1897,13 @@
   const TypePtr *adr_type = adr->bottom_type()->isa_ptr();
   assert(adr_type != NULL, "expecting TypeKlassPtr");
 #ifdef _LP64
-  if (adr_type->is_ptr_to_narrowoop()) {
+  if (adr_type->is_ptr_to_narrowklass()) {
     assert(UseCompressedKlassPointers, "no compressed klasses");
-    Node* load_klass = gvn.transform(new (C) LoadNKlassNode(ctl, mem, adr, at, tk->make_narrowoop()));
-    return new (C) DecodeNNode(load_klass, load_klass->bottom_type()->make_ptr());
+    Node* load_klass = gvn.transform(new (C) LoadNKlassNode(ctl, mem, adr, at, tk->make_narrowklass()));
+    return new (C) DecodeNKlassNode(load_klass, load_klass->bottom_type()->make_ptr());
   }
 #endif
-  assert(!adr_type->is_ptr_to_narrowoop(), "should have got back a narrow oop");
+  assert(!adr_type->is_ptr_to_narrowklass() && !adr_type->is_ptr_to_narrowoop(), "should have got back a narrow oop");
   return new (C) LoadKlassNode(ctl, mem, adr, at, tk);
 }
 
@@ -2110,7 +2113,7 @@
   if (t == Type::TOP)
     return t;
 
-  return t->make_narrowoop();
+  return t->make_narrowklass();
 }
 
 //------------------------------Identity---------------------------------------
@@ -2121,9 +2124,10 @@
 
   const Type *t = phase->type( x );
   if( t == Type::TOP ) return x;
-  if( t->isa_narrowoop()) return x;
-
-  return phase->transform(new (phase->C) EncodePNode(x, t->make_narrowoop()));
+  if( t->isa_narrowklass()) return x;
+  assert (!t->isa_narrowoop(), "no narrow oop here");
+
+  return phase->transform(new (phase->C) EncodePKlassNode(x, t->make_narrowklass()));
 }
 
 //------------------------------Value-----------------------------------------
@@ -2228,12 +2232,15 @@
   case T_ADDRESS:
   case T_OBJECT:
 #ifdef _LP64
-    if (adr->bottom_type()->is_ptr_to_narrowoop() ||
-        (UseCompressedKlassPointers && val->bottom_type()->isa_klassptr() &&
-         adr->bottom_type()->isa_rawptr())) {
+    if (adr->bottom_type()->is_ptr_to_narrowoop()) {
       val = gvn.transform(new (C) EncodePNode(val, val->bottom_type()->make_narrowoop()));
       return new (C) StoreNNode(ctl, mem, adr, adr_type, val);
-    } else
+    } else if (adr->bottom_type()->is_ptr_to_narrowklass() ||
+               (UseCompressedKlassPointers && val->bottom_type()->isa_klassptr() &&
+                adr->bottom_type()->isa_rawptr())) {
+      val = gvn.transform(new (C) EncodePKlassNode(val, val->bottom_type()->make_narrowklass()));
+      return new (C) StoreNKlassNode(ctl, mem, adr, adr_type, val);
+    }
 #endif
     {
       return new (C) StorePNode(ctl, mem, adr, adr_type, val);