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