828 __ movl(count, Address(rsp, 12+ 12));
829
830 if (entry != NULL) {
831 *entry = __ pc(); // Entry point from conjoint arraycopy stub.
832 BLOCK_COMMENT("Entry:");
833 }
834
835 if (t == T_OBJECT) {
836 __ testl(count, count);
837 __ jcc(Assembler::zero, L_0_count);
838 }
839
840 DecoratorSet decorators = ARRAYCOPY_DISJOINT;
841 if (dest_uninitialized) {
842 decorators |= AS_DEST_NOT_INITIALIZED;
843 }
844 if (aligned) {
845 decorators |= ARRAYCOPY_ALIGNED;
846 }
847
848 BarrierSetAssembler *bs = Universe::heap()->barrier_set()->barrier_set_assembler();
849 bs->arraycopy_prologue(_masm, decorators, t, from, to, count);
850
851 __ subptr(to, from); // to --> to_from
852 __ cmpl(count, 2<<shift); // Short arrays (< 8 bytes) copy by element
853 __ jcc(Assembler::below, L_copy_4_bytes); // use unsigned cmp
854 if (!UseUnalignedLoadStores && !aligned && (t == T_BYTE || t == T_SHORT)) {
855 // align source address at 4 bytes address boundary
856 if (t == T_BYTE) {
857 // One byte misalignment happens only for byte arrays
858 __ testl(from, 1);
859 __ jccb(Assembler::zero, L_skip_align1);
860 __ movb(rax, Address(from, 0));
861 __ movb(Address(from, to_from, Address::times_1, 0), rax);
862 __ increment(from);
863 __ decrement(count);
864 __ BIND(L_skip_align1);
865 }
866 // Two bytes misalignment happens only for byte and short (char) arrays
867 __ testl(from, 2);
868 __ jccb(Assembler::zero, L_skip_align2);
1017 RuntimeAddress nooverlap(nooverlap_target);
1018 __ cmpptr(dst, src);
1019 __ lea(end, Address(src, count, sf, 0)); // src + count * elem_size
1020 __ jump_cc(Assembler::belowEqual, nooverlap);
1021 __ cmpptr(dst, end);
1022 __ jump_cc(Assembler::aboveEqual, nooverlap);
1023
1024 if (t == T_OBJECT) {
1025 __ testl(count, count);
1026 __ jcc(Assembler::zero, L_0_count);
1027 }
1028
1029 DecoratorSet decorators = 0;
1030 if (dest_uninitialized) {
1031 decorators |= AS_DEST_NOT_INITIALIZED;
1032 }
1033 if (aligned) {
1034 decorators |= ARRAYCOPY_ALIGNED;
1035 }
1036
1037 BarrierSetAssembler *bs = Universe::heap()->barrier_set()->barrier_set_assembler();
1038 bs->arraycopy_prologue(_masm, decorators, t, from, to, count);
1039
1040 // copy from high to low
1041 __ cmpl(count, 2<<shift); // Short arrays (< 8 bytes) copy by element
1042 __ jcc(Assembler::below, L_copy_4_bytes); // use unsigned cmp
1043 if (t == T_BYTE || t == T_SHORT) {
1044 // Align the end of destination array at 4 bytes address boundary
1045 __ lea(end, Address(dst, count, sf, 0));
1046 if (t == T_BYTE) {
1047 // One byte misalignment happens only for byte arrays
1048 __ testl(end, 1);
1049 __ jccb(Assembler::zero, L_skip_align1);
1050 __ decrement(count);
1051 __ movb(rdx, Address(from, count, sf, 0));
1052 __ movb(Address(to, count, sf, 0), rdx);
1053 __ BIND(L_skip_align1);
1054 }
1055 // Two bytes misalignment happens only for byte and short (char) arrays
1056 __ testl(end, 2);
1057 __ jccb(Assembler::zero, L_skip_align2);
1372
1373 // Loop-invariant addresses. They are exclusive end pointers.
1374 Address end_from_addr(from, length, Address::times_ptr, 0);
1375 Address end_to_addr(to, length, Address::times_ptr, 0);
1376
1377 Register end_from = from; // re-use
1378 Register end_to = to; // re-use
1379 Register count = length; // re-use
1380
1381 // Loop-variant addresses. They assume post-incremented count < 0.
1382 Address from_element_addr(end_from, count, Address::times_ptr, 0);
1383 Address to_element_addr(end_to, count, Address::times_ptr, 0);
1384 Address elem_klass_addr(elem, oopDesc::klass_offset_in_bytes());
1385
1386 DecoratorSet decorators = ARRAYCOPY_CHECKCAST;
1387 if (dest_uninitialized) {
1388 decorators |= AS_DEST_NOT_INITIALIZED;
1389 }
1390
1391 BasicType type = T_OBJECT;
1392 BarrierSetAssembler *bs = Universe::heap()->barrier_set()->barrier_set_assembler();
1393 bs->arraycopy_prologue(_masm, decorators, type, from, to, count);
1394
1395 // Copy from low to high addresses, indexed from the end of each array.
1396 __ lea(end_from, end_from_addr);
1397 __ lea(end_to, end_to_addr);
1398 assert(length == count, ""); // else fix next line:
1399 __ negptr(count); // negate and test the length
1400 __ jccb(Assembler::notZero, L_load_element);
1401
1402 // Empty array: Nothing to do.
1403 __ xorptr(rax, rax); // return 0 on (trivial) success
1404 __ jmp(L_done);
1405
1406 // ======== begin loop ========
1407 // (Loop is rotated; its entry is L_load_element.)
1408 // Loop control:
1409 // for (count = -count; count != 0; count++)
1410 // Base pointers src, dst are biased by 8*count,to last element.
1411 __ align(OptoLoopAlignment);
1412
|
828 __ movl(count, Address(rsp, 12+ 12));
829
830 if (entry != NULL) {
831 *entry = __ pc(); // Entry point from conjoint arraycopy stub.
832 BLOCK_COMMENT("Entry:");
833 }
834
835 if (t == T_OBJECT) {
836 __ testl(count, count);
837 __ jcc(Assembler::zero, L_0_count);
838 }
839
840 DecoratorSet decorators = ARRAYCOPY_DISJOINT;
841 if (dest_uninitialized) {
842 decorators |= AS_DEST_NOT_INITIALIZED;
843 }
844 if (aligned) {
845 decorators |= ARRAYCOPY_ALIGNED;
846 }
847
848 BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler();
849 bs->arraycopy_prologue(_masm, decorators, t, from, to, count);
850
851 __ subptr(to, from); // to --> to_from
852 __ cmpl(count, 2<<shift); // Short arrays (< 8 bytes) copy by element
853 __ jcc(Assembler::below, L_copy_4_bytes); // use unsigned cmp
854 if (!UseUnalignedLoadStores && !aligned && (t == T_BYTE || t == T_SHORT)) {
855 // align source address at 4 bytes address boundary
856 if (t == T_BYTE) {
857 // One byte misalignment happens only for byte arrays
858 __ testl(from, 1);
859 __ jccb(Assembler::zero, L_skip_align1);
860 __ movb(rax, Address(from, 0));
861 __ movb(Address(from, to_from, Address::times_1, 0), rax);
862 __ increment(from);
863 __ decrement(count);
864 __ BIND(L_skip_align1);
865 }
866 // Two bytes misalignment happens only for byte and short (char) arrays
867 __ testl(from, 2);
868 __ jccb(Assembler::zero, L_skip_align2);
1017 RuntimeAddress nooverlap(nooverlap_target);
1018 __ cmpptr(dst, src);
1019 __ lea(end, Address(src, count, sf, 0)); // src + count * elem_size
1020 __ jump_cc(Assembler::belowEqual, nooverlap);
1021 __ cmpptr(dst, end);
1022 __ jump_cc(Assembler::aboveEqual, nooverlap);
1023
1024 if (t == T_OBJECT) {
1025 __ testl(count, count);
1026 __ jcc(Assembler::zero, L_0_count);
1027 }
1028
1029 DecoratorSet decorators = 0;
1030 if (dest_uninitialized) {
1031 decorators |= AS_DEST_NOT_INITIALIZED;
1032 }
1033 if (aligned) {
1034 decorators |= ARRAYCOPY_ALIGNED;
1035 }
1036
1037 BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler();
1038 bs->arraycopy_prologue(_masm, decorators, t, from, to, count);
1039
1040 // copy from high to low
1041 __ cmpl(count, 2<<shift); // Short arrays (< 8 bytes) copy by element
1042 __ jcc(Assembler::below, L_copy_4_bytes); // use unsigned cmp
1043 if (t == T_BYTE || t == T_SHORT) {
1044 // Align the end of destination array at 4 bytes address boundary
1045 __ lea(end, Address(dst, count, sf, 0));
1046 if (t == T_BYTE) {
1047 // One byte misalignment happens only for byte arrays
1048 __ testl(end, 1);
1049 __ jccb(Assembler::zero, L_skip_align1);
1050 __ decrement(count);
1051 __ movb(rdx, Address(from, count, sf, 0));
1052 __ movb(Address(to, count, sf, 0), rdx);
1053 __ BIND(L_skip_align1);
1054 }
1055 // Two bytes misalignment happens only for byte and short (char) arrays
1056 __ testl(end, 2);
1057 __ jccb(Assembler::zero, L_skip_align2);
1372
1373 // Loop-invariant addresses. They are exclusive end pointers.
1374 Address end_from_addr(from, length, Address::times_ptr, 0);
1375 Address end_to_addr(to, length, Address::times_ptr, 0);
1376
1377 Register end_from = from; // re-use
1378 Register end_to = to; // re-use
1379 Register count = length; // re-use
1380
1381 // Loop-variant addresses. They assume post-incremented count < 0.
1382 Address from_element_addr(end_from, count, Address::times_ptr, 0);
1383 Address to_element_addr(end_to, count, Address::times_ptr, 0);
1384 Address elem_klass_addr(elem, oopDesc::klass_offset_in_bytes());
1385
1386 DecoratorSet decorators = ARRAYCOPY_CHECKCAST;
1387 if (dest_uninitialized) {
1388 decorators |= AS_DEST_NOT_INITIALIZED;
1389 }
1390
1391 BasicType type = T_OBJECT;
1392 BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler();
1393 bs->arraycopy_prologue(_masm, decorators, type, from, to, count);
1394
1395 // Copy from low to high addresses, indexed from the end of each array.
1396 __ lea(end_from, end_from_addr);
1397 __ lea(end_to, end_to_addr);
1398 assert(length == count, ""); // else fix next line:
1399 __ negptr(count); // negate and test the length
1400 __ jccb(Assembler::notZero, L_load_element);
1401
1402 // Empty array: Nothing to do.
1403 __ xorptr(rax, rax); // return 0 on (trivial) success
1404 __ jmp(L_done);
1405
1406 // ======== begin loop ========
1407 // (Loop is rotated; its entry is L_load_element.)
1408 // Loop control:
1409 // for (count = -count; count != 0; count++)
1410 // Base pointers src, dst are biased by 8*count,to last element.
1411 __ align(OptoLoopAlignment);
1412
|