Skip to content

(0.44) Use signed comparisons for Latin-1 encoded indexOf in VP #19444

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

Conversation

hzongaro
Copy link
Member

@hzongaro hzongaro commented May 3, 2024

The implementations of String.indexOf operations cast the target char to a byte if Latin-1 encoded Strings are involved. The value might be cast to type byte by the caller or in the implementation itself, depending on the JDK version.

Value Propagation has to ensure that it uses signed byte comparisons if it transforms an indexOf involving a known String to replicate the run-time behaviour that otherwise would have resulted, regardless of JDK version.

Port of OpenJ9 pull request #19428 to v0.44.0-release branch.

Fixes: #18974

The implementations of String.indexOf operations cast the target char to
a byte if Latin-1 encoded Strings are involved.  The value might be cast
to type byte by the caller or in the implementation itself, depending on
the JDK version.

Value Propagation has to ensure that it uses signed byte comparisons if
it transforms an indexOf involving a known String to replicate the
run-time behaviour that otherwise would have resulted, regardless of
JDK version.
@hzongaro
Copy link
Member Author

hzongaro commented May 3, 2024

@pshipton, may I ask you to merge this change to the v0.44.0-release branch?

@hzongaro
Copy link
Member Author

hzongaro commented May 3, 2024

For some reason the link to the Line Endings Check appears to be for the bad pull request #19443 I had opened and closed just before I opened this one. The actual Line Endings Check for this pull request was successful.

@pshipton pshipton changed the title Use signed comparisons for Latin-1 encoded indexOf in VP (0.44) Use signed comparisons for Latin-1 encoded indexOf in VP May 3, 2024
@pshipton pshipton merged commit 85b3f7c into eclipse-openj9:v0.44.0-release May 3, 2024
1 of 2 checks passed
@hzongaro hzongaro deleted the indexOf-latin1-encoded-0.44 branch May 3, 2024 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants