-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[GSB] Centralize, clean up, and cache nested type name lookup #12097
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
DougGregor
merged 9 commits into
swiftlang:master
from
DougGregor:gsb-nested-type-lookup
Sep 25, 2017
Merged
[GSB] Centralize, clean up, and cache nested type name lookup #12097
DougGregor
merged 9 commits into
swiftlang:master
from
DougGregor:gsb-nested-type-lookup
Sep 25, 2017
Conversation
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
We had two similar loops that performed name lookup for nested types on a potential archetype, so consolidate those into a single implementation on the equivalence class itself.
The full state of the GSB isn’t all that useful for testing, creates a ton of noise and gets in the way of some cleanups we’d like to make in the interface. Stop dumping it as part of `-debug-generic-signatures`.
Funnel all places where we create a generic signature builder to compute the generic signature through a single entry point in the GSB (`computeGenericSignature()`), and make `finalize` and `getGenericSignature` private so no new uses crop up. Tighten up the signature of `computeGenericSignature()` so it only works on GSB rvalues, and ensure that all clients consider the GSB dead after that point by clearing out the internal representation of the GSB.
It’s small and straightforward. NFC
These only occur with canonicalized builders in invalid code; it’s not worth having them slip out.
The GSB performs repeated lookups of the same nested type (by name) within a given equivalence class. Cache the results of this lookup.
…type(). The type checker shouldn’t know about potential archetypes. Use GenericSignatureBuilder::resolveEquivalenceClass() and perform the lookup into that instead. The test case change highlights an existing problem with generic signature minimization.
@swift-ci please smoke test and merge |
@swift-ci please smoke test and merge |
1 similar comment
@swift-ci please smoke test and merge |
Foundation/NSData.swift:19:8: error: module file was created by an older version of the compiler; rebuild 'Dispatch' and try again: |
@swift-ci please clean smoke test Linux |
1 similar comment
@swift-ci please clean smoke test Linux |
This was referenced Sep 25, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Handle all name lookup for nested types of generic types through the equivalence class, rather than relying on depending on which potential archetypes have been constructed and returning the first one. Introduce caching of that lookup to improve compile-time performance (5% of type-checking time for the standard library).