--- old/src/share/vm/opto/macro.cpp Tue Nov 17 16:51:06 2009 +++ new/src/share/vm/opto/macro.cpp Tue Nov 17 16:51:06 2009 @@ -316,6 +316,25 @@ assert(adr_idx == Compile::AliasIdxRaw, "address must match or be raw"); } mem = mem->in(MemNode::Memory); + } else if (mem->Opcode() == Op_ClearArray) { + intptr_t offset; + AllocateNode* clear_alloc = AllocateNode::Ideal_allocation(mem->in(3), phase, offset); + // We can not bypass initialization of the instance we are looking for + // or when something is wrong. + if (clear_alloc == NULL) + return mem; + InitializeNode* init = clear_alloc->initialization(); + if (clear_alloc == alloc) { + // We are looking for value, return Initialize node. + assert(init != NULL, "should have"); + return init; + } else { + // Otherwise skip it. + if (init != NULL) + mem = init->in(TypeFunc::Memory); + else + mem = clear_alloc->in(TypeFunc::Memory); + } } else if (mem->Opcode() == Op_SCMemProj) { assert(mem->in(0)->is_LoadStore(), "sanity"); const TypePtr* atype = mem->in(0)->in(MemNode::Address)->bottom_type()->is_ptr(); @@ -823,6 +842,18 @@ Node *n = use->last_out(k); uint oc2 = use->outcnt(); if (n->is_Store()) { +#ifdef ASSERT + // Verify that there is no dependent MemBarVolatile nodes, + // they should be removed during IGVN, see MemBarNode::Ideal(). + for (DUIterator_Fast pmax, p = n->fast_outs(pmax); + p < pmax; p++) { + Node* mb = n->fast_out(p); + assert(mb->is_Initialize() || !mb->is_MemBar() || + mb->req() <= MemBarNode::Precedent || + mb->in(MemBarNode::Precedent) != n, + "MemBarVolatile should be eliminated for non-escaping object"); + } +#endif _igvn.replace_node(n, n->in(MemNode::Memory)); } else { eliminate_card_mark(n);