Skip to content
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

Merged
merged 3 commits into from Jul 25, 2018

Conversation

rjmccall
Copy link
Member

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.

@rjmccall
Copy link
Member Author

@swift-ci Please test.

@swift-ci
Copy link
Collaborator

Build failed
Swift Test Linux Platform
Git Sha - cb936cd937969cf5c8c43edf675297cbcae2c085

@rjmccall rjmccall force-pushed the in-place-value-metadata-dependencies branch from cb936cd to ac14b77 Compare July 25, 2018 07:38
@rjmccall
Copy link
Member Author

@swift-ci Please test.

@swift-ci
Copy link
Collaborator

Build failed
Swift Test OS X Platform
Git Sha - cb936cd937969cf5c8c43edf675297cbcae2c085

@swift-ci
Copy link
Collaborator

Build failed
Swift Test Linux Platform
Git Sha - cb936cd937969cf5c8c43edf675297cbcae2c085

@rjmccall rjmccall force-pushed the in-place-value-metadata-dependencies branch from ac14b77 to a471111 Compare July 25, 2018 17:21
@rjmccall
Copy link
Member Author

@swift-ci Please test.

@swift-ci
Copy link
Collaborator

Build failed
Swift Test OS X Platform
Git Sha - ac14b779a7036cb517d99fd99db8b7937b8a5828

@swift-ci
Copy link
Collaborator

Build failed
Swift Test Linux Platform
Git Sha - ac14b779a7036cb517d99fd99db8b7937b8a5828

…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.
@rjmccall rjmccall force-pushed the in-place-value-metadata-dependencies branch from 1b94dc3 to dc052e6 Compare July 25, 2018 19:22
@rjmccall
Copy link
Member Author

Failed to protect against protected in a Linux test; otherwise that build was clean. Just doing a smoke test this time.

@rjmccall
Copy link
Member Author

@swift-ci Please smoke test.

1 similar comment
@rjmccall
Copy link
Member Author

@swift-ci Please smoke test.

@rjmccall rjmccall merged commit a5524d2 into apple:master Jul 25, 2018
@rjmccall rjmccall deleted the in-place-value-metadata-dependencies branch July 25, 2018 20:54
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.

None yet

2 participants