Small changes in ARM and x86-64 SystemArrayCopy intrinsics.
Have these intrinsics share a more uniform style with the
ARM64 SystemArrayCopy intrinsic.
Also make some changes/improvements in:
- art::IntrinsicOptimizations
- art::arm64::GenSystemArrayCopyAddresses
Change-Id: Ieeb224795229580f8e5f7219c586d04786d8c705
diff --git a/compiler/optimizing/intrinsics_arm.cc b/compiler/optimizing/intrinsics_arm.cc
index 4b94c94..86b7bc1 100644
--- a/compiler/optimizing/intrinsics_arm.cc
+++ b/compiler/optimizing/intrinsics_arm.cc
@@ -1394,15 +1394,13 @@
SlowPathCode* slow_path = new (GetAllocator()) IntrinsicSlowPathARM(invoke);
codegen_->AddSlowPath(slow_path);
- Label ok;
+ Label conditions_on_positions_validated;
SystemArrayCopyOptimizations optimizations(invoke);
- if (!optimizations.GetDestinationIsSource()) {
- if (!src_pos.IsConstant() || !dest_pos.IsConstant()) {
- __ cmp(src, ShifterOperand(dest));
- }
+ if (!optimizations.GetDestinationIsSource() &&
+ (!src_pos.IsConstant() || !dest_pos.IsConstant())) {
+ __ cmp(src, ShifterOperand(dest));
}
-
// If source and destination are the same, we go to slow path if we need to do
// forward copying.
if (src_pos.IsConstant()) {
@@ -1413,14 +1411,14 @@
|| (src_pos_constant >= dest_pos.GetConstant()->AsIntConstant()->GetValue()));
} else {
if (!optimizations.GetDestinationIsSource()) {
- __ b(&ok, NE);
+ __ b(&conditions_on_positions_validated, NE);
}
__ cmp(dest_pos.AsRegister<Register>(), ShifterOperand(src_pos_constant));
__ b(slow_path->GetEntryLabel(), GT);
}
} else {
if (!optimizations.GetDestinationIsSource()) {
- __ b(&ok, NE);
+ __ b(&conditions_on_positions_validated, NE);
}
if (dest_pos.IsConstant()) {
int32_t dest_pos_constant = dest_pos.GetConstant()->AsIntConstant()->GetValue();
@@ -1431,7 +1429,7 @@
__ b(slow_path->GetEntryLabel(), LT);
}
- __ Bind(&ok);
+ __ Bind(&conditions_on_positions_validated);
if (!optimizations.GetSourceIsNotNull()) {
// Bail out if the source is null.
@@ -1482,7 +1480,7 @@
bool did_unpoison = false;
if (!optimizations.GetDestinationIsNonPrimitiveArray() ||
!optimizations.GetSourceIsNonPrimitiveArray()) {
- // One or two of the references need to be unpoisoned. Unpoisoned them
+ // One or two of the references need to be unpoisoned. Unpoison them
// both to make the identity check valid.
__ MaybeUnpoisonHeapReference(temp1);
__ MaybeUnpoisonHeapReference(temp2);
@@ -1491,6 +1489,7 @@
if (!optimizations.GetDestinationIsNonPrimitiveArray()) {
// Bail out if the destination is not a non primitive array.
+ // /* HeapReference<Class> */ temp3 = temp1->component_type_
__ LoadFromOffset(kLoadWord, temp3, temp1, component_offset);
__ CompareAndBranchIfZero(temp3, slow_path->GetEntryLabel());
__ MaybeUnpoisonHeapReference(temp3);
@@ -1501,7 +1500,7 @@
if (!optimizations.GetSourceIsNonPrimitiveArray()) {
// Bail out if the source is not a non primitive array.
- // Bail out if the destination is not a non primitive array.
+ // /* HeapReference<Class> */ temp3 = temp2->component_type_
__ LoadFromOffset(kLoadWord, temp3, temp2, component_offset);
__ CompareAndBranchIfZero(temp3, slow_path->GetEntryLabel());
__ MaybeUnpoisonHeapReference(temp3);
@@ -1518,8 +1517,10 @@
if (!did_unpoison) {
__ MaybeUnpoisonHeapReference(temp1);
}
+ // /* HeapReference<Class> */ temp1 = temp1->component_type_
__ LoadFromOffset(kLoadWord, temp1, temp1, component_offset);
__ MaybeUnpoisonHeapReference(temp1);
+ // /* HeapReference<Class> */ temp1 = temp1->super_class_
__ LoadFromOffset(kLoadWord, temp1, temp1, super_offset);
// No need to unpoison the result, we're comparing against null.
__ CompareAndBranchIfNonZero(temp1, slow_path->GetEntryLabel());
@@ -1530,8 +1531,10 @@
} else if (!optimizations.GetSourceIsNonPrimitiveArray()) {
DCHECK(optimizations.GetDestinationIsNonPrimitiveArray());
// Bail out if the source is not a non primitive array.
+ // /* HeapReference<Class> */ temp1 = src->klass_
__ LoadFromOffset(kLoadWord, temp1, src, class_offset);
__ MaybeUnpoisonHeapReference(temp1);
+ // /* HeapReference<Class> */ temp3 = temp1->component_type_
__ LoadFromOffset(kLoadWord, temp3, temp1, component_offset);
__ CompareAndBranchIfZero(temp3, slow_path->GetEntryLabel());
__ MaybeUnpoisonHeapReference(temp3);
@@ -1585,7 +1588,7 @@
temp2,
dest,
Register(kNoRegister),
- /* can_be_null */ false);
+ /* value_can_be_null */ false);
__ Bind(slow_path->GetExitLabel());
}