comparison src/share/vm/opto/memnode.hpp @ 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 f95d63e2154a
children 1d1603768966
comparison
equal deleted inserted replaced
2411:63997f575155 2412:f9424955eb18
774 // Return allocation input memory edge if it is different instance 774 // Return allocation input memory edge if it is different instance
775 // or itself if it is the one we are looking for. 775 // or itself if it is the one we are looking for.
776 static bool step_through(Node** np, uint instance_id, PhaseTransform* phase); 776 static bool step_through(Node** np, uint instance_id, PhaseTransform* phase);
777 }; 777 };
778 778
779 //------------------------------StrComp------------------------------------- 779 //------------------------------StrIntrinsic-------------------------------
780 class StrCompNode: public Node { 780 // Base class for Ideal nodes used in String instrinsic code.
781 public: 781 class StrIntrinsicNode: public Node {
782 StrCompNode(Node* control, Node* char_array_mem, 782 public:
783 Node* s1, Node* c1, 783 StrIntrinsicNode(Node* control, Node* char_array_mem,
784 Node* s2, Node* c2): Node(control, char_array_mem, 784 Node* s1, Node* c1, Node* s2, Node* c2):
785 s1, c1, 785 Node(control, char_array_mem, s1, c1, s2, c2) {
786 s2, c2) {}; 786 }
787 virtual int Opcode() const; 787
788 StrIntrinsicNode(Node* control, Node* char_array_mem,
789 Node* s1, Node* s2, Node* c):
790 Node(control, char_array_mem, s1, s2, c) {
791 }
792
793 StrIntrinsicNode(Node* control, Node* char_array_mem,
794 Node* s1, Node* s2):
795 Node(control, char_array_mem, s1, s2) {
796 }
797
788 virtual bool depends_only_on_test() const { return false; } 798 virtual bool depends_only_on_test() const { return false; }
789 virtual const Type* bottom_type() const { return TypeInt::INT; }
790 virtual const TypePtr* adr_type() const { return TypeAryPtr::CHARS; } 799 virtual const TypePtr* adr_type() const { return TypeAryPtr::CHARS; }
791 virtual uint match_edge(uint idx) const; 800 virtual uint match_edge(uint idx) const;
792 virtual uint ideal_reg() const { return Op_RegI; } 801 virtual uint ideal_reg() const { return Op_RegI; }
793 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 802 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
794 }; 803 };
795 804
805 //------------------------------StrComp-------------------------------------
806 class StrCompNode: public StrIntrinsicNode {
807 public:
808 StrCompNode(Node* control, Node* char_array_mem,
809 Node* s1, Node* c1, Node* s2, Node* c2):
810 StrIntrinsicNode(control, char_array_mem, s1, c1, s2, c2) {};
811 virtual int Opcode() const;
812 virtual const Type* bottom_type() const { return TypeInt::INT; }
813 };
814
796 //------------------------------StrEquals------------------------------------- 815 //------------------------------StrEquals-------------------------------------
797 class StrEqualsNode: public Node { 816 class StrEqualsNode: public StrIntrinsicNode {
798 public: 817 public:
799 StrEqualsNode(Node* control, Node* char_array_mem, 818 StrEqualsNode(Node* control, Node* char_array_mem,
800 Node* s1, Node* s2, Node* c): Node(control, char_array_mem, 819 Node* s1, Node* s2, Node* c):
801 s1, s2, c) {}; 820 StrIntrinsicNode(control, char_array_mem, s1, s2, c) {};
802 virtual int Opcode() const; 821 virtual int Opcode() const;
803 virtual bool depends_only_on_test() const { return false; }
804 virtual const Type* bottom_type() const { return TypeInt::BOOL; } 822 virtual const Type* bottom_type() const { return TypeInt::BOOL; }
805 virtual const TypePtr* adr_type() const { return TypeAryPtr::CHARS; }
806 virtual uint match_edge(uint idx) const;
807 virtual uint ideal_reg() const { return Op_RegI; }
808 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
809 }; 823 };
810 824
811 //------------------------------StrIndexOf------------------------------------- 825 //------------------------------StrIndexOf-------------------------------------
812 class StrIndexOfNode: public Node { 826 class StrIndexOfNode: public StrIntrinsicNode {
813 public: 827 public:
814 StrIndexOfNode(Node* control, Node* char_array_mem, 828 StrIndexOfNode(Node* control, Node* char_array_mem,
815 Node* s1, Node* c1, 829 Node* s1, Node* c1, Node* s2, Node* c2):
816 Node* s2, Node* c2): Node(control, char_array_mem, 830 StrIntrinsicNode(control, char_array_mem, s1, c1, s2, c2) {};
817 s1, c1, 831 virtual int Opcode() const;
818 s2, c2) {};
819 virtual int Opcode() const;
820 virtual bool depends_only_on_test() const { return false; }
821 virtual const Type* bottom_type() const { return TypeInt::INT; } 832 virtual const Type* bottom_type() const { return TypeInt::INT; }
822 virtual const TypePtr* adr_type() const { return TypeAryPtr::CHARS; }
823 virtual uint match_edge(uint idx) const;
824 virtual uint ideal_reg() const { return Op_RegI; }
825 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
826 }; 833 };
827 834
828 //------------------------------AryEq--------------------------------------- 835 //------------------------------AryEq---------------------------------------
829 class AryEqNode: public Node { 836 class AryEqNode: public StrIntrinsicNode {
830 public: 837 public:
831 AryEqNode(Node* control, Node* char_array_mem, 838 AryEqNode(Node* control, Node* char_array_mem, Node* s1, Node* s2):
832 Node* s1, Node* s2): Node(control, char_array_mem, s1, s2) {}; 839 StrIntrinsicNode(control, char_array_mem, s1, s2) {};
833 virtual int Opcode() const; 840 virtual int Opcode() const;
834 virtual bool depends_only_on_test() const { return false; }
835 virtual const Type* bottom_type() const { return TypeInt::BOOL; } 841 virtual const Type* bottom_type() const { return TypeInt::BOOL; }
836 virtual const TypePtr* adr_type() const { return TypeAryPtr::CHARS; }
837 virtual uint match_edge(uint idx) const;
838 virtual uint ideal_reg() const { return Op_RegI; }
839 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
840 }; 842 };
841 843
842 //------------------------------MemBar----------------------------------------- 844 //------------------------------MemBar-----------------------------------------
843 // There are different flavors of Memory Barriers to match the Java Memory 845 // There are different flavors of Memory Barriers to match the Java Memory
844 // Model. Monitor-enter and volatile-load act as Aquires: no following ref 846 // Model. Monitor-enter and volatile-load act as Aquires: no following ref