Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8026049

(bf) Intrinsify ByteBuffer.put{Int,Double,Float,...} methods

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 9
    • core-libs
    • b64

        I think the issue can also be solved with VM intrinsics, but it seems simpler to do it with s.m.Unsafe. Current code for non-byte ByteBuffer calls all the way down to Bits, which does:

            static void putIntB(ByteBuffer bb, int bi, int x) {
                bb._put(bi , int3(x));
                bb._put(bi + 1, int2(x));
                bb._put(bi + 2, int1(x));
                bb._put(bi + 3, int0(x));
            }

        The compiler is known to produce distinct writes in these cases. It is beneficial to replace byte-wide stores into the full-width stores. The caveats include: misaligned reads/writes, handling endianness, etc.

              aph Andrew Haley
              shade Aleksey Shipilev
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: