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

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

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b64

      Backports

        Description

        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.

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  Created:
                  Updated:
                  Resolved: