< prev index next >

src/hotspot/share/opto/valuetypenode.cpp

Print this page

        

*** 743,753 **** // Search for multiple allocations of this value type // and try to replace them by dominating allocations. void ValueTypeNode::remove_redundant_allocations(PhaseIterGVN* igvn, PhaseIdealLoop* phase) { assert(EliminateAllocations, "allocation elimination should be enabled"); - Node_List dead_allocations; // Search for allocations of this value type for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) { AllocateNode* alloc = fast_out(i)->isa_Allocate(); if (alloc != NULL && alloc->result_cast() != NULL && alloc->in(AllocateNode::ValueNode) == this) { Node* res_dom = NULL; --- 743,752 ----
*** 771,785 **** } if (res_dom != NULL) { // Move users to dominating allocation Node* res = alloc->result_cast(); igvn->replace_node(res, res_dom); ! // The dominated allocation is now dead, remove the ! // value type node connection and adjust the iterator. ! dead_allocations.push(alloc); ! igvn->replace_input_of(alloc, AllocateNode::ValueNode, NULL); ! --i; --imax; #ifdef ASSERT if (PrintEliminateAllocations) { tty->print("++++ Eliminated: %d Allocate ", alloc->_idx); dump_spec(tty); tty->cr(); --- 770,782 ---- } if (res_dom != NULL) { // Move users to dominating allocation Node* res = alloc->result_cast(); igvn->replace_node(res, res_dom); ! // The result of the dominated allocation is now unused and will be ! // removed later in AllocateNode::Ideal() to not confuse loop opts. ! igvn->record_for_igvn(alloc); #ifdef ASSERT if (PrintEliminateAllocations) { tty->print("++++ Eliminated: %d Allocate ", alloc->_idx); dump_spec(tty); tty->cr();
*** 787,834 **** #endif } } } - // Remove dead value type allocations by replacing the projection nodes - for (uint i = 0; i < dead_allocations.size(); ++i) { - CallProjections projs; - AllocateNode* alloc = dead_allocations.at(i)->as_Allocate(); - alloc->extract_projections(&projs, true); - // Use lazy_replace to avoid corrupting the dominator tree of PhaseIdealLoop - phase->lazy_replace(projs.fallthrough_catchproj, alloc->in(TypeFunc::Control)); - phase->lazy_replace(projs.fallthrough_memproj, alloc->in(TypeFunc::Memory)); - phase->lazy_replace(projs.catchall_memproj, phase->C->top()); - phase->lazy_replace(projs.fallthrough_ioproj, alloc->in(TypeFunc::I_O)); - phase->lazy_replace(projs.catchall_ioproj, phase->C->top()); - phase->lazy_replace(projs.catchall_catchproj, phase->C->top()); - phase->lazy_replace(projs.resproj, phase->C->top()); - } - // Process users for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) { Node* out = fast_out(i); if (out->isa_ValueType() != NULL) { // Recursively process value type users out->as_ValueType()->remove_redundant_allocations(igvn, phase); - --i; --imax; } else if (out->isa_Allocate() != NULL) { ! // Unlink AllocateNode assert(out->in(AllocateNode::ValueNode) == this, "should be linked"); - igvn->replace_input_of(out, AllocateNode::ValueNode, NULL); - --i; --imax; } else { #ifdef ASSERT // The value type should not have any other users at this time out->dump(); assert(false, "unexpected user of value type"); #endif } } - - // Should be dead now - igvn->remove_dead_node(this); } ValueTypePtrNode* ValueTypePtrNode::make_from_value_type(PhaseGVN& gvn, ValueTypeNode* vt) { ValueTypePtrNode* vtptr = new ValueTypePtrNode(vt->value_klass(), vt->get_oop()); for (uint i = Oop+1; i < vt->req(); i++) { --- 784,810 ---- #endif } } } // Process users for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) { Node* out = fast_out(i); if (out->isa_ValueType() != NULL) { // Recursively process value type users out->as_ValueType()->remove_redundant_allocations(igvn, phase); } else if (out->isa_Allocate() != NULL) { ! // Allocate users should be linked assert(out->in(AllocateNode::ValueNode) == this, "should be linked"); } else { #ifdef ASSERT // The value type should not have any other users at this time out->dump(); assert(false, "unexpected user of value type"); #endif } } } ValueTypePtrNode* ValueTypePtrNode::make_from_value_type(PhaseGVN& gvn, ValueTypeNode* vt) { ValueTypePtrNode* vtptr = new ValueTypePtrNode(vt->value_klass(), vt->get_oop()); for (uint i = Oop+1; i < vt->req(); i++) {
< prev index next >