1796 if (length != NULL) { // Arrays need length field
1797 rawmem = make_store(control, rawmem, object, arrayOopDesc::length_offset_in_bytes(), length, T_INT);
1798 // conservatively small header size:
1799 header_size = arrayOopDesc::base_offset_in_bytes(T_BYTE);
1800 ciKlass* k = _igvn.type(klass_node)->is_klassptr()->klass();
1801 if (k->is_array_klass()) // we know the exact header size in most cases:
1802 header_size = Klass::layout_helper_header_size(k->layout_helper());
1803 }
1804
1805 // Clear the object body, if necessary.
1806 if (init == NULL) {
1807 // The init has somehow disappeared; be cautious and clear everything.
1808 //
1809 // This can happen if a node is allocated but an uncommon trap occurs
1810 // immediately. In this case, the Initialize gets associated with the
1811 // trap, and may be placed in a different (outer) loop, if the Allocate
1812 // is in a loop. If (this is rare) the inner loop gets unrolled, then
1813 // there can be two Allocates to one Initialize. The answer in all these
1814 // edge cases is safety first. It is always safe to clear immediately
1815 // within an Allocate, and then (maybe or maybe not) clear some more later.
1816 if (!ZeroTLAB)
1817 rawmem = ClearArrayNode::clear_memory(control, rawmem, object,
1818 header_size, size_in_bytes,
1819 &_igvn);
1820 } else {
1821 if (!init->is_complete()) {
1822 // Try to win by zeroing only what the init does not store.
1823 // We can also try to do some peephole optimizations,
1824 // such as combining some adjacent subword stores.
1825 rawmem = init->complete_stores(control, rawmem, object,
1826 header_size, size_in_bytes, &_igvn);
1827 }
1828 // We have no more use for this link, since the AllocateNode goes away:
1829 init->set_req(InitializeNode::RawAddress, top());
1830 // (If we keep the link, it just confuses the register allocator,
1831 // who thinks he sees a real use of the address by the membar.)
1832 }
1833
1834 return rawmem;
1835 }
1836
1837 // Generate prefetch instructions for next allocations.
1838 Node* PhaseMacroExpand::prefetch_allocation(Node* i_o, Node*& needgc_false,
1839 Node*& contended_phi_rawmem,
|
1796 if (length != NULL) { // Arrays need length field
1797 rawmem = make_store(control, rawmem, object, arrayOopDesc::length_offset_in_bytes(), length, T_INT);
1798 // conservatively small header size:
1799 header_size = arrayOopDesc::base_offset_in_bytes(T_BYTE);
1800 ciKlass* k = _igvn.type(klass_node)->is_klassptr()->klass();
1801 if (k->is_array_klass()) // we know the exact header size in most cases:
1802 header_size = Klass::layout_helper_header_size(k->layout_helper());
1803 }
1804
1805 // Clear the object body, if necessary.
1806 if (init == NULL) {
1807 // The init has somehow disappeared; be cautious and clear everything.
1808 //
1809 // This can happen if a node is allocated but an uncommon trap occurs
1810 // immediately. In this case, the Initialize gets associated with the
1811 // trap, and may be placed in a different (outer) loop, if the Allocate
1812 // is in a loop. If (this is rare) the inner loop gets unrolled, then
1813 // there can be two Allocates to one Initialize. The answer in all these
1814 // edge cases is safety first. It is always safe to clear immediately
1815 // within an Allocate, and then (maybe or maybe not) clear some more later.
1816 if (!(UseTLAB && ZeroTLAB)) {
1817 rawmem = ClearArrayNode::clear_memory(control, rawmem, object,
1818 header_size, size_in_bytes,
1819 &_igvn);
1820 }
1821 } else {
1822 if (!init->is_complete()) {
1823 // Try to win by zeroing only what the init does not store.
1824 // We can also try to do some peephole optimizations,
1825 // such as combining some adjacent subword stores.
1826 rawmem = init->complete_stores(control, rawmem, object,
1827 header_size, size_in_bytes, &_igvn);
1828 }
1829 // We have no more use for this link, since the AllocateNode goes away:
1830 init->set_req(InitializeNode::RawAddress, top());
1831 // (If we keep the link, it just confuses the register allocator,
1832 // who thinks he sees a real use of the address by the membar.)
1833 }
1834
1835 return rawmem;
1836 }
1837
1838 // Generate prefetch instructions for next allocations.
1839 Node* PhaseMacroExpand::prefetch_allocation(Node* i_o, Node*& needgc_false,
1840 Node*& contended_phi_rawmem,
|