Skip to content
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

(0.48.0) Fall back to out-of-line call to StringUTF16.toBytes #20020

Conversation

hzongaro
Copy link
Member

The implementation of StringUTF16.toBytes will throw a NegativeArraySizeException if the specified array length is negative or an OutOfMemoryError if the length is 2^30 or greater. The IL for the inline implementation that the JIT compiler generates for that recognized method could throw a NegativeArraySizeException in situations where the actual implementation would throw an OutOfMemoryError.

This change calls the actual implementation if the array length is outside the range [0,0x3fffffff] to ensure that the behaviour is always as expected in exceptional situations.

Port of pull request #19953 to v0.48.0-release branch for issue #19309

The implementation of StringUTF16.toBytes will throw a
NegativeArraySizeException if the specified array length is negative or
an OutOfMemoryError if the length is 2^30 or greater.  The IL for the
inline implementation that the JIT compiler generates for that
recognized method could throw a NegativeArraySizeException in situations
where the actual implementation would throw an OutOfMemoryError.

This change calls the actual implementation if the array length is
outside the range [0,0x3fffffff] to ensure that the expected behaviour
always results in exceptional situations.

Signed-off-by:  Henry Zongaro <zongaro@ca.ibm.com>
This change corrects some typographical errors in the use of "fallback"
and "fall back."  When used as a noun, the correct word is fallback.
When used as a verb, it should be written "fall back"; when used as a
noun, the word is "fallback."

Signed-off-by:  Henry Zongaro <zongaro@ca.ibm.com>
@hzongaro
Copy link
Member Author

@0xdaryl, may I ask you to merge this port of the change from pull request #19953 to the 0.48.0-release branch?

@0xdaryl 0xdaryl self-assigned this Aug 20, 2024
Copy link
Contributor

@0xdaryl 0xdaryl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pshipton : FYI

@0xdaryl 0xdaryl merged commit fb38bda into eclipse-openj9:v0.48.0-release Aug 20, 2024
2 checks passed
@hzongaro hzongaro deleted the string-constructor-exception-v0.48.0 branch August 27, 2024 15:24
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