Skip to content

[Serialization] Collapse indirection in DeclContextID #26813

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 2 commits into from
Aug 27, 2019

Conversation

jrose-apple
Copy link
Contributor

...by making it a tagged union of either a DeclID or a LocalDeclContextID. This should lead to smaller module files and be slightly more efficient to deserialize, and also means that every AST entity kind is serialized in exactly one way, which allows factoring out a common loop in writing AST block entities.

I suggest reviewing each commit separately. I'm not entirely convinced the second one is worth it.

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test source compatibility

@jrose-apple
Copy link
Contributor Author

For code size

@swift-ci Please smoke benchmark

@jrose-apple
Copy link
Contributor Author

…oh wait, that is code size rather than swiftmodule size. Oh well.

@jrose-apple
Copy link
Contributor Author

Shaves 0.6% off of the stdlib compiled module for macOS, and 1% off the one for Foundation.

@swift-ci

This comment has been minimized.

@beccadax
Copy link
Contributor

What's the downside? That it replaces proven code with new code?

@jrose-apple
Copy link
Contributor Author

Mainly that there's not a good common name for the un-templated function. writeDecl is obvious; writeASTBlockEntity looks funny to me.

@jrose-apple jrose-apple force-pushed the a-more-direct-approach branch from 4cab539 to 2f73f9a Compare August 27, 2019 01:29
@jrose-apple
Copy link
Contributor Author

@varungandhi-apple, any thoughts? Think I should wait for Brent to get back?

@swift-ci Please smoke test

...by making it a tagged union of either a DeclID or a
LocalDeclContextID. This should lead to smaller module files and be
slightly more efficient to deserialize, and also means that every
AST entity kind is serialized in exactly one way, which allows for
the following commit's refactoring.
No intended functionality change (other than a small reorder).
@jrose-apple jrose-apple force-pushed the a-more-direct-approach branch from 2f73f9a to 6bd0421 Compare August 27, 2019 18:39
@jrose-apple
Copy link
Contributor Author

@swift-ci Please smoke test

@jrose-apple jrose-apple merged commit e5e48cb into swiftlang:master Aug 27, 2019
@jrose-apple jrose-apple deleted the a-more-direct-approach branch August 27, 2019 21:52
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.

5 participants