Mercurial > hg > graal-compiler
comparison src/share/vm/opto/memnode.cpp @ 2412:f9424955eb18
7029152: Ideal nodes for String intrinsics miss memory edge optimization
Summary: In Ideal() method of String intrinsics nodes look for TypeAryPtr::CHARS memory slice if memory is MergeMem. Do not unroll a loop with String intrinsics code.
Reviewed-by: never
author | kvn |
---|---|
date | Wed, 30 Mar 2011 12:08:49 -0700 |
parents | b099aaf51bf8 |
children | cb162b348743 |
comparison
equal
deleted
inserted
replaced
2411:63997f575155 | 2412:f9424955eb18 |
---|---|
2615 assert(done_offset == end_offset, ""); | 2615 assert(done_offset == end_offset, ""); |
2616 return mem; | 2616 return mem; |
2617 } | 2617 } |
2618 | 2618 |
2619 //============================================================================= | 2619 //============================================================================= |
2620 // Do we match on this edge? No memory edges | 2620 // Do not match memory edge. |
2621 uint StrCompNode::match_edge(uint idx) const { | 2621 uint StrIntrinsicNode::match_edge(uint idx) const { |
2622 return idx == 2 || idx == 3; // StrComp (Binary str1 cnt1) (Binary str2 cnt2) | 2622 return idx == 2 || idx == 3; |
2623 } | 2623 } |
2624 | 2624 |
2625 //------------------------------Ideal------------------------------------------ | 2625 //------------------------------Ideal------------------------------------------ |
2626 // Return a node which is more "ideal" than the current node. Strip out | 2626 // Return a node which is more "ideal" than the current node. Strip out |
2627 // control copies | 2627 // control copies |
2628 Node *StrCompNode::Ideal(PhaseGVN *phase, bool can_reshape){ | 2628 Node *StrIntrinsicNode::Ideal(PhaseGVN *phase, bool can_reshape) { |
2629 return remove_dead_region(phase, can_reshape) ? this : NULL; | 2629 if (remove_dead_region(phase, can_reshape)) return this; |
2630 } | 2630 |
2631 | 2631 Node* mem = phase->transform(in(MemNode::Memory)); |
2632 //============================================================================= | 2632 // If transformed to a MergeMem, get the desired slice |
2633 // Do we match on this edge? No memory edges | 2633 uint alias_idx = phase->C->get_alias_index(adr_type()); |
2634 uint StrEqualsNode::match_edge(uint idx) const { | 2634 mem = mem->is_MergeMem() ? mem->as_MergeMem()->memory_at(alias_idx) : mem; |
2635 return idx == 2 || idx == 3; // StrEquals (Binary str1 str2) cnt | 2635 if (mem != in(MemNode::Memory)) |
2636 } | 2636 set_req(MemNode::Memory, mem); |
2637 | 2637 return NULL; |
2638 //------------------------------Ideal------------------------------------------ | |
2639 // Return a node which is more "ideal" than the current node. Strip out | |
2640 // control copies | |
2641 Node *StrEqualsNode::Ideal(PhaseGVN *phase, bool can_reshape){ | |
2642 return remove_dead_region(phase, can_reshape) ? this : NULL; | |
2643 } | |
2644 | |
2645 //============================================================================= | |
2646 // Do we match on this edge? No memory edges | |
2647 uint StrIndexOfNode::match_edge(uint idx) const { | |
2648 return idx == 2 || idx == 3; // StrIndexOf (Binary str1 cnt1) (Binary str2 cnt2) | |
2649 } | |
2650 | |
2651 //------------------------------Ideal------------------------------------------ | |
2652 // Return a node which is more "ideal" than the current node. Strip out | |
2653 // control copies | |
2654 Node *StrIndexOfNode::Ideal(PhaseGVN *phase, bool can_reshape){ | |
2655 return remove_dead_region(phase, can_reshape) ? this : NULL; | |
2656 } | |
2657 | |
2658 //============================================================================= | |
2659 // Do we match on this edge? No memory edges | |
2660 uint AryEqNode::match_edge(uint idx) const { | |
2661 return idx == 2 || idx == 3; // StrEquals ary1 ary2 | |
2662 } | |
2663 //------------------------------Ideal------------------------------------------ | |
2664 // Return a node which is more "ideal" than the current node. Strip out | |
2665 // control copies | |
2666 Node *AryEqNode::Ideal(PhaseGVN *phase, bool can_reshape){ | |
2667 return remove_dead_region(phase, can_reshape) ? this : NULL; | |
2668 } | 2638 } |
2669 | 2639 |
2670 //============================================================================= | 2640 //============================================================================= |
2671 MemBarNode::MemBarNode(Compile* C, int alias_idx, Node* precedent) | 2641 MemBarNode::MemBarNode(Compile* C, int alias_idx, Node* precedent) |
2672 : MultiNode(TypeFunc::Parms + (precedent == NULL? 0: 1)), | 2642 : MultiNode(TypeFunc::Parms + (precedent == NULL? 0: 1)), |