84 fields[SrcLen] = TypeInt::INT;
85 fields[DestLen] = TypeInt::INT;
86 fields[SrcKlass] = TypeKlassPtr::BOTTOM;
87 fields[DestKlass] = TypeKlassPtr::BOTTOM;
88 const TypeTuple *domain = TypeTuple::make(ParmLimit, fields);
89
90 // create result type (range)
91 fields = TypeTuple::fields(0);
92
93 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
94
95 _arraycopy_type_Type = TypeFunc::make(domain, range);
96 }
97
98 const TypePtr* get_src_adr_type(PhaseGVN* phase) const;
99 private:
100 ArrayCopyNode(Compile* C, bool alloc_tightly_coupled, bool has_negative_length_guard);
101
102 intptr_t get_length_if_constant(PhaseGVN *phase) const;
103 int get_count(PhaseGVN *phase) const;
104 static const TypePtr* get_address_type(PhaseGVN* phase, const TypePtr* atp, Node* n);
105
106 Node* try_clone_instance(PhaseGVN *phase, bool can_reshape, int count);
107
108 Node* make_and_transform_addp(PhaseGVN* phase, Node* base, Node* offset);
109 Node* make_and_transform_addp(PhaseGVN* phase, Node* base, Node* ptr, Node* offset);
110
111 bool prepare_array_copy(PhaseGVN *phase, bool can_reshape,
112 Node*& adr_src, Node*& base_src, Node*& adr_dest, Node*& base_dest,
113 BasicType& copy_type, const Type*& value_type, bool& disjoint_bases);
114 void array_copy_test_overlap(PhaseGVN *phase, bool can_reshape,
115 bool disjoint_bases, int count,
116 Node*& forward_ctl, Node*& backward_ctl);
117 Node* array_copy_forward(PhaseGVN *phase, bool can_reshape, Node*& ctl,
118 Node* mem,
119 const TypePtr* atp_src, const TypePtr* atp_dest,
120 Node* adr_src, Node* base_src, Node* adr_dest, Node* base_dest,
121 BasicType copy_type, const Type* value_type, int count);
122 Node* array_copy_backward(PhaseGVN *phase, bool can_reshape, Node*& ctl,
123 Node* mem,
124 const TypePtr* atp_src, const TypePtr* atp_dest,
125 Node* adr_src, Node* base_src, Node* adr_dest, Node* base_dest,
126 BasicType copy_type, const Type* value_type, int count);
127 bool finish_transform(PhaseGVN *phase, bool can_reshape,
128 Node* ctl, Node *mem);
129 static bool may_modify_helper(const TypeOopPtr* t_oop, Node* n, PhaseValues* phase, ArrayCopyNode*& ac);
130 public:
131 static Node* load(BarrierSetC2* bs, PhaseGVN *phase, Node*& ctl, MergeMemNode* mem, Node* addr, const TypePtr* adr_type, const Type *type, BasicType bt);
132 private:
133 void store(BarrierSetC2* bs, PhaseGVN *phase, Node*& ctl, MergeMemNode* mem, Node* addr, const TypePtr* adr_type, Node* val, const Type *type, BasicType bt);
134
135 public:
136
137 enum {
138 Src = TypeFunc::Parms,
139 SrcPos,
140 Dest,
141 DestPos,
142 Length,
143 SrcLen,
144 DestLen,
145 SrcKlass,
146 DestKlass,
147 ParmLimit
148 };
|
84 fields[SrcLen] = TypeInt::INT;
85 fields[DestLen] = TypeInt::INT;
86 fields[SrcKlass] = TypeKlassPtr::BOTTOM;
87 fields[DestKlass] = TypeKlassPtr::BOTTOM;
88 const TypeTuple *domain = TypeTuple::make(ParmLimit, fields);
89
90 // create result type (range)
91 fields = TypeTuple::fields(0);
92
93 const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
94
95 _arraycopy_type_Type = TypeFunc::make(domain, range);
96 }
97
98 const TypePtr* get_src_adr_type(PhaseGVN* phase) const;
99 private:
100 ArrayCopyNode(Compile* C, bool alloc_tightly_coupled, bool has_negative_length_guard);
101
102 intptr_t get_length_if_constant(PhaseGVN *phase) const;
103 int get_count(PhaseGVN *phase) const;
104 static const TypeAryPtr* get_address_type(PhaseGVN* phase, const TypePtr* atp, Node* n);
105
106 Node* try_clone_instance(PhaseGVN *phase, bool can_reshape, int count);
107
108 Node* make_and_transform_addp(PhaseGVN* phase, Node* base, Node* offset);
109 Node* make_and_transform_addp(PhaseGVN* phase, Node* base, Node* ptr, Node* offset);
110
111 bool prepare_array_copy(PhaseGVN *phase, bool can_reshape,
112 Node*& adr_src, Node*& base_src, Node*& adr_dest, Node*& base_dest,
113 BasicType& copy_type, const Type*& value_type, bool& disjoint_bases);
114 void array_copy_test_overlap(GraphKit& kit,
115 bool disjoint_bases, int count,
116 Node*& backward_ctl);
117 void array_copy_forward(GraphKit& kit, bool can_reshape,
118 const TypeAryPtr* atp_src, const TypeAryPtr* atp_dest,
119 Node* adr_src, Node* base_src, Node* adr_dest, Node* base_dest,
120 BasicType copy_type, const Type* value_type, int count);
121 void array_copy_backward(GraphKit& kit, bool can_reshape,
122 const TypeAryPtr* atp_src, const TypeAryPtr* atp_dest,
123 Node* adr_src, Node* base_src, Node* adr_dest, Node* base_dest,
124 BasicType copy_type, const Type* value_type, int count);
125 bool finish_transform(PhaseGVN *phase, bool can_reshape,
126 Node* ctl, Node *mem);
127 void copy(GraphKit& kit, const TypeAryPtr* atp_src, const TypeAryPtr* atp_dest, int i,
128 Node* base_src, Node* base_dest, Node* adr_src, Node* adr_dest,
129 BasicType copy_type, const Type* value_type);
130
131 static bool may_modify_helper(const TypeOopPtr* t_oop, Node* n, PhaseValues* phase, ArrayCopyNode*& ac);
132 public:
133 static Node* load(BarrierSetC2* bs, PhaseGVN *phase, Node*& ctl, MergeMemNode* mem, Node* addr, const TypePtr* adr_type, const Type *type, BasicType bt);
134 private:
135 void store(BarrierSetC2* bs, PhaseGVN *phase, Node*& ctl, MergeMemNode* mem, Node* addr, const TypePtr* adr_type, Node* val, const Type *type, BasicType bt);
136
137 public:
138
139 enum {
140 Src = TypeFunc::Parms,
141 SrcPos,
142 Dest,
143 DestPos,
144 Length,
145 SrcLen,
146 DestLen,
147 SrcKlass,
148 DestKlass,
149 ParmLimit
150 };
|