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.21.0) Fix Power ArrayCopyBNDCHK handling of negative constants #10163

Conversation

aviansie-ben
Copy link
Contributor

@aviansie-ben aviansie-ben commented Jul 14, 2020

Previously, the Power codegen's evaluator for ArrayCopyBNDCHK implicitly
assumed that neither of its children was a negative constant by failing
to check them against LOWER_IMMED when generating cmpi/twi instructions.
This could result in incorrect behaviour if exactly one of the children
is a constant which happens to be less than LOWER_IMMED. Prior to the
binary encoder refactor, this would result in the immediate being
silently truncated to 16 bits. This can cause the check to behave
incorrectly and can cause the bound check to pass when it shouldn't.

This has now been corrected by adding the necessary checks of constant
values against LOWER_IMMED.

Signed-off-by: Ben Thomas [email protected]

Cherry pick of #10162 for the 0.21.0 release.

Previously, the Power codegen's evaluator for ArrayCopyBNDCHK implicitly
assumed that neither of its children was a negative constant by failing
to check them against LOWER_IMMED when generating cmpi/twi instructions.
This could result in incorrect behaviour if exactly one of the children
is a constant which happens to be less than LOWER_IMMED. Prior to the
binary encoder refactor, this would result in the immediate being
silently truncated to 16 bits. This can cause the check to behave
incorrectly and can cause the bound check to pass when it shouldn't.

This has now been corrected by adding the necessary checks of constant
values against LOWER_IMMED.

Signed-off-by: Ben Thomas <[email protected]>
@pshipton pshipton self-assigned this Jul 14, 2020
@pshipton pshipton merged commit 34cf4c0 into eclipse-openj9:v0.21.0-release Jul 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants