< prev index next >

src/hotspot/share/opto/memnode.cpp

Print this page

        

@@ -1110,16 +1110,29 @@
   Node* addr = in(Address);
   intptr_t offset;
   Node* base = AddPNode::Ideal_base_and_offset(addr, phase, offset);
   if (base != NULL && base->is_ValueTypePtr()) {
     Node* value = base->as_ValueTypePtr()->field_value_by_offset((int)offset, true);
-    if (bottom_type()->isa_narrowoop()) {
+    if (value->is_ValueType()) {
+      // Non-flattened value type field
+      ValueTypeNode* vt = value->as_ValueType();
+      if (vt->is_allocated(phase)) {
+        value = vt->get_oop();
+      } else {
+        // Not yet allocated, bail out
+        value = NULL;
+      }
+    }
+    if (value != NULL) {
+      if (Opcode() == Op_LoadN) {
+        // Encode oop value if we are loading a narrow oop
       assert(!phase->type(value)->isa_narrowoop(), "should already be decoded");
       value = phase->transform(new EncodePNode(value, bottom_type()));
     }
     return value;
   }
+  }
 
   // If the previous store-maker is the right kind of Store, and the store is
   // to the same address, then we are equal to the value stored.
   Node* mem = in(Memory);
   Node* value = can_see_stored_value(mem, phase);
< prev index next >