-
Notifications
You must be signed in to change notification settings - Fork 10.5k
SwiftCompilerSources: rework bridging #69039
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
@swift-ci test |
Looking forward to trying the pure mode on Android, which still has problems with C++ Interop. |
@swift-ci clean smoke test linux |
@swift-ci clean test linux |
`ForeignAsyncConvention.h` and `ForeignErrorConvention.h` must be included in `Decl.h`, because those types are used in an `llvm::Optional` in `Decl.h`.
Introduce two modes of bridging: * inline mode: this is basically how it worked so far. Using full C++ interop which allows bridging functions to be inlined. * pure mode: bridging functions are not inlined but compiled in a cpp file. This allows to reduce the C++ interop requirements to a minimum. No std/llvm/swift headers are imported. This change requires a major refactoring of bridging sources. The implementation of bridging functions go to two separate files: SILBridgingImpl.h and OptimizerBridgingImpl.h. Depending on the mode, those files are either included in the corresponding header files (inline mode), or included in the c++ file (pure mode). The mode can be selected with the BRIDGING_MODE cmake variable. By default it is set to the inline mode (= existing behavior). The pure mode is only selected in certain configurations to work around C++ interop issues: * In debug builds, to workaround a problem with LLDB's `po` command (rdar://115770255). * On windows to workaround a build problem.
Putting it into a separate source file OptimizerBridging.cpp caused linker errors for sourcekitd-test in sourcekit tests on linux.
07a29a0
to
3a0f635
Compare
@swift-ci test |
@eeckstein, I was able to get bootstrapping with hosttools working natively on Android after setting this bridging mode to pure with the Oct. 14 trunk source snapshot. I'm going to try it with cross-compilation and the full bootstrap next. Any plans to backport these three bridging pulls you just added to 5.10? |
Nice!
Sorry, no. At this time it's not possible |
How so? If you simply don't have the time, do you mind if I backport these changes and submit them to the 5.10 branch myself? |
The bar is already very high for cherry picking changes to 5.10. |
OK, got it. I will simply backport it and use it locally for my upcoming native Swift 5.10 toolchain for Android instead. |
Introduce two modes of bridging:
This change requires a major refactoring of bridging sources. The implementation of bridging functions go to two separate files: SILBridgingImpl.h and OptimizerBridgingImpl.h.
Depending on the mode, those files are either included in the corresponding header files (inline mode), or included in the c++ file (pure mode).
The mode can be selected with the BRIDGING_MODE cmake variable. By default it is set to the inline mode (= existing behavior). The pure mode is only selected in certain configurations to work around C++ interop issues:
po
command (rdar://115770255).