< prev index next >

src/share/vm/opto/valuetypenode.cpp

Print this page

        

@@ -41,14 +41,14 @@
   // Create a new ValueTypeNode with default values
   ValueTypeNode* vt = ValueTypeNode::make(gvn, vk);
   for (uint i = 0; i < vt->field_count(); ++i) {
     ciType* field_type = vt->field_type(i);
     Node* value = NULL;
-    if (field_type->is_primitive_type()) {
-      value = gvn.zerocon(field_type->basic_type());
-    } else {
+    if (field_type->is_valuetype()) {
       value = ValueTypeNode::make_default(gvn, field_type->as_value_klass());
+    } else {
+      value = gvn.zerocon(field_type->basic_type());
     }
     vt->set_field_value(i, value);
   }
   return gvn.transform(vt);
 }

@@ -108,11 +108,12 @@
         } else {
           ciField* field = holder->get_field_by_offset(offset, false);
           adr_type = gvn.C->alias_type(field)->adr_type();
         }
         Node* adr = gvn.transform(new AddPNode(base, ptr, gvn.MakeConX(offset)));
-        value = LoadNode::make(gvn, NULL, mem, adr, adr_type, Type::get_const_type(ftype), ftype->basic_type(), MemNode::unordered);
+        BasicType bt = type2field[ftype->basic_type()];
+        value = LoadNode::make(gvn, NULL, mem, adr, adr_type, Type::get_const_type(ftype), bt, MemNode::unordered);
       }
     }
     set_field_value(i, gvn.transform(value));
   }
 }

@@ -141,11 +142,20 @@
       } else {
         ciField* field = holder->get_field_by_offset(offset, false);
         adr_type = kit->C->alias_type(field)->adr_type();
       }
       Node* adr = kit->basic_plus_adr(base, ptr, offset);
-      kit->store_to_memory(kit->control(), adr, value, field_type(i)->basic_type(), adr_type, MemNode::unordered);
+      BasicType bt = type2field[field_type(i)->basic_type()];
+      if (is_java_primitive(bt)) {
+        kit->store_to_memory(kit->control(), adr, value, bt, adr_type, MemNode::unordered);
+      } else {
+        const TypeOopPtr* ft = TypeOopPtr::make_from_klass(field_type(i)->as_klass());
+        assert(adr->bottom_type()->is_ptr_to_narrowoop() == UseCompressedOops, "inconsistent");
+        bool is_array = base_type->isa_aryptr() != NULL;
+        kit->store_oop(kit->control(), base, adr, adr_type, value, ft, bt, is_array, MemNode::unordered);
+      }
+
     }
   }
 }
 
 Node* ValueTypeNode::store_to_memory(GraphKit* kit) {

@@ -168,26 +178,20 @@
   PhiNode* io  = new PhiNode(region, Type::ABIO);
   PhiNode* mem = new PhiNode(region, Type::MEMORY, TypePtr::BOTTOM);
 
   // Oop is non-NULL, use it
   region->init_req(1, kit->control());
-  // Fixme if we cast oop to not null we fail if the control path is not folded
-  // castnode.cpp:69: #  assert(ft == Type::TOP) failed: special case #3
-  //oop   ->init_req(1, not_null_oop);
-  oop   ->init_req(1, in_oop);
+  oop   ->init_req(1, not_null_oop);
   io    ->init_req(1, kit->i_o());
   mem   ->init_req(1, kit->merged_memory());
 
   // Oop is NULL, allocate value type
   kit->set_control(null_ctl);
   kit->kill_dead_locals();
   ciValueKlass* vk = value_klass();
   Node* klass_node = kit->makecon(TypeKlassPtr::make(vk));
   Node* alloc_oop  = kit->new_instance(klass_node);
-  AllocateNode* alloc = AllocateNode::Ideal_allocation(alloc_oop, &kit->gvn());
-  // TODO enable/fix this
-  // alloc->initialization()->set_complete_with_arraycopy();
   // Write field values to memory
   store_values(kit, alloc_oop, alloc_oop, vk);
   region->init_req(2, kit->control());
   oop   ->init_req(2, alloc_oop);
   io    ->init_req(2, kit->i_o());
< prev index next >