Unsafe.{get,put}-X-Unaligned; Efficient array comparison intrinsics
David Holmes
david.holmes at oracle.com
Sun Mar 8 23:11:54 UTC 2015
On 7/03/2015 4:50 AM, Andrew Haley wrote:
> I've tried to so everything I've been asked. If this version passes
> muster with everyone I'll Javadoc all the public methods and fields
> and put it up for RFA next week.
>
> I guess it's going to need a lot of testing and security analysis.
>
> I added versions of all {put,get} methods with the boolean bigEndian
> argument. This makes HeapByteBuffer much cleaner, and it does not
> need to know the machine endianness at all. I hope that's OK.
>
> Andrew.
>
>
> http://cr.openjdk.java.net/~aph/unaligned.hotspot.4/
> http://cr.openjdk.java.net/~aph/unaligned.jdk.4/
I think it is cleaner and more efficient if Unsafe maintains BE as an
instance variable (initialized at construction) and that isBigEndian()
simply returns that. The native check should only need to be called once
in the lifetime of the VM.
David
More information about the core-libs-dev
mailing list