comparison src/share/vm/opto/memnode.cpp @ 305:ab075d07f1ba

6736417: Fastdebug C2 crashes in StoreBNode::Ideal Summary: The result of step_through_mergemem() and remove_dead_region() is not checked in some cases. Reviewed-by: never
author kvn
date Wed, 27 Aug 2008 09:15:46 -0700
parents c3e045194476
children 8261ee795323
comparison
equal deleted inserted replaced
304:dc7f315e41f7 305:ab075d07f1ba
212 Node *MemNode::Ideal_common(PhaseGVN *phase, bool can_reshape) { 212 Node *MemNode::Ideal_common(PhaseGVN *phase, bool can_reshape) {
213 // If our control input is a dead region, kill all below the region 213 // If our control input is a dead region, kill all below the region
214 Node *ctl = in(MemNode::Control); 214 Node *ctl = in(MemNode::Control);
215 if (ctl && remove_dead_region(phase, can_reshape)) 215 if (ctl && remove_dead_region(phase, can_reshape))
216 return this; 216 return this;
217 ctl = in(MemNode::Control);
218 // Don't bother trying to transform a dead node
219 if( ctl && ctl->is_top() ) return NodeSentinel;
217 220
218 // Ignore if memory is dead, or self-loop 221 // Ignore if memory is dead, or self-loop
219 Node *mem = in(MemNode::Memory); 222 Node *mem = in(MemNode::Memory);
220 if( phase->type( mem ) == Type::TOP ) return NodeSentinel; // caller will return NULL 223 if( phase->type( mem ) == Type::TOP ) return NodeSentinel; // caller will return NULL
221 assert( mem != this, "dead loop in MemNode::Ideal" ); 224 assert( mem != this, "dead loop in MemNode::Ideal" );
242 mem = step_through_mergemem(phase, mmem, tp, adr_type(), tty); 245 mem = step_through_mergemem(phase, mmem, tp, adr_type(), tty);
243 } 246 }
244 247
245 if (mem != old_mem) { 248 if (mem != old_mem) {
246 set_req(MemNode::Memory, mem); 249 set_req(MemNode::Memory, mem);
250 if (phase->type( mem ) == Type::TOP) return NodeSentinel;
247 return this; 251 return this;
248 } 252 }
249 253
250 // let the subclass continue analyzing... 254 // let the subclass continue analyzing...
251 return NULL; 255 return NULL;
1314 if (addr_t != NULL) { 1318 if (addr_t != NULL) {
1315 // try to optimize our memory input 1319 // try to optimize our memory input
1316 Node* opt_mem = MemNode::optimize_memory_chain(mem, addr_t, phase); 1320 Node* opt_mem = MemNode::optimize_memory_chain(mem, addr_t, phase);
1317 if (opt_mem != mem) { 1321 if (opt_mem != mem) {
1318 set_req(MemNode::Memory, opt_mem); 1322 set_req(MemNode::Memory, opt_mem);
1323 if (phase->type( opt_mem ) == Type::TOP) return NULL;
1319 return this; 1324 return this;
1320 } 1325 }
1321 const TypeOopPtr *t_oop = addr_t->isa_oopptr(); 1326 const TypeOopPtr *t_oop = addr_t->isa_oopptr();
1322 if (can_reshape && opt_mem->is_Phi() && 1327 if (can_reshape && opt_mem->is_Phi() &&
1323 (t_oop != NULL) && t_oop->is_known_instance_field()) { 1328 (t_oop != NULL) && t_oop->is_known_instance_field()) {
2445 2450
2446 //------------------------------Ideal------------------------------------------ 2451 //------------------------------Ideal------------------------------------------
2447 // Return a node which is more "ideal" than the current node. Strip out 2452 // Return a node which is more "ideal" than the current node. Strip out
2448 // control copies 2453 // control copies
2449 Node *MemBarNode::Ideal(PhaseGVN *phase, bool can_reshape) { 2454 Node *MemBarNode::Ideal(PhaseGVN *phase, bool can_reshape) {
2450 if (remove_dead_region(phase, can_reshape)) return this; 2455 return remove_dead_region(phase, can_reshape) ? this : NULL;
2451 return NULL;
2452 } 2456 }
2453 2457
2454 //------------------------------Value------------------------------------------ 2458 //------------------------------Value------------------------------------------
2455 const Type *MemBarNode::Value( PhaseTransform *phase ) const { 2459 const Type *MemBarNode::Value( PhaseTransform *phase ) const {
2456 if( !in(0) ) return Type::TOP; 2460 if( !in(0) ) return Type::TOP;