hotspot/src/share/vm/opto/macro.cpp
changeset 371 1aacedc9db7c
parent 360 21d113ecbf6a
child 589 a44a1e70a3e4
child 1374 4c24294029a9
--- a/hotspot/src/share/vm/opto/macro.cpp	Thu Apr 17 07:16:03 2008 -0700
+++ b/hotspot/src/share/vm/opto/macro.cpp	Wed Apr 23 11:20:36 2008 -0700
@@ -584,7 +584,7 @@
 
       const Type *field_type;
       // The next code is taken from Parse::do_get_xxx().
-      if (basic_elem_type == T_OBJECT) {
+      if (basic_elem_type == T_OBJECT || basic_elem_type == T_ARRAY) {
         if (!elem_type->is_loaded()) {
           field_type = TypeInstPtr::BOTTOM;
         } else if (field != NULL && field->is_constant()) {
@@ -597,6 +597,10 @@
         } else {
           field_type = TypeOopPtr::make_from_klass(elem_type->as_klass());
         }
+        if (UseCompressedOops) {
+          field_type = field_type->is_oopptr()->make_narrowoop();
+          basic_elem_type = T_NARROWOOP;
+        }
       } else {
         field_type = Type::get_const_basic_type(basic_elem_type);
       }
@@ -659,6 +663,13 @@
 #endif
         return false;
       }
+      if (UseCompressedOops && field_type->isa_narrowoop()) {
+        // Enable "DecodeN(EncodeP(Allocate)) --> Allocate" transformation
+        // to be able scalar replace the allocation.
+        _igvn.set_delay_transform(false);
+        field_val = DecodeNNode::decode(&_igvn, field_val);
+        _igvn.set_delay_transform(true);
+      }
       sfpt->add_req(field_val);
     }
     JVMState *jvms = sfpt->jvms();