comparison src/share/vm/opto/memnode.cpp @ 11005:08d35fd1b599

8001345: VM crashes with assert(n->outcnt() != 0 || C->top() == n || n->is_Proj()) failed: No dead instructions after post-alloc Summary: Remove unnecessary LoadN / DecodeN nodes at MemBarAcquire nodes. Reviewed-by: kvn, roland
author adlertz
date Wed, 19 Jun 2013 00:41:56 +0200
parents 6f3fd5150b67
children b88209cf98c0
comparison
equal deleted inserted replaced
11004:87a6f2df28e2 11005:08d35fd1b599
2928 // Return a node which is more "ideal" than the current node. Strip out 2928 // Return a node which is more "ideal" than the current node. Strip out
2929 // control copies 2929 // control copies
2930 Node *MemBarNode::Ideal(PhaseGVN *phase, bool can_reshape) { 2930 Node *MemBarNode::Ideal(PhaseGVN *phase, bool can_reshape) {
2931 if (remove_dead_region(phase, can_reshape)) return this; 2931 if (remove_dead_region(phase, can_reshape)) return this;
2932 // Don't bother trying to transform a dead node 2932 // Don't bother trying to transform a dead node
2933 if (in(0) && in(0)->is_top()) return NULL; 2933 if (in(0) && in(0)->is_top()) {
2934 return NULL;
2935 }
2934 2936
2935 // Eliminate volatile MemBars for scalar replaced objects. 2937 // Eliminate volatile MemBars for scalar replaced objects.
2936 if (can_reshape && req() == (Precedent+1)) { 2938 if (can_reshape && req() == (Precedent+1)) {
2937 bool eliminate = false; 2939 bool eliminate = false;
2938 int opc = Opcode(); 2940 int opc = Opcode();
2939 if ((opc == Op_MemBarAcquire || opc == Op_MemBarVolatile)) { 2941 if ((opc == Op_MemBarAcquire || opc == Op_MemBarVolatile)) {
2940 // Volatile field loads and stores. 2942 // Volatile field loads and stores.
2941 Node* my_mem = in(MemBarNode::Precedent); 2943 Node* my_mem = in(MemBarNode::Precedent);
2944 // The MembarAquire may keep an unused LoadNode alive through the Precedent edge
2945 if ((my_mem != NULL) && (opc == Op_MemBarAcquire) && (my_mem->outcnt() == 1)) {
2946 assert(my_mem->unique_out() == this, "sanity");
2947 phase->hash_delete(this);
2948 del_req(Precedent);
2949 phase->is_IterGVN()->_worklist.push(my_mem); // remove dead node later
2950 my_mem = NULL;
2951 }
2942 if (my_mem != NULL && my_mem->is_Mem()) { 2952 if (my_mem != NULL && my_mem->is_Mem()) {
2943 const TypeOopPtr* t_oop = my_mem->in(MemNode::Address)->bottom_type()->isa_oopptr(); 2953 const TypeOopPtr* t_oop = my_mem->in(MemNode::Address)->bottom_type()->isa_oopptr();
2944 // Check for scalar replaced object reference. 2954 // Check for scalar replaced object reference.
2945 if( t_oop != NULL && t_oop->is_known_instance_field() && 2955 if( t_oop != NULL && t_oop->is_known_instance_field() &&
2946 t_oop->offset() != Type::OffsetBot && 2956 t_oop->offset() != Type::OffsetBot &&