194 |
194 |
195 // |
195 // |
196 // Default versions of arraycopy functions |
196 // Default versions of arraycopy functions |
197 // |
197 // |
198 |
198 |
|
199 static void gen_arraycopy_barrier_pre(oop* dest, size_t count) { |
|
200 assert(count != 0, "count should be non-zero"); |
|
201 assert(count <= (size_t)max_intx, "count too large"); |
|
202 BarrierSet* bs = Universe::heap()->barrier_set(); |
|
203 assert(bs->has_write_ref_array_pre_opt(), "Must have pre-barrier opt"); |
|
204 bs->write_ref_array_pre(dest, (int)count); |
|
205 } |
|
206 |
199 static void gen_arraycopy_barrier(oop* dest, size_t count) { |
207 static void gen_arraycopy_barrier(oop* dest, size_t count) { |
200 assert(count != 0, "count should be non-zero"); |
208 assert(count != 0, "count should be non-zero"); |
201 BarrierSet* bs = Universe::heap()->barrier_set(); |
209 BarrierSet* bs = Universe::heap()->barrier_set(); |
202 assert(bs->has_write_ref_array_opt(), "Barrier set must have ref array opt"); |
210 assert(bs->has_write_ref_array_opt(), "Barrier set must have ref array opt"); |
203 bs->write_ref_array(MemRegion((HeapWord*)dest, (HeapWord*)(dest + count))); |
211 bs->write_ref_array((HeapWord*)dest, count); |
204 } |
212 } |
205 |
213 |
206 JRT_LEAF(void, StubRoutines::jbyte_copy(jbyte* src, jbyte* dest, size_t count)) |
214 JRT_LEAF(void, StubRoutines::jbyte_copy(jbyte* src, jbyte* dest, size_t count)) |
207 #ifndef PRODUCT |
215 #ifndef PRODUCT |
208 SharedRuntime::_jbyte_array_copy_ctr++; // Slow-path byte array copy |
216 SharedRuntime::_jbyte_array_copy_ctr++; // Slow-path byte array copy |
238 JRT_LEAF(void, StubRoutines::oop_copy(oop* src, oop* dest, size_t count)) |
246 JRT_LEAF(void, StubRoutines::oop_copy(oop* src, oop* dest, size_t count)) |
239 #ifndef PRODUCT |
247 #ifndef PRODUCT |
240 SharedRuntime::_oop_array_copy_ctr++; // Slow-path oop array copy |
248 SharedRuntime::_oop_array_copy_ctr++; // Slow-path oop array copy |
241 #endif // !PRODUCT |
249 #endif // !PRODUCT |
242 assert(count != 0, "count should be non-zero"); |
250 assert(count != 0, "count should be non-zero"); |
|
251 gen_arraycopy_barrier_pre(dest, count); |
243 Copy::conjoint_oops_atomic(src, dest, count); |
252 Copy::conjoint_oops_atomic(src, dest, count); |
244 gen_arraycopy_barrier(dest, count); |
253 gen_arraycopy_barrier(dest, count); |
245 JRT_END |
254 JRT_END |
246 |
255 |
247 JRT_LEAF(void, StubRoutines::arrayof_jbyte_copy(HeapWord* src, HeapWord* dest, size_t count)) |
256 JRT_LEAF(void, StubRoutines::arrayof_jbyte_copy(HeapWord* src, HeapWord* dest, size_t count)) |
279 JRT_LEAF(void, StubRoutines::arrayof_oop_copy(HeapWord* src, HeapWord* dest, size_t count)) |
288 JRT_LEAF(void, StubRoutines::arrayof_oop_copy(HeapWord* src, HeapWord* dest, size_t count)) |
280 #ifndef PRODUCT |
289 #ifndef PRODUCT |
281 SharedRuntime::_oop_array_copy_ctr++; // Slow-path oop array copy |
290 SharedRuntime::_oop_array_copy_ctr++; // Slow-path oop array copy |
282 #endif // !PRODUCT |
291 #endif // !PRODUCT |
283 assert(count != 0, "count should be non-zero"); |
292 assert(count != 0, "count should be non-zero"); |
|
293 gen_arraycopy_barrier_pre((oop *) dest, count); |
284 Copy::arrayof_conjoint_oops(src, dest, count); |
294 Copy::arrayof_conjoint_oops(src, dest, count); |
285 gen_arraycopy_barrier((oop *) dest, count); |
295 gen_arraycopy_barrier((oop *) dest, count); |
286 JRT_END |
296 JRT_END |