-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[metadata prespecialization] Add canonical prespecialization to end of type descriptors. #33442
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
Previously, it was possible to alias an old LinkEntity which was marked used (i.e. in LLVMUsed) or compiler used (i.e. in LLVMCompilerUsed). The result of defining such an alias was a failure downstream when writing out the lists of globals. Here, the old value is removed from the list before it is invalidated.
@swift-ci please test |
1 similar comment
@swift-ci please test |
Build failed |
@swift-ci please test |
Build failed |
Build failed |
e0da2f8
to
7069f4b
Compare
@swift-ci please test |
Previously, a call to emitMethodLookupFunction or emitDispatchThunk would always simply emit a function, even if it had previously been emitted. That was a problem since these emissions are triggered by emitting class type context descriptors which can now be lazily reemitted upon encountering prespecialized metadata. Here, that behavior is changed to delete the old body, if any, before emitting the body again.
Previously, emitting the descriptor for a nonoverride method always simply emitted, even if it had previously been emitted. That was not a problem before, but is now that class type context descriptors can be reemitted upon encountering metadata prespecializations. Here, the behavior is changed to delete the old definition before emitting the new definition.
The attachment of the canonical prespecializations to the generic type will enable runtime functions to look through the canonical prespecializations in order to return them (getGenericMetadata) and register them with the runtime (getSpecializedGenericMetadata).
The metadata accessor and type context descriptor for a nominal type both depend on canonical metadata--the former because it returns those metadata, the latter because it has them as trailing objects. Here, the work is done to reemit those values when new canonical prespecialized metadata are encountered.
Previously, noncanonical records were only allowed if one of the arguments was from the module where the record was to be emitted. Here, that restriction is lifted. Now getSpecializedGenericMetadata will, on first run, register all canonical metadata with the global cache before attempting to bless the passed-in noncanonical record, allowing noncanonical records to be for the same arguments as a canonical record (since in the case that a canonical record does exist, it will be returned).
7069f4b
to
5114f22
Compare
@swift-ci please test |
1 similar comment
@swift-ci please test |
@swift-ci please test windows |
Build failed |
Build failed |
@swift-ci please test |
Build failed |
Build failed |
@swift-ci please test macos |
@swift-ci please test windows |
Enumerating the canonical prespecializations at the end of the type descriptors enables both (1) lifting one of the limitations on cross-module prespecializations and also (2) lifting the logic for iterating through the canonical prespecializations from individual metadata accessors into getGenericMetadata.