diff options
author | 2021-11-19 12:48:28 +0000 | |
---|---|---|
committer | 2021-12-06 10:13:55 +0000 | |
commit | 3322cc5ff93b83c49e694bff14a8f43c893b2ed8 (patch) | |
tree | deca812b3035d104ba0db9937dd0fbbc1f103125 /compiler/optimizing/instruction_builder.cc | |
parent | 3a50f34c84f79048dfa19b5a4a66e38a0d148a5c (diff) |
x86_64: Implement VarHandle.getAnd* for arrays and byte array views.
Benchmarks improvements (using benchmarks provided by
https://android-review.googlesource.com/1420959):
benchmark before after
----------------------------------------------------------
GetAndSetArrayElementInt 2.771 0.013
GetAndSetArrayElementDouble 2.709 0.011
GetAndSetArrayElementString 3.105 0.012
GetAndAddArrayElementInt 2.769 0.013
GetAndAddArrayElementDouble 2.713 0.011
GetAndBitwiseXorArrayElementInt 2.767 0.011
GetAndSetByteArrayViewInt 2.819 0.013
GetAndAddByteArrayViewInt 2.830 0.013
GetAndBitwiseXorByteArrayViewInt 2.822 0.012
GetAndSetByteArrayViewBigEndianInt 2.829 0.012
GetAndAddByteArrayViewBigEndianInt 2.826 0.012
GetAndBitwiseXorByteArrayViewBigEndianInt 2.824 0.012
Bug: 71781600
Test: lunch aosp_cf_x86_64_phone-userdebug \
&& art/test.py --host -r -t 712-varhandle-invocations --64
Test: Repeat with ART_USE_READ_BARRIER=false.
Test: Repeat with ART_HEAP_POISONING=true.
Change-Id: Icdc066bb5cbef7b7afe5513842ec8e1ee1d8eb94
Diffstat (limited to 'compiler/optimizing/instruction_builder.cc')
-rw-r--r-- | compiler/optimizing/instruction_builder.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc index ed760f190d..f8bf126eeb 100644 --- a/compiler/optimizing/instruction_builder.cc +++ b/compiler/optimizing/instruction_builder.cc @@ -1302,6 +1302,11 @@ static void DecideVarHandleIntrinsic(HInvoke* invoke) { if (IsVarHandleGetAndAdd(invoke) && (value_type == DataType::Type::kReference || value_type == DataType::Type::kBool)) { // We should only add numerical types. + // + // For byte array views floating-point types are not allowed, see javadoc comments for + // java.lang.invoke.MethodHandles.byteArrayViewVarHandle(). But ART treats them as numeric + // types in ByteArrayViewVarHandle::Access(). Consequently we do generate intrinsic code, + // but it always fails access mode check at runtime. optimizations.SetDoNotIntrinsify(); return; } else if (IsVarHandleGetAndBitwiseOp(invoke) && !DataType::IsIntegralType(value_type)) { |