Unsafe.{get,put}-X-Unaligned; Efficient array comparison intrinsics
David Holmes
david.holmes at oracle.com
Thu Mar 5 01:01:10 UTC 2015
I'm only glancing at parts of this ...
On 5/03/2015 6:21 AM, Andrew Haley wrote:
> John's suggestion works well; the code is smaller and neater.
>
> http://cr.openjdk.java.net/~aph/unaligned.jdk.3/
This doesn't make sense to me:
929 // The byte ordering of this machine
930 public final static boolean LITTLE_ENDIAN = false;
931 public final static boolean BIG_ENDIAN = true;
as they won't necessarily represent "this" machine! And the usage:
! private static final ByteOrder byteOrder
! = unsafe.getByteOrder() == Unsafe.LITTLE_ENDIAN ?
ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN;
suggests getByteorder() is really isBigEndian() (which the hotspot part
confirms) - so then the two constants can be removed completely:
private static final ByteOrder byteOrder
= unsafe.isBigEndian() ? ByteOrder.BIG_ENDIAN :
ByteOrder.LITTLE_ENDIAN;
David
-----
> http://cr.openjdk.java.net/~aph/unaligned.hotspot.3/hotspot.patch
>
> Andrew.
>
More information about the core-libs-dev
mailing list