Skip to content

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

Conversation

slavapestov
Copy link
Contributor

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.

if (isa<MissingMemberDecl>(field))
return true;

return false;
Copy link
Contributor

Choose a reason for hiding this comment

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

What about resilient modules?

Copy link
Contributor Author

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'.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@slavapestov slavapestov force-pushed the remove-another-unnecessarily-resilient-access-pattern branch from 96678fe to 84aa4a4 Compare August 3, 2018 02:40
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.
@slavapestov slavapestov force-pushed the remove-another-unnecessarily-resilient-access-pattern branch from 84aa4a4 to bee6b09 Compare August 3, 2018 02:42
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented Aug 3, 2018

Build failed
Swift Test OS X Platform
Git Sha - bee6b09

@slavapestov slavapestov merged commit 937f009 into swiftlang:master Aug 3, 2018
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.

3 participants