Skip to content

[IRGen] Fix emitPrimitiveLoadPayloadAndExtraTag for CVW #75270

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

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

drexin
Copy link
Contributor

@drexin drexin commented Jul 16, 2024

rdar://129627898

When casting the projectedBits to Int8, we accidetnally passed the base addr instead of the projectedBits. This was causing the wrong bits to be read.

@drexin drexin requested a review from rjmccall as a code owner July 16, 2024 17:27
@drexin
Copy link
Contributor Author

drexin commented Jul 16, 2024

@swift-ci smoke test

rdar://129627898

When casting the projectedBits to Int8, we accidetnally passed the base addr instead of the projectedBits. This was causing the wrong bits to be read.
@drexin
Copy link
Contributor Author

drexin commented Jul 16, 2024

@swift-ci smoke test

case x(AnyObject)
case y(Int)
case x(Int)
case y(AnyObject)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason for this change is that the bug was masked by the fact that we were using tag 0 in the test. The bug caused the first byte of the object to be read, instead of the tag byte. When this is a reference, it will always cause the tag to be read as 0, causing the test to succeed. So now we are using 1, which should make the test more reliable.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we duplicate this test and verify both declaration orders? (For the main PR only; the 6.0 cherry-pick doesn't need to wait for that.)

Copy link
Contributor

Choose a reason for hiding this comment

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

For that matter, what happens with a 257-element enum? Does that end up with a 9-bit tag?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, we only treat 1-bit tags like that, everything else uses full bytes. Yes, I can add the other order as well.

@drexin drexin merged commit c276904 into swiftlang:main Jul 16, 2024
3 checks passed
@drexin drexin deleted the wip-131798355 branch July 16, 2024 20:46
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