-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Concurrency] Build executors as their own separate object modules. #76483
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
76f9f89
to
7527d31
Compare
@swift-ci Please test |
Hmmm. Looks like I've broken a few tests there :-) More to do, it seems. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAICS this looks pretty right. The new header looks good and has all the hooks I'd expect.
7527d31
to
b10687b
Compare
@swift-ci Please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To what extent is this protocol for async main (the drain / donate system) already ABI vs. just an internal detail of the concurrency library? That's the main thing that stands out to me — that we're effectively making this pseudo-ABI (admittedly still something we reserve the right to change in later releases), and we should consider what clients are likely to actually want to take over.
@rjmccall That's an interesting point. I think |
@swift-ci Please test |
cea7583
to
cdadb49
Compare
@swift-ci Please test |
Yeah, it's otherwise impossible to actually drain the queue. Okay, if |
@swift-ci Please test macOS platform |
C++ executor implementations were `#include`ed into `GlobalExecutor.cpp`, which makes it difficult to replace the global executor when using the Embedded Concurrency library. Refactor things so that they build into separate objects, which means replacing them is just a matter of writing the relevant functions yourself. rdar://135380149
`ExecutorHooks.h` is now nothing to do with hooks, so rename it. Also there are some additional functions it should declare, and a couple of places where we've slightly messed up the boundary, for instance `swift_task_asyncMainDrainQueue` was defined in `Task.cpp` rather than in the executor implementations, which is wrong, so fix that too. `CooperativeGlobalExecutor.cpp` now builds against the interface from `ExecutorImpl.h`, rather than including the all the concurrency headers. rdar://135380149
When Embedded Concurrency is enabled, install `ExecutorImpl.h` in the `include/swift` directory in the toolchain. rdar://135380149
Added an executor implementation and a test that tries to use it. Also fix up a few issues in `ExecutorImpl.h`. rdar://135380149
We were missing a field in `SwiftJob`, which broke various things. To avoid that problem in future, this PR adds a set of static asserts to check the layout of various structures and that we're using the same values as well. Also added some functions to the ABI, and fixed things so that if you enable the debug logging the library still builds (there was an extra `_` in `Actor.cpp` that caused a build failure). Finally, renamed `Hooks.cpp` to `ConcurrencyHooks.cpp`. rdar://135380149
Define `NOMINMAX` and `WIN32_LEAN_AND_MEAN` when including `<Windows.h>`. Don't export the interface from DLLs. Make sure we include `<new>` when using placement operator new. rdar://135380149
cdadb49
to
e6882f2
Compare
Rebased. |
@swift-ci Please test |
We need to use the `swift` namespace in `NonDispatchGlobalExecutor.cpp`. rdar://135380149
@swift-ci Please test |
Okay. Ideally I think that entry point would purely be an additional function offered when we build in that mode. And just in general I don't think we care about supporting any of the patching mechanisms in the embedded mode that uses this — they're really only there for the stable-ABI platforms. |
We want to split the global executor implementations out into their own separate object files, because that will allow us to provide a custom executor specific to the target platform when using Embedded Concurrency.
rdar://135380149