Skip to content

[Runtime] Remove protocol descriptor overlap #18146

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

DougGregor
Copy link
Member

In all of the places where we look into protocol descriptors in the runtime, remote AST, and remote mirrors, separate out of the code paths and data structures for Objective-C and Swift protocols. After this, there should be nothing remaining that relies on the layouts being identical (even though they still are).

…overlap.

As a small step toward splitting apart the Swift and Objective-C protocol
descriptors, eliminate most places where we rely on a shared representation.
Introduce TargetObjCProtocolPrefix, which describes just enough of the
Objective-C runtime’s Protocol structure to extract the name without
having to call Objective-C’s protocol_getName().
When reading the protocol metadata from existential type metadata,
check the “isObjC” bit and handle the reading of the Objective-C
protocol name (using TargetObjCProtocolPrefix) separately from the reading the name of a Swift protocol (using TargetProtocolDescriptor).
More preparation for separating the layout of these two entities.
We don’t want the Swift runtime knowing the layout of Objective-C
protocols. Rather, it should use protocol_getName() when it needs the
(possibly mangled) name of an Objective-C protocol. Do so in the 
runtime. The code paths that handle ObjC vs. Swift protocols will
diverge significantly soon, and “getName()” isn’t an API we expect to
need in general.

Sink TargetObjCProtocolPrefix down into MetadataReader, because
that’s the only place where we want to expose the Objective-C protocol
layout, so we can form metadata without running code.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

Bah, the last commit doesn't work.

@DougGregor
Copy link
Member Author

Superseded by #18163

@DougGregor DougGregor closed this Jul 24, 2018
@DougGregor DougGregor deleted the remove-protocol-descriptor-overlap branch July 24, 2018 00:02
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.

1 participant