Initial Task Executor implementation Task(on:), addTask(on:) etc. (#68793)

Co-authored-by: John McCall <rjmccall@gmail.com>
This commit is contained in:
Konrad `ktoso` Malawski
2023-12-12 17:14:24 +09:00
committed by GitHub
parent 7a3e3aea15
commit 828f589be4
68 changed files with 2680 additions and 277 deletions

View File

@@ -35,6 +35,16 @@ public struct X {
public func launchRocker<T>(closure: @escaping () async throws -> T) {
_ = Builtin.createAsyncTask(0, closure)
}
// CHECK-LABEL: sil hidden [ossa] @$s4test1XV24launchFutureWithExecutor_8executoryx_BetlF : $@convention(method) <T> (@in_guaranteed T, Builtin.Executor, X) -> () {
func launchFutureWithExecutor<T>(_ value: T, executor: Builtin.Executor) {
// CHECK: bb0([[ZERO:%[0-9]+]] : $*T, [[EXECUTOR:%[0-9]+]] : $Builtin.Executor, [[TWO:%[0-9]+]] : $X):
// CHECK: [[TASK:%[0-9]+]] = builtin "createAsyncTaskWithExecutor"<T>([[NINE:%[0-9]+]] : $Int, [[EXECUTOR]] : $Builtin.Executor, [[TYPE:%[0-9]+]] : $@thick any Any.Type, [[FN:%[0-9]+]] : $@async @callee_guaranteed @substituted <τ_0_0> () -> (@out τ_0_0, @error any Error) for <T>) : $(Builtin.NativeObject, Builtin.RawPointer)
_ = Builtin.createAsyncTaskWithExecutor(0, executor) { () async throws -> T in
return value
}
}
}
// CHECK-LABEL: sil [ossa] @$s4test26usesWithUnsafeContinuationyyYaF : $@convention(thin) @async () -> () {