diff src/share/vm/opto/cfgnode.cpp @ 6848:8e47bac5643a

7054512: Compress class pointers after perm gen removal Summary: support of compress class pointers in the compilers. Reviewed-by: kvn, twisti
author roland
date Tue, 09 Oct 2012 10:11:38 +0200
parents e626685e9f6c
children ad5dd04754ee
line wrap: on
line diff
--- a/src/share/vm/opto/cfgnode.cpp	Mon Oct 08 17:04:00 2012 -0700
+++ b/src/share/vm/opto/cfgnode.cpp	Tue Oct 09 10:11:38 2012 +0200
@@ -1386,7 +1386,7 @@
     Node *n = phi->in(i);
     if( !n ) return NULL;
     if( phase->type(n) == Type::TOP ) return NULL;
-    if( n->Opcode() == Op_ConP || n->Opcode() == Op_ConN )
+    if( n->Opcode() == Op_ConP || n->Opcode() == Op_ConN || n->Opcode() == Op_ConNKlass )
       break;
   }
   if( i >= phi->req() )         // Only split for constants
@@ -1875,17 +1875,19 @@
   }
 
 #ifdef _LP64
-  // Push DecodeN down through phi.
+  // Push DecodeN/DecodeNKlass down through phi.
   // The rest of phi graph will transform by split EncodeP node though phis up.
-  if (UseCompressedOops && can_reshape && progress == NULL) {
+  if ((UseCompressedOops || UseCompressedKlassPointers) && can_reshape && progress == NULL) {
     bool may_push = true;
     bool has_decodeN = false;
+    bool is_decodeN = false;
     for (uint i=1; i<req(); ++i) {// For all paths in
       Node *ii = in(i);
-      if (ii->is_DecodeN() && ii->bottom_type() == bottom_type()) {
+      if (ii->is_DecodeNarrowPtr() && ii->bottom_type() == bottom_type()) {
         // Do optimization if a non dead path exist.
         if (ii->in(1)->bottom_type() != Type::TOP) {
           has_decodeN = true;
+          is_decodeN = ii->is_DecodeN();
         }
       } else if (!ii->is_Phi()) {
         may_push = false;
@@ -1895,13 +1897,18 @@
     if (has_decodeN && may_push) {
       PhaseIterGVN *igvn = phase->is_IterGVN();
       // Make narrow type for new phi.
-      const Type* narrow_t = TypeNarrowOop::make(this->bottom_type()->is_ptr());
+      const Type* narrow_t;
+      if (is_decodeN) {
+        narrow_t = TypeNarrowOop::make(this->bottom_type()->is_ptr());
+      } else {
+        narrow_t = TypeNarrowKlass::make(this->bottom_type()->is_ptr());
+      }
       PhiNode* new_phi = new (phase->C) PhiNode(r, narrow_t);
       uint orig_cnt = req();
       for (uint i=1; i<req(); ++i) {// For all paths in
         Node *ii = in(i);
         Node* new_ii = NULL;
-        if (ii->is_DecodeN()) {
+        if (ii->is_DecodeNarrowPtr()) {
           assert(ii->bottom_type() == bottom_type(), "sanity");
           new_ii = ii->in(1);
         } else {
@@ -1909,14 +1916,22 @@
           if (ii->as_Phi() == this) {
             new_ii = new_phi;
           } else {
-            new_ii = new (phase->C) EncodePNode(ii, narrow_t);
+            if (is_decodeN) {
+              new_ii = new (phase->C) EncodePNode(ii, narrow_t);
+            } else {
+              new_ii = new (phase->C) EncodePKlassNode(ii, narrow_t);
+            }
             igvn->register_new_node_with_optimizer(new_ii);
           }
         }
         new_phi->set_req(i, new_ii);
       }
       igvn->register_new_node_with_optimizer(new_phi, this);
-      progress = new (phase->C) DecodeNNode(new_phi, bottom_type());
+      if (is_decodeN) {
+        progress = new (phase->C) DecodeNNode(new_phi, bottom_type());
+      } else {
+        progress = new (phase->C) DecodeNKlassNode(new_phi, bottom_type());
+      }
     }
   }
 #endif