[Concurrency] Implement a builtin createAsyncTask() to create a new task.

`Builtin.createAsyncTask` takes flags, an optional parent task, and an
async/throwing function to execute, and passes it along to the
`swift_task_create_f` entry point to create a new (potentially child)
task, returning the new task and its initial context.
This commit is contained in:
Doug Gregor
2020-11-07 21:21:16 -08:00
parent b43eab419a
commit 4c2c2f32e9
16 changed files with 171 additions and 7 deletions

View File

@@ -602,6 +602,10 @@ IRGenModule::IRGenModule(IRGenerator &irgen,
/*isVarArg*/ false);
TaskContinuationFunctionPtrTy = TaskContinuationFunctionTy->getPointerTo();
AsyncTaskAndContextTy = createStructType(
*this, "swift.async_task_and_context",
{ SwiftTaskPtrTy, SwiftContextPtrTy });
DifferentiabilityWitnessTy = createStructType(
*this, "swift.differentiability_witness", {Int8PtrTy, Int8PtrTy});
}