98 Node *prev = NULL; |
98 Node *prev = NULL; |
99 Node *result = mchain; |
99 Node *result = mchain; |
100 while (prev != result) { |
100 while (prev != result) { |
101 prev = result; |
101 prev = result; |
102 if (result == start_mem) |
102 if (result == start_mem) |
103 break; // hit one of our sentinals |
103 break; // hit one of our sentinels |
104 // skip over a call which does not affect this memory slice |
104 // skip over a call which does not affect this memory slice |
105 if (result->is_Proj() && result->as_Proj()->_con == TypeFunc::Memory) { |
105 if (result->is_Proj() && result->as_Proj()->_con == TypeFunc::Memory) { |
106 Node *proj_in = result->in(0); |
106 Node *proj_in = result->in(0); |
107 if (proj_in->is_Allocate() && proj_in->_idx == instance_id) { |
107 if (proj_in->is_Allocate() && proj_in->_idx == instance_id) { |
108 break; // hit one of our sentinals |
108 break; // hit one of our sentinels |
109 } else if (proj_in->is_Call()) { |
109 } else if (proj_in->is_Call()) { |
110 CallNode *call = proj_in->as_Call(); |
110 CallNode *call = proj_in->as_Call(); |
111 if (!call->may_modify(t_adr, phase)) { |
111 if (!call->may_modify(t_adr, phase)) { |
112 result = call->in(TypeFunc::Memory); |
112 result = call->in(TypeFunc::Memory); |
113 } |
113 } |
196 tinst->offset() == Type::OffsetBot) ) { |
196 tinst->offset() == Type::OffsetBot) ) { |
197 // compress paths and change unreachable cycles to TOP |
197 // compress paths and change unreachable cycles to TOP |
198 // If not, we can update the input infinitely along a MergeMem cycle |
198 // If not, we can update the input infinitely along a MergeMem cycle |
199 // Equivalent code in PhiNode::Ideal |
199 // Equivalent code in PhiNode::Ideal |
200 Node* m = phase->transform(mmem); |
200 Node* m = phase->transform(mmem); |
201 // If tranformed to a MergeMem, get the desired slice |
201 // If transformed to a MergeMem, get the desired slice |
202 // Otherwise the returned node represents memory for every slice |
202 // Otherwise the returned node represents memory for every slice |
203 mem = (m->is_MergeMem())? m->as_MergeMem()->memory_at(alias_idx) : m; |
203 mem = (m->is_MergeMem())? m->as_MergeMem()->memory_at(alias_idx) : m; |
204 // Update input if it is progress over what we have now |
204 // Update input if it is progress over what we have now |
205 } |
205 } |
206 return mem; |
206 return mem; |
968 // usually runs first, producing the singleton type of the Con.) |
968 // usually runs first, producing the singleton type of the Con.) |
969 return value; |
969 return value; |
970 } |
970 } |
971 |
971 |
972 // Search for an existing data phi which was generated before for the same |
972 // Search for an existing data phi which was generated before for the same |
973 // instance's field to avoid infinite genertion of phis in a loop. |
973 // instance's field to avoid infinite generation of phis in a loop. |
974 Node *region = mem->in(0); |
974 Node *region = mem->in(0); |
975 if (is_instance_field_load_with_local_phi(region)) { |
975 if (is_instance_field_load_with_local_phi(region)) { |
976 const TypePtr *addr_t = in(MemNode::Address)->bottom_type()->isa_ptr(); |
976 const TypePtr *addr_t = in(MemNode::Address)->bottom_type()->isa_ptr(); |
977 int this_index = phase->C->get_alias_index(addr_t); |
977 int this_index = phase->C->get_alias_index(addr_t); |
978 int this_offset = addr_t->offset(); |
978 int this_offset = addr_t->offset(); |
1252 // Make sure that the type array is big enough for |
1252 // Make sure that the type array is big enough for |
1253 // our new node, even though we may throw the node away. |
1253 // our new node, even though we may throw the node away. |
1254 // (This tweaking with igvn only works because x is a new node.) |
1254 // (This tweaking with igvn only works because x is a new node.) |
1255 igvn->set_type(x, t); |
1255 igvn->set_type(x, t); |
1256 // If x is a TypeNode, capture any more-precise type permanently into Node |
1256 // If x is a TypeNode, capture any more-precise type permanently into Node |
1257 // othewise it will be not updated during igvn->transform since |
1257 // otherwise it will be not updated during igvn->transform since |
1258 // igvn->type(x) is set to x->Value() already. |
1258 // igvn->type(x) is set to x->Value() already. |
1259 x->raise_bottom_type(t); |
1259 x->raise_bottom_type(t); |
1260 Node *y = x->Identity(igvn); |
1260 Node *y = x->Identity(igvn); |
1261 if( y != x ) { |
1261 if( y != x ) { |
1262 wins++; |
1262 wins++; |
2589 // may also be created at that point to represent any required zeroing. |
2589 // may also be created at that point to represent any required zeroing. |
2590 // The InitializeNode is then marked 'complete', prohibiting further |
2590 // The InitializeNode is then marked 'complete', prohibiting further |
2591 // capturing of nearby memory operations. |
2591 // capturing of nearby memory operations. |
2592 // |
2592 // |
2593 // During macro-expansion, all captured initializations which store |
2593 // During macro-expansion, all captured initializations which store |
2594 // constant values of 32 bits or smaller are coalesced (if advantagous) |
2594 // constant values of 32 bits or smaller are coalesced (if advantageous) |
2595 // into larger 'tiles' 32 or 64 bits. This allows an object to be |
2595 // into larger 'tiles' 32 or 64 bits. This allows an object to be |
2596 // initialized in fewer memory operations. Memory words which are |
2596 // initialized in fewer memory operations. Memory words which are |
2597 // covered by neither tiles nor non-constant stores are pre-zeroed |
2597 // covered by neither tiles nor non-constant stores are pre-zeroed |
2598 // by explicit stores of zero. (The code shape happens to do all |
2598 // by explicit stores of zero. (The code shape happens to do all |
2599 // zeroing first, then all other stores, with both sequences occurring |
2599 // zeroing first, then all other stores, with both sequences occurring |
3676 new_mem = (new_base == this || new_base == empty_mem)? empty_mem : new_base; |
3676 new_mem = (new_base == this || new_base == empty_mem)? empty_mem : new_base; |
3677 } |
3677 } |
3678 else if (old_mmem != NULL) { |
3678 else if (old_mmem != NULL) { |
3679 new_mem = old_mmem->memory_at(i); |
3679 new_mem = old_mmem->memory_at(i); |
3680 } |
3680 } |
3681 // else preceeding memory was not a MergeMem |
3681 // else preceding memory was not a MergeMem |
3682 |
3682 |
3683 // replace equivalent phis (unfortunately, they do not GVN together) |
3683 // replace equivalent phis (unfortunately, they do not GVN together) |
3684 if (new_mem != NULL && new_mem != new_base && |
3684 if (new_mem != NULL && new_mem != new_base && |
3685 new_mem->req() == phi_len && new_mem->in(0) == phi_reg) { |
3685 new_mem->req() == phi_len && new_mem->in(0) == phi_reg) { |
3686 if (new_mem->is_Phi()) { |
3686 if (new_mem->is_Phi()) { |