-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Serialization] Drop GenericEnvironmentID for GenericSignatureID #26862
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
@swift-ci Please test |
@swift-ci Please test source compatibility |
@swift-ci Please smoke test compiler performance |
Mm, does that mean that the environments were deserialized eagerly or that they were de-duplicated better? :-/ |
@varungandhi-apple The new code makes a lot more sense, check it out. @swift-ci Please test |
Build failed |
Build failed |
@swift-ci Please test |
Build failed |
Build failed |
4065988
to
1556c06
Compare
@swift-ci Please test macOS |
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.
A generic environment is always serialized as a GenericSignature with a lazily-recreated environment, though sometimes it has to include extra info specifically for generic environments used by SIL. The code that was doing this claimed a bit for disambiguating between the two, shrinking the permitted size of a compiled module from 2^31 bits to 2^30. (The code isn't just needlessly complicated; GenericEnvironments used to be serialized with more information.) Rather than have two representations for GenericEnvironmentID, this commit just drops it altogether in favor of referencing GenericSignatures directly. This causes a negligible file size shrinkage for swiftmodules in addition to eliminating the problematic disambiguation bit. For now, the Deserialization logic will continue to cache GenericEnvironments that are used directly by Deserialization, but really that should probably be done at the AST level. Then we can simplify further to ModuleFile tracking a plain list of GenericSignatures.
Passed full tests already before the merge conflicts. @swift-ci Please smoke test |
Built on top of #26813 for now (only the last commit is relevant). Prompted by this FIXME I noticed recently (added in #26800).
A generic environment is always serialized as a GenericSignature with a lazily-recreated environment, though sometimes it has to include extra info specifically for generic environments used by SIL. The code that was doing this claimed a bit for disambiguating between the two, shrinking the permitted size of a compiled module from 2^31 bits to 2^30. (The code isn't just needlessly complicated; GenericEnvironments used to be serialized with more information.)
Rather than have two representations for GenericEnvironmentID, this commit serializes generic signatures and "special SIL generic environments" in the same list, automatically picking the most compact representation, and makes sure the right type always comes out on the deserialization side.Rather than have two representations for GenericEnvironmentID, this commit just drops it altogether in favor of referencing GenericSignatures directly. This causes a negligible file size shrinkage for swiftmodules in addition to eliminating the problematic disambiguation bit.For now, the Deserialization logic will continue to cache GenericEnvironments that are used directly by Deserialization, but really that should probably be done at the AST level. Then we can simplify further to ModuleFile tracking a plain list of GenericSignatures.