arm, arm64: Unpoison byte array view class reference before comparison.
Varhandle class reference needs to be unpoisoned before it gets compared
to the byte array view class reference from the boot image returned by
`LoadClassRootForIntrinsic`. This was missing in the CLs that added
varhandle intrinsics for byte array views and resulted in byte array
views handled by the slow path if poisoning is enabled:
- https://r.android.com/1535201 (arm64)
- https://r.android.com/1555075 (arm)
Bug: 71781600
Test: Ran benchmarks provided by https://r.android.com/1420959 with
ART_HEAP_POISONING=true before and after the change, observed improved
run time for byte array views (on sargo, arm64):
before after
-------------------------------------------
GetByteArrayViewInt 9.86 0.074
SetByteArrayViewInt 10.07 0.074
GetByteArrayViewBigEndianInt 10.40 0.077
SetByteArrayViewBigEndianInt 10.07 0.077
Test: art/test.py --target -r -t 712-varhandle-invocations
Test: same with ART_HEAP_POISONING=true
Change-Id: Ie776b44759df642d3227a64b824caa0b21ffd5e6
diff --git a/compiler/optimizing/intrinsics_arm64.cc b/compiler/optimizing/intrinsics_arm64.cc
index 4fcea2e..dcdab10 100644
--- a/compiler/optimizing/intrinsics_arm64.cc
+++ b/compiler/optimizing/intrinsics_arm64.cc
@@ -5523,6 +5523,7 @@
// the class of the actual coordinate argument but it does not match the value type.
// Check if the `varhandle` references a ByteArrayViewVarHandle instance.
__ Ldr(temp, HeapOperand(varhandle, class_offset.Int32Value()));
+ codegen->GetAssembler()->MaybeUnpoisonHeapReference(temp);
codegen->LoadClassRootForIntrinsic(temp2, ClassRoot::kJavaLangInvokeByteArrayViewVarHandle);
__ Cmp(temp, temp2);
__ B(GetEntryLabel(), ne);
diff --git a/compiler/optimizing/intrinsics_arm_vixl.cc b/compiler/optimizing/intrinsics_arm_vixl.cc
index 098ad6d..53e3886 100644
--- a/compiler/optimizing/intrinsics_arm_vixl.cc
+++ b/compiler/optimizing/intrinsics_arm_vixl.cc
@@ -5416,6 +5416,7 @@
// the class of the actual coordinate argument but it does not match the value type.
// Check if the `varhandle` references a ByteArrayViewVarHandle instance.
__ Ldr(temp, MemOperand(varhandle, class_offset.Int32Value()));
+ codegen->GetAssembler()->MaybeUnpoisonHeapReference(temp);
codegen->LoadClassRootForIntrinsic(temp2, ClassRoot::kJavaLangInvokeByteArrayViewVarHandle);
__ Cmp(temp, temp2);
__ B(ne, GetEntryLabel());