1.1 --- a/src/share/vm/opto/macro.cpp Tue Dec 08 16:27:21 2009 -0800 1.2 +++ b/src/share/vm/opto/macro.cpp Wed Dec 09 16:40:45 2009 -0800 1.3 @@ -316,6 +316,21 @@ 1.4 assert(adr_idx == Compile::AliasIdxRaw, "address must match or be raw"); 1.5 } 1.6 mem = mem->in(MemNode::Memory); 1.7 + } else if (mem->is_ClearArray()) { 1.8 + if (!ClearArrayNode::step_through(&mem, alloc->_idx, phase)) { 1.9 + // Can not bypass initialization of the instance 1.10 + // we are looking. 1.11 + debug_only(intptr_t offset;) 1.12 + assert(alloc == AllocateNode::Ideal_allocation(mem->in(3), phase, offset), "sanity"); 1.13 + InitializeNode* init = alloc->as_Allocate()->initialization(); 1.14 + // We are looking for stored value, return Initialize node 1.15 + // or memory edge from Allocate node. 1.16 + if (init != NULL) 1.17 + return init; 1.18 + else 1.19 + return alloc->in(TypeFunc::Memory); // It will produce zero value (see callers). 1.20 + } 1.21 + // Otherwise skip it (the call updated 'mem' value). 1.22 } else if (mem->Opcode() == Op_SCMemProj) { 1.23 assert(mem->in(0)->is_LoadStore(), "sanity"); 1.24 const TypePtr* atype = mem->in(0)->in(MemNode::Address)->bottom_type()->is_ptr(); 1.25 @@ -823,6 +838,18 @@ 1.26 Node *n = use->last_out(k); 1.27 uint oc2 = use->outcnt(); 1.28 if (n->is_Store()) { 1.29 +#ifdef ASSERT 1.30 + // Verify that there is no dependent MemBarVolatile nodes, 1.31 + // they should be removed during IGVN, see MemBarNode::Ideal(). 1.32 + for (DUIterator_Fast pmax, p = n->fast_outs(pmax); 1.33 + p < pmax; p++) { 1.34 + Node* mb = n->fast_out(p); 1.35 + assert(mb->is_Initialize() || !mb->is_MemBar() || 1.36 + mb->req() <= MemBarNode::Precedent || 1.37 + mb->in(MemBarNode::Precedent) != n, 1.38 + "MemBarVolatile should be eliminated for non-escaping object"); 1.39 + } 1.40 +#endif 1.41 _igvn.replace_node(n, n->in(MemNode::Memory)); 1.42 } else { 1.43 eliminate_card_mark(n);