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

Fix underestimation of array length in constrainAload (0.48) #212

Merged

Conversation

dylanjtuttle
Copy link
Contributor

To this point, VP has constrained the length of an array in constrainAload to be between 0 and TR::getMaxSigned<TR::Int32>() / elementSize elements long. This was likely a due to a historical limitation. Since arrays can be longer than TR::getMaxSigned<TR::Int32>() bytes, if such an array were copied, it would fail the ArrayCopyBNDCHK, causing erroneous removal of trees that would prevent the copy from being performed. I discussed my findings during my investigation of this issue in a series of comments in openj9 #19247.

This PR increases the high bound of the constraint on the length of an array in constrainAload by using J9::ObjectModel::maxArraySizeInElements() instead, which produces a better upper bound based on the size of the heap. We already use this method in other parts of VP, like constrainArraylength.

This PR ports omr #7461 to the 0.48 release.

Fixes: openj9 #19247, openj9 #19403, openj9 #15500 (most likely)

Increase the upper bound of array length constraint in
constrainAload by taking heap size into account, fixing
erroneous failed ArrayCopyBNDCHK
@dylanjtuttle
Copy link
Contributor Author

@hzongaro I believe I did everything correctly, could you review this for me?

@dylanjtuttle dylanjtuttle changed the title Take heap size into account for high bound of array length (0.48) Fix underestimation of array length in constrainAload (0.48) Oct 3, 2024
@pshipton pshipton merged commit f8f0d78 into eclipse-openj9:v0.48.0-release Oct 3, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants