-
Notifications
You must be signed in to change notification settings - Fork 10.5k
DiscardingTaskGroup
has ABI signature mismatch issue
#63060
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
Comments
DiscardingTaskGroup
has ABI signature mismatch issue
Thank you for the report, I'll look into it and ask around what we should do here. |
Passing a null result type means the task won't have a future segment at all. That should be fine (and preferred) for |
Do you think you'll be able to submit a PR here @kateinoigakukun ? Just want to confirm if you're intending to. |
@ktoso I don't think I'll be able to do it for a while, sorry 🙇 |
No worries, just needed clarity if your PoC commit was signal that you're about to fix this or not :) I'll try to make the time soon. |
rdar://104628947 |
Fixed by #66219 |
Description
There is an ABI signature mismatch in DiscardingTaskGroup introduced by #62914.
Steps to reproduce
It looks like the following example crashes in WebAssembly because of ABI signature mismatch.
It means
$sIeghH_s5Error_pIegHzo_TRTA
called byfuture_adapter
is expected to bevoid (OpaqueValue *indirectResult, SWIFT_ASYNC_CONTEXT AsyncContext *, SWIFT_CONTEXT void *);
but it actually hasvoid (SWIFT_ASYNC_CONTEXT AsyncContext *, SWIFT_CONTEXT void *)
due to void result type.This mismatch happens only when
swift_task_create
is emitted throughCreateAsyncTaskInGroup
SIL builtin function because it does not create re-abstraction thunk for its continuation function even thoughCreateAsyncTask
SIL builtin function create a thunk for it.https://github.com/apple/swift/blob/a5bcf13ea905770713e647764bbdc687ca3f2dae/lib/SILGen/SILGenBuiltin.cpp#L1567-L1571
https://github.com/apple/swift/blob/a5bcf13ea905770713e647764bbdc687ca3f2dae/lib/SILGen/SILGenBuiltin.cpp#L1608-L1609
Fortunately(?), this mismatch does not cause real problems on platforms where Swift contexts and error are allocated in reserved registers, but it causes something wrong in other platforms.
I investigated this a little bit closer, and I found
swift_task_create
supports nullfutureResultType
withnon_future_adapter
, which calls the continuation function without indirect result pointer. I thought it would be better to use this feature for DiscardingTaskGroup and where the result type is known to be void.However, it looks like no one is using this now. Do we still use this path now?
https://github.com/apple/swift/blob/4551d21375f6696ba25055ddb1a085f6bf82e6e1/stdlib/public/Concurrency/Task.cpp#L870-L879
It's not clear to me whether way (1. reabstraction thunk, 2. null
futureResultType
) I should take to fix this, so I opened this ticket to ask you @ktoso :)Expected behavior
No ABI signature mismatch.
Environment
The text was updated successfully, but these errors were encountered: