Mercurial > hg > truffle
comparison src/share/vm/opto/macro.cpp @ 1100:f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
Summary: Add missing checks for MemBar nodes in EA.
Reviewed-by: never
author | kvn |
---|---|
date | Wed, 09 Dec 2009 16:40:45 -0800 |
parents | 7c57aead6d3e |
children | 9e321dcfa5b7 |
comparison
equal
deleted
inserted
replaced
1099:c5d3d979ae27 | 1100:f96a1a986f7b |
---|---|
314 return mem; | 314 return mem; |
315 } else { | 315 } else { |
316 assert(adr_idx == Compile::AliasIdxRaw, "address must match or be raw"); | 316 assert(adr_idx == Compile::AliasIdxRaw, "address must match or be raw"); |
317 } | 317 } |
318 mem = mem->in(MemNode::Memory); | 318 mem = mem->in(MemNode::Memory); |
319 } else if (mem->is_ClearArray()) { | |
320 if (!ClearArrayNode::step_through(&mem, alloc->_idx, phase)) { | |
321 // Can not bypass initialization of the instance | |
322 // we are looking. | |
323 debug_only(intptr_t offset;) | |
324 assert(alloc == AllocateNode::Ideal_allocation(mem->in(3), phase, offset), "sanity"); | |
325 InitializeNode* init = alloc->as_Allocate()->initialization(); | |
326 // We are looking for stored value, return Initialize node | |
327 // or memory edge from Allocate node. | |
328 if (init != NULL) | |
329 return init; | |
330 else | |
331 return alloc->in(TypeFunc::Memory); // It will produce zero value (see callers). | |
332 } | |
333 // Otherwise skip it (the call updated 'mem' value). | |
319 } else if (mem->Opcode() == Op_SCMemProj) { | 334 } else if (mem->Opcode() == Op_SCMemProj) { |
320 assert(mem->in(0)->is_LoadStore(), "sanity"); | 335 assert(mem->in(0)->is_LoadStore(), "sanity"); |
321 const TypePtr* atype = mem->in(0)->in(MemNode::Address)->bottom_type()->is_ptr(); | 336 const TypePtr* atype = mem->in(0)->in(MemNode::Address)->bottom_type()->is_ptr(); |
322 int adr_idx = Compile::current()->get_alias_index(atype); | 337 int adr_idx = Compile::current()->get_alias_index(atype); |
323 if (adr_idx == alias_idx) { | 338 if (adr_idx == alias_idx) { |
821 if (use->is_AddP()) { | 836 if (use->is_AddP()) { |
822 for (DUIterator_Last kmin, k = use->last_outs(kmin); k >= kmin; ) { | 837 for (DUIterator_Last kmin, k = use->last_outs(kmin); k >= kmin; ) { |
823 Node *n = use->last_out(k); | 838 Node *n = use->last_out(k); |
824 uint oc2 = use->outcnt(); | 839 uint oc2 = use->outcnt(); |
825 if (n->is_Store()) { | 840 if (n->is_Store()) { |
841 #ifdef ASSERT | |
842 // Verify that there is no dependent MemBarVolatile nodes, | |
843 // they should be removed during IGVN, see MemBarNode::Ideal(). | |
844 for (DUIterator_Fast pmax, p = n->fast_outs(pmax); | |
845 p < pmax; p++) { | |
846 Node* mb = n->fast_out(p); | |
847 assert(mb->is_Initialize() || !mb->is_MemBar() || | |
848 mb->req() <= MemBarNode::Precedent || | |
849 mb->in(MemBarNode::Precedent) != n, | |
850 "MemBarVolatile should be eliminated for non-escaping object"); | |
851 } | |
852 #endif | |
826 _igvn.replace_node(n, n->in(MemNode::Memory)); | 853 _igvn.replace_node(n, n->in(MemNode::Memory)); |
827 } else { | 854 } else { |
828 eliminate_card_mark(n); | 855 eliminate_card_mark(n); |
829 } | 856 } |
830 k -= (oc2 - use->outcnt()); | 857 k -= (oc2 - use->outcnt()); |