Unsafe.{get,put}-X-Unaligned; Efficient array comparison intrinsics (original) (raw)

Andrew Haley aph at redhat.com
Thu Mar 5 08:45:45 UTC 2015


On 05/03/15 01:01, David Holmes wrote:

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 LITTLEENDIAN = false; 931 public final static boolean BIGENDIAN = true; as they won't necessarily represent "this" machine! And the usage: ! private static final ByteOrder byteOrder ! = unsafe.getByteOrder() == Unsafe.LITTLEENDIAN ? ByteOrder.LITTLEENDIAN : ByteOrder.BIGENDIAN; 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.BIGENDIAN : ByteOrder.LITTLEENDIAN;

Indeed, I was thinking of giving that method a better name. Works for me.

Andrew.



More information about the hotspot-compiler-dev mailing list