comparison src/share/vm/opto/escape.cpp @ 2459:55973726c600

6992789: assert(phi->_idx >= nodes_size()) failed: only new Phi per instance memory slice Summary: Swap checks: check for regular memory slice first and keep input phi. Reviewed-by: never
author kvn
date Wed, 06 Apr 2011 17:32:09 -0700
parents 3763ca6579b7
children 66b0e2371912
comparison
equal deleted inserted replaced
2458:98c560260039 2459:55973726c600
592 return true; 592 return true;
593 } 593 }
594 594
595 // 595 //
596 // Create a new version of orig_phi if necessary. Returns either the newly 596 // Create a new version of orig_phi if necessary. Returns either the newly
597 // created phi or an existing phi. Sets create_new to indicate wheter a new 597 // created phi or an existing phi. Sets create_new to indicate whether a new
598 // phi was created. Cache the last newly created phi in the node map. 598 // phi was created. Cache the last newly created phi in the node map.
599 // 599 //
600 PhiNode *ConnectionGraph::create_split_phi(PhiNode *orig_phi, int alias_idx, GrowableArray<PhiNode *> &orig_phi_worklist, PhaseGVN *igvn, bool &new_created) { 600 PhiNode *ConnectionGraph::create_split_phi(PhiNode *orig_phi, int alias_idx, GrowableArray<PhiNode *> &orig_phi_worklist, PhaseGVN *igvn, bool &new_created) {
601 Compile *C = _compile; 601 Compile *C = _compile;
602 new_created = false; 602 new_created = false;
647 new_created = true; 647 new_created = true;
648 return result; 648 return result;
649 } 649 }
650 650
651 // 651 //
652 // Return a new version of Memory Phi "orig_phi" with the inputs having the 652 // Return a new version of Memory Phi "orig_phi" with the inputs having the
653 // specified alias index. 653 // specified alias index.
654 // 654 //
655 PhiNode *ConnectionGraph::split_memory_phi(PhiNode *orig_phi, int alias_idx, GrowableArray<PhiNode *> &orig_phi_worklist, PhaseGVN *igvn) { 655 PhiNode *ConnectionGraph::split_memory_phi(PhiNode *orig_phi, int alias_idx, GrowableArray<PhiNode *> &orig_phi_worklist, PhaseGVN *igvn) {
656 656
657 assert(alias_idx != Compile::AliasIdxBot, "can't split out bottom memory"); 657 assert(alias_idx != Compile::AliasIdxBot, "can't split out bottom memory");
826 prev = result; 826 prev = result;
827 if (result == start_mem) 827 if (result == start_mem)
828 break; // hit one of our sentinels 828 break; // hit one of our sentinels
829 if (result->is_Mem()) { 829 if (result->is_Mem()) {
830 const Type *at = phase->type(result->in(MemNode::Address)); 830 const Type *at = phase->type(result->in(MemNode::Address));
831 if (at != Type::TOP) { 831 if (at == Type::TOP)
832 assert (at->isa_ptr() != NULL, "pointer type required."); 832 break; // Dead
833 int idx = C->get_alias_index(at->is_ptr()); 833 assert (at->isa_ptr() != NULL, "pointer type required.");
834 if (idx == alias_idx) 834 int idx = C->get_alias_index(at->is_ptr());
835 break; 835 if (idx == alias_idx)
836 break; // Found
837 if (!is_instance && (at->isa_oopptr() == NULL ||
838 !at->is_oopptr()->is_known_instance())) {
839 break; // Do not skip store to general memory slice.
836 } 840 }
837 result = result->in(MemNode::Memory); 841 result = result->in(MemNode::Memory);
838 } 842 }
839 if (!is_instance) 843 if (!is_instance)
840 continue; // don't search further for non-instance types 844 continue; // don't search further for non-instance types
900 } 904 }
901 if (result->is_Phi()) { 905 if (result->is_Phi()) {
902 PhiNode *mphi = result->as_Phi(); 906 PhiNode *mphi = result->as_Phi();
903 assert(mphi->bottom_type() == Type::MEMORY, "memory phi required"); 907 assert(mphi->bottom_type() == Type::MEMORY, "memory phi required");
904 const TypePtr *t = mphi->adr_type(); 908 const TypePtr *t = mphi->adr_type();
905 if (C->get_alias_index(t) != alias_idx) { 909 if (!is_instance) {
906 // Create a new Phi with the specified alias index type.
907 result = split_memory_phi(mphi, alias_idx, orig_phis, phase);
908 } else if (!is_instance) {
909 // Push all non-instance Phis on the orig_phis worklist to update inputs 910 // Push all non-instance Phis on the orig_phis worklist to update inputs
910 // during Phase 4 if needed. 911 // during Phase 4 if needed.
911 orig_phis.append_if_missing(mphi); 912 orig_phis.append_if_missing(mphi);
913 } else if (C->get_alias_index(t) != alias_idx) {
914 // Create a new Phi with the specified alias index type.
915 result = split_memory_phi(mphi, alias_idx, orig_phis, phase);
912 } 916 }
913 } 917 }
914 // the result is either MemNode, PhiNode, InitializeNode. 918 // the result is either MemNode, PhiNode, InitializeNode.
915 return result; 919 return result;
916 } 920 }