-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[release/9.0] Ensure the layout of StackAllocatedBox<T>
matches boxed layouts
#107075
Merged
Conversation
This file contains 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
The boxed layout of a struct always has its data at +8, as evidenced by `Object::UnBox`. This means that `StackAllocatedBox<T>` should have `Pack = 1`, otherwise this may not be the case. In the test failure we had a `StackAllocatedBox<Int128>` which had its `_value` field at offset 16. After object stack allocation this meant that we were saving data in padding of the structure, which promotion does not guarantee to preserve. Fix #106947
Tagging subscribers to this area: @mangod9 |
This comment was marked as off-topic.
This comment was marked as off-topic.
jkotas
approved these changes
Aug 28, 2024
jeffschwMSFT
approved these changes
Aug 28, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. we can merge when ready
AndyAyersMS
approved these changes
Aug 28, 2024
Open
3 tasks
This was referenced Aug 29, 2024
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.
Backport of #107050 to release/9.0
/cc @jakobbotsch
Customer Impact
The JIT may produce silent bad codegen when stack allocating a box of a type with alignment larger than 8 (such as
Int128
orVector128
). In those cases it is possible for some of the data of the struct value to be silently discarded.Regression
Rare edge case not found immediately with the stack allocation work.
Testing
Internal tests failed under a JIT stress mode (#106947). The fix was manually verified on those tests with the jit stress mode applied.
Also added assert to make other potential bugs of this flavor much more easy to discover.
Risk
Low.