Repository navigation
Change return type of TR_FrontEnd::getStringUTF8Length to int32_t - #7620
Merged
Merged
Conversation
Contributor
Author
|
@jdmpapin, may I ask you to review this change along with the corresponding downstream changes in OpenJ9 pull request eclipse-openj9/openj9#21005? |
A String object that might consist of up to 2^31-1 chars could require up to three times as many bytes as chars to be encoded in UTF-8. The current return type of getUTF8StringLength - intptr_t - is unable to correctly represent all valid lengths in 32-bit mode. This change makes the return type of the existing TR_FrontEnd::getStringUTF8Length method int32_t. It must only be used in situations where it is known that the UTF-8 encoded length of the String will not exceed 2^31-1 bytes. This change also introduces a new getUTF8StringUnabbreviatedLength method whose return type of uint64_t is able to represent all possible UTF-8 encoded string lengths. Signed-off-by: Henry Zongaro <zongaro@ca.ibm.com>
hzongaro
force-pushed
the
long-utf8-string-length
branch
from
February 3, 2025 14:10
066d695 to
4906d18
Compare
jdmpapin
approved these changes
Feb 3, 2025
Contributor
|
Jenkins build all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
Stringobject that might consist of up to 231-1 chars could require up to three times as many bytes as chars to be encoded in UTF-8. The current return type ofgetUTF8StringLength-intptr_t- is unable to correctly represent all valid lengths in 32-bit mode.This change makes the return type of the existing
TR_FrontEnd::getStringUTF8Lengthmethodint32_t. It must only be used in situations where it is known that the UTF-8 encoded length of the String will not exceed 231-1 bytes.This change also introduces a new
getUTF8StringUnabbreviatedLengthmethod whose return type ofuint64_tis able to represent all possible UTF-8 encoded string lengths.