Mercurial > hg > truffle
comparison src/share/vm/opto/memnode.cpp @ 4115:1bd45abaa507
6890673: Eliminate allocations immediately after EA
Summary: Try to eliminate allocations and related locks immediately after escape analysis.
Reviewed-by: never
author | kvn |
---|---|
date | Wed, 16 Nov 2011 09:13:57 -0800 |
parents | 670a74b863fc |
children | f745b2be3737 |
comparison
equal
deleted
inserted
replaced
4114:6729bbc1fcd6 | 4115:1bd45abaa507 |
---|---|
2659 //------------------------------Ideal------------------------------------------ | 2659 //------------------------------Ideal------------------------------------------ |
2660 // Return a node which is more "ideal" than the current node. Strip out | 2660 // Return a node which is more "ideal" than the current node. Strip out |
2661 // control copies | 2661 // control copies |
2662 Node *StrIntrinsicNode::Ideal(PhaseGVN *phase, bool can_reshape) { | 2662 Node *StrIntrinsicNode::Ideal(PhaseGVN *phase, bool can_reshape) { |
2663 if (remove_dead_region(phase, can_reshape)) return this; | 2663 if (remove_dead_region(phase, can_reshape)) return this; |
2664 // Don't bother trying to transform a dead node | |
2665 if (in(0) && in(0)->is_top()) return NULL; | |
2664 | 2666 |
2665 if (can_reshape) { | 2667 if (can_reshape) { |
2666 Node* mem = phase->transform(in(MemNode::Memory)); | 2668 Node* mem = phase->transform(in(MemNode::Memory)); |
2667 // If transformed to a MergeMem, get the desired slice | 2669 // If transformed to a MergeMem, get the desired slice |
2668 uint alias_idx = phase->C->get_alias_index(adr_type()); | 2670 uint alias_idx = phase->C->get_alias_index(adr_type()); |
2671 set_req(MemNode::Memory, mem); | 2673 set_req(MemNode::Memory, mem); |
2672 return this; | 2674 return this; |
2673 } | 2675 } |
2674 } | 2676 } |
2675 return NULL; | 2677 return NULL; |
2678 } | |
2679 | |
2680 //------------------------------Value------------------------------------------ | |
2681 const Type *StrIntrinsicNode::Value( PhaseTransform *phase ) const { | |
2682 if (in(0) && phase->type(in(0)) == Type::TOP) return Type::TOP; | |
2683 return bottom_type(); | |
2676 } | 2684 } |
2677 | 2685 |
2678 //============================================================================= | 2686 //============================================================================= |
2679 MemBarNode::MemBarNode(Compile* C, int alias_idx, Node* precedent) | 2687 MemBarNode::MemBarNode(Compile* C, int alias_idx, Node* precedent) |
2680 : MultiNode(TypeFunc::Parms + (precedent == NULL? 0: 1)), | 2688 : MultiNode(TypeFunc::Parms + (precedent == NULL? 0: 1)), |
2713 //------------------------------Ideal------------------------------------------ | 2721 //------------------------------Ideal------------------------------------------ |
2714 // Return a node which is more "ideal" than the current node. Strip out | 2722 // Return a node which is more "ideal" than the current node. Strip out |
2715 // control copies | 2723 // control copies |
2716 Node *MemBarNode::Ideal(PhaseGVN *phase, bool can_reshape) { | 2724 Node *MemBarNode::Ideal(PhaseGVN *phase, bool can_reshape) { |
2717 if (remove_dead_region(phase, can_reshape)) return this; | 2725 if (remove_dead_region(phase, can_reshape)) return this; |
2726 // Don't bother trying to transform a dead node | |
2727 if (in(0) && in(0)->is_top()) return NULL; | |
2718 | 2728 |
2719 // Eliminate volatile MemBars for scalar replaced objects. | 2729 // Eliminate volatile MemBars for scalar replaced objects. |
2720 if (can_reshape && req() == (Precedent+1) && | 2730 if (can_reshape && req() == (Precedent+1) && |
2721 (Opcode() == Op_MemBarAcquire || Opcode() == Op_MemBarVolatile)) { | 2731 (Opcode() == Op_MemBarAcquire || Opcode() == Op_MemBarVolatile)) { |
2722 // Volatile field loads and stores. | 2732 // Volatile field loads and stores. |