RFR 8162458 Buffer view implementations use incorrect offset for Unsafe access

Andrew Haley aph at redhat.com
Mon Aug 15 17:15:53 UTC 2016


Hi,

On 27/07/16 12:47, Paul Sandoz wrote:

> I made an embarrassing mistake in the fix for
> 
>   https://bugs.openjdk.java.net/browse/JDK-8151163
>   All Buffer implementations should leverage Unsafe unaligned accessors
> 
> The offset calculation for Unsafe access was incorrect, it’s easy to
> get confused because for heap buffers the offset is relative to the
> array, and for direct buffers the address (which can update for
> slices/duplicates). Disturbingly all existing tests were passing
> both for core and hotspot when i pushed to hs.
> 
> As a penance i wrote a combinatorial test for buffer views to
> navigate the twisty maze of heap/direct, aligned/unaligned,
> little/big endian for accessing binary data and views from the
> source buffer.
> 
> Please review:
> 
>   http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8162458-byte-buffer-view-offset-access-incorrect/webrev/

has anyone looked at this yet?  I've just got back from my travels.

Andrew.


More information about the core-libs-dev mailing list