< prev index next >

src/hotspot/share/opto/macro.cpp

Print this page

1660     rawmem = new ProjNode(call, TypeFunc::Memory);
1661     transform_later(rawmem);
1662   }
1663 }
1664 
1665 // Helper for PhaseMacroExpand::expand_allocate_common.
1666 // Initializes the newly-allocated storage.
1667 Node*
1668 PhaseMacroExpand::initialize_object(AllocateNode* alloc,
1669                                     Node* control, Node* rawmem, Node* object,
1670                                     Node* klass_node, Node* length,
1671                                     Node* size_in_bytes) {
1672   InitializeNode* init = alloc->initialization();
1673   // Store the klass & mark bits
1674   Node* mark_node = alloc->make_ideal_mark(&_igvn, object, control, rawmem);
1675   if (!mark_node->is_Con()) {
1676     transform_later(mark_node);
1677   }
1678   rawmem = make_store(control, rawmem, object, oopDesc::mark_offset_in_bytes(), mark_node, TypeX_X->basic_type());
1679 
1680   rawmem = make_store(control, rawmem, object, oopDesc::klass_offset_in_bytes(), klass_node, T_METADATA);



1681   int header_size = alloc->minimum_header_size();  // conservatively small
1682 
1683   // Array length
1684   if (length != nullptr) {         // Arrays need length field
1685     rawmem = make_store(control, rawmem, object, arrayOopDesc::length_offset_in_bytes(), length, T_INT);
1686     // conservatively small header size:
1687     header_size = arrayOopDesc::base_offset_in_bytes(T_BYTE);
1688     ciKlass* k = _igvn.type(klass_node)->is_klassptr()->klass();
1689     if (k->is_array_klass())    // we know the exact header size in most cases:
1690       header_size = Klass::layout_helper_header_size(k->layout_helper());
1691   }
1692 
1693   // Clear the object body, if necessary.
1694   if (init == nullptr) {
1695     // The init has somehow disappeared; be cautious and clear everything.
1696     //
1697     // This can happen if a node is allocated but an uncommon trap occurs
1698     // immediately.  In this case, the Initialize gets associated with the
1699     // trap, and may be placed in a different (outer) loop, if the Allocate
1700     // is in a loop.  If (this is rare) the inner loop gets unrolled, then

1660     rawmem = new ProjNode(call, TypeFunc::Memory);
1661     transform_later(rawmem);
1662   }
1663 }
1664 
1665 // Helper for PhaseMacroExpand::expand_allocate_common.
1666 // Initializes the newly-allocated storage.
1667 Node*
1668 PhaseMacroExpand::initialize_object(AllocateNode* alloc,
1669                                     Node* control, Node* rawmem, Node* object,
1670                                     Node* klass_node, Node* length,
1671                                     Node* size_in_bytes) {
1672   InitializeNode* init = alloc->initialization();
1673   // Store the klass & mark bits
1674   Node* mark_node = alloc->make_ideal_mark(&_igvn, object, control, rawmem);
1675   if (!mark_node->is_Con()) {
1676     transform_later(mark_node);
1677   }
1678   rawmem = make_store(control, rawmem, object, oopDesc::mark_offset_in_bytes(), mark_node, TypeX_X->basic_type());
1679 
1680   if (!UseCompactObjectHeaders) {
1681     rawmem = make_store(control, rawmem, object, oopDesc::klass_offset_in_bytes(), klass_node, T_METADATA);
1682   }
1683 
1684   int header_size = alloc->minimum_header_size();  // conservatively small
1685 
1686   // Array length
1687   if (length != nullptr) {         // Arrays need length field
1688     rawmem = make_store(control, rawmem, object, arrayOopDesc::length_offset_in_bytes(), length, T_INT);
1689     // conservatively small header size:
1690     header_size = arrayOopDesc::base_offset_in_bytes(T_BYTE);
1691     ciKlass* k = _igvn.type(klass_node)->is_klassptr()->klass();
1692     if (k->is_array_klass())    // we know the exact header size in most cases:
1693       header_size = Klass::layout_helper_header_size(k->layout_helper());
1694   }
1695 
1696   // Clear the object body, if necessary.
1697   if (init == nullptr) {
1698     // The init has somehow disappeared; be cautious and clear everything.
1699     //
1700     // This can happen if a node is allocated but an uncommon trap occurs
1701     // immediately.  In this case, the Initialize gets associated with the
1702     // trap, and may be placed in a different (outer) loop, if the Allocate
1703     // is in a loop.  If (this is rare) the inner loop gets unrolled, then
< prev index next >