-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Serialization: Stop reading control block early on version mismatch and fix current control block ordering #73828
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
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9779806
Serialization: Stop reading the control block if the format version d…
xymus 76e7fa9
Serialization: Move the distribution channel to the end of the contro…
xymus 998a40a
Serialization: Move SDK version to the end of the control block enum
xymus ab6a701
Merge branch 'main' into serial-fix-control-block
xymus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
As I said in the other PR, not sure about how any of this work, I just want to understand the consequences of this change. Wouldn't this make working with a compiler from
main
impossible to use against files compiled with previous compilers? That would make using.swiftmodule
files distributed by Xcode not valid, wouldn't it? Before this I think old files were still mostly compatible.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.
This won't change the current behavior. I would not expect a main compiler to be able to use swiftmodules built by any compiler older than a week or so. If that swiftmodule has a different serialization format it would have been rejected already.
The main content of swiftmodule files have very limited compatibility as they are designed to be a local cache. In theory they should only be read by the exact same compiler that wrote them, and in the exact same context. That's why any distributed modules should use swiftinterfaces. And the only swiftmodules shipped with Xcode are only the prebuilt cache, they can all be rebuilt from swiftinterfaces in a similar manner by newer compilers.
So any swiftmodule with a different serialization format version are rejected. swiftmodule files are also rejected between released compilers with a different tag. We leave some room for dev compilers, just to avoid rebuilding the stdlib all the time during development.
As you pointed out, the control block should be compatible with different compilers. But as soon as we know it should be rejected it's safe to skip reading the rest of the information.