1.1 --- a/src/share/vm/opto/escape.cpp Wed Apr 06 16:02:50 2011 -0700 1.2 +++ b/src/share/vm/opto/escape.cpp Wed Apr 06 17:32:09 2011 -0700 1.3 @@ -594,7 +594,7 @@ 1.4 1.5 // 1.6 // Create a new version of orig_phi if necessary. Returns either the newly 1.7 -// created phi or an existing phi. Sets create_new to indicate wheter a new 1.8 +// created phi or an existing phi. Sets create_new to indicate whether a new 1.9 // phi was created. Cache the last newly created phi in the node map. 1.10 // 1.11 PhiNode *ConnectionGraph::create_split_phi(PhiNode *orig_phi, int alias_idx, GrowableArray<PhiNode *> &orig_phi_worklist, PhaseGVN *igvn, bool &new_created) { 1.12 @@ -649,7 +649,7 @@ 1.13 } 1.14 1.15 // 1.16 -// Return a new version of Memory Phi "orig_phi" with the inputs having the 1.17 +// Return a new version of Memory Phi "orig_phi" with the inputs having the 1.18 // specified alias index. 1.19 // 1.20 PhiNode *ConnectionGraph::split_memory_phi(PhiNode *orig_phi, int alias_idx, GrowableArray<PhiNode *> &orig_phi_worklist, PhaseGVN *igvn) { 1.21 @@ -828,11 +828,15 @@ 1.22 break; // hit one of our sentinels 1.23 if (result->is_Mem()) { 1.24 const Type *at = phase->type(result->in(MemNode::Address)); 1.25 - if (at != Type::TOP) { 1.26 - assert (at->isa_ptr() != NULL, "pointer type required."); 1.27 - int idx = C->get_alias_index(at->is_ptr()); 1.28 - if (idx == alias_idx) 1.29 - break; 1.30 + if (at == Type::TOP) 1.31 + break; // Dead 1.32 + assert (at->isa_ptr() != NULL, "pointer type required."); 1.33 + int idx = C->get_alias_index(at->is_ptr()); 1.34 + if (idx == alias_idx) 1.35 + break; // Found 1.36 + if (!is_instance && (at->isa_oopptr() == NULL || 1.37 + !at->is_oopptr()->is_known_instance())) { 1.38 + break; // Do not skip store to general memory slice. 1.39 } 1.40 result = result->in(MemNode::Memory); 1.41 } 1.42 @@ -902,13 +906,13 @@ 1.43 PhiNode *mphi = result->as_Phi(); 1.44 assert(mphi->bottom_type() == Type::MEMORY, "memory phi required"); 1.45 const TypePtr *t = mphi->adr_type(); 1.46 - if (C->get_alias_index(t) != alias_idx) { 1.47 - // Create a new Phi with the specified alias index type. 1.48 - result = split_memory_phi(mphi, alias_idx, orig_phis, phase); 1.49 - } else if (!is_instance) { 1.50 + if (!is_instance) { 1.51 // Push all non-instance Phis on the orig_phis worklist to update inputs 1.52 // during Phase 4 if needed. 1.53 orig_phis.append_if_missing(mphi); 1.54 + } else if (C->get_alias_index(t) != alias_idx) { 1.55 + // Create a new Phi with the specified alias index type. 1.56 + result = split_memory_phi(mphi, alias_idx, orig_phis, phase); 1.57 } 1.58 } 1.59 // the result is either MemNode, PhiNode, InitializeNode.