RFR 8151163 All Buffer implementations should leverage Unsafe unaligned accessors

Paul Sandoz paul.sandoz at oracle.com
Tue Mar 8 13:06:37 UTC 2016


Hi,

Please pre-emptively review a fix to update the buffer implementations to leverage the Unsafe unaligned accessors:

  http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8151163-buffer-unsafe-unaligned-access/webrev/

  http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8151163-buffer-unsafe-unaligned-access-hotspot/webrev/

The JDK changes depend on those for the following which is in CCC review:

  https://bugs.openjdk.java.net/browse/JDK-8149469
  ByteBuffer API and implementation enhancements for VarHandles

  http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8149469-byte-buffer-align-and-unifying-enhancements/webrev/


The changes in this webrev take advantage of those for JDK-8149469 and apply the unsafe double addressing scheme so certain byte buffer view implementations can work across heap and direct buffers. This should improve the performance on x86 for:

1) direct ByteBuffers using the wider unit size method accessors; and
2) wider unit size views over heap ByteBuffers.

As a consequence Bits.java has greatly reduced in size :-)


The HotSpot changes update the test that was originally added when the heap ByteBuffer method accessors were updated to utilise unsafe unaligned access. I split the test out so as to reduce the execution time, since I doubled the amount of tests. These tests could be improved for views at various unaligned/unaligned positions in the byte buffer, but i left that for now.

I plan to push through hs-comp since JDK-8149469 will go through hs-comp.

Later on today i will kick of a JPRT hotspot test run.

—

This is a small step towards unifying the buffer implementations using the unsafe double addressing scheme:

  https://bugs.openjdk.java.net/browse/JDK-6509032

Thanks,
Paul.



More information about the core-libs-dev mailing list