-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Resolve cyclic dependencies in in-place metadata initialization of value types #18214
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
Resolve cyclic dependencies in in-place metadata initialization of value types #18214
Conversation
@swift-ci Please test. |
Build failed |
cb936cd
to
ac14b77
Compare
@swift-ci Please test. |
Build failed |
Build failed |
ac14b77
to
a471111
Compare
@swift-ci Please test. |
Build failed |
Build failed |
a471111
to
1b94dc3
Compare
…t layout. The central thrust of this patch is to get these metadata initializations off of `swift_once` and onto the metadata-request system where we can properly detect and resolve dependencies. We do this by first introducing runtime support for resolving metadata requests for "in-place" initializations (committed previously) and then teaching IRGen to actually generate code to use them (this patch). A non-trivial amount of this patch is just renaming and refactoring some of existing infrastructure that was being used for in-place initializations to try to avoid unnecessary confusion. The remaining cases that are still using `swift_once` resolution of metadata initialization are: - non-generic classes that can't statically fill their superclass or have resilient internal layout - foreign type metadata Classes require more work because I'd like to switch at least the resilient-superclass case over to using a pattern much more like what we do with generic class instantiation. That is, I'd like in-place initialization to be reserved for classes that actually don't need relocation. Foreign metadata should also be updated to the request/dependency scheme before we declare ABI stability. I'm not sure why foreign metadata would ever require a type to be resolved, but let's assume it's possible. Fixes part of SR-7876.
1b94dc3
to
dc052e6
Compare
Failed to protect against |
@swift-ci Please smoke test. |
1 similar comment
@swift-ci Please smoke test. |
The central thrust of this PR is to get these metadata initializations off of
swift_once
and onto the metadata-request system where we can properly detect and resolve dependencies. We do this by first introducing runtime support for resolving metadata requests for "in-place" initializations and then teaching IRGen to actually generate code to use them.The remaining cases that are still using
swift_once
resolution of metadata initialization are:non-generic classes that can't statically fill their superclass or
have resilient internal layout
foreign type metadata
Classes require more work because I'd like to switch at least the resilient-superclass case over to using a pattern much more like what we do with generic class instantiation. That is, I'd like in-place initialization to be reserved for classes that actually don't need relocation. Maybe that doesn't work given some of our goals of allowing system classes to be updated to become Swift in the future.
Foreign metadata should also be updated to the request/dependency scheme before we declare ABI stability. I'm not sure why foreign metadata would ever require a type to be resolved, but let's assume it's possible.