Clean up VarHandles.set*() for arrays and byte array views.
This CL is a clean up for https://r.android.com/1875684. Changes:
- Use setters instead of constructor arguments.
- Rerun benchmarks and add improvements for arrays to commit message
(as aosp/1875684 forgot to mention changes for arrays).
- Do BSWAP at compile time if the argument is a constant value.
`HandleFieldSet` now can optionally perform byte swap. The function
is rewritten so that constant and non-constant values are handled in
separate branches, which makes both cases simpler.
- Add helper function `CodeGeneratorX86_64::GetInstructionCodegen` to
reduce boilerplate.
Benchmarks improvements (using benchmarks provided by
https://android-review.googlesource.com/1420959):
benchmark before aosp/1875684 now
----------------------------------------------------------------
VarHandleSetArrayElementInt 2.79 0.002
VarHandleSetArrayElementString 3.09 0.003
VarHandleSetByteArrayViewInt 2.89 0.004
VarHandleSetByteArrayViewBigEndianInt 2.89 0.004
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: I8cc37321228ffb2833a1158a75ced65f18af968e
3 files changed