Skip to content

Fix problems with pseudogeneric thunks (3.0) #4823

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

Merged

Conversation

slavapestov
Copy link
Contributor

  • Description: There were some issues with bridging blocks taking other blocks as inputs in generic context. I believe all of these are regressions in 3.0.
  • Scope of the issue: Anybody writing code interoperating with Objective-C could be affected.
  • Risk: Medium, the code here is tricky.
  • Tested: New tests added.
  • Radar: rdar://problem/27718566

@slavapestov slavapestov force-pushed the fix-pseudogeneric-thunks-3.0 branch from 50a234f to 1e6f553 Compare September 16, 2016 02:26
@slavapestov
Copy link
Contributor Author

@jckarter Do you mind reviewing this?

@slavapestov slavapestov added this to the Swift 3.0 milestone Sep 16, 2016
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - 1e6f5533b9aba63906b1d1a014d69ecb36d8e181
Test requested by - @slavapestov

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - 1e6f5533b9aba63906b1d1a014d69ecb36d8e181
Test requested by - @slavapestov

@slavapestov slavapestov force-pushed the fix-pseudogeneric-thunks-3.0 branch from 1e6f553 to 22fd17a Compare September 16, 2016 03:03
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - 22fd17a678b59e7d08696cd4cd3e2109563113d4
Test requested by - @slavapestov

Pseudogeneric functions do not have runtime type metadata in
their closure context, so don't try to emit metadata sources
in the capture descriptor for reflection.

Also, erase generic type parameters in capture types down to
AnyObject, since the reflection library won't be able to
substitute them.
This would manifest as crashes in IRGen when bridging a block
taking another block in generic context.

- When emitting a re-abstraction thunk, make it pseudogeneric if
  its parent function is pseudogeneric. This ensures we don't
  try to get runtime type metadata when it doesn't exist.

- Mangle pseudogeneric-ness of a reabstraction thunk correctly.
  Otherwise we could emit thunks with different signatures under
  the same mangling.

- Only set the pseudogeneric attribute if the thunk has a generic
  signature, since otherwise the mangling is no longer unique.

Fixes <rdar://problem/27718566>.
@slavapestov slavapestov force-pushed the fix-pseudogeneric-thunks-3.0 branch from 22fd17a to fb073be Compare September 16, 2016 04:44
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - fb073be
Test requested by - @slavapestov

@tkremenek
Copy link
Member

@slavapestov this fails on the iOS simulator:

22:08:39 
******************** TEST 'Swift(iphonesimulator-x86_64) :: 1_stdlib/UnsafePointer.swift.gyb' FAILED ********************

@jckarter
Copy link
Contributor

Looks good, thanks for fixing this @slavapestov!

@NachoSoto
Copy link
Contributor

Thanks guys 😍

@slavapestov
Copy link
Contributor Author

@swift-ci Please test macOS

@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@tkremenek tkremenek merged commit 584c5cf into swiftlang:swift-3.0-branch Sep 20, 2016
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.

5 participants