RFR: 8315970: Big-endian issues after JDK-8310929 [v2]

Claes Redestad redestad at openjdk.org
Mon Sep 11 13:45:54 UTC 2023


On Mon, 11 Sep 2023 12:50:43 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:

> Your earlier version didn't work. The one which I have successfully tested is after 2nd commit.

I think this looks OK.

This patch probably reverts performance numbers on little-endian on some measures to pre-JDK-8310929 levels. A follow-up could examine if we can recuperate, e.g. differentiate the logic on big-endian, e.g. something like:

        charPos -= 2;
        if (BIG_ENDIAN) {
            putPair(..);
        } else {
            int packed = (int) StringLatin1.PACKED_DIGITS[-i];
            int inflated = ((packed & 0xFF00) << 8) | (packed & 0xFF);
            ByteArrayLittleEndian.setInt(buf, charPos << 1, inflated);
        }

        
It might also work generally if we made `int inflated = ((packed & 0xFF) << (16 + HI_BYTE_SHIFT)) | ((packed & 0xFF00) << HI_BYTE_SHIFT)`, but I have no way to test that and the performance of `ByteArrayLittleEndian` might be poor on AIX.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/15652#issuecomment-1713907279


More information about the core-libs-dev mailing list