Skip to content

[4.1] Outliner: Can't handle generic ObjC classes #13855

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

aschwaighofer
Copy link
Contributor

The outliner can't handle outlining calls to generic objective c
classes resulting in crashes if it attempted so.

Explanation: The outliner can't handle outlining calls to generic objective c
classes resulting in crashes if it attempted so.

Scope: Use of Osize with swift code that uses generic objective c classes results in crashes.

Risk: Low. This disables the optimization if an objective c method call is encountered that is generic. We would have crashed before this fix.

Testing: Swift CI test added

rdar://36395452

The outliner can't handle outlining calls to generic objective c
classes resulting in crashes if it attempted so.

rdar://36395452
(cherry picked from commit fe16c80)
@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@aschwaighofer
Copy link
Contributor Author

Reviewed by Erik here: #13852

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test source compatibility

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please nominate

@slavapestov
Copy link
Contributor

Can you just solve the general case? The thunk should have the same generic signature as the bridging method that its calling. It should be @pseudogeneric so that no type metadata actually gets passed at runtime. When the thunk calls the bridging method, it uses SILFunction::getForwardingSubstitutions(). When the caller calls the thunk it uses the same substitutions that it used when it used to call the bridging method directly.

In general I'm not a huge fan of this pattern in the optimizer where we say "if this and that don't attempt this optimization". While solving the general case requires a bit more thought sometimes it makes the code simpler and easier to test because there are fewer possible paths through the code.

@aschwaighofer
Copy link
Contributor Author

I don't agree that adding the code you describe would lead to simplifications. You just described the code that has to be added. This is more code than a bailout.

I agree with you that ultimately we want to add that code. But that is not going to happen for the swift-4.1-branch.

@aschwaighofer aschwaighofer merged commit edecd95 into swiftlang:swift-4.1-branch Jan 10, 2018
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.

2 participants