Skip to content

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

Merged
pshipton merged 1 commit into
eclipse-openj9:v0.48.0-releasefrom
maggietuttle:constrainAload
Oct 3, 2024
Merged

pshipton merged 1 commit into
eclipse-openj9:v0.48.0-releasefrom
maggietuttle:constrainAload

Conversation

@maggietuttle

Copy link
Copy Markdown
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
@maggietuttle

Copy link
Copy Markdown
Contributor Author

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

@maggietuttle maggietuttle 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
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