RFR 8157152: Atomic add for VarHandle byte[]/ByteBuffer views is incorrect for endian conversion
Vladimir Ivanov
vladimir.x.ivanov at oracle.com
Wed May 18 13:32:18 UTC 2016
Looks good.
Best regards,
Vladimir Ivanov
On 5/18/16 2:24 PM, Paul Sandoz wrote:
> Hi,
>
> Please review:
>
> http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8157152-vh-array-views-atomic-add-endianness/webrev/ <http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8157152-vh-array-views-atomic-add-endianness/webrev/>
>
> The implementation for the atomic add methods for array and byte buffer views were incorrect when the native endianness differs from the requested endianness (an embarrassing oversight).
>
> The tests did not catch this due to values used for addition, since there was no carrying over of bits from a byte to it's subsequent higher-order byte.
>
> If there is a mismatch in endianness then a weak+volatile CAS loop is used.
>
> Credit goes to Frank (Yaun) for finding this and verifying.
>
> Paul.
>
More information about the core-libs-dev
mailing list