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


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



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

  ByteBuffer API and implementation enhancements for VarHandles


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:



More information about the core-libs-dev mailing list