-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Use known instance size and alignment across module boundaries #18464
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
Use known instance size and alignment across module boundaries #18464
Conversation
if (isa<MissingMemberDecl>(field)) | ||
return true; | ||
|
||
return false; |
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.
What about resilient modules?
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.
Resilience is handled elsewhere -- there's an isResilient() check too. I didn't want to conflate it with 'has missing members'.
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.
Makes sense. Do we have enough information to assert that here? That would assuage my fears of doing the wrong thing after a refactoring.
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.
Maybe, but we effectively call both classHasIncompleteLayout() and isResilient() and OR the results together. I'll see about adding better asserts as I refactor the code more; for now I don't want to change classHasIncompleteLayout(), I'm just moving it to a different place in the file.
96678fe
to
84aa4a4
Compare
Asking isFixedLayout() on the class's StructLayout does not take missing members or Objective-C sliding into account. Adding a new bit that carries this information allows removing the hack where across modules the size of a class was always loaded from metadata. In practice we hope most classes will be resilient, but its better to centralize the checking for what resilience means instead of using different rules in different places.
84aa4a4
to
bee6b09
Compare
@swift-ci Please smoke test |
1 similar comment
@swift-ci Please smoke test |
@swift-ci Please test |
Build failed |
Follow-up to #18463. Removes another bogus case where we would fall back to the resilient pattern when a class came from a different module, after fixing the missing member case to do the right thing.