RFR 8151163 All Buffer implementations should leverage Unsafe unaligned accessors
Aleksey Shipilev
aleksey.shipilev at oracle.com
Tue Mar 8 13:37:39 UTC 2016
On 03/08/2016 04:06 PM, Paul Sandoz wrote:
> 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/
*) My concern with using double-register Unsafe calls is that compilers
are unable to speculate on (hb == null) value, which means you will have
the additional field read on the fast path. See:
https://bugs.openjdk.java.net/browse/JDK-8150921
http://cr.openjdk.java.net/~shade/8150921/notes.txt
So, while I agree that using double-register unaligned accessors are
cleaner, I'd try to special-case (bb.hb == null) case for Heap* buffers.
Current patch might still be better than going through Bits though.
> 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:
I understand the idea, but I think we would need to verify this before
pushing.
Thanks,
-Aleksey
More information about the core-libs-dev
mailing list