< prev index next >

src/hotspot/share/opto/macro.cpp

Print this page

1832     transform_later(rawmem);
1833   }
1834 }
1835 
1836 // Helper for PhaseMacroExpand::expand_allocate_common.
1837 // Initializes the newly-allocated storage.
1838 Node*
1839 PhaseMacroExpand::initialize_object(AllocateNode* alloc,
1840                                     Node* control, Node* rawmem, Node* object,
1841                                     Node* klass_node, Node* length,
1842                                     Node* size_in_bytes) {
1843   InitializeNode* init = alloc->initialization();
1844   // Store the klass & mark bits
1845   Node* mark_node = alloc->make_ideal_mark(&_igvn, control, rawmem);
1846   if (!mark_node->is_Con()) {
1847     transform_later(mark_node);
1848   }
1849   rawmem = make_store_raw(control, rawmem, object, oopDesc::mark_offset_in_bytes(), mark_node, TypeX_X->basic_type());
1850 
1851   if (!UseCompactObjectHeaders) {
1852     rawmem = make_store_raw(control, rawmem, object, oopDesc::klass_offset_in_bytes(), klass_node, T_METADATA);
1853   }
1854   int header_size = alloc->minimum_header_size();  // conservatively small
1855 
1856   // Array length
1857   if (length != nullptr) {         // Arrays need length field
1858     rawmem = make_store_raw(control, rawmem, object, arrayOopDesc::length_offset_in_bytes(), length, T_INT);
1859     // conservatively small header size:
1860     header_size = arrayOopDesc::base_offset_in_bytes(T_BYTE);
1861     if (_igvn.type(klass_node)->isa_aryklassptr()) {   // we know the exact header size in most cases:
1862       BasicType elem = _igvn.type(klass_node)->is_klassptr()->as_instance_type()->isa_aryptr()->elem()->array_element_basic_type();
1863       if (is_reference_type(elem, true)) {
1864         elem = T_OBJECT;
1865       }
1866       header_size = Klass::layout_helper_header_size(Klass::array_layout_helper(elem));
1867     }
1868   }
1869 
1870   // Clear the object body, if necessary.
1871   if (init == nullptr) {
1872     // The init has somehow disappeared; be cautious and clear everything.

2457   Node* superklass = check->in(SubTypeCheckNode::SuperKlass);
2458   assert(bol->is_Bool() && bol->as_Bool()->_test._test == BoolTest::ne, "unexpected bool node");
2459 
2460   for (DUIterator_Last imin, i = bol->last_outs(imin); i >= imin; --i) {
2461     Node* iff = bol->last_out(i);
2462     assert(iff->is_If(), "where's the if?");
2463 
2464     if (iff->in(0)->is_top()) {
2465       _igvn.replace_input_of(iff, 1, C->top());
2466       continue;
2467     }
2468 
2469     IfTrueNode* iftrue = iff->as_If()->true_proj();
2470     IfFalseNode* iffalse = iff->as_If()->false_proj();
2471     Node* ctrl = iff->in(0);
2472 
2473     Node* subklass = nullptr;
2474     if (_igvn.type(obj_or_subklass)->isa_klassptr()) {
2475       subklass = obj_or_subklass;
2476     } else {
2477       Node* k_adr = basic_plus_adr(obj_or_subklass, oopDesc::klass_offset_in_bytes());
2478       subklass = _igvn.transform(LoadKlassNode::make(_igvn, C->immutable_memory(), k_adr, TypeInstPtr::KLASS));
2479     }
2480 
2481     Node* not_subtype_ctrl = Phase::gen_subtype_check(subklass, superklass, &ctrl, nullptr, _igvn, check->method(), check->bci());
2482 
2483     _igvn.replace_input_of(iff, 0, C->top());
2484     _igvn.replace_node(iftrue, not_subtype_ctrl);
2485     _igvn.replace_node(iffalse, ctrl);
2486   }
2487   _igvn.replace_node(check, C->top());
2488 }
2489 
2490 // Perform refining of strip mined loop nodes in the macro nodes list.
2491 void PhaseMacroExpand::refine_strip_mined_loop_macro_nodes() {
2492    for (int i = C->macro_count(); i > 0; i--) {
2493     Node* n = C->macro_node(i - 1);
2494     if (n->is_OuterStripMinedLoop()) {
2495       n->as_OuterStripMinedLoop()->adjust_strip_mined_loop(&_igvn);
2496     }
2497   }

1832     transform_later(rawmem);
1833   }
1834 }
1835 
1836 // Helper for PhaseMacroExpand::expand_allocate_common.
1837 // Initializes the newly-allocated storage.
1838 Node*
1839 PhaseMacroExpand::initialize_object(AllocateNode* alloc,
1840                                     Node* control, Node* rawmem, Node* object,
1841                                     Node* klass_node, Node* length,
1842                                     Node* size_in_bytes) {
1843   InitializeNode* init = alloc->initialization();
1844   // Store the klass & mark bits
1845   Node* mark_node = alloc->make_ideal_mark(&_igvn, control, rawmem);
1846   if (!mark_node->is_Con()) {
1847     transform_later(mark_node);
1848   }
1849   rawmem = make_store_raw(control, rawmem, object, oopDesc::mark_offset_in_bytes(), mark_node, TypeX_X->basic_type());
1850 
1851   if (!UseCompactObjectHeaders) {
1852     rawmem = make_store_raw(control, rawmem, object, Type::klass_offset(), klass_node, T_METADATA);
1853   }
1854   int header_size = alloc->minimum_header_size();  // conservatively small
1855 
1856   // Array length
1857   if (length != nullptr) {         // Arrays need length field
1858     rawmem = make_store_raw(control, rawmem, object, arrayOopDesc::length_offset_in_bytes(), length, T_INT);
1859     // conservatively small header size:
1860     header_size = arrayOopDesc::base_offset_in_bytes(T_BYTE);
1861     if (_igvn.type(klass_node)->isa_aryklassptr()) {   // we know the exact header size in most cases:
1862       BasicType elem = _igvn.type(klass_node)->is_klassptr()->as_instance_type()->isa_aryptr()->elem()->array_element_basic_type();
1863       if (is_reference_type(elem, true)) {
1864         elem = T_OBJECT;
1865       }
1866       header_size = Klass::layout_helper_header_size(Klass::array_layout_helper(elem));
1867     }
1868   }
1869 
1870   // Clear the object body, if necessary.
1871   if (init == nullptr) {
1872     // The init has somehow disappeared; be cautious and clear everything.

2457   Node* superklass = check->in(SubTypeCheckNode::SuperKlass);
2458   assert(bol->is_Bool() && bol->as_Bool()->_test._test == BoolTest::ne, "unexpected bool node");
2459 
2460   for (DUIterator_Last imin, i = bol->last_outs(imin); i >= imin; --i) {
2461     Node* iff = bol->last_out(i);
2462     assert(iff->is_If(), "where's the if?");
2463 
2464     if (iff->in(0)->is_top()) {
2465       _igvn.replace_input_of(iff, 1, C->top());
2466       continue;
2467     }
2468 
2469     IfTrueNode* iftrue = iff->as_If()->true_proj();
2470     IfFalseNode* iffalse = iff->as_If()->false_proj();
2471     Node* ctrl = iff->in(0);
2472 
2473     Node* subklass = nullptr;
2474     if (_igvn.type(obj_or_subklass)->isa_klassptr()) {
2475       subklass = obj_or_subklass;
2476     } else {
2477       Node* k_adr = basic_plus_adr(obj_or_subklass, Type::klass_offset());
2478       subklass = _igvn.transform(LoadKlassNode::make(_igvn, C->immutable_memory(), k_adr, TypeInstPtr::KLASS));
2479     }
2480 
2481     Node* not_subtype_ctrl = Phase::gen_subtype_check(subklass, superklass, &ctrl, nullptr, _igvn, check->method(), check->bci());
2482 
2483     _igvn.replace_input_of(iff, 0, C->top());
2484     _igvn.replace_node(iftrue, not_subtype_ctrl);
2485     _igvn.replace_node(iffalse, ctrl);
2486   }
2487   _igvn.replace_node(check, C->top());
2488 }
2489 
2490 // Perform refining of strip mined loop nodes in the macro nodes list.
2491 void PhaseMacroExpand::refine_strip_mined_loop_macro_nodes() {
2492    for (int i = C->macro_count(); i > 0; i--) {
2493     Node* n = C->macro_node(i - 1);
2494     if (n->is_OuterStripMinedLoop()) {
2495       n->as_OuterStripMinedLoop()->adjust_strip_mined_loop(&_igvn);
2496     }
2497   }
< prev index next >