Ensure the layout of StackAllocatedBox<T> matches boxed layouts#107050
Merged
jakobbotsch merged 3 commits intodotnet:mainfrom Aug 28, 2024
Merged
Ensure the layout of StackAllocatedBox<T> matches boxed layouts#107050jakobbotsch merged 3 commits intodotnet:mainfrom
StackAllocatedBox<T> matches boxed layouts#107050jakobbotsch merged 3 commits intodotnet:mainfrom
Conversation
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 dotnet#106947
jakobbotsch
commented
Aug 27, 2024
src/coreclr/jit/valuenum.cpp
Outdated
| CorInfoType baseJitType = (CorInfoType)ConstantValue<int>(simdType->m_args[1]); | ||
|
|
||
| printf("%s(simd%d, %s)", VNFuncName(simdType->m_func), simdSize, varTypeName(JitType2PreciseVarType(baseJitType))); | ||
| printf("%s(simd%d, %s)", VNFuncName(simdType->m_func), simdSize, baseJitType == TYP_UNDEF ? varTypeName(TYP_UNDEF) : varTypeName(JitType2PreciseVarType(baseJitType))); |
Member
Author
There was a problem hiding this comment.
I hit assert inside JitType2PreciseVarType with JitDump enabled while investigating -- this fixes the problem.
jkotas
approved these changes
Aug 27, 2024
AndyAyersMS
approved these changes
Aug 27, 2024
Member
Author
|
/ba-g There are no machines in the Helix queue for Ubuntu.2204.amd64.open.rt, so the jobs are going to time out. There is current investigation happening about the issue. |
Member
Author
|
/backport to release/9.0 |
Contributor
|
Started backporting to release/9.0: https://github.com/dotnet/runtime/actions/runs/10593809747 |
4 tasks
jtschuster
pushed a commit
to jtschuster/runtime
that referenced
this pull request
Sep 17, 2024
…tnet#107050) 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 dotnet#106947
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
The boxed layout of a struct always has its data at +8, as evidenced by
Object::UnBox. This means thatStackAllocatedBox<T>should havePack = 1, otherwise this may not be the case. In the test failure we had aStackAllocatedBox<Int128>which had its_valuefield at offset16. 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