4564 // (5) dest_offset must not be negative.
4565 generate_negative_guard(dest_offset, slow_region);
4566
4567 // (6) length must not be negative (moved to generate_arraycopy()).
4568 // generate_negative_guard(length, slow_region);
4569
4570 // (7) src_offset + length must not exceed length of src.
4571 generate_limit_guard(src_offset, length,
4572 load_array_length(src),
4573 slow_region);
4574
4575 // (8) dest_offset + length must not exceed length of dest.
4576 generate_limit_guard(dest_offset, length,
4577 load_array_length(dest),
4578 slow_region);
4579
4580 // (9) each element of an oop array must be assignable
4581 // The generate_arraycopy subroutine checks this.
4582
4583 // This is where the memory effects are placed:
4584 const TypePtr* adr_type = TypeAryPtr::get_array_body_type(dest_elem);
4585 generate_arraycopy(adr_type, dest_elem,
4586 src, src_offset, dest, dest_offset, length,
4587 false, false, slow_region);
4588
4589 return true;
4590 }
4591
4592 //-----------------------------generate_arraycopy----------------------
4593 // Generate an optimized call to arraycopy.
4594 // Caller must guard against non-arrays.
4595 // Caller must determine a common array basic-type for both arrays.
4596 // Caller must validate offsets against array bounds.
4597 // The slow_region has already collected guard failure paths
4598 // (such as out of bounds length or non-conformable array types).
4599 // The generated code has this shape, in general:
4600 //
4601 // if (length == 0) return // via zero_path
4602 // slowval = -1
4603 // if (types unknown) {
4604 // slowval = call generic copy loop
|
4564 // (5) dest_offset must not be negative.
4565 generate_negative_guard(dest_offset, slow_region);
4566
4567 // (6) length must not be negative (moved to generate_arraycopy()).
4568 // generate_negative_guard(length, slow_region);
4569
4570 // (7) src_offset + length must not exceed length of src.
4571 generate_limit_guard(src_offset, length,
4572 load_array_length(src),
4573 slow_region);
4574
4575 // (8) dest_offset + length must not exceed length of dest.
4576 generate_limit_guard(dest_offset, length,
4577 load_array_length(dest),
4578 slow_region);
4579
4580 // (9) each element of an oop array must be assignable
4581 // The generate_arraycopy subroutine checks this.
4582
4583 // This is where the memory effects are placed:
4584 const TypePtr* adr_type = (top_dest->const_oop()) ? top_dest : TypeAryPtr::get_array_body_type(dest_elem);
4585 generate_arraycopy(adr_type, dest_elem,
4586 src, src_offset, dest, dest_offset, length,
4587 false, false, slow_region);
4588
4589 return true;
4590 }
4591
4592 //-----------------------------generate_arraycopy----------------------
4593 // Generate an optimized call to arraycopy.
4594 // Caller must guard against non-arrays.
4595 // Caller must determine a common array basic-type for both arrays.
4596 // Caller must validate offsets against array bounds.
4597 // The slow_region has already collected guard failure paths
4598 // (such as out of bounds length or non-conformable array types).
4599 // The generated code has this shape, in general:
4600 //
4601 // if (length == 0) return // via zero_path
4602 // slowval = -1
4603 // if (types unknown) {
4604 // slowval = call generic copy loop
|