Concurrency: Redo non-_f variants of swift_task_create to accept closures as is.

In their previous form, the non-`_f` variants of these entry points were unused, and IRGen
lowered the `createAsyncTask` builtins to use the `_f` variants with a large amount of caller-side
codegen to manually unpack closure values. Amid all this, it also failed to make anyone responsible
for releasing the closure context after the task completed, causing every task creation to leak.
Redo the `swift_task_create_*` entry points to accept the two words of an async closure value
directly, and unpack the closure to get its invocation entry point and initial context size
inside the runtime. (Also get rid of the non-future `swift_task_create` variant, since it's unused
and it's subtly different in a lot of hairy ways from the future forms. Better to add it later
when it's needed than to have a broken unexercised version now.)
This commit is contained in:
Joe Groff
2021-03-08 16:54:19 -08:00
parent 016496384e
commit d9798c0868
17 changed files with 213 additions and 225 deletions

View File

@@ -1813,7 +1813,6 @@ static void visitBuiltinAddress(BuiltinInst *builtin,
case BuiltinValueKind::IntInstrprofIncrement:
case BuiltinValueKind::TSanInoutAccess:
case BuiltinValueKind::CancelAsyncTask:
case BuiltinValueKind::CreateAsyncTask:
case BuiltinValueKind::CreateAsyncTaskFuture:
case BuiltinValueKind::CreateAsyncTaskGroupFuture:
case BuiltinValueKind::AutoDiffCreateLinearMapContext: