576 int phi_alias_idx = C->get_alias_index(orig_phi->adr_type()); |
576 int phi_alias_idx = C->get_alias_index(orig_phi->adr_type()); |
577 // nothing to do if orig_phi is bottom memory or matches alias_idx |
577 // nothing to do if orig_phi is bottom memory or matches alias_idx |
578 if (phi_alias_idx == alias_idx) { |
578 if (phi_alias_idx == alias_idx) { |
579 return orig_phi; |
579 return orig_phi; |
580 } |
580 } |
581 // have we already created a Phi for this alias index? |
581 // Have we recently created a Phi for this alias index? |
582 PhiNode *result = get_map_phi(orig_phi->_idx); |
582 PhiNode *result = get_map_phi(orig_phi->_idx); |
583 if (result != NULL && C->get_alias_index(result->adr_type()) == alias_idx) { |
583 if (result != NULL && C->get_alias_index(result->adr_type()) == alias_idx) { |
584 return result; |
584 return result; |
|
585 } |
|
586 // Previous check may fail when the same wide memory Phi was split into Phis |
|
587 // for different memory slices. Search all Phis for this region. |
|
588 if (result != NULL) { |
|
589 Node* region = orig_phi->in(0); |
|
590 for (DUIterator_Fast imax, i = region->fast_outs(imax); i < imax; i++) { |
|
591 Node* phi = region->fast_out(i); |
|
592 if (phi->is_Phi() && |
|
593 C->get_alias_index(phi->as_Phi()->adr_type()) == alias_idx) { |
|
594 assert(phi->_idx >= nodes_size(), "only new Phi per instance memory slice"); |
|
595 return phi->as_Phi(); |
|
596 } |
|
597 } |
585 } |
598 } |
586 if ((int)C->unique() + 2*NodeLimitFudgeFactor > MaxNodeLimit) { |
599 if ((int)C->unique() + 2*NodeLimitFudgeFactor > MaxNodeLimit) { |
587 if (C->do_escape_analysis() == true && !C->failing()) { |
600 if (C->do_escape_analysis() == true && !C->failing()) { |
588 // Retry compilation without escape analysis. |
601 // Retry compilation without escape analysis. |
589 // If this is the first failure, the sentinel string will "stick" |
602 // If this is the first failure, the sentinel string will "stick" |
593 return NULL; |
606 return NULL; |
594 } |
607 } |
595 orig_phi_worklist.append_if_missing(orig_phi); |
608 orig_phi_worklist.append_if_missing(orig_phi); |
596 const TypePtr *atype = C->get_adr_type(alias_idx); |
609 const TypePtr *atype = C->get_adr_type(alias_idx); |
597 result = PhiNode::make(orig_phi->in(0), NULL, Type::MEMORY, atype); |
610 result = PhiNode::make(orig_phi->in(0), NULL, Type::MEMORY, atype); |
|
611 C->copy_node_notes_to(result, orig_phi); |
598 set_map_phi(orig_phi->_idx, result); |
612 set_map_phi(orig_phi->_idx, result); |
599 igvn->set_type(result, result->bottom_type()); |
613 igvn->set_type(result, result->bottom_type()); |
600 record_for_optimizer(result); |
614 record_for_optimizer(result); |
601 new_created = true; |
615 new_created = true; |
602 return result; |
616 return result; |