comparison src/share/vm/opto/escape.cpp @ 247:02a35ad4adf8

6723160: Nightly failure: Error: meet not symmetric Summary: Add missing _instance_id settings and other EA fixes. Reviewed-by: rasbold
author kvn
date Wed, 16 Jul 2008 16:04:39 -0700
parents 4a4c365f777d
children b0fe4deeb9fb
comparison
equal deleted inserted replaced
246:9b66e6287f4a 247:02a35ad4adf8
715 } else { 715 } else {
716 break; 716 break;
717 } 717 }
718 } 718 }
719 } 719 }
720 if (is_instance && result->is_Phi()) { 720 if (result->is_Phi()) {
721 PhiNode *mphi = result->as_Phi(); 721 PhiNode *mphi = result->as_Phi();
722 assert(mphi->bottom_type() == Type::MEMORY, "memory phi required"); 722 assert(mphi->bottom_type() == Type::MEMORY, "memory phi required");
723 const TypePtr *t = mphi->adr_type(); 723 const TypePtr *t = mphi->adr_type();
724 if (C->get_alias_index(t) != alias_idx) { 724 if (C->get_alias_index(t) != alias_idx) {
725 // Create a new Phi with the specified alias index type.
725 result = split_memory_phi(mphi, alias_idx, orig_phis, phase); 726 result = split_memory_phi(mphi, alias_idx, orig_phis, phase);
727 } else if (!is_instance) {
728 // Push all non-instance Phis on the orig_phis worklist to update inputs
729 // during Phase 4 if needed.
730 orig_phis.append_if_missing(mphi);
726 } 731 }
727 } 732 }
728 // the result is either MemNode, PhiNode, InitializeNode. 733 // the result is either MemNode, PhiNode, InitializeNode.
729 return result; 734 return result;
730 } 735 }
857 n = alloc->result_cast(); 862 n = alloc->result_cast();
858 if (n == NULL || // No uses accept Initialize or 863 if (n == NULL || // No uses accept Initialize or
859 !n->is_CheckCastPP()) // not unique CheckCastPP. 864 !n->is_CheckCastPP()) // not unique CheckCastPP.
860 continue; 865 continue;
861 // The inline code for Object.clone() casts the allocation result to 866 // The inline code for Object.clone() casts the allocation result to
862 // java.lang.Object and then to the the actual type of the allocated 867 // java.lang.Object and then to the actual type of the allocated
863 // object. Detect this case and use the second cast. 868 // object. Detect this case and use the second cast.
869 // Also detect j.l.reflect.Array.newInstance(jobject, jint) case when
870 // the allocation result is cast to java.lang.Object and then
871 // to the actual Array type.
864 if (alloc->is_Allocate() && n->as_Type()->type() == TypeInstPtr::NOTNULL 872 if (alloc->is_Allocate() && n->as_Type()->type() == TypeInstPtr::NOTNULL
865 && igvn->type(alloc->in(AllocateNode::KlassNode)) != TypeKlassPtr::OBJECT) { 873 && (alloc->is_AllocateArray() ||
874 igvn->type(alloc->in(AllocateNode::KlassNode)) != TypeKlassPtr::OBJECT)) {
866 Node *cast2 = NULL; 875 Node *cast2 = NULL;
867 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { 876 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
868 Node *use = n->fast_out(i); 877 Node *use = n->fast_out(i);
869 if (use->is_CheckCastPP()) { 878 if (use->is_CheckCastPP()) {
870 cast2 = use; 879 cast2 = use;
876 } else { 885 } else {
877 continue; 886 continue;
878 } 887 }
879 } 888 }
880 set_escape_state(n->_idx, es); 889 set_escape_state(n->_idx, es);
881 // in order for an object to be stackallocatable, it must be: 890 // in order for an object to be scalar-replaceable, it must be:
882 // - a direct allocation (not a call returning an object) 891 // - a direct allocation (not a call returning an object)
883 // - non-escaping 892 // - non-escaping
884 // - eligible to be a unique type 893 // - eligible to be a unique type
885 // - not determined to be ineligible by escape analysis 894 // - not determined to be ineligible by escape analysis
886 set_map(alloc->_idx, n); 895 set_map(alloc->_idx, n);
887 set_map(n->_idx, alloc); 896 set_map(n->_idx, alloc);
888 const TypeOopPtr *t = igvn->type(n)->isa_oopptr(); 897 const TypeOopPtr *t = igvn->type(n)->isa_oopptr();
889 if (t == NULL) 898 if (t == NULL)
890 continue; // not a TypeInstPtr 899 continue; // not a TypeInstPtr
891 tinst = t->cast_to_instance_id(ni); 900 tinst = t->cast_to_exactness(true)->is_oopptr()->cast_to_instance_id(ni);
892 igvn->hash_delete(n); 901 igvn->hash_delete(n);
893 igvn->set_type(n, tinst); 902 igvn->set_type(n, tinst);
894 n->raise_bottom_type(tinst); 903 n->raise_bottom_type(tinst);
895 igvn->hash_insert(n); 904 igvn->hash_insert(n);
896 record_for_optimizer(n); 905 record_for_optimizer(n);
1202 // First update the inputs of any non-instance Phi's from 1211 // First update the inputs of any non-instance Phi's from
1203 // which we split out an instance Phi. Note we don't have 1212 // which we split out an instance Phi. Note we don't have
1204 // to recursively process Phi's encounted on the input memory 1213 // to recursively process Phi's encounted on the input memory
1205 // chains as is done in split_memory_phi() since they will 1214 // chains as is done in split_memory_phi() since they will
1206 // also be processed here. 1215 // also be processed here.
1207 while (orig_phis.length() != 0) { 1216 for (int j = 0; j < orig_phis.length(); j++) {
1208 PhiNode *phi = orig_phis.pop(); 1217 PhiNode *phi = orig_phis.at(j);
1209 int alias_idx = _compile->get_alias_index(phi->adr_type()); 1218 int alias_idx = _compile->get_alias_index(phi->adr_type());
1210 igvn->hash_delete(phi); 1219 igvn->hash_delete(phi);
1211 for (uint i = 1; i < phi->req(); i++) { 1220 for (uint i = 1; i < phi->req(); i++) {
1212 Node *mem = phi->in(i); 1221 Node *mem = phi->in(i);
1213 Node *new_mem = find_inst_mem(mem, alias_idx, orig_phis, igvn); 1222 Node *new_mem = find_inst_mem(mem, alias_idx, orig_phis, igvn);