Skip to content

[Runtime] Add entry point to canonicalize metadata. #32506

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

nate-chandler
Copy link
Contributor

The new function swift_getCanonicalSpecializedMetadata takes a metadata request, a prespecialized non-canonical metadata, and a cache as its arguments. The idea of the function is either to bless the provided prespecialized metadata as canonical if there is not currently a canonical metadata record for the type it describes or else to return the actual canonical metadata.

When called, the metadata cache checks for a preexisting entry for this metadata. If none is found, the passed-in prespecialized metadata is added to the cache. Otherwise, the metadata record found in the cache is returned.

Until the ability to look through a type's canonical prespecializations is added, swift_getCanonicalSpecializedMetadata can't look through the canonical prespecializations that have been created for the generic nominal type in order to return it. Consequently, it must only be called with arguments which can be statically known not to have been possible to canonically prespecialize--for example, it would be sufficient to know that one of the generic arguments is from the module in which the non-canonical prespecialization is defined.

rdar://problem/56995359

@nate-chandler nate-chandler requested a review from jckarter June 23, 2020 02:59
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 0b7141dd7e186faf864a3ec23be29b07359075cd

@nate-chandler nate-chandler force-pushed the runtime/add-swift_getCanonicalSpecializedMetadata branch from 0b7141d to bb9a7f2 Compare June 23, 2020 03:39
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

1 similar comment
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 0b7141dd7e186faf864a3ec23be29b07359075cd

@nate-chandler
Copy link
Contributor Author

@swift-ci please test windows platform

Copy link
Contributor

@jckarter jckarter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks reasonable.

The new function swift_getCanonicalSpecializedMetadata takes a metadata
request, a prespecialized non-canonical metadata, and a cache as its
arguments.  The idea of the function is either to bless the provided
prespecialized metadata as canonical if there is not currently a
canonical metadata record for the type it describes or else to return
the actual canonical metadata.

When called, the metadata cache checks for a preexisting entry for this
metadata.  If none is found, the passed-in prespecialized metadata is
added to the cache.  Otherwise, the metadata record found in the cache
is returned.

rdar://problem/56995359
@nate-chandler nate-chandler force-pushed the runtime/add-swift_getCanonicalSpecializedMetadata branch from bb9a7f2 to b0fc8da Compare July 15, 2020 22:48
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - bb9a7f292ec2e6363aeeeceac4cfe881a2c3b9e3

@nate-chandler
Copy link
Contributor Author

@swift-ci please clean test linux

@nate-chandler nate-chandler merged commit 5141219 into swiftlang:master Jul 16, 2020
@nate-chandler nate-chandler deleted the runtime/add-swift_getCanonicalSpecializedMetadata branch July 16, 2020 19:19
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.

3 participants