-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Let indirect enum cases export spare bits #77062
Conversation
To determine the correct enum layout, we first count various categories of cases. Before, we counted indirect generic cases as "generic", but regular "generic" cases can't export spare bits. Change this to count "indirect" cases as a separate category. In particular, this ensures that fully-indirect enums use spare bits from the pointers even when some or all of the cases are generic. Resolves rdar://133890406
@swift-ci Please test |
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
…c indirect vs. non-generic indirect. Counting indirect cases as regular non-empty cases is a better fit.
// CHECK64-NEXT: (class_instance size=24 alignment=8 stride=24 num_extra_inhabitants=0 bitwise_takable=1 | ||
// CHECK64-NEXT: (field name=outer offset=16 | ||
// x86_64 and arm64 have different spare bit pointer masks, hence different numbers of extra inhabitants here | ||
// CHECK64-NEXT: (multi_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants={{[0-9]+}} bitwise_takable=1 |
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.
More trivia.
@swift-ci Please test |
@swift-ci smoke test |
@augusto2112 -- These changes need a full test, not just a smoke test, since the reflection tests are all under "validation-test" which isn't run for a smoke test. |
@tbkka I think you need to run smoke test to merge anyway, which is why I ran it :) |
@augusto2112 A full test run will clear the smoke test check as well, so no need to run both. |
@drexin oh cool, I didn't know that, I always thought you needed to run both |
Determining whether a particular case is "generic" is a lot more complex than this credits. Need to rethink the whole approach here. |
On further consideration: This isn't a complete solution, since "generic" needs more work, but it does solve this specific case well enough to be landed. |
@swift-ci Please test |
To determine the correct enum layout, we first count various categories of cases. Before, we counted indirect generic cases as "generic", but regular "generic" cases can't export spare bits.
Change this to count "indirect" cases as a separate category. In particular, this ensures that fully-indirect enums use spare bits from the pointers even when some or all of the cases are generic.Edited: A better approach is to treat indirect cases as non-generic & non-empty. Non-empty should be obvious. Non-generic because this code uses "generic" as a flag for whether to consider spare bits -- generic cases never export spare bits. Indirect cases always do, because of the pointer.
Resolves rdar://133890406