-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8315970: Big-endian issues after JDK-8310929 #15652
Conversation
👋 Welcome back wenshao! A progress list of the required criteria for merging this PR into |
Filed https://bugs.openjdk.org/browse/JDK-8315970 for this. |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest backing out the whole commit and resumitting after the fix and more complete testing.
I don't have a big endian environment so I can't test it. I need help from @TheRealMDoerr |
|
||
private static int inflatePacked(int v) { | ||
int packed = (int) StringLatin1.PACKED_DIGITS[v]; | ||
return ((packed & 0xFF) << HI_BYTE_SHIFT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is correct.
Compare StringUTF16::putChar
where these constants are used to shift right to extract the equivalent byte from a value:
val[index++] = (byte)(c >> HI_BYTE_SHIFT);
val[index] = (byte)(c >> LO_BYTE_SHIFT);
I.e., when inflating a byte
0xaa
to a char
encoded into a byte[]
we end up with 0xaa00
on big-endian. Inflating a short
literal 0xaabb
encoding two chars logically I think will need to consider each byte in isolation, ending up with 0xaa00bb00
(in little-endian notation). Or maybe it's 0xbb00aa00
. Ugh..
Since HI_BYTE_SHIFT
is 8 on big-endian and 0 on little-endian I guess this might just work:
return ((packed & 0xFF) << 16 + HI_BYTE_SHIFT) | ((packed & 0xFF00) << HI_BYTE_SHIFT)
.. but we really need to re-examine, prototype and test this out thoroughly on a big-endian system. I second @RogerRiggs notion that the best course of action right now is to back out #14699 and redo it with big-endianness issues resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also not sure if this PR is correct.
Could it be caused by using VarHandle/ByteArrayLittleEndian? |
This helps. I'll run more tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks reasonable. The tests have passed on linux Big Endian and AIX. Thanks for fixing it so quickly. (Otherwise, backout and re-do would have been a good option as well.)
|
@wenshao This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 28 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@RogerRiggs, @TheRealMDoerr) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
@TheRealMDoerr |
Your earlier version didn't work. The one which I have successfully tested is after 2nd commit. |
/integrate |
GHA Pre-submit test results look good. Tests on AIX as well. Let's ship it! |
Going to push as commit 4cb4637.
Your commit was automatically rebased without conflicts. |
@TheRealMDoerr @wenshao Pushed as commit 4cb4637. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
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:
It might also work generally if we made |
Shouldn't this get optimized by the JIT compilers? Why is |
It will be faster to use ByteArrayLittle or ByteArrayLittleEndian. ByteArrayLittleEndian has an Integer.reverseBytes operation under the bigendian endian platform. |
And none of these are covered by Oracle-internal or GHA testing, sadly. It'd be interesting to see performance numbers for |
https://bugs.openjdk.org/browse/JDK-8310929
@TheRealMDoerr Feedback:
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/15652/head:pull/15652
$ git checkout pull/15652
Update a local copy of the PR:
$ git checkout pull/15652
$ git pull https://git.openjdk.org/jdk.git pull/15652/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 15652
View PR using the GUI difftool:
$ git pr show -t 15652
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/15652.diff
Webrev
Link to Webrev Comment