Unsafe.{get,put}-X-Unaligned performance

Vitaly Davidovich vitalyd at gmail.com
Wed Mar 11 17:41:01 UTC 2015


Also,

static boolean unaligned() {
 595         if (unalignedKnown)
 596             return unaligned; 597         unaligned =
unsafe.unalignedAccess();



 598         unalignedKnown = true;
 599         return unaligned;
 600     }

I don't think we need this unalignedKnown dance anymore -- just return
unsafe.unalignedAccess() there?

On Wed, Mar 11, 2015 at 1:39 PM, Andrew Haley <aph at redhat.com> wrote:

> On 03/11/2015 05:38 PM, Vitaly Davidovich wrote:
> > private static final ByteOrder byteOrder
> >  571         = unsafe.isBigEndian() ? ByteOrder.BIG_ENDIAN :
> ByteOrder.LITTLE_ENDIAN;
> >  572
> >  573     static ByteOrder byteOrder() {
> >  574         if (byteOrder == null)
> >  575             throw new Error("Unknown byte order");
> >  576         return byteOrder;
> >  577     }
> >  578
> >
> > No need for null check in byteOrder() anymore, right?
>
> OK, thx.
>
> Andrew.
>
>



More information about the core-libs-dev mailing list