1355 //---------------------------------------------------------------
1356 // Assembler stub will be used for this call to arraycopy
1357 // if the two arrays are subtypes of Object[] but the
1358 // destination array type is not equal to or a supertype
1359 // of the source type. Each element must be separately
1360 // checked.
1361
1362 // Loop-invariant addresses. They are exclusive end pointers.
1363 Address end_from_addr(from, length, Address::times_ptr, 0);
1364 Address end_to_addr(to, length, Address::times_ptr, 0);
1365
1366 Register end_from = from; // re-use
1367 Register end_to = to; // re-use
1368 Register count = length; // re-use
1369
1370 // Loop-variant addresses. They assume post-incremented count < 0.
1371 Address from_element_addr(end_from, count, Address::times_ptr, 0);
1372 Address to_element_addr(end_to, count, Address::times_ptr, 0);
1373 Address elem_klass_addr(elem, oopDesc::klass_offset_in_bytes());
1374
1375 DecoratorSet decorators = IN_HEAP | IS_ARRAY | ARRAYCOPY_CHECKCAST;
1376 if (dest_uninitialized) {
1377 decorators |= IS_DEST_UNINITIALIZED;
1378 }
1379
1380 BasicType type = T_OBJECT;
1381 BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler();
1382 bs->arraycopy_prologue(_masm, decorators, type, from, to, count);
1383
1384 // Copy from low to high addresses, indexed from the end of each array.
1385 __ lea(end_from, end_from_addr);
1386 __ lea(end_to, end_to_addr);
1387 assert(length == count, ""); // else fix next line:
1388 __ negptr(count); // negate and test the length
1389 __ jccb(Assembler::notZero, L_load_element);
1390
1391 // Empty array: Nothing to do.
1392 __ xorptr(rax, rax); // return 0 on (trivial) success
1393 __ jmp(L_done);
1394
1395 // ======== begin loop ========
|
1355 //---------------------------------------------------------------
1356 // Assembler stub will be used for this call to arraycopy
1357 // if the two arrays are subtypes of Object[] but the
1358 // destination array type is not equal to or a supertype
1359 // of the source type. Each element must be separately
1360 // checked.
1361
1362 // Loop-invariant addresses. They are exclusive end pointers.
1363 Address end_from_addr(from, length, Address::times_ptr, 0);
1364 Address end_to_addr(to, length, Address::times_ptr, 0);
1365
1366 Register end_from = from; // re-use
1367 Register end_to = to; // re-use
1368 Register count = length; // re-use
1369
1370 // Loop-variant addresses. They assume post-incremented count < 0.
1371 Address from_element_addr(end_from, count, Address::times_ptr, 0);
1372 Address to_element_addr(end_to, count, Address::times_ptr, 0);
1373 Address elem_klass_addr(elem, oopDesc::klass_offset_in_bytes());
1374
1375 // Note: checkcast arraycopy is always disjoint. If it were not, then we wouldn't
1376 // need to checkcast.
1377 DecoratorSet decorators = IN_HEAP | IS_ARRAY | ARRAYCOPY_CHECKCAST | ARRAYCOPY_DISJOINT;
1378 if (dest_uninitialized) {
1379 decorators |= IS_DEST_UNINITIALIZED;
1380 }
1381
1382 BasicType type = T_OBJECT;
1383 BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler();
1384 bs->arraycopy_prologue(_masm, decorators, type, from, to, count);
1385
1386 // Copy from low to high addresses, indexed from the end of each array.
1387 __ lea(end_from, end_from_addr);
1388 __ lea(end_to, end_to_addr);
1389 assert(length == count, ""); // else fix next line:
1390 __ negptr(count); // negate and test the length
1391 __ jccb(Assembler::notZero, L_load_element);
1392
1393 // Empty array: Nothing to do.
1394 __ xorptr(rax, rax); // return 0 on (trivial) success
1395 __ jmp(L_done);
1396
1397 // ======== begin loop ========
|