1
- // RUN: %target-swift-frontend -O -primary-file %s -emit-sil -enable-experimental-distributed | %FileCheck %s
1
+ // RUN: %target-swift-frontend -O -primary-file %s -emit-sil -enable-experimental-distributed | %FileCheck %s --dump-input=always
2
2
3
3
import _Distributed
4
4
5
5
@available ( SwiftStdlib 5 . 5 , * )
6
6
distributed actor SimpleEmptyDistributedActor {
7
7
}
8
8
9
+ // ==== ------------------------------------------------------------------------
10
+ // ==== deinit must invoke transport.resignIdentity() when it is local
11
+
9
12
// CHECK: // SimpleEmptyDistributedActor.deinit
10
- // CHECK: TEST
13
+ // CHECK: sil hidden [available 12.0] @$s36distributed_actor_default_deinit_sil27SimpleEmptyDistributedActorCfd : $@convention(method) (@guaranteed SimpleEmptyDistributedActor) -> @owned Builtin.NativeObject {
14
+ // CHECK: [[SELF:%[0-9]+]] "self"
15
+ // CHECK: bb0(%0 : $SimpleEmptyDistributedActor):
16
+ // CHECK: debug_value %0 : $SimpleEmptyDistributedActor, let, name "self", argno 1
17
+ // CHECK: [[ID_ADDR:%[0-9]+]] = ref_element_addr %0 : $SimpleEmptyDistributedActor, #SimpleEmptyDistributedActor.id
18
+ // CHECK: [[TRANSPORT_ADDR:%[0-9]+]] = ref_element_addr %0 : $SimpleEmptyDistributedActor, #SimpleEmptyDistributedActor.actorTransport
19
+ // CHECK: %4 = init_existential_ref %0 : $SimpleEmptyDistributedActor : $SimpleEmptyDistributedActor, $AnyObject
20
+ // CHECK: // function_ref swift_distributed_actor_is_remote
21
+ // CHECK: %5 = function_ref @swift_distributed_actor_is_remote : $@convention(thin) (@guaranteed AnyObject) -> Bool
22
+ // CHECK: %6 = apply %5(%4) : $@convention(thin) (@guaranteed AnyObject) -> Bool
23
+ // CHECK: %7 = struct_extract %6 : $Bool, #Bool._value
24
+ // CHECK: cond_br %7, [[REMOTE_BB:bb[0-9]+]], [[LOCAL_BB:bb[0-9]+]]
25
+
26
+ // If local...
27
+ // CHECK: [[LOCAL_BB]]:
28
+ // CHECK: %9 = open_existential_addr immutable_access %3 : $*ActorTransport to $*@opened({{.*}}) ActorTransport
29
+ // CHECK: %10 = witness_method $@opened({{.*}}) ActorTransport, #ActorTransport.resignIdentity : <Self where Self : ActorTransport> (Self) -> (AnyActorIdentity) -> (), %9 : $*@opened({{.*}}) ActorTransport : $@convention(witness_method: ActorTransport) <τ_0_0 where τ_0_0 : ActorTransport> (@in_guaranteed AnyActorIdentity, @in_guaranteed τ_0_0) -> ()
30
+ // CHECK: %11 = apply %10<@opened({{.*}}) ActorTransport>(%2, %9) : $@convention(witness_method: ActorTransport) <τ_0_0 where τ_0_0 : ActorTransport> (@in_guaranteed AnyActorIdentity, @in_guaranteed τ_0_0) -> ()
31
+ // CHECK: br bb3
32
+
33
+ // If remote...
34
+ // CHECK: [[REMOTE_BB]]:
35
+ // CHECK: br bb3
36
+
37
+ // Finish up the destroying...
38
+ // CHECK: bb3:
39
+ // CHECK: destroy_addr [[ID_ADDR]] : $*AnyActorIdentity
40
+ // CHECK: destroy_addr [[TRANSPORT_ADDR]] : $*ActorTransport
41
+ // CHECK: %16 = builtin "destroyDefaultActor"(%0 : $SimpleEmptyDistributedActor) : $()
42
+ // CHECK: %17 = unchecked_ref_cast %0 : $SimpleEmptyDistributedActor to $Builtin.NativeObject
43
+ // CHECK: return %17 : $Builtin.NativeObject
44
+ // CHECK: } // end sil function '$s36distributed_actor_default_deinit_sil27SimpleEmptyDistributedActorCfd'
0 commit comments