1690 transform_later(rawmem);
1691 }
1692 }
1693
1694 // Helper for PhaseMacroExpand::expand_allocate_common.
1695 // Initializes the newly-allocated storage.
1696 Node*
1697 PhaseMacroExpand::initialize_object(AllocateNode* alloc,
1698 Node* control, Node* rawmem, Node* object,
1699 Node* klass_node, Node* length,
1700 Node* size_in_bytes) {
1701 InitializeNode* init = alloc->initialization();
1702 // Store the klass & mark bits
1703 Node* mark_node = alloc->make_ideal_mark(&_igvn, object, control, rawmem);
1704 if (!mark_node->is_Con()) {
1705 transform_later(mark_node);
1706 }
1707 rawmem = make_store(control, rawmem, object, oopDesc::mark_offset_in_bytes(), mark_node, TypeX_X->basic_type());
1708
1709 if (!UseCompactObjectHeaders) {
1710 rawmem = make_store(control, rawmem, object, oopDesc::klass_offset_in_bytes(), klass_node, T_METADATA);
1711 }
1712 int header_size = alloc->minimum_header_size(); // conservatively small
1713
1714 // Array length
1715 if (length != nullptr) { // Arrays need length field
1716 rawmem = make_store(control, rawmem, object, arrayOopDesc::length_offset_in_bytes(), length, T_INT);
1717 // conservatively small header size:
1718 header_size = arrayOopDesc::base_offset_in_bytes(T_BYTE);
1719 if (_igvn.type(klass_node)->isa_aryklassptr()) { // we know the exact header size in most cases:
1720 BasicType elem = _igvn.type(klass_node)->is_klassptr()->as_instance_type()->isa_aryptr()->elem()->array_element_basic_type();
1721 if (is_reference_type(elem, true)) {
1722 elem = T_OBJECT;
1723 }
1724 header_size = Klass::layout_helper_header_size(Klass::array_layout_helper(elem));
1725 }
1726 }
1727
1728 // Clear the object body, if necessary.
1729 if (init == nullptr) {
1730 // The init has somehow disappeared; be cautious and clear everything.
2317 Node* superklass = check->in(SubTypeCheckNode::SuperKlass);
2318 assert(bol->is_Bool() && bol->as_Bool()->_test._test == BoolTest::ne, "unexpected bool node");
2319
2320 for (DUIterator_Last imin, i = bol->last_outs(imin); i >= imin; --i) {
2321 Node* iff = bol->last_out(i);
2322 assert(iff->is_If(), "where's the if?");
2323
2324 if (iff->in(0)->is_top()) {
2325 _igvn.replace_input_of(iff, 1, C->top());
2326 continue;
2327 }
2328
2329 Node* iftrue = iff->as_If()->proj_out(1);
2330 Node* iffalse = iff->as_If()->proj_out(0);
2331 Node* ctrl = iff->in(0);
2332
2333 Node* subklass = nullptr;
2334 if (_igvn.type(obj_or_subklass)->isa_klassptr()) {
2335 subklass = obj_or_subklass;
2336 } else {
2337 Node* k_adr = basic_plus_adr(obj_or_subklass, oopDesc::klass_offset_in_bytes());
2338 subklass = _igvn.transform(LoadKlassNode::make(_igvn, nullptr, C->immutable_memory(), k_adr, TypeInstPtr::KLASS));
2339 }
2340
2341 Node* not_subtype_ctrl = Phase::gen_subtype_check(subklass, superklass, &ctrl, nullptr, _igvn, check->method(), check->bci());
2342
2343 _igvn.replace_input_of(iff, 0, C->top());
2344 _igvn.replace_node(iftrue, not_subtype_ctrl);
2345 _igvn.replace_node(iffalse, ctrl);
2346 }
2347 _igvn.replace_node(check, C->top());
2348 }
2349
2350 //---------------------------eliminate_macro_nodes----------------------
2351 // Eliminate scalar replaced allocations and associated locks.
2352 void PhaseMacroExpand::eliminate_macro_nodes() {
2353 if (C->macro_count() == 0)
2354 return;
2355 NOT_PRODUCT(int membar_before = count_MemBar(C);)
2356
2357 // Before elimination may re-mark (change to Nested or NonEscObj)
|
1690 transform_later(rawmem);
1691 }
1692 }
1693
1694 // Helper for PhaseMacroExpand::expand_allocate_common.
1695 // Initializes the newly-allocated storage.
1696 Node*
1697 PhaseMacroExpand::initialize_object(AllocateNode* alloc,
1698 Node* control, Node* rawmem, Node* object,
1699 Node* klass_node, Node* length,
1700 Node* size_in_bytes) {
1701 InitializeNode* init = alloc->initialization();
1702 // Store the klass & mark bits
1703 Node* mark_node = alloc->make_ideal_mark(&_igvn, object, control, rawmem);
1704 if (!mark_node->is_Con()) {
1705 transform_later(mark_node);
1706 }
1707 rawmem = make_store(control, rawmem, object, oopDesc::mark_offset_in_bytes(), mark_node, TypeX_X->basic_type());
1708
1709 if (!UseCompactObjectHeaders) {
1710 rawmem = make_store(control, rawmem, object, Type::klass_offset(), klass_node, T_METADATA);
1711 }
1712 int header_size = alloc->minimum_header_size(); // conservatively small
1713
1714 // Array length
1715 if (length != nullptr) { // Arrays need length field
1716 rawmem = make_store(control, rawmem, object, arrayOopDesc::length_offset_in_bytes(), length, T_INT);
1717 // conservatively small header size:
1718 header_size = arrayOopDesc::base_offset_in_bytes(T_BYTE);
1719 if (_igvn.type(klass_node)->isa_aryklassptr()) { // we know the exact header size in most cases:
1720 BasicType elem = _igvn.type(klass_node)->is_klassptr()->as_instance_type()->isa_aryptr()->elem()->array_element_basic_type();
1721 if (is_reference_type(elem, true)) {
1722 elem = T_OBJECT;
1723 }
1724 header_size = Klass::layout_helper_header_size(Klass::array_layout_helper(elem));
1725 }
1726 }
1727
1728 // Clear the object body, if necessary.
1729 if (init == nullptr) {
1730 // The init has somehow disappeared; be cautious and clear everything.
2317 Node* superklass = check->in(SubTypeCheckNode::SuperKlass);
2318 assert(bol->is_Bool() && bol->as_Bool()->_test._test == BoolTest::ne, "unexpected bool node");
2319
2320 for (DUIterator_Last imin, i = bol->last_outs(imin); i >= imin; --i) {
2321 Node* iff = bol->last_out(i);
2322 assert(iff->is_If(), "where's the if?");
2323
2324 if (iff->in(0)->is_top()) {
2325 _igvn.replace_input_of(iff, 1, C->top());
2326 continue;
2327 }
2328
2329 Node* iftrue = iff->as_If()->proj_out(1);
2330 Node* iffalse = iff->as_If()->proj_out(0);
2331 Node* ctrl = iff->in(0);
2332
2333 Node* subklass = nullptr;
2334 if (_igvn.type(obj_or_subklass)->isa_klassptr()) {
2335 subklass = obj_or_subklass;
2336 } else {
2337 Node* k_adr = basic_plus_adr(obj_or_subklass, Type::klass_offset());
2338 subklass = _igvn.transform(LoadKlassNode::make(_igvn, nullptr, C->immutable_memory(), k_adr, TypeInstPtr::KLASS));
2339 }
2340
2341 Node* not_subtype_ctrl = Phase::gen_subtype_check(subklass, superklass, &ctrl, nullptr, _igvn, check->method(), check->bci());
2342
2343 _igvn.replace_input_of(iff, 0, C->top());
2344 _igvn.replace_node(iftrue, not_subtype_ctrl);
2345 _igvn.replace_node(iffalse, ctrl);
2346 }
2347 _igvn.replace_node(check, C->top());
2348 }
2349
2350 //---------------------------eliminate_macro_nodes----------------------
2351 // Eliminate scalar replaced allocations and associated locks.
2352 void PhaseMacroExpand::eliminate_macro_nodes() {
2353 if (C->macro_count() == 0)
2354 return;
2355 NOT_PRODUCT(int membar_before = count_MemBar(C);)
2356
2357 // Before elimination may re-mark (change to Nested or NonEscObj)
|