< prev index next >

src/hotspot/share/opto/callnode.cpp

Print this page
@@ -1615,12 +1615,18 @@
      _is_allocation_MemBar_redundant = true;
    }
  }
  Node *AllocateNode::make_ideal_mark(PhaseGVN *phase, Node* obj, Node* control, Node* mem) {
    Node* mark_node = nullptr;
-   // For now only enable fast locking for non-array types
-   mark_node = phase->MakeConX(markWord::prototype().value());
+   if (UseCompactObjectHeaders) {
+     Node* klass_node = in(AllocateNode::KlassNode);
+     Node* proto_adr = phase->transform(new AddPNode(klass_node, klass_node, phase->MakeConX(in_bytes(Klass::prototype_header_offset()))));
+     mark_node = LoadNode::make(*phase, control, mem, proto_adr, TypeRawPtr::BOTTOM, TypeX_X, TypeX_X->basic_type(), MemNode::unordered);
+   } else {
+     // For now only enable fast locking for non-array types
+     mark_node = phase->MakeConX(markWord::prototype().value());
+   }
    return mark_node;
  }
  
  // Retrieve the length from the AllocateArrayNode. Narrow the type with a
  // CastII, if appropriate.  If we are not allowed to create new nodes, and
< prev index next >