Last active
May 4, 2024 10:37
-
-
Save kntkymt/3f8af33b98f238128a0eba638b74b81d to your computer and use it in GitHub Desktop.
`withUnsafeContinuation` doesn't inherit Actor Context SIL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TOOLCHAINS=org.swift.600202404301a swiftc -emit-sil main.swift | |
sil_stage canonical | |
import Builtin | |
import Swift | |
import SwiftShims | |
import Foundation | |
@MainActor func doSomething(a: Int) async | |
// main | |
sil @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 { | |
bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>): | |
// function_ref async_Main | |
%2 = function_ref @async_Main : $@convention(thin) @async () -> () // user: %9 | |
%3 = integer_literal $Builtin.Int64, 2048 // user: %4 | |
%4 = struct $Int (%3 : $Builtin.Int64) // user: %11 | |
%5 = enum $Optional<Builtin.Executor>, #Optional.none!enumelt // user: %11 | |
%6 = enum $Optional<Builtin.RawPointer>, #Optional.none!enumelt // user: %11 | |
%7 = enum $Optional<Builtin.Executor>, #Optional.none!enumelt // user: %11 | |
// function_ref thunk for @escaping @convention(thin) @async () -> () | |
%8 = function_ref @$sIetH_yts5Error_pIeghHrzo_TR : $@convention(thin) @Sendable @async (@convention(thin) @async () -> ()) -> (@out (), @error any Error) // user: %9 | |
%9 = partial_apply [callee_guaranteed] %8(%2) : $@convention(thin) @Sendable @async (@convention(thin) @async () -> ()) -> (@out (), @error any Error) // user: %10 | |
%10 = convert_function %9 : $@Sendable @async @callee_guaranteed () -> (@out (), @error any Error) to $@Sendable @async @callee_guaranteed @substituted <τ_0_0> () -> (@out τ_0_0, @error any Error) for <()> // user: %11 | |
%11 = builtin "createAsyncTask"<()>(%4 : $Int, %5 : $Optional<Builtin.Executor>, %6 : $Optional<Builtin.RawPointer>, %7 : $Optional<Builtin.Executor>, %10 : $@Sendable @async @callee_guaranteed @substituted <τ_0_0> () -> (@out τ_0_0, @error any Error) for <()>) : $(Builtin.NativeObject, Builtin.RawPointer) // user: %12 | |
%12 = tuple_extract %11 : $(Builtin.NativeObject, Builtin.RawPointer), 0 // user: %14 | |
// function_ref swift_job_run | |
%13 = function_ref @swift_job_run : $@convention(thin) (UnownedJob, UnownedSerialExecutor) -> () // user: %18 | |
%14 = builtin "convertTaskToJob"(%12 : $Builtin.NativeObject) : $Builtin.Job // user: %15 | |
%15 = struct $UnownedJob (%14 : $Builtin.Job) // user: %18 | |
%16 = builtin "buildMainActorExecutorRef"() : $Builtin.Executor // user: %17 | |
%17 = struct $UnownedSerialExecutor (%16 : $Builtin.Executor) // user: %18 | |
%18 = apply %13(%15, %17) : $@convention(thin) (UnownedJob, UnownedSerialExecutor) -> () | |
// function_ref swift_task_asyncMainDrainQueue | |
%19 = function_ref @swift_task_asyncMainDrainQueue : $@convention(thin) () -> Never // user: %20 | |
%20 = apply %19() : $@convention(thin) () -> Never | |
unreachable // id: %21 | |
} // end sil function 'main' | |
// async_Main | |
sil private @async_Main : $@convention(thin) @async () -> () { | |
bb0: | |
%0 = builtin "buildMainActorExecutorRef"() : $Builtin.Executor // user: %1 | |
%1 = enum $Optional<Builtin.Executor>, #Optional.some!enumelt, %0 : $Builtin.Executor // user: %15 | |
%2 = metatype $@thin Task<(), Never>.Type // user: %9 | |
%3 = alloc_stack $Optional<TaskPriority> // users: %11, %10, %9, %4 | |
inject_enum_addr %3 : $*Optional<TaskPriority>, #Optional.none!enumelt // id: %4 | |
// function_ref closure #1 in | |
%5 = function_ref @$s4mainyyYaYbcfU_ : $@convention(thin) @Sendable @async @substituted <τ_0_0> (@guaranteed Optional<any Actor>) -> @out τ_0_0 for <()> // user: %7 | |
%6 = enum $Optional<any Actor>, #Optional.none!enumelt // user: %7 | |
%7 = partial_apply [callee_guaranteed] [isolated_any] %5(%6) : $@convention(thin) @Sendable @async @substituted <τ_0_0> (@guaranteed Optional<any Actor>) -> @out τ_0_0 for <()> // user: %9 | |
// function_ref static Task<>.detached(priority:operation:) | |
%8 = function_ref @$sScTss5NeverORs_rlE8detached8priority9operationScTyxABGScPSg_xyYaYbYAcntFZ : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@in_guaranteed Optional<TaskPriority>, @owned @isolated(any) @Sendable @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <τ_0_0>, @thin Task<τ_0_0, Never>.Type) -> @owned Task<τ_0_0, Never> // user: %9 | |
%9 = apply %8<(), Never>(%3, %7, %2) : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@in_guaranteed Optional<TaskPriority>, @owned @isolated(any) @Sendable @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <τ_0_0>, @thin Task<τ_0_0, Never>.Type) -> @owned Task<τ_0_0, Never> // users: %16, %14 | |
destroy_addr %3 : $*Optional<TaskPriority> // id: %10 | |
dealloc_stack %3 : $*Optional<TaskPriority> // id: %11 | |
%12 = alloc_stack $() // users: %17, %14 | |
// function_ref Task<>.value.getter | |
%13 = function_ref @$sScTss5NeverORs_rlE5valuexvg : $@convention(method) @async <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@guaranteed Task<τ_0_0, Never>) -> @out τ_0_0 // user: %14 | |
%14 = apply %13<(), Never>(%12, %9) : $@convention(method) @async <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@guaranteed Task<τ_0_0, Never>) -> @out τ_0_0 | |
hop_to_executor %1 : $Optional<Builtin.Executor> // id: %15 | |
release_value %9 : $Task<(), Never> // id: %16 | |
dealloc_stack %12 : $*() // id: %17 | |
%18 = integer_literal $Builtin.Int32, 0 // user: %19 | |
%19 = struct $Int32 (%18 : $Builtin.Int32) // user: %21 | |
// function_ref exit | |
%20 = function_ref @exit : $@convention(c) (Int32) -> Never // user: %21 | |
%21 = apply %20(%19) : $@convention(c) (Int32) -> Never | |
unreachable // id: %22 | |
} // end sil function 'async_Main' | |
// thunk for @escaping @convention(thin) @async () -> () | |
sil shared [transparent] [reabstraction_thunk] @$sIetH_yts5Error_pIeghHrzo_TR : $@convention(thin) @Sendable @async (@convention(thin) @async () -> ()) -> (@out (), @error any Error) { | |
// %1 // user: %2 | |
bb0(%0 : $*(), %1 : $@convention(thin) @async () -> ()): | |
%2 = apply %1() : $@convention(thin) @async () -> () | |
%3 = tuple () // user: %4 | |
return %3 : $() // id: %4 | |
} // end sil function '$sIetH_yts5Error_pIeghHrzo_TR' | |
// swift_job_run | |
sil [available 12.0.0] @swift_job_run : $@convention(thin) (UnownedJob, UnownedSerialExecutor) -> () | |
// swift_task_asyncMainDrainQueue | |
sil [available 12.0.0] @swift_task_asyncMainDrainQueue : $@convention(thin) () -> Never | |
// closure #1 in | |
sil private @$s4mainyyYaYbcfU_ : $@convention(thin) @Sendable @async @substituted <τ_0_0> (@guaranteed Optional<any Actor>) -> @out τ_0_0 for <()> { | |
// %0 "$return_value" | |
bb0(%0 : $*(), %1 : $Optional<any Actor>): | |
%2 = integer_literal $Builtin.Int64, 1 // user: %3 | |
%3 = struct $Int (%2 : $Builtin.Int64) // user: %5 | |
// function_ref doSomething(a:) | |
%4 = function_ref @$s4main11doSomething1aySi_tYaF : $@convention(thin) @async (Int) -> () // user: %5 | |
%5 = apply %4(%3) : $@convention(thin) @async (Int) -> () | |
%6 = tuple () // user: %7 | |
return %6 : $() // id: %7 | |
} // end sil function '$s4mainyyYaYbcfU_' | |
// Int.init(_builtinIntegerLiteral:) | |
sil public_external [transparent] @$sSi22_builtinIntegerLiteralSiBI_tcfC : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int { | |
// %0 // user: %2 | |
bb0(%0 : $Builtin.IntLiteral, %1 : $@thin Int.Type): | |
%2 = builtin "s_to_s_checked_trunc_IntLiteral_Int64"(%0 : $Builtin.IntLiteral) : $(Builtin.Int64, Builtin.Int1) // user: %3 | |
%3 = tuple_extract %2 : $(Builtin.Int64, Builtin.Int1), 0 // user: %4 | |
%4 = struct $Int (%3 : $Builtin.Int64) // user: %5 | |
return %4 : $Int // id: %5 | |
} // end sil function '$sSi22_builtinIntegerLiteralSiBI_tcfC' | |
// doSomething(a:) | |
sil hidden @$s4main11doSomething1aySi_tYaF : $@convention(thin) @async (Int) -> () { | |
// %0 "a" // user: %1 | |
bb0(%0 : $Int): | |
debug_value %0 : $Int, let, name "a", argno 1 // id: %1 | |
%2 = metatype $@thick MainActor.Type // user: %4 | |
// function_ref static MainActor.shared.getter | |
%3 = function_ref @$sScM6sharedScMvgZ : $@convention(method) (@thick MainActor.Type) -> @owned MainActor // user: %4 | |
%4 = apply %3(%2) : $@convention(method) (@thick MainActor.Type) -> @owned MainActor // users: %19, %5, %17 | |
hop_to_executor %4 : $MainActor // id: %5 | |
%6 = alloc_stack $() // users: %18, %15 | |
%7 = metatype $@thick MainActor.Type // user: %9 | |
// function_ref static MainActor.shared.getter | |
%8 = function_ref @$sScM6sharedScMvgZ : $@convention(method) (@thick MainActor.Type) -> @owned MainActor // user: %9 | |
%9 = apply %8(%7) : $@convention(method) (@thick MainActor.Type) -> @owned MainActor // user: %10 | |
%10 = init_existential_ref %9 : $MainActor : $MainActor, $any Actor // user: %11 | |
%11 = enum $Optional<any Actor>, #Optional.some!enumelt, %10 : $any Actor // users: %16, %15 | |
// function_ref closure #1 in doSomething(a:) | |
%12 = function_ref @$s4main11doSomething1aySi_tYaFySccyyts5NeverOGXEfU_ : $@convention(thin) @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <()> // user: %13 | |
%13 = thin_to_thick_function %12 : $@convention(thin) @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <()> to $@noescape @callee_guaranteed @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <()> // user: %15 | |
// function_ref withUnsafeContinuation<A>(isolation:_:) | |
%14 = function_ref @$ss22withUnsafeContinuation9isolation_xScA_pSgYi_ySccyxs5NeverOGXEtYalF : $@convention(thin) @async <τ_0_0> (@sil_isolated @guaranteed Optional<any Actor>, @guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <τ_0_0>) -> @out τ_0_0 // user: %15 | |
%15 = apply %14<()>(%6, %11, %13) : $@convention(thin) @async <τ_0_0> (@sil_isolated @guaranteed Optional<any Actor>, @guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <τ_0_0>) -> @out τ_0_0 | |
release_value %11 : $Optional<any Actor> // id: %16 | |
hop_to_executor %4 : $MainActor // id: %17 | |
dealloc_stack %6 : $*() // id: %18 | |
strong_release %4 : $MainActor // id: %19 | |
%20 = tuple () // user: %21 | |
return %20 : $() // id: %21 | |
} // end sil function '$s4main11doSomething1aySi_tYaF' | |
// static Task<>.detached(priority:operation:) | |
sil shared [available 12.0.0] @$sScTss5NeverORs_rlE8detached8priority9operationScTyxABGScPSg_xyYaYbYAcntFZ : $@convention(method) <Success, Failure where Success : Sendable, Failure == Never> (@in_guaranteed Optional<TaskPriority>, @owned @isolated(any) @Sendable @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <Success>, @thin Task<Success, Never>.Type) -> @owned Task<Success, Never> { | |
// %0 // user: %4 | |
// %1 // users: %26, %42 | |
// %2 // user: %49 | |
bb0(%0 : $*Optional<TaskPriority>, %1 : $@isolated(any) @Sendable @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <Success>, %2 : $@thin Task<Success, Never>.Type): | |
%3 = alloc_stack $Optional<TaskPriority> // users: %18, %10, %7, %6, %5, %4 | |
copy_addr %0 to [init] %3 : $*Optional<TaskPriority> // id: %4 | |
switch_enum_addr %3 : $*Optional<TaskPriority>, case #Optional.some!enumelt: bb2, case #Optional.none!enumelt: bb1 // id: %5 | |
bb1: // Preds: bb0 | |
destroy_addr %3 : $*Optional<TaskPriority> // id: %6 | |
dealloc_stack %3 : $*Optional<TaskPriority> // id: %7 | |
%8 = integer_literal $Builtin.Int64, 0 // user: %9 | |
br bb3(%8 : $Builtin.Int64) // id: %9 | |
bb2: // Preds: bb0 | |
%10 = unchecked_take_enum_data_addr %3 : $*Optional<TaskPriority>, #Optional.some!enumelt // users: %16, %12 | |
%11 = alloc_stack $TaskPriority // users: %17, %15, %14, %12 | |
copy_addr %10 to [init] %11 : $*TaskPriority // id: %12 | |
// function_ref TaskPriority.rawValue.getter | |
%13 = function_ref @$sScP8rawValues5UInt8Vvg : $@convention(method) (@in_guaranteed TaskPriority) -> UInt8 // user: %14 | |
%14 = apply %13(%11) : $@convention(method) (@in_guaranteed TaskPriority) -> UInt8 // user: %19 | |
destroy_addr %11 : $*TaskPriority // id: %15 | |
destroy_addr %10 : $*TaskPriority // id: %16 | |
dealloc_stack %11 : $*TaskPriority // id: %17 | |
dealloc_stack %3 : $*Optional<TaskPriority> // id: %18 | |
%19 = struct_extract %14 : $UInt8, #UInt8._value // user: %20 | |
%20 = builtin "zextOrBitCast_Int8_Int64"(%19 : $Builtin.Int8) : $Builtin.Int64 // user: %21 | |
br bb3(%20 : $Builtin.Int64) // id: %21 | |
// %22 // user: %24 | |
bb3(%22 : $Builtin.Int64): // Preds: bb2 bb1 | |
%23 = integer_literal $Builtin.Int64, 4096 // user: %24 | |
%24 = builtin "or_Int64"(%22 : $Builtin.Int64, %23 : $Builtin.Int64) : $Builtin.Int64 // user: %25 | |
%25 = struct $Int (%24 : $Builtin.Int64) // user: %46 | |
%26 = function_extract_isolation %1 : $@isolated(any) @Sendable @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <Success> // users: %28, %27 | |
retain_value %26 : $Optional<any Actor> // id: %27 | |
switch_enum %26 : $Optional<any Actor>, case #Optional.some!enumelt: bb5, case #Optional.none!enumelt: bb4 // id: %28 | |
bb4: // Preds: bb3 | |
%29 = enum $Optional<Builtin.Executor>, #Optional.none!enumelt // user: %30 | |
br bb6(%29 : $Optional<Builtin.Executor>) // id: %30 | |
// %31 // user: %32 | |
bb5(%31 : $any Actor): // Preds: bb3 | |
%32 = open_existential_ref %31 : $any Actor to $@opened("4B9701EC-0A02-11EF-89CE-A2953BDFE1C2", any Actor) Self // users: %35, %34, %34, %33 | |
%33 = witness_method $@opened("4B9701EC-0A02-11EF-89CE-A2953BDFE1C2", any Actor) Self, #Actor.unownedExecutor!getter : <Self where Self : Actor> (Self) -> () -> UnownedSerialExecutor, %32 : $@opened("4B9701EC-0A02-11EF-89CE-A2953BDFE1C2", any Actor) Self : $@convention(witness_method: Actor) <τ_0_0 where τ_0_0 : Actor> (@guaranteed τ_0_0) -> UnownedSerialExecutor // type-defs: %32; user: %34 | |
%34 = apply %33<@opened("4B9701EC-0A02-11EF-89CE-A2953BDFE1C2", any Actor) Self>(%32) : $@convention(witness_method: Actor) <τ_0_0 where τ_0_0 : Actor> (@guaranteed τ_0_0) -> UnownedSerialExecutor // type-defs: %32; user: %36 | |
strong_release %32 : $@opened("4B9701EC-0A02-11EF-89CE-A2953BDFE1C2", any Actor) Self // id: %35 | |
%36 = struct_extract %34 : $UnownedSerialExecutor, #UnownedSerialExecutor.executor // user: %37 | |
%37 = enum $Optional<Builtin.Executor>, #Optional.some!enumelt, %36 : $Builtin.Executor // user: %38 | |
br bb6(%37 : $Optional<Builtin.Executor>) // id: %38 | |
// %39 // user: %46 | |
bb6(%39 : $Optional<Builtin.Executor>): // Preds: bb5 bb4 | |
%40 = enum $Optional<Builtin.RawPointer>, #Optional.none!enumelt // user: %46 | |
%41 = enum $Optional<Builtin.Executor>, #Optional.none!enumelt // user: %46 | |
%42 = convert_function %1 : $@isolated(any) @Sendable @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <Success> to $@isolated(any) @Sendable @async @callee_guaranteed () -> @out Success // user: %44 | |
// function_ref thunk for @escaping @isolated(any) @callee_guaranteed @Sendable @async () -> (@out A) | |
%43 = function_ref @$sxIeAghHr_xs5Error_pIeghHrzo_s8SendableRzs5NeverORs_r0_lTR : $@convention(thin) @Sendable @async <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@guaranteed @isolated(any) @Sendable @async @callee_guaranteed () -> @out τ_0_0) -> (@out τ_0_0, @error any Error) // user: %44 | |
%44 = partial_apply [callee_guaranteed] %43<Success, Never>(%42) : $@convention(thin) @Sendable @async <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@guaranteed @isolated(any) @Sendable @async @callee_guaranteed () -> @out τ_0_0) -> (@out τ_0_0, @error any Error) // user: %45 | |
%45 = convert_function %44 : $@Sendable @async @callee_guaranteed () -> (@out Success, @error any Error) to $@Sendable @async @callee_guaranteed @substituted <τ_0_0> () -> (@out τ_0_0, @error any Error) for <Success> // user: %46 | |
%46 = builtin "createAsyncTask"<Success>(%25 : $Int, %39 : $Optional<Builtin.Executor>, %40 : $Optional<Builtin.RawPointer>, %41 : $Optional<Builtin.Executor>, %45 : $@Sendable @async @callee_guaranteed @substituted <τ_0_0> () -> (@out τ_0_0, @error any Error) for <Success>) : $(Builtin.NativeObject, Builtin.RawPointer) // user: %47 | |
%47 = tuple_extract %46 : $(Builtin.NativeObject, Builtin.RawPointer), 0 // user: %49 | |
// function_ref Task.init(_:) | |
%48 = function_ref @$sScTyScTyxq_GBocfC : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 : Error> (@owned Builtin.NativeObject, @thin Task<τ_0_0, τ_0_1>.Type) -> @owned Task<τ_0_0, τ_0_1> // user: %49 | |
%49 = apply %48<Success, Never>(%47, %2) : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 : Error> (@owned Builtin.NativeObject, @thin Task<τ_0_0, τ_0_1>.Type) -> @owned Task<τ_0_0, τ_0_1> // user: %50 | |
return %49 : $Task<Success, Never> // id: %50 | |
} // end sil function '$sScTss5NeverORs_rlE8detached8priority9operationScTyxABGScPSg_xyYaYbYAcntFZ' | |
// Task<>.value.getter | |
sil [available 12.0.0] @$sScTss5NeverORs_rlE5valuexvg : $@convention(method) @async <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@guaranteed Task<τ_0_0, Never>) -> @out τ_0_0 | |
// exit | |
// clang name: exit | |
sil [clang exit] @exit : $@convention(c) (Int32) -> Never | |
// static MainActor.shared.getter | |
sil [available 12.0.0] @$sScM6sharedScMvgZ : $@convention(method) (@thick MainActor.Type) -> @owned MainActor | |
// freestanding macro expansion #1 of isolation in doSomething(a:) | |
sil @$s4main11doSomething1aySi_tYaF9isolationfMf_ : $@convention(thin) () -> () | |
// __unknown_macro__ | |
sil @__unknown_macro__ : $@convention(thin) () -> () | |
// closure #1 in doSomething(a:) | |
sil private @$s4main11doSomething1aySi_tYaFySccyyts5NeverOGXEfU_ : $@convention(thin) @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <()> { | |
// %0 "continuation" // users: %27, %1 | |
bb0(%0 : $UnsafeContinuation<(), Never>): | |
debug_value %0 : $UnsafeContinuation<(), Never>, let, name "continuation", argno 1 // id: %1 | |
debug_step // id: %2 | |
%3 = metatype $@thick MainActor.Type // user: %5 | |
// function_ref static MainActor.shared.getter | |
%4 = function_ref @$sScM6sharedScMvgZ : $@convention(method) (@thick MainActor.Type) -> @owned MainActor // user: %5 | |
%5 = apply %4(%3) : $@convention(method) (@thick MainActor.Type) -> @owned MainActor // users: %21, %18 | |
%6 = string_literal utf8 "main/main.swift" // user: %8 | |
%7 = integer_literal $Builtin.Word, 15 // user: %10 | |
%8 = builtin "ptrtoint_Word"(%6 : $Builtin.RawPointer) : $Builtin.Word // user: %10 | |
%9 = integer_literal $Builtin.Int8, 2 // user: %10 | |
%10 = struct $StaticString (%8 : $Builtin.Word, %7 : $Builtin.Word, %9 : $Builtin.Int8) // user: %18 | |
%11 = integer_literal $Builtin.Int64, 9 // user: %12 | |
%12 = struct $UInt (%11 : $Builtin.Int64) // user: %18 | |
// function_ref default argument 0 of Actor.assertIsolated(_:file:line:) | |
%13 = function_ref @$sScAsE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutFfA_ : $@convention(thin) <τ_0_0 where τ_0_0 : Actor> () -> @owned @callee_guaranteed () -> @owned String // user: %14 | |
%14 = apply %13<MainActor>() : $@convention(thin) <τ_0_0 where τ_0_0 : Actor> () -> @owned @callee_guaranteed () -> @owned String // users: %20, %19, %16, %15 | |
strong_retain %14 : $@callee_guaranteed () -> @owned String // id: %15 | |
%16 = convert_escape_to_noescape %14 : $@callee_guaranteed () -> @owned String to $@noescape @callee_guaranteed () -> @owned String // user: %18 | |
// function_ref Actor.assertIsolated(_:file:line:) | |
%17 = function_ref @$sScAsE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutF : $@convention(method) <τ_0_0 where τ_0_0 : Actor> (@guaranteed @noescape @callee_guaranteed () -> @owned String, StaticString, UInt, @guaranteed τ_0_0) -> () // user: %18 | |
%18 = apply %17<MainActor>(%16, %10, %12, %5) : $@convention(method) <τ_0_0 where τ_0_0 : Actor> (@guaranteed @noescape @callee_guaranteed () -> @owned String, StaticString, UInt, @guaranteed τ_0_0) -> () | |
strong_release %14 : $@callee_guaranteed () -> @owned String // id: %19 | |
strong_release %14 : $@callee_guaranteed () -> @owned String // id: %20 | |
strong_release %5 : $MainActor // id: %21 | |
debug_step // id: %22 | |
%23 = tuple () // user: %25 | |
%24 = alloc_stack $() // users: %25, %28, %27 | |
store %23 to %24 : $*() // id: %25 | |
// function_ref UnsafeContinuation.resume<>(returning:) | |
%26 = function_ref @$sScc6resume9returningyxn_ts5NeverORs_rlF : $@convention(method) <τ_0_0, τ_0_1 where τ_0_1 == Never> (@in τ_0_0, UnsafeContinuation<τ_0_0, Never>) -> () // user: %27 | |
%27 = apply %26<(), Never>(%24, %0) : $@convention(method) <τ_0_0, τ_0_1 where τ_0_1 == Never> (@in τ_0_0, UnsafeContinuation<τ_0_0, Never>) -> () | |
dealloc_stack %24 : $*() // id: %28 | |
%29 = tuple () // user: %30 | |
return %29 : $() // id: %30 | |
} // end sil function '$s4main11doSomething1aySi_tYaFySccyyts5NeverOGXEfU_' | |
// _stdlib_isOSVersionAtLeast(_:_:_:) | |
sil [readnone] [_semantics "availability.osversion"] @$ss26_stdlib_isOSVersionAtLeastyBi1_Bw_BwBwtF : $@convention(thin) (Builtin.Word, Builtin.Word, Builtin.Word) -> Builtin.Int1 | |
// StaticString.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:) | |
sil public_external [transparent] [readonly] @$ss12StaticStringV08_builtinB7Literal17utf8CodeUnitCount7isASCIIABBp_BwBi1_tcfC : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin StaticString.Type) -> StaticString { | |
// %0 // user: %4 | |
// %1 // user: %11 | |
// %2 // user: %5 | |
bb0(%0 : $Builtin.RawPointer, %1 : $Builtin.Word, %2 : $Builtin.Int1, %3 : $@thin StaticString.Type): | |
%4 = builtin "ptrtoint_Word"(%0 : $Builtin.RawPointer) : $Builtin.Word // user: %11 | |
cond_br %2, bb2, bb1 // id: %5 | |
bb1: // Preds: bb0 | |
%6 = integer_literal $Builtin.Int8, 0 // user: %7 | |
br bb3(%6 : $Builtin.Int8) // id: %7 | |
bb2: // Preds: bb0 | |
%8 = integer_literal $Builtin.Int8, 2 // user: %9 | |
br bb3(%8 : $Builtin.Int8) // id: %9 | |
// %10 // user: %11 | |
bb3(%10 : $Builtin.Int8): // Preds: bb2 bb1 | |
%11 = struct $StaticString (%4 : $Builtin.Word, %1 : $Builtin.Word, %10 : $Builtin.Int8) // user: %12 | |
return %11 : $StaticString // id: %12 | |
} // end sil function '$ss12StaticStringV08_builtinB7Literal17utf8CodeUnitCount7isASCIIABBp_BwBi1_tcfC' | |
// UInt.init(_builtinIntegerLiteral:) | |
sil public_external [transparent] @$sSu22_builtinIntegerLiteralSuBI_tcfC : $@convention(method) (Builtin.IntLiteral, @thin UInt.Type) -> UInt { | |
// %0 // user: %2 | |
bb0(%0 : $Builtin.IntLiteral, %1 : $@thin UInt.Type): | |
%2 = builtin "s_to_u_checked_trunc_IntLiteral_Int64"(%0 : $Builtin.IntLiteral) : $(Builtin.Int64, Builtin.Int1) // user: %3 | |
%3 = tuple_extract %2 : $(Builtin.Int64, Builtin.Int1), 0 // user: %4 | |
%4 = struct $UInt (%3 : $Builtin.Int64) // user: %5 | |
return %4 : $UInt // id: %5 | |
} // end sil function '$sSu22_builtinIntegerLiteralSuBI_tcfC' | |
// default argument 0 of Actor.assertIsolated(_:file:line:) | |
sil shared [available 14.0] @$sScAsE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutFfA_ : $@convention(thin) <Self where Self : Actor> () -> @owned @callee_guaranteed () -> @owned String { | |
bb0: | |
// function_ref implicit closure #1 in default argument 0 of Actor.assertIsolated(_:file:line:) | |
%0 = function_ref @$sScAsE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutFfA_SSycfu_ : $@convention(thin) () -> @owned String // user: %1 | |
%1 = thin_to_thick_function %0 : $@convention(thin) () -> @owned String to $@callee_guaranteed () -> @owned String // user: %2 | |
return %1 : $@callee_guaranteed () -> @owned String // id: %2 | |
} // end sil function '$sScAsE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutFfA_' | |
// Actor.assertIsolated(_:file:line:) | |
sil [available 14.0] @$sScAsE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutF : $@convention(method) <τ_0_0 where τ_0_0 : Actor> (@guaranteed @noescape @callee_guaranteed () -> @owned String, StaticString, UInt, @guaranteed τ_0_0) -> () | |
// UnsafeContinuation.resume<>(returning:) | |
sil shared [available 12.0.0] @$sScc6resume9returningyxn_ts5NeverORs_rlF : $@convention(method) <T, E where E == Never> (@in T, UnsafeContinuation<T, Never>) -> () { | |
// %0 // user: %3 | |
// %1 // user: %2 | |
bb0(%0 : $*T, %1 : $UnsafeContinuation<T, Never>): | |
%2 = struct_extract %1 : $UnsafeContinuation<T, Never>, #UnsafeContinuation.context // user: %3 | |
%3 = builtin "resumeNonThrowingContinuationReturning"<T>(%2 : $Builtin.RawUnsafeContinuation, %0 : $*T) : $() | |
%4 = tuple () // user: %5 | |
return %4 : $() // id: %5 | |
} // end sil function '$sScc6resume9returningyxn_ts5NeverORs_rlF' | |
// withUnsafeContinuation<A>(isolation:_:) | |
sil shared [available 12.0.0] @$ss22withUnsafeContinuation9isolation_xScA_pSgYi_ySccyxs5NeverOGXEtYalF : $@convention(thin) @async <T> (@sil_isolated @guaranteed Optional<any Actor>, @guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <T>) -> @out T { | |
// %0 // user: %9 | |
// %1 // user: %3 | |
// %2 // user: %7 | |
bb0(%0 : $*T, %1 : $Optional<any Actor>, %2 : $@noescape @callee_guaranteed @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <T>): | |
hop_to_executor %1 : $Optional<any Actor> // id: %3 | |
// function_ref closure #1 in withUnsafeContinuation<A>(isolation:_:) | |
%4 = function_ref @$ss22withUnsafeContinuation9isolation_xScA_pSgYi_ySccyxs5NeverOGXEtYalFyBcXEfU_ : $@convention(thin) <τ_0_0> (Builtin.RawUnsafeContinuation, @guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <τ_0_0>) -> () // user: %7 | |
%5 = alloc_stack $T // users: %10, %9, %6 | |
%6 = get_async_continuation_addr T, %5 : $*T // users: %8, %7 | |
%7 = apply %4<T>(%6, %2) : $@convention(thin) <τ_0_0> (Builtin.RawUnsafeContinuation, @guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <τ_0_0>) -> () | |
await_async_continuation %6 : $Builtin.RawUnsafeContinuation, resume bb1 // id: %8 | |
bb1: // Preds: bb0 | |
copy_addr [take] %5 to [init] %0 : $*T // id: %9 | |
dealloc_stack %5 : $*T // id: %10 | |
%11 = tuple () // user: %12 | |
return %11 : $() // id: %12 | |
} // end sil function '$ss22withUnsafeContinuation9isolation_xScA_pSgYi_ySccyxs5NeverOGXEtYalF' | |
// TaskPriority.rawValue.getter | |
sil [available 12.0.0] @$sScP8rawValues5UInt8Vvg : $@convention(method) (@in_guaranteed TaskPriority) -> UInt8 | |
// thunk for @escaping @isolated(any) @callee_guaranteed @Sendable @async () -> (@out A) | |
sil shared [transparent] [reabstraction_thunk] @$sxIeAghHr_xs5Error_pIeghHrzo_s8SendableRzs5NeverORs_r0_lTR : $@convention(thin) @Sendable @async <Success, Failure where Success : Sendable, Failure == Never> (@guaranteed @isolated(any) @Sendable @async @callee_guaranteed () -> @out Success) -> (@out Success, @error any Error) { | |
// %0 // user: %2 | |
// %1 // user: %2 | |
bb0(%0 : $*Success, %1 : $@isolated(any) @Sendable @async @callee_guaranteed () -> @out Success): | |
%2 = apply %1(%0) : $@isolated(any) @Sendable @async @callee_guaranteed () -> @out Success | |
%3 = tuple () // user: %4 | |
return %3 : $() // id: %4 | |
} // end sil function '$sxIeAghHr_xs5Error_pIeghHrzo_s8SendableRzs5NeverORs_r0_lTR' | |
// Task.init(_:) | |
sil shared [available 12.0.0] @$sScTyScTyxq_GBocfC : $@convention(method) <Success, Failure where Success : Sendable, Failure : Error> (@owned Builtin.NativeObject, @thin Task<Success, Failure>.Type) -> @owned Task<Success, Failure> { | |
// %0 // user: %2 | |
bb0(%0 : $Builtin.NativeObject, %1 : $@thin Task<Success, Failure>.Type): | |
%2 = struct $Task<Success, Failure> (%0 : $Builtin.NativeObject) // user: %3 | |
return %2 : $Task<Success, Failure> // id: %3 | |
} // end sil function '$sScTyScTyxq_GBocfC' | |
// closure #1 in withUnsafeContinuation<A>(isolation:_:) | |
sil shared @$ss22withUnsafeContinuation9isolation_xScA_pSgYi_ySccyxs5NeverOGXEtYalFyBcXEfU_ : $@convention(thin) <T> (Builtin.RawUnsafeContinuation, @guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <T>) -> () { | |
// %0 // user: %4 | |
// %1 // user: %5 | |
bb0(%0 : $Builtin.RawUnsafeContinuation, %1 : @closureCapture $@noescape @callee_guaranteed @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <T>): | |
%2 = metatype $@thin UnsafeContinuation<T, Never>.Type // user: %4 | |
// function_ref UnsafeContinuation.init(_:) | |
%3 = function_ref @$sSccySccyxq_GBccfC : $@convention(method) <τ_0_0, τ_0_1 where τ_0_1 : Error> (Builtin.RawUnsafeContinuation, @thin UnsafeContinuation<τ_0_0, τ_0_1>.Type) -> UnsafeContinuation<τ_0_0, τ_0_1> // user: %4 | |
%4 = apply %3<T, Never>(%0, %2) : $@convention(method) <τ_0_0, τ_0_1 where τ_0_1 : Error> (Builtin.RawUnsafeContinuation, @thin UnsafeContinuation<τ_0_0, τ_0_1>.Type) -> UnsafeContinuation<τ_0_0, τ_0_1> // user: %5 | |
%5 = apply %1(%4) : $@noescape @callee_guaranteed @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <T> | |
%6 = tuple () // user: %7 | |
return %6 : $() // id: %7 | |
} // end sil function '$ss22withUnsafeContinuation9isolation_xScA_pSgYi_ySccyxs5NeverOGXEtYalFyBcXEfU_' | |
// UnsafeContinuation.init(_:) | |
sil shared [available 12.0.0] @$sSccySccyxq_GBccfC : $@convention(method) <T, E where E : Error> (Builtin.RawUnsafeContinuation, @thin UnsafeContinuation<T, E>.Type) -> UnsafeContinuation<T, E> { | |
// %0 // user: %2 | |
bb0(%0 : $Builtin.RawUnsafeContinuation, %1 : $@thin UnsafeContinuation<T, E>.Type): | |
%2 = struct $UnsafeContinuation<T, E> (%0 : $Builtin.RawUnsafeContinuation) // user: %3 | |
return %2 : $UnsafeContinuation<T, E> // id: %3 | |
} // end sil function '$sSccySccyxq_GBccfC' | |
// implicit closure #1 in default argument 0 of Actor.assertIsolated(_:file:line:) | |
sil shared [transparent] @$sScAsE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutFfA_SSycfu_ : $@convention(thin) () -> @owned String { | |
bb0: | |
%0 = integer_literal $Builtin.Int64, 0 // user: %4 | |
%1 = integer_literal $Builtin.Int64, -2305843009213693952 // user: %2 | |
%2 = value_to_bridge_object %1 : $Builtin.Int64 // users: %5, %3 | |
strong_retain %2 : $Builtin.BridgeObject // id: %3 | |
%4 = struct $UInt64 (%0 : $Builtin.Int64) // user: %5 | |
%5 = struct $_StringObject (%4 : $UInt64, %2 : $Builtin.BridgeObject) // user: %6 | |
%6 = struct $_StringGuts (%5 : $_StringObject) // user: %7 | |
%7 = struct $String (%6 : $_StringGuts) // user: %8 | |
return %7 : $String // id: %8 | |
} // end sil function '$sScAsE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutFfA_SSycfu_' | |
// Mappings from '#fileID' to '#filePath': | |
// 'main/main.swift' => 'main.swift' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@MainActor | |
func doSomething() async { | |
await withUnsafeContinuation { continuation in | |
if #available(macOS 14.0, *) { | |
MainActor.shared.assertIsolated() | |
} | |
continuation.resume(returning: ()) | |
} | |
} | |
await Task.detached { | |
await doSomething() | |
}.value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sil_stage canonical | |
import Builtin | |
import Swift | |
import SwiftShims | |
import Foundation | |
@MainActor func doSomething() async | |
// main | |
sil @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 { | |
bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>): | |
// function_ref async_Main | |
%2 = function_ref @async_Main : $@convention(thin) @async () -> () // user: %8 | |
%3 = integer_literal $Builtin.Int64, 2048 // user: %4 | |
%4 = struct $Int (%3 : $Builtin.Int64) // user: %10 | |
%5 = metatype $@thick ().Type // user: %6 | |
%6 = init_existential_metatype %5 : $@thick ().Type, $@thick any Any.Type // user: %10 | |
// function_ref thunk for @escaping @convention(thin) @async () -> () | |
%7 = function_ref @$sIetH_yts5Error_pIegHrzo_TR : $@convention(thin) @async (@convention(thin) @async () -> ()) -> (@out (), @error any Error) // user: %8 | |
%8 = partial_apply [callee_guaranteed] %7(%2) : $@convention(thin) @async (@convention(thin) @async () -> ()) -> (@out (), @error any Error) // user: %9 | |
%9 = convert_function %8 : $@async @callee_guaranteed () -> (@out (), @error any Error) to $@async @callee_guaranteed @substituted <τ_0_0> () -> (@out τ_0_0, @error any Error) for <()> // user: %10 | |
%10 = builtin "createAsyncTask"<()>(%4 : $Int, %6 : $@thick any Any.Type, %9 : $@async @callee_guaranteed @substituted <τ_0_0> () -> (@out τ_0_0, @error any Error) for <()>) : $(Builtin.NativeObject, Builtin.RawPointer) // user: %11 | |
%11 = tuple_extract %10 : $(Builtin.NativeObject, Builtin.RawPointer), 0 // user: %13 | |
// function_ref swift_job_run | |
%12 = function_ref @swift_job_run : $@convention(thin) (UnownedJob, UnownedSerialExecutor) -> () // user: %18 | |
%13 = builtin "convertTaskToJob"(%11 : $Builtin.NativeObject) : $Builtin.Job // user: %14 | |
%14 = struct $UnownedJob (%13 : $Builtin.Job) // user: %18 | |
// function_ref swift_task_getMainExecutor | |
%15 = function_ref @swift_task_getMainExecutor : $@convention(thin) () -> Builtin.Executor // user: %16 | |
%16 = apply %15() : $@convention(thin) () -> Builtin.Executor // user: %17 | |
%17 = struct $UnownedSerialExecutor (%16 : $Builtin.Executor) // user: %18 | |
%18 = apply %12(%14, %17) : $@convention(thin) (UnownedJob, UnownedSerialExecutor) -> () | |
// function_ref swift_task_asyncMainDrainQueue | |
%19 = function_ref @swift_task_asyncMainDrainQueue : $@convention(thin) () -> Never // user: %20 | |
%20 = apply %19() : $@convention(thin) () -> Never | |
unreachable // id: %21 | |
} // end sil function 'main' | |
// async_Main | |
sil hidden @async_Main : $@convention(thin) @async () -> () { | |
bb0: | |
// function_ref swift_task_getMainExecutor | |
%0 = function_ref @swift_task_getMainExecutor : $@convention(thin) () -> Builtin.Executor // user: %1 | |
%1 = apply %0() : $@convention(thin) () -> Builtin.Executor // user: %2 | |
%2 = enum $Optional<Builtin.Executor>, #Optional.some!enumelt, %1 : $Builtin.Executor // user: %15 | |
%3 = metatype $@thin Task<(), Never>.Type // user: %9 | |
%4 = alloc_stack $Optional<TaskPriority> // users: %11, %10, %9, %5 | |
inject_enum_addr %4 : $*Optional<TaskPriority>, #Optional.none!enumelt // id: %5 | |
// function_ref closure #1 in | |
%6 = function_ref @$s4mainyyYaYbcfU_ : $@convention(thin) @Sendable @async @substituted <τ_0_0> () -> @out τ_0_0 for <()> // user: %7 | |
%7 = thin_to_thick_function %6 : $@convention(thin) @Sendable @async @substituted <τ_0_0> () -> @out τ_0_0 for <()> to $@Sendable @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <()> // user: %9 | |
// function_ref static Task<>.detached(priority:operation:) | |
%8 = function_ref @$sScTss5NeverORs_rlE8detached8priority9operationScTyxABGScPSg_xyYaYbcntFZ : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@in_guaranteed Optional<TaskPriority>, @owned @Sendable @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <τ_0_0>, @thin Task<τ_0_0, Never>.Type) -> @owned Task<τ_0_0, Never> // user: %9 | |
%9 = apply %8<(), Never>(%4, %7, %3) : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@in_guaranteed Optional<TaskPriority>, @owned @Sendable @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <τ_0_0>, @thin Task<τ_0_0, Never>.Type) -> @owned Task<τ_0_0, Never> // users: %16, %14 | |
destroy_addr %4 : $*Optional<TaskPriority> // id: %10 | |
dealloc_stack %4 : $*Optional<TaskPriority> // id: %11 | |
%12 = alloc_stack $() // users: %17, %14 | |
// function_ref Task<>.value.getter | |
%13 = function_ref @$sScTss5NeverORs_rlE5valuexvg : $@convention(method) @async <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@guaranteed Task<τ_0_0, Never>) -> @out τ_0_0 // user: %14 | |
%14 = apply %13<(), Never>(%12, %9) : $@convention(method) @async <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@guaranteed Task<τ_0_0, Never>) -> @out τ_0_0 | |
hop_to_executor %2 : $Optional<Builtin.Executor> // id: %15 | |
release_value %9 : $Task<(), Never> // id: %16 | |
dealloc_stack %12 : $*() // id: %17 | |
%18 = integer_literal $Builtin.Int32, 0 // user: %19 | |
%19 = struct $Int32 (%18 : $Builtin.Int32) // user: %21 | |
// function_ref exit | |
%20 = function_ref @exit : $@convention(c) (Int32) -> Never // user: %21 | |
%21 = apply %20(%19) : $@convention(c) (Int32) -> Never | |
unreachable // id: %22 | |
} // end sil function 'async_Main' | |
// thunk for @escaping @convention(thin) @async () -> () | |
sil shared [transparent] [reabstraction_thunk] @$sIetH_yts5Error_pIegHrzo_TR : $@convention(thin) @async (@convention(thin) @async () -> ()) -> (@out (), @error any Error) { | |
// %1 // user: %2 | |
bb0(%0 : $*(), %1 : $@convention(thin) @async () -> ()): | |
%2 = apply %1() : $@convention(thin) @async () -> () | |
%3 = tuple () // user: %4 | |
return %3 : $() // id: %4 | |
} // end sil function '$sIetH_yts5Error_pIegHrzo_TR' | |
// swift_job_run | |
sil [available 12.0.0] @swift_job_run : $@convention(thin) (UnownedJob, UnownedSerialExecutor) -> () | |
// swift_task_getMainExecutor | |
sil [available 12.0.0] @swift_task_getMainExecutor : $@convention(thin) () -> Builtin.Executor | |
// swift_task_asyncMainDrainQueue | |
sil [available 12.0.0] @swift_task_asyncMainDrainQueue : $@convention(thin) () -> Never | |
// doSomething() | |
sil hidden @$s4main11doSomethingyyYaF : $@convention(thin) @async () -> () { | |
bb0: | |
%0 = metatype $@thick MainActor.Type // user: %2 | |
// function_ref static MainActor.shared.getter | |
%1 = function_ref @$sScM6sharedScMvgZ : $@convention(method) (@thick MainActor.Type) -> @owned MainActor // user: %2 | |
%2 = apply %1(%0) : $@convention(method) (@thick MainActor.Type) -> @owned MainActor // users: %10, %8 | |
%3 = alloc_stack $() // users: %9, %7 | |
// function_ref closure #1 in doSomething() | |
%4 = function_ref @$s4main11doSomethingyyYaFySccyyts5NeverOGXEfU_ : $@convention(thin) @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <()> // user: %5 | |
%5 = thin_to_thick_function %4 : $@convention(thin) @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <()> to $@noescape @callee_guaranteed @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <()> // user: %7 | |
// function_ref withUnsafeContinuation<A>(_:) | |
%6 = function_ref @$ss22withUnsafeContinuationyxySccyxs5NeverOGXEYalF : $@convention(thin) @async <τ_0_0> (@guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <τ_0_0>) -> @out τ_0_0 // user: %7 | |
%7 = apply %6<()>(%3, %5) : $@convention(thin) @async <τ_0_0> (@guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <τ_0_0>) -> @out τ_0_0 | |
hop_to_executor %2 : $MainActor // id: %8 | |
dealloc_stack %3 : $*() // id: %9 | |
strong_release %2 : $MainActor // id: %10 | |
%11 = tuple () // user: %12 | |
return %11 : $() // id: %12 | |
} // end sil function '$s4main11doSomethingyyYaF' | |
// static MainActor.shared.getter | |
sil [available 12.0.0] @$sScM6sharedScMvgZ : $@convention(method) (@thick MainActor.Type) -> @owned MainActor | |
// closure #1 in doSomething() | |
sil private @$s4main11doSomethingyyYaFySccyyts5NeverOGXEfU_ : $@convention(thin) @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <()> { | |
// %0 "continuation" // users: %27, %1 | |
bb0(%0 : $UnsafeContinuation<(), Never>): | |
debug_value %0 : $UnsafeContinuation<(), Never>, let, name "continuation", argno 1 // id: %1 | |
debug_step // id: %2 | |
%3 = metatype $@thick MainActor.Type // user: %5 | |
// function_ref static MainActor.shared.getter | |
%4 = function_ref @$sScM6sharedScMvgZ : $@convention(method) (@thick MainActor.Type) -> @owned MainActor // user: %5 | |
%5 = apply %4(%3) : $@convention(method) (@thick MainActor.Type) -> @owned MainActor // users: %21, %18 | |
%6 = string_literal utf8 "main/main.swift" // user: %8 | |
%7 = integer_literal $Builtin.Word, 15 // user: %10 | |
%8 = builtin "ptrtoint_Word"(%6 : $Builtin.RawPointer) : $Builtin.Word // user: %10 | |
%9 = integer_literal $Builtin.Int8, 2 // user: %10 | |
%10 = struct $StaticString (%8 : $Builtin.Word, %7 : $Builtin.Word, %9 : $Builtin.Int8) // user: %18 | |
%11 = integer_literal $Builtin.Int64, 19 // user: %12 | |
%12 = struct $UInt (%11 : $Builtin.Int64) // user: %18 | |
// function_ref default argument 0 of Actor.assertIsolated(_:file:line:) | |
%13 = function_ref @$sScAsE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutFfA_ : $@convention(thin) <τ_0_0 where τ_0_0 : Actor> () -> @owned @callee_guaranteed () -> @owned String // user: %14 | |
%14 = apply %13<MainActor>() : $@convention(thin) <τ_0_0 where τ_0_0 : Actor> () -> @owned @callee_guaranteed () -> @owned String // users: %20, %19, %16, %15 | |
strong_retain %14 : $@callee_guaranteed () -> @owned String // id: %15 | |
%16 = convert_escape_to_noescape %14 : $@callee_guaranteed () -> @owned String to $@noescape @callee_guaranteed () -> @owned String // user: %18 | |
// function_ref Actor.assertIsolated(_:file:line:) | |
%17 = function_ref @$sScAsE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutF : $@convention(method) <τ_0_0 where τ_0_0 : Actor> (@guaranteed @noescape @callee_guaranteed () -> @owned String, StaticString, UInt, @guaranteed τ_0_0) -> () // user: %18 | |
%18 = apply %17<MainActor>(%16, %10, %12, %5) : $@convention(method) <τ_0_0 where τ_0_0 : Actor> (@guaranteed @noescape @callee_guaranteed () -> @owned String, StaticString, UInt, @guaranteed τ_0_0) -> () | |
strong_release %14 : $@callee_guaranteed () -> @owned String // id: %19 | |
strong_release %14 : $@callee_guaranteed () -> @owned String // id: %20 | |
strong_release %5 : $MainActor // id: %21 | |
debug_step // id: %22 | |
%23 = tuple () // user: %25 | |
%24 = alloc_stack $() // users: %25, %28, %27 | |
store %23 to %24 : $*() // id: %25 | |
// function_ref UnsafeContinuation.resume<>(returning:) | |
%26 = function_ref @$sScc6resume9returningyxn_ts5NeverORs_rlF : $@convention(method) <τ_0_0, τ_0_1 where τ_0_1 == Never> (@in τ_0_0, UnsafeContinuation<τ_0_0, Never>) -> () // user: %27 | |
%27 = apply %26<(), Never>(%24, %0) : $@convention(method) <τ_0_0, τ_0_1 where τ_0_1 == Never> (@in τ_0_0, UnsafeContinuation<τ_0_0, Never>) -> () | |
dealloc_stack %24 : $*() // id: %28 | |
%29 = tuple () // user: %30 | |
return %29 : $() // id: %30 | |
} // end sil function '$s4main11doSomethingyyYaFySccyyts5NeverOGXEfU_' | |
// _stdlib_isOSVersionAtLeast(_:_:_:) | |
sil [readnone] [_semantics "availability.osversion"] @$ss26_stdlib_isOSVersionAtLeastyBi1_Bw_BwBwtF : $@convention(thin) (Builtin.Word, Builtin.Word, Builtin.Word) -> Builtin.Int1 | |
// StaticString.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:) | |
sil public_external [transparent] [readonly] @$ss12StaticStringV08_builtinB7Literal17utf8CodeUnitCount7isASCIIABBp_BwBi1_tcfC : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin StaticString.Type) -> StaticString { | |
// %0 // user: %4 | |
// %1 // user: %11 | |
// %2 // user: %5 | |
bb0(%0 : $Builtin.RawPointer, %1 : $Builtin.Word, %2 : $Builtin.Int1, %3 : $@thin StaticString.Type): | |
%4 = builtin "ptrtoint_Word"(%0 : $Builtin.RawPointer) : $Builtin.Word // user: %11 | |
cond_br %2, bb2, bb1 // id: %5 | |
bb1: // Preds: bb0 | |
%6 = integer_literal $Builtin.Int8, 0 // user: %7 | |
br bb3(%6 : $Builtin.Int8) // id: %7 | |
bb2: // Preds: bb0 | |
%8 = integer_literal $Builtin.Int8, 2 // user: %9 | |
br bb3(%8 : $Builtin.Int8) // id: %9 | |
// %10 // user: %11 | |
bb3(%10 : $Builtin.Int8): // Preds: bb2 bb1 | |
%11 = struct $StaticString (%4 : $Builtin.Word, %1 : $Builtin.Word, %10 : $Builtin.Int8) // user: %12 | |
return %11 : $StaticString // id: %12 | |
} // end sil function '$ss12StaticStringV08_builtinB7Literal17utf8CodeUnitCount7isASCIIABBp_BwBi1_tcfC' | |
// UInt.init(_builtinIntegerLiteral:) | |
sil public_external [transparent] @$sSu22_builtinIntegerLiteralSuBI_tcfC : $@convention(method) (Builtin.IntLiteral, @thin UInt.Type) -> UInt { | |
// %0 // user: %2 | |
bb0(%0 : $Builtin.IntLiteral, %1 : $@thin UInt.Type): | |
%2 = builtin "s_to_u_checked_trunc_IntLiteral_Int64"(%0 : $Builtin.IntLiteral) : $(Builtin.Int64, Builtin.Int1) // user: %3 | |
%3 = tuple_extract %2 : $(Builtin.Int64, Builtin.Int1), 0 // user: %4 | |
%4 = struct $UInt (%3 : $Builtin.Int64) // user: %5 | |
return %4 : $UInt // id: %5 | |
} // end sil function '$sSu22_builtinIntegerLiteralSuBI_tcfC' | |
// default argument 0 of Actor.assertIsolated(_:file:line:) | |
sil shared [available 14.0] @$sScAsE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutFfA_ : $@convention(thin) <Self where Self : Actor> () -> @owned @callee_guaranteed () -> @owned String { | |
bb0: | |
// function_ref implicit closure #1 in default argument 0 of Actor.assertIsolated(_:file:line:) | |
%0 = function_ref @$sScAsE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutFfA_SSycfu_ : $@convention(thin) () -> @owned String // user: %1 | |
%1 = thin_to_thick_function %0 : $@convention(thin) () -> @owned String to $@callee_guaranteed () -> @owned String // user: %2 | |
return %1 : $@callee_guaranteed () -> @owned String // id: %2 | |
} // end sil function '$sScAsE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutFfA_' | |
// Actor.assertIsolated(_:file:line:) | |
sil [available 14.0] @$sScAsE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutF : $@convention(method) <τ_0_0 where τ_0_0 : Actor> (@guaranteed @noescape @callee_guaranteed () -> @owned String, StaticString, UInt, @guaranteed τ_0_0) -> () | |
// UnsafeContinuation.resume<>(returning:) | |
sil shared [available 12.0.0] @$sScc6resume9returningyxn_ts5NeverORs_rlF : $@convention(method) <T, E where E == Never> (@in T, UnsafeContinuation<T, Never>) -> () { | |
// %0 // user: %3 | |
// %1 // user: %2 | |
bb0(%0 : $*T, %1 : $UnsafeContinuation<T, Never>): | |
%2 = struct_extract %1 : $UnsafeContinuation<T, Never>, #UnsafeContinuation.context // user: %3 | |
%3 = builtin "resumeNonThrowingContinuationReturning"<T>(%2 : $Builtin.RawUnsafeContinuation, %0 : $*T) : $() | |
%4 = tuple () // user: %5 | |
return %4 : $() // id: %5 | |
} // end sil function '$sScc6resume9returningyxn_ts5NeverORs_rlF' | |
// withUnsafeContinuation<A>(_:) | |
sil shared [available 12.0.0] @$ss22withUnsafeContinuationyxySccyxs5NeverOGXEYalF : $@convention(thin) @async <T> (@guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <T>) -> @out T { | |
// %0 // user: %3 | |
// %1 // user: %4 | |
bb0(%0 : $*T, %1 : $@noescape @callee_guaranteed @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <T>): | |
// function_ref closure #1 in withUnsafeContinuation<A>(_:) | |
%2 = function_ref @$ss22withUnsafeContinuationyxySccyxs5NeverOGXEYalFyBcXEfU_ : $@convention(thin) <τ_0_0> (Builtin.RawUnsafeContinuation, @guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <τ_0_0>) -> () // user: %4 | |
%3 = get_async_continuation_addr T, %0 : $*T // users: %5, %4 | |
%4 = apply %2<T>(%3, %1) : $@convention(thin) <τ_0_0> (Builtin.RawUnsafeContinuation, @guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <τ_0_0>) -> () | |
await_async_continuation %3 : $Builtin.RawUnsafeContinuation, resume bb1 // id: %5 | |
bb1: // Preds: bb0 | |
%6 = tuple () // user: %7 | |
return %6 : $() // id: %7 | |
} // end sil function '$ss22withUnsafeContinuationyxySccyxs5NeverOGXEYalF' | |
// closure #1 in | |
sil private @$s4mainyyYaYbcfU_ : $@convention(thin) @Sendable @async @substituted <τ_0_0> () -> @out τ_0_0 for <()> { | |
// %0 "$return_value" | |
bb0(%0 : $*()): | |
// function_ref doSomething() | |
%1 = function_ref @$s4main11doSomethingyyYaF : $@convention(thin) @async () -> () // user: %2 | |
%2 = apply %1() : $@convention(thin) @async () -> () | |
%3 = tuple () // user: %4 | |
return %3 : $() // id: %4 | |
} // end sil function '$s4mainyyYaYbcfU_' | |
// static Task<>.detached(priority:operation:) | |
sil shared [available 12.0.0] @$sScTss5NeverORs_rlE8detached8priority9operationScTyxABGScPSg_xyYaYbcntFZ : $@convention(method) <Success, Failure where Success : Sendable, Failure == Never> (@in_guaranteed Optional<TaskPriority>, @owned @Sendable @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <Success>, @thin Task<Success, Never>.Type) -> @owned Task<Success, Never> { | |
// %0 // user: %4 | |
// %1 // users: %32, %27, %21 | |
// %2 // user: %31 | |
bb0(%0 : $*Optional<TaskPriority>, %1 : $@Sendable @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <Success>, %2 : $@thin Task<Success, Never>.Type): | |
%3 = alloc_stack $Optional<TaskPriority> // users: %17, %9, %6, %5, %4 | |
copy_addr %0 to [init] %3 : $*Optional<TaskPriority> // id: %4 | |
switch_enum_addr %3 : $*Optional<TaskPriority>, case #Optional.some!enumelt: bb2, case #Optional.none!enumelt: bb1 // id: %5 | |
bb1: // Preds: bb0 | |
destroy_addr %3 : $*Optional<TaskPriority> // id: %6 | |
%7 = integer_literal $Builtin.Int64, 0 // user: %8 | |
br bb3(%7 : $Builtin.Int64) // id: %8 | |
bb2: // Preds: bb0 | |
%9 = unchecked_take_enum_data_addr %3 : $*Optional<TaskPriority>, #Optional.some!enumelt // users: %12, %11 | |
// function_ref TaskPriority.rawValue.getter | |
%10 = function_ref @$sScP8rawValues5UInt8Vvg : $@convention(method) (@in_guaranteed TaskPriority) -> UInt8 // user: %11 | |
%11 = apply %10(%9) : $@convention(method) (@in_guaranteed TaskPriority) -> UInt8 // user: %13 | |
destroy_addr %9 : $*TaskPriority // id: %12 | |
%13 = struct_extract %11 : $UInt8, #UInt8._value // user: %14 | |
%14 = builtin "zextOrBitCast_Int8_Int64"(%13 : $Builtin.Int8) : $Builtin.Int64 // user: %15 | |
br bb3(%14 : $Builtin.Int64) // id: %15 | |
// %16 // user: %19 | |
bb3(%16 : $Builtin.Int64): // Preds: bb2 bb1 | |
dealloc_stack %3 : $*Optional<TaskPriority> // id: %17 | |
%18 = integer_literal $Builtin.Int64, 4096 // user: %19 | |
%19 = builtin "or_Int64"(%16 : $Builtin.Int64, %18 : $Builtin.Int64) : $Builtin.Int64 // user: %20 | |
%20 = struct $Int (%19 : $Builtin.Int64) // user: %28 | |
%21 = convert_function %1 : $@Sendable @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <Success> to $@Sendable @async @callee_guaranteed () -> @out Success // user: %23 | |
// function_ref thunk for @escaping @callee_guaranteed @Sendable @async () -> (@out A) | |
%22 = function_ref @$sxIeghHr_xs5Error_pIegHrzo_s8SendableRzs5NeverORs_r0_lTR : $@convention(thin) @async <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@guaranteed @Sendable @async @callee_guaranteed () -> @out τ_0_0) -> (@out τ_0_0, @error any Error) // user: %23 | |
%23 = partial_apply [callee_guaranteed] %22<Success, Never>(%21) : $@convention(thin) @async <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@guaranteed @Sendable @async @callee_guaranteed () -> @out τ_0_0) -> (@out τ_0_0, @error any Error) // user: %24 | |
%24 = convert_function %23 : $@async @callee_guaranteed () -> (@out Success, @error any Error) to $@async @callee_guaranteed @substituted <τ_0_0> () -> (@out τ_0_0, @error any Error) for <Success> // user: %28 | |
%25 = metatype $@thick Success.Type // user: %26 | |
%26 = init_existential_metatype %25 : $@thick Success.Type, $@thick any Any.Type // user: %28 | |
strong_retain %1 : $@Sendable @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <Success> // id: %27 | |
%28 = builtin "createAsyncTask"<Success>(%20 : $Int, %26 : $@thick any Any.Type, %24 : $@async @callee_guaranteed @substituted <τ_0_0> () -> (@out τ_0_0, @error any Error) for <Success>) : $(Builtin.NativeObject, Builtin.RawPointer) // user: %29 | |
%29 = tuple_extract %28 : $(Builtin.NativeObject, Builtin.RawPointer), 0 // user: %31 | |
// function_ref Task.init(_:) | |
%30 = function_ref @$sScTyScTyxq_GBocfC : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 : Error> (@owned Builtin.NativeObject, @thin Task<τ_0_0, τ_0_1>.Type) -> @owned Task<τ_0_0, τ_0_1> // user: %31 | |
%31 = apply %30<Success, Never>(%29, %2) : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 : Error> (@owned Builtin.NativeObject, @thin Task<τ_0_0, τ_0_1>.Type) -> @owned Task<τ_0_0, τ_0_1> // user: %33 | |
strong_release %1 : $@Sendable @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <Success> // id: %32 | |
return %31 : $Task<Success, Never> // id: %33 | |
} // end sil function '$sScTss5NeverORs_rlE8detached8priority9operationScTyxABGScPSg_xyYaYbcntFZ' | |
// Task<>.value.getter | |
sil [available 12.0.0] @$sScTss5NeverORs_rlE5valuexvg : $@convention(method) @async <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@guaranteed Task<τ_0_0, Never>) -> @out τ_0_0 | |
// exit | |
// clang name: exit | |
sil [clang exit] @exit : $@convention(c) (Int32) -> Never | |
// TaskPriority.rawValue.getter | |
sil [available 12.0.0] @$sScP8rawValues5UInt8Vvg : $@convention(method) (@in_guaranteed TaskPriority) -> UInt8 | |
// thunk for @escaping @callee_guaranteed @Sendable @async () -> (@out A) | |
sil shared [transparent] [reabstraction_thunk] @$sxIeghHr_xs5Error_pIegHrzo_s8SendableRzs5NeverORs_r0_lTR : $@convention(thin) @async <Success, Failure where Success : Sendable, Failure == Never> (@guaranteed @Sendable @async @callee_guaranteed () -> @out Success) -> (@out Success, @error any Error) { | |
// %0 // user: %2 | |
// %1 // user: %2 | |
bb0(%0 : $*Success, %1 : $@Sendable @async @callee_guaranteed () -> @out Success): | |
%2 = apply %1(%0) : $@Sendable @async @callee_guaranteed () -> @out Success | |
%3 = tuple () // user: %4 | |
return %3 : $() // id: %4 | |
} // end sil function '$sxIeghHr_xs5Error_pIegHrzo_s8SendableRzs5NeverORs_r0_lTR' | |
// Task.init(_:) | |
sil shared [available 12.0.0] @$sScTyScTyxq_GBocfC : $@convention(method) <Success, Failure where Success : Sendable, Failure : Error> (@owned Builtin.NativeObject, @thin Task<Success, Failure>.Type) -> @owned Task<Success, Failure> { | |
// %0 // user: %2 | |
bb0(%0 : $Builtin.NativeObject, %1 : $@thin Task<Success, Failure>.Type): | |
%2 = struct $Task<Success, Failure> (%0 : $Builtin.NativeObject) // user: %3 | |
return %2 : $Task<Success, Failure> // id: %3 | |
} // end sil function '$sScTyScTyxq_GBocfC' | |
// closure #1 in withUnsafeContinuation<A>(_:) | |
sil shared @$ss22withUnsafeContinuationyxySccyxs5NeverOGXEYalFyBcXEfU_ : $@convention(thin) <T> (Builtin.RawUnsafeContinuation, @guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <T>) -> () { | |
// %0 // user: %4 | |
// %1 // user: %5 | |
bb0(%0 : $Builtin.RawUnsafeContinuation, %1 : @closureCapture $@noescape @callee_guaranteed @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <T>): | |
%2 = metatype $@thin UnsafeContinuation<T, Never>.Type // user: %4 | |
// function_ref UnsafeContinuation.init(_:) | |
%3 = function_ref @$sSccySccyxq_GBccfC : $@convention(method) <τ_0_0, τ_0_1 where τ_0_1 : Error> (Builtin.RawUnsafeContinuation, @thin UnsafeContinuation<τ_0_0, τ_0_1>.Type) -> UnsafeContinuation<τ_0_0, τ_0_1> // user: %4 | |
%4 = apply %3<T, Never>(%0, %2) : $@convention(method) <τ_0_0, τ_0_1 where τ_0_1 : Error> (Builtin.RawUnsafeContinuation, @thin UnsafeContinuation<τ_0_0, τ_0_1>.Type) -> UnsafeContinuation<τ_0_0, τ_0_1> // user: %5 | |
%5 = apply %1(%4) : $@noescape @callee_guaranteed @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <T> | |
%6 = tuple () // user: %7 | |
return %6 : $() // id: %7 | |
} // end sil function '$ss22withUnsafeContinuationyxySccyxs5NeverOGXEYalFyBcXEfU_' | |
// UnsafeContinuation.init(_:) | |
sil shared [available 12.0.0] @$sSccySccyxq_GBccfC : $@convention(method) <T, E where E : Error> (Builtin.RawUnsafeContinuation, @thin UnsafeContinuation<T, E>.Type) -> UnsafeContinuation<T, E> { | |
// %0 // user: %2 | |
bb0(%0 : $Builtin.RawUnsafeContinuation, %1 : $@thin UnsafeContinuation<T, E>.Type): | |
%2 = struct $UnsafeContinuation<T, E> (%0 : $Builtin.RawUnsafeContinuation) // user: %3 | |
return %2 : $UnsafeContinuation<T, E> // id: %3 | |
} // end sil function '$sSccySccyxq_GBccfC' | |
// implicit closure #1 in default argument 0 of Actor.assertIsolated(_:file:line:) | |
sil shared [transparent] @$sScAsE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutFfA_SSycfu_ : $@convention(thin) () -> @owned String { | |
bb0: | |
%0 = metatype $@thin String.Type // user: %2 | |
// function_ref String.init() | |
%1 = function_ref @$sS2SycfC : $@convention(method) (@thin String.Type) -> @owned String // user: %2 | |
%2 = apply %1(%0) : $@convention(method) (@thin String.Type) -> @owned String // user: %3 | |
return %2 : $String // id: %3 | |
} // end sil function '$sScAsE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutFfA_SSycfu_' | |
// String.init() | |
sil [always_inline] [_semantics "string.init_empty"] @$sS2SycfC : $@convention(method) (@thin String.Type) -> @owned String | |
// Mappings from '#fileID' to '#filePath': | |
// 'main/main.swift' => 'main.swift' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sil_stage raw | |
import Builtin | |
import Swift | |
import SwiftShims | |
import Foundation | |
@MainActor func doSomething() async | |
// main | |
sil [ossa] @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 { | |
bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>): | |
// function_ref async_Main | |
%2 = function_ref @async_Main : $@convention(thin) @async () -> () // user: %8 | |
%3 = integer_literal $Builtin.Int64, 2048 // user: %4 | |
%4 = struct $Int (%3 : $Builtin.Int64) // user: %10 | |
%5 = metatype $@thick ().Type // user: %6 | |
%6 = init_existential_metatype %5 : $@thick ().Type, $@thick any Any.Type // user: %10 | |
// function_ref thunk for @escaping @convention(thin) @async () -> () | |
%7 = function_ref @$sIetH_yts5Error_pIegHrzo_TR : $@convention(thin) @async (@convention(thin) @async () -> ()) -> (@out (), @error any Error) // user: %8 | |
%8 = partial_apply [callee_guaranteed] %7(%2) : $@convention(thin) @async (@convention(thin) @async () -> ()) -> (@out (), @error any Error) // user: %9 | |
%9 = convert_function %8 : $@async @callee_guaranteed () -> (@out (), @error any Error) to $@async @callee_guaranteed @substituted <τ_0_0> () -> (@out τ_0_0, @error any Error) for <()> // user: %10 | |
%10 = builtin "createAsyncTask"<()>(%4 : $Int, %6 : $@thick any Any.Type, %9 : $@async @callee_guaranteed @substituted <τ_0_0> () -> (@out τ_0_0, @error any Error) for <()>) : $(Builtin.NativeObject, Builtin.RawPointer) // user: %11 | |
(%11, %12) = destructure_tuple %10 : $(Builtin.NativeObject, Builtin.RawPointer) // user: %14 | |
// function_ref swift_job_run | |
%13 = function_ref @swift_job_run : $@convention(thin) (UnownedJob, UnownedSerialExecutor) -> () // user: %19 | |
%14 = builtin "convertTaskToJob"(%11 : $Builtin.NativeObject) : $Builtin.Job // user: %15 | |
%15 = struct $UnownedJob (%14 : $Builtin.Job) // user: %19 | |
// function_ref swift_task_getMainExecutor | |
%16 = function_ref @swift_task_getMainExecutor : $@convention(thin) () -> Builtin.Executor // user: %17 | |
%17 = apply %16() : $@convention(thin) () -> Builtin.Executor // user: %18 | |
%18 = struct $UnownedSerialExecutor (%17 : $Builtin.Executor) // user: %19 | |
%19 = apply %13(%15, %18) : $@convention(thin) (UnownedJob, UnownedSerialExecutor) -> () | |
// function_ref swift_task_asyncMainDrainQueue | |
%20 = function_ref @swift_task_asyncMainDrainQueue : $@convention(thin) () -> Never // user: %21 | |
%21 = apply %20() : $@convention(thin) () -> Never | |
unreachable // id: %22 | |
} // end sil function 'main' | |
// async_Main | |
sil hidden [ossa] @async_Main : $@convention(thin) @async () -> () { | |
bb0: | |
// function_ref swift_task_getMainExecutor | |
%0 = function_ref @swift_task_getMainExecutor : $@convention(thin) () -> Builtin.Executor // user: %1 | |
%1 = apply %0() : $@convention(thin) () -> Builtin.Executor // user: %2 | |
%2 = enum $Optional<Builtin.Executor>, #Optional.some!enumelt, %1 : $Builtin.Executor // user: %16 | |
%3 = metatype $@thin Task<(), Never>.Type // user: %9 | |
%4 = alloc_stack $Optional<TaskPriority> // users: %11, %10, %9, %5 | |
inject_enum_addr %4 : $*Optional<TaskPriority>, #Optional.none!enumelt // id: %5 | |
// function_ref closure #1 in | |
%6 = function_ref @$s4mainyyYaYbcfU_ : $@convention(thin) @Sendable @async @substituted <τ_0_0> () -> @out τ_0_0 for <()> // user: %7 | |
%7 = thin_to_thick_function %6 : $@convention(thin) @Sendable @async @substituted <τ_0_0> () -> @out τ_0_0 for <()> to $@Sendable @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <()> // user: %9 | |
// function_ref static Task<>.detached(priority:operation:) | |
%8 = function_ref @$sScTss5NeverORs_rlE8detached8priority9operationScTyxABGScPSg_xyYaYbcntFZ : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@in_guaranteed Optional<TaskPriority>, @owned @Sendable @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <τ_0_0>, @thin Task<τ_0_0, Never>.Type) -> @owned Task<τ_0_0, Never> // user: %9 | |
%9 = apply %8<(), Never>(%4, %7, %3) : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@in_guaranteed Optional<TaskPriority>, @owned @Sendable @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <τ_0_0>, @thin Task<τ_0_0, Never>.Type) -> @owned Task<τ_0_0, Never> // users: %19, %12 | |
destroy_addr %4 : $*Optional<TaskPriority> // id: %10 | |
dealloc_stack %4 : $*Optional<TaskPriority> // id: %11 | |
%12 = begin_borrow %9 : $Task<(), Never> // users: %18, %15 | |
%13 = alloc_stack $() // users: %20, %17, %15 | |
// function_ref Task<>.value.getter | |
%14 = function_ref @$sScTss5NeverORs_rlE5valuexvg : $@convention(method) @async <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@guaranteed Task<τ_0_0, Never>) -> @out τ_0_0 // user: %15 | |
%15 = apply %14<(), Never>(%13, %12) : $@convention(method) @async <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@guaranteed Task<τ_0_0, Never>) -> @out τ_0_0 | |
hop_to_executor %2 : $Optional<Builtin.Executor> // id: %16 | |
%17 = load [trivial] %13 : $*() | |
end_borrow %12 : $Task<(), Never> // id: %18 | |
destroy_value %9 : $Task<(), Never> // id: %19 | |
dealloc_stack %13 : $*() // id: %20 | |
%21 = integer_literal $Builtin.Int32, 0 // user: %22 | |
%22 = struct $Int32 (%21 : $Builtin.Int32) // user: %24 | |
// function_ref exit | |
%23 = function_ref @exit : $@convention(c) (Int32) -> Never // user: %24 | |
%24 = apply %23(%22) : $@convention(c) (Int32) -> Never | |
unreachable // id: %25 | |
} // end sil function 'async_Main' | |
// thunk for @escaping @convention(thin) @async () -> () | |
sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sIetH_yts5Error_pIegHrzo_TR : $@convention(thin) @async (@convention(thin) @async () -> ()) -> (@out (), @error any Error) { | |
// %1 // user: %2 | |
bb0(%0 : $*(), %1 : $@convention(thin) @async () -> ()): | |
%2 = apply %1() : $@convention(thin) @async () -> () | |
%3 = tuple () // user: %4 | |
return %3 : $() // id: %4 | |
} // end sil function '$sIetH_yts5Error_pIegHrzo_TR' | |
// swift_job_run | |
sil [available 12.0.0] @swift_job_run : $@convention(thin) (UnownedJob, UnownedSerialExecutor) -> () | |
// swift_task_getMainExecutor | |
sil [available 12.0.0] @swift_task_getMainExecutor : $@convention(thin) () -> Builtin.Executor | |
// swift_task_asyncMainDrainQueue | |
sil [available 12.0.0] @swift_task_asyncMainDrainQueue : $@convention(thin) () -> Never | |
// doSomething() | |
sil hidden [ossa] @$s4main11doSomethingyyYaF : $@convention(thin) @async () -> () { | |
bb0: | |
%0 = metatype $@thick MainActor.Type // user: %2 | |
// function_ref static MainActor.shared.getter | |
%1 = function_ref @$sScM6sharedScMvgZ : $@convention(method) (@thick MainActor.Type) -> @owned MainActor // user: %2 | |
%2 = apply %1(%0) : $@convention(method) (@thick MainActor.Type) -> @owned MainActor // users: %14, %3 | |
%3 = begin_borrow %2 : $MainActor // users: %13, %10, %4 | |
hop_to_executor %3 : $MainActor // id: %4 | |
%5 = alloc_stack $() // users: %12, %11, %9 | |
// function_ref closure #1 in doSomething() | |
%6 = function_ref @$s4main11doSomethingyyYaFySccyyts5NeverOGXEfU_ : $@convention(thin) @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <()> // user: %7 | |
%7 = thin_to_thick_function %6 : $@convention(thin) @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <()> to $@noescape @callee_guaranteed @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <()> // user: %9 | |
// function_ref withUnsafeContinuation<A>(_:) | |
%8 = function_ref @$ss22withUnsafeContinuationyxySccyxs5NeverOGXEYalF : $@convention(thin) @async <τ_0_0> (@guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <τ_0_0>) -> @out τ_0_0 // user: %9 | |
%9 = apply %8<()>(%5, %7) : $@convention(thin) @async <τ_0_0> (@guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <τ_0_0>) -> @out τ_0_0 | |
hop_to_executor %3 : $MainActor // id: %10 | |
%11 = load [trivial] %5 : $*() | |
dealloc_stack %5 : $*() // id: %12 | |
end_borrow %3 : $MainActor // id: %13 | |
destroy_value %2 : $MainActor // id: %14 | |
%15 = tuple () // user: %16 | |
return %15 : $() // id: %16 | |
} // end sil function '$s4main11doSomethingyyYaF' | |
// static MainActor.shared.getter | |
sil [available 12.0.0] @$sScM6sharedScMvgZ : $@convention(method) (@thick MainActor.Type) -> @owned MainActor | |
// closure #1 in doSomething() | |
sil private [ossa] @$s4main11doSomethingyyYaFySccyyts5NeverOGXEfU_ : $@convention(thin) @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <()> { | |
// %0 "continuation" // users: %35, %1 | |
bb0(%0 : $UnsafeContinuation<(), Never>): | |
debug_value %0 : $UnsafeContinuation<(), Never>, let, name "continuation", argno 1 // id: %1 | |
%2 = integer_literal $Builtin.Word, 14 // user: %6 | |
%3 = integer_literal $Builtin.Word, 0 // user: %6 | |
%4 = integer_literal $Builtin.Word, 0 // user: %6 | |
// function_ref _stdlib_isOSVersionAtLeast(_:_:_:) | |
%5 = function_ref @$ss26_stdlib_isOSVersionAtLeastyBi1_Bw_BwBwtF : $@convention(thin) (Builtin.Word, Builtin.Word, Builtin.Word) -> Builtin.Int1 // user: %6 | |
%6 = apply %5(%2, %3, %4) : $@convention(thin) (Builtin.Word, Builtin.Word, Builtin.Word) -> Builtin.Int1 // user: %7 | |
cond_br %6, bb1, bb2 // id: %7 | |
bb1: // Preds: bb0 | |
%8 = metatype $@thick MainActor.Type // user: %10 | |
// function_ref static MainActor.shared.getter | |
%9 = function_ref @$sScM6sharedScMvgZ : $@convention(method) (@thick MainActor.Type) -> @owned MainActor // user: %10 | |
%10 = apply %9(%8) : $@convention(method) (@thick MainActor.Type) -> @owned MainActor // users: %28, %25 | |
%11 = string_literal utf8 "main/main.swift" // user: %16 | |
%12 = integer_literal $Builtin.Word, 15 // user: %16 | |
%13 = integer_literal $Builtin.Int1, -1 // user: %16 | |
%14 = metatype $@thin StaticString.Type // user: %16 | |
// function_ref StaticString.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:) | |
%15 = function_ref @$ss12StaticStringV08_builtinB7Literal17utf8CodeUnitCount7isASCIIABBp_BwBi1_tcfC : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin StaticString.Type) -> StaticString // user: %16 | |
%16 = apply %15(%11, %12, %13, %14) : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin StaticString.Type) -> StaticString // user: %25 | |
%17 = integer_literal $Builtin.IntLiteral, 19 // user: %20 | |
%18 = metatype $@thin UInt.Type // user: %20 | |
// function_ref UInt.init(_builtinIntegerLiteral:) | |
%19 = function_ref @$sSu22_builtinIntegerLiteralSuBI_tcfC : $@convention(method) (Builtin.IntLiteral, @thin UInt.Type) -> UInt // user: %20 | |
%20 = apply %19(%17, %18) : $@convention(method) (Builtin.IntLiteral, @thin UInt.Type) -> UInt // user: %25 | |
// function_ref default argument 0 of Actor.assertIsolated(_:file:line:) | |
%21 = function_ref @$sScAsE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutFfA_ : $@convention(thin) <τ_0_0 where τ_0_0 : Actor> () -> @owned @callee_guaranteed () -> @owned String // user: %22 | |
%22 = apply %21<MainActor>() : $@convention(thin) <τ_0_0 where τ_0_0 : Actor> () -> @owned @callee_guaranteed () -> @owned String // users: %27, %23 | |
%23 = convert_escape_to_noescape [not_guaranteed] %22 : $@callee_guaranteed () -> @owned String to $@noescape @callee_guaranteed () -> @owned String // users: %26, %25 | |
// function_ref Actor.assertIsolated(_:file:line:) | |
%24 = function_ref @$sScAsE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutF : $@convention(method) <τ_0_0 where τ_0_0 : Actor> (@guaranteed @noescape @callee_guaranteed () -> @owned String, StaticString, UInt, @guaranteed τ_0_0) -> () // user: %25 | |
%25 = apply %24<MainActor>(%23, %16, %20, %10) : $@convention(method) <τ_0_0 where τ_0_0 : Actor> (@guaranteed @noescape @callee_guaranteed () -> @owned String, StaticString, UInt, @guaranteed τ_0_0) -> () | |
destroy_value %23 : $@noescape @callee_guaranteed () -> @owned String // id: %26 | |
destroy_value %22 : $@callee_guaranteed () -> @owned String // id: %27 | |
destroy_value %10 : $MainActor // id: %28 | |
br bb3 // id: %29 | |
bb2: // Preds: bb0 | |
br bb3 // id: %30 | |
bb3: // Preds: bb1 bb2 | |
%31 = tuple () // user: %33 | |
%32 = alloc_stack $() // users: %36, %35, %33 | |
store %31 to [trivial] %32 : $*() // id: %33 | |
// function_ref UnsafeContinuation.resume<>(returning:) | |
%34 = function_ref @$sScc6resume9returningyxn_ts5NeverORs_rlF : $@convention(method) <τ_0_0, τ_0_1 where τ_0_1 == Never> (@in τ_0_0, UnsafeContinuation<τ_0_0, Never>) -> () // user: %35 | |
%35 = apply %34<(), Never>(%32, %0) : $@convention(method) <τ_0_0, τ_0_1 where τ_0_1 == Never> (@in τ_0_0, UnsafeContinuation<τ_0_0, Never>) -> () | |
dealloc_stack %32 : $*() // id: %36 | |
%37 = tuple () // user: %38 | |
return %37 : $() // id: %38 | |
} // end sil function '$s4main11doSomethingyyYaFySccyyts5NeverOGXEfU_' | |
// _stdlib_isOSVersionAtLeast(_:_:_:) | |
sil [readnone] [_semantics "availability.osversion"] @$ss26_stdlib_isOSVersionAtLeastyBi1_Bw_BwBwtF : $@convention(thin) (Builtin.Word, Builtin.Word, Builtin.Word) -> Builtin.Int1 | |
// StaticString.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:) | |
sil [transparent] [serialized] [readonly] @$ss12StaticStringV08_builtinB7Literal17utf8CodeUnitCount7isASCIIABBp_BwBi1_tcfC : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin StaticString.Type) -> StaticString | |
// UInt.init(_builtinIntegerLiteral:) | |
sil [transparent] [serialized] @$sSu22_builtinIntegerLiteralSuBI_tcfC : $@convention(method) (Builtin.IntLiteral, @thin UInt.Type) -> UInt | |
// default argument 0 of Actor.assertIsolated(_:file:line:) | |
sil hidden_external [serialized] [available 14.0] @$sScAsE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutFfA_ : $@convention(thin) <τ_0_0 where τ_0_0 : Actor> () -> @owned @callee_guaranteed () -> @owned String | |
// Actor.assertIsolated(_:file:line:) | |
sil [available 14.0] @$sScAsE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutF : $@convention(method) <τ_0_0 where τ_0_0 : Actor> (@guaranteed @noescape @callee_guaranteed () -> @owned String, StaticString, UInt, @guaranteed τ_0_0) -> () | |
// UnsafeContinuation.resume<>(returning:) | |
sil hidden_external [serialized] [available 12.0.0] @$sScc6resume9returningyxn_ts5NeverORs_rlF : $@convention(method) <τ_0_0, τ_0_1 where τ_0_1 == Never> (@in τ_0_0, UnsafeContinuation<τ_0_0, Never>) -> () | |
// withUnsafeContinuation<A>(_:) | |
sil hidden_external [serialized] [available 12.0.0] @$ss22withUnsafeContinuationyxySccyxs5NeverOGXEYalF : $@convention(thin) @async <τ_0_0> (@guaranteed @noescape @callee_guaranteed @substituted <τ_0_0> (UnsafeContinuation<τ_0_0, Never>) -> () for <τ_0_0>) -> @out τ_0_0 | |
// closure #1 in | |
sil private [ossa] @$s4mainyyYaYbcfU_ : $@convention(thin) @Sendable @async @substituted <τ_0_0> () -> @out τ_0_0 for <()> { | |
// %0 "$return_value" | |
bb0(%0 : $*()): | |
%1 = enum $Optional<Builtin.Executor>, #Optional.none!enumelt // users: %5, %2 | |
hop_to_executor %1 : $Optional<Builtin.Executor> // id: %2 | |
// function_ref doSomething() | |
%3 = function_ref @$s4main11doSomethingyyYaF : $@convention(thin) @async () -> () // user: %4 | |
%4 = apply %3() : $@convention(thin) @async () -> () | |
hop_to_executor %1 : $Optional<Builtin.Executor> // id: %5 | |
%6 = tuple () // user: %7 | |
return %6 : $() // id: %7 | |
} // end sil function '$s4mainyyYaYbcfU_' | |
// static Task<>.detached(priority:operation:) | |
sil hidden_external [serialized] [available 12.0.0] @$sScTss5NeverORs_rlE8detached8priority9operationScTyxABGScPSg_xyYaYbcntFZ : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@in_guaranteed Optional<TaskPriority>, @owned @Sendable @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <τ_0_0>, @thin Task<τ_0_0, Never>.Type) -> @owned Task<τ_0_0, Never> | |
// Task<>.value.getter | |
sil [available 12.0.0] @$sScTss5NeverORs_rlE5valuexvg : $@convention(method) @async <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@guaranteed Task<τ_0_0, Never>) -> @out τ_0_0 | |
// exit | |
// clang name: exit | |
sil [serialized] [clang exit] @exit : $@convention(c) (Int32) -> Never | |
// Mappings from '#fileID' to '#filePath': | |
// 'main/main.swift' => 'main.swift' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment