Skip to content

Conversation

@jakobbotsch
Copy link
Member

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

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
@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Aug 27, 2024
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)));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hit assert inside JitType2PreciseVarType with JitDump enabled while investigating -- this fixes the problem.

@jakobbotsch
Copy link
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.

@jakobbotsch jakobbotsch merged commit 7ff684a into dotnet:main Aug 28, 2024
@jakobbotsch jakobbotsch deleted the fix-106947 branch August 28, 2024 09:16
@jakobbotsch
Copy link
Member Author

/backport to release/9.0

@github-actions
Copy link
Contributor

Started backporting to release/9.0: https://github.com/dotnet/runtime/actions/runs/10593809747

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
@github-actions github-actions bot locked and limited conversation to collaborators Sep 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test failure: System.Text.Json.SourceGeneration.Tests.NumberHandlingTests_Default.Number_AsRootType_RoundTrip

3 participants