Skip to content

Commit 74b3582

Browse files
committed
more test updates for actorSystem assignment
1 parent 053286a commit 74b3582

6 files changed

+222
-25
lines changed

test/Distributed/Runtime/distributed_actor_init_local.swift

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,22 @@ distributed actor ThrowBeforeFullyInit {
6363
}
6464
}
6565

66+
distributed actor ThrowingAssign {
67+
init(_ getSystem: @Sendable () throws -> FakeActorSystem) throws {
68+
self.actorSystem = try getSystem()
69+
}
70+
}
71+
72+
distributed actor MaybeSystem {
73+
init?(_ sys: FakeActorSystem?) {
74+
if let system = sys {
75+
self.actorSystem = system
76+
return
77+
}
78+
return nil
79+
}
80+
}
81+
6682
// ==== Fake Transport ---------------------------------------------------------
6783

6884
struct ActorAddress: Sendable, Hashable, Codable {
@@ -220,13 +236,27 @@ func test() async {
220236
// CHECK: ready actor:main.Bug_CallsReadyTwice, id:ActorAddress(address: "[[ID7]]")
221237
// CHECK-NEXT: ready actor:main.Bug_CallsReadyTwice, id:ActorAddress(address: "[[ID7]]")
222238

239+
test.append(MaybeSystem(system))
240+
// CHECK: assign type:MaybeSystem, id:ActorAddress(address: "[[ID8:.*]]")
241+
// CHECK: ready actor:main.MaybeSystem, id:ActorAddress(address: "[[ID8]]")
242+
243+
// the following tests fail to initialize the actor's identity.
244+
print("-- start of no-assign tests --")
245+
test.append(MaybeSystem(nil))
246+
test.append(try? ThrowingAssign { throw MyError.test })
247+
print("-- end of no-assign tests --")
248+
// CHECK: -- start of no-assign tests --
249+
// CHECK-NOT: assign
250+
// CHECK: -- end of no-assign tests --
251+
223252
// CHECK-DAG: resign id:ActorAddress(address: "[[ID1]]")
224253
// CHECK-DAG: resign id:ActorAddress(address: "[[ID2]]")
225254
// CHECK-DAG: resign id:ActorAddress(address: "[[ID3]]")
226255
// MISSING-CHECK-DAG: resign id:ActorAddress(address: "[[ID4]]") // FIXME: should eventually work (rdar://84533820).
227256
// MISSING-CHECK-DAG: resign id:ActorAddress(address: "[[ID5]]") // FIXME: should eventually work (rdar://84533820).
228257
// CHECK-DAG: resign id:ActorAddress(address: "[[ID6]]")
229258
// CHECK-DAG: resign id:ActorAddress(address: "[[ID7]]")
259+
// CHECK-DAG: resign id:ActorAddress(address: "[[ID8]]")
230260
}
231261

232262
@main struct Main {

test/Distributed/SIL/distributed_actor_default_init_sil_1.swift

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,39 @@ distributed actor MyDistActor {
2323
var localOnlyField: SomeClass
2424

2525
init(system_sync: FakeActorSystem) {
26-
self.actorSystem = system_sync
2726
self.localOnlyField = SomeClass()
27+
self.actorSystem = system_sync
2828
}
2929

3030
// CHECK-LABEL: // MyDistActor.init(system_sync:)
3131
// CHECK: sil hidden @$s14default_deinit11MyDistActorC11system_syncAC015FakeDistributedE7Systems0hE6SystemV_tcfc : $@convention(method) (@owned FakeActorSystem, @owned MyDistActor) -> @owned MyDistActor {
32-
// CHECK: bb0([[SYSTEM:%[0-9]+]] : $FakeActorSystem, [[SELF:%[0-9]+]] : $MyDistActor):
32+
// CHECK: bb0([[SYS_PARAM:%[0-9]+]] : $FakeActorSystem, [[SELF:%[0-9]+]] : $MyDistActor):
3333
// CHECK: builtin "initializeDefaultActor"([[SELF]] : $MyDistActor)
34+
35+
// *** save user-defined property ***
36+
// CHECK: store {{%[0-9]+}} to {{%[0-9]+}} : $*SomeClass
37+
3438
// *** save system ***
35-
// CHECK: [[TP_FIELD:%[0-9]+]] = ref_element_addr [[SELF]] : $MyDistActor, #MyDistActor.actorSystem
36-
// CHECK: store [[SYSTEM]] to [[TP_FIELD]] : $*FakeActorSystem
39+
// CHECK: [[TP_FIELD1:%[0-9]+]] = ref_element_addr [[SELF]] : $MyDistActor, #MyDistActor.actorSystem
40+
// CHECK: store [[SYS_PARAM]] to [[TP_FIELD1]] : $*FakeActorSystem
41+
3742
// *** obtain an identity ***
43+
// CHECK: [[TP_FIELD2:%[0-9]+]] = ref_element_addr [[SELF]] : $MyDistActor, #MyDistActor.actorSystem
44+
// CHECK: [[RELOADED_SYS1:%[0-9]+]] = load [[TP_FIELD2]] : $*FakeActorSystem
3845
// CHECK: [[SELF_METATYPE:%[0-9]+]] = metatype $@thick MyDistActor.Type
39-
// CHECK: [[ASSIGN_ID_FN:%[0-9]+]] = function_ref @$s27FakeDistributedActorSystems0aC6SystemV8assignIDyAA0C7AddressVxm0B00bC0RzAF0G0RtzlF : $@convention(method) <τ_0_0 where τ_0_0 : DistributedActor, τ_0_0.ID == ActorAddress> (@thick τ_0_0.Type, @guaranteed FakeActorSystem) -> @owned ActorAddress // user: %12
40-
// CHECK: [[ID:%[0-9]+]] = apply [[ASSIGN_ID_FN]]<MyDistActor>([[SELF_METATYPE]], [[SYSTEM]]) : $@convention(method) <τ_0_0 where τ_0_0 : DistributedActor, τ_0_0.ID == ActorAddress> (@thick τ_0_0.Type, @guaranteed FakeActorSystem) -> @owned ActorAddress
46+
// CHECK: [[ASSIGN_ID_FN:%[0-9]+]] = function_ref @$s27FakeDistributedActorSystems0aC6SystemV8assignIDyAA0C7AddressVxm0B00bC0RzAF0G0RtzlF
47+
// CHECK: [[ID:%[0-9]+]] = apply [[ASSIGN_ID_FN]]<MyDistActor>([[SELF_METATYPE]], [[RELOADED_SYS1]])
48+
4149
// *** save identity ***
4250
// CHECK: [[ID_FIELD:%[0-9]+]] = ref_element_addr [[SELF]] : $MyDistActor, #MyDistActor.id
4351
// CHECK: store [[ID]] to [[ID_FIELD]] : $*ActorAddress
44-
// *** save user-defined property ***
45-
// CHECK: store {{%[0-9]+}} to {{%[0-9]+}} : $*SomeClass
52+
4653
// *** invoke actorReady ***
47-
// CHECK: [[READY_FN:%[0-9]+]] = function_ref @$s27FakeDistributedActorSystems0aC6SystemV10actorReadyyyx0B00bC0RzAA0C7AddressV2IDRtzlF : $@convention(method) <τ_0_0 where τ_0_0 : DistributedActor, τ_0_0.ID == ActorAddress> (@guaranteed τ_0_0, @guaranteed FakeActorSystem) -> ()
48-
// CHECK: = apply [[READY_FN]]<MyDistActor>([[SELF]], [[SYSTEM]])
49-
// *** clean-ups ***
50-
// CHECK: release_value [[SYSTEM]] : $FakeActorSystem
51-
// CHECK: return [[SELF]] : $MyDistActor
54+
// CHECK: [[TP_FIELD3:%[0-9]+]] = ref_element_addr [[SELF]] : $MyDistActor, #MyDistActor.actorSystem
55+
// CHECK: [[RELOADED_SYS2:%[0-9]+]] = load [[TP_FIELD3]] : $*FakeActorSystem
56+
// CHECK: [[READY_FN:%[0-9]+]] = function_ref @$s27FakeDistributedActorSystems0aC6SystemV10actorReadyyyx0B00bC0RzAA0C7AddressV2IDRtzlF
57+
// CHECK: = apply [[READY_FN]]<MyDistActor>([[SELF]], [[RELOADED_SYS2]])
58+
5259
// CHECK: } // end sil function '$s14default_deinit11MyDistActorC11system_syncAC015FakeDistributedE7Systems0hE6SystemV_tcfc'
5360

5461
}

test/Distributed/SIL/distributed_actor_default_init_sil_2.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,20 @@ distributed actor MyDistActor {
3030

3131
// CHECK-LABEL: // MyDistActor.init(system_sync_fail:cond:)
3232
// CHECK: sil hidden @$s14default_deinit11MyDistActorC16system_sync_fail4condACSg015FakeDistributedE7Systems0jE6SystemV_Sbtcfc : $@convention(method) (@owned FakeActorSystem, Bool, @owned MyDistActor) -> @owned Optional<MyDistActor> {
33-
// CHECK: bb0([[SYSTEM:%[0-9]+]] : $FakeActorSystem, [[COND:%[0-9]+]] : $Bool, [[SELF:%[0-9]+]] : $MyDistActor):
33+
// CHECK: bb0([[SYS_PARAM:%[0-9]+]] : $FakeActorSystem, [[COND:%[0-9]+]] : $Bool, [[SELF:%[0-9]+]] : $MyDistActor):
3434
// CHECK: builtin "initializeDefaultActor"([[SELF]] : $MyDistActor)
35+
3536
// CHECK: [[SYS_FIELD:%[0-9]+]] = ref_element_addr [[SELF]] : $MyDistActor, #MyDistActor.actorSystem
36-
// CHECK: retain_value [[SYSTEM]] : $FakeActorSystem
37-
// CHECK: store [[SYSTEM]] to [[SYS_FIELD]] : $*FakeActorSystem
37+
// CHECK: store [[SYS_PARAM]] to [[SYS_FIELD]] : $*FakeActorSystem
38+
3839
// CHECK: [[ID_FIELD:%[0-9]+]] = ref_element_addr [[SELF]] : $MyDistActor, #MyDistActor.id
3940
// CHECK: store {{%[0-9]+}} to [[ID_FIELD]] : $*ActorAddress
41+
4042
// CHECK: [[RAW_BOOL:%[0-9]+]] = struct_extract [[COND]] : $Bool, #Bool._value
4143
// CHECK: cond_br [[RAW_BOOL]], [[SUCCESS_BB:bb[0-9]+]], [[FAIL_BB:bb[0-9]+]]
4244

4345
// CHECK: [[SUCCESS_BB]]:
44-
// CHECK: [[READY_FN:%[0-9]+]] = function_ref @$s27FakeDistributedActorSystems0aC6SystemV10actorReadyyyx0B00bC0RzAA0C7AddressV2IDRtzlF : $@convention(method) <τ_0_0 where τ_0_0 : DistributedActor, τ_0_0.ID == ActorAddress> (@guaranteed τ_0_0, @guaranteed FakeActorSystem) -> ()
46+
// CHECK: [[READY_FN:%[0-9]+]] = function_ref @$s27FakeDistributedActorSystems0aC6SystemV10actorReadyyyx0B00bC0RzAA0C7AddressV2IDRtzlF
4547
// CHECK: = apply [[READY_FN]]
4648
// CHECK: br [[RET_BB:bb[0-9]+]]
4749

test/Distributed/SIL/distributed_actor_default_init_sil_5.swift

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,8 @@ distributed actor MyDistActor {
4343

4444
// CHECK: [[TRUE_BB]]:
4545
// CHECK: hop_to_executor [[SELF]] : $MyDistActor
46-
// CHECK-NEXT: retain_value [[SYSTEM]] : $FakeActorSystem
47-
// CHECK-NEXT: retain_value [[SYSTEM]] : $FakeActorSystem
48-
// CHECK-NEXT: // function_ref FakeActorSystem.actorReady<A>(_:)
49-
// CHECK-NEXT: [[READY_FN:%[0-9]+]] = function_ref @$s27FakeDistributedActorSystems0aC6SystemV10actorReadyyyx0B00bC0RzAA0C7AddressV2IDRtzlF : $@convention(method) <τ_0_0 where τ_0_0 : DistributedActor, τ_0_0.ID == ActorAddress> (@guaranteed τ_0_0, @guaranteed FakeActorSystem) -> ()
46+
// CHECK: // function_ref FakeActorSystem.actorReady<A>(_:)
47+
// CHECK-NEXT: [[READY_FN:%[0-9]+]] = function_ref @$s27FakeDistributedActorSystems0aC6SystemV10actorReadyyyx0B00bC0RzAA0C7AddressV2IDRtzlF
5048
// CHECK-NEXT: [[APPLIED:%[0-9]+]] = apply [[READY_FN]]
5149
// CHECK: br [[JOIN:bb[0-9]+]]
5250

@@ -65,10 +63,7 @@ distributed actor MyDistActor {
6563

6664
// CHECK: [[CONTINUE]]:
6765
// CHECK: hop_to_executor [[SELF]] : $MyDistActor
68-
// One of the following retain_value operations could be optimized away.
69-
// CHECK-NEXT: retain_value [[SYSTEM]] : $FakeActorSystem
70-
// CHECK-NEXT: retain_value [[SYSTEM]] : $FakeActorSystem
71-
// CHECK-NEXT: // function_ref FakeActorSystem.actorReady<A>(_:)
66+
// CHECK: // function_ref FakeActorSystem.actorReady<A>(_:)
7267
// CHECK-NEXT: [[READY_FN:%[0-9]+]] = function_ref @$s27FakeDistributedActorSystems0aC6SystemV10actorReadyyyx0B00bC0RzAA0C7AddressV2IDRtzlF : $@convention(method) <τ_0_0 where τ_0_0 : DistributedActor, τ_0_0.ID == ActorAddress> (@guaranteed τ_0_0, @guaranteed FakeActorSystem) -> ()
7368
// CHECK-NEXT: = apply [[READY_FN]]
7469
// CHECK: return
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend-emit-module -emit-module-path %t/FakeDistributedActorSystems.swiftmodule -module-name FakeDistributedActorSystems -disable-availability-checking %S/../Inputs/FakeDistributedActorSystems.swift
3+
// RUN: %target-swift-frontend -module-name default_deinit -primary-file %s -emit-sil -verify -disable-availability-checking -I %t | %FileCheck %s --enable-var-scope --dump-input=fail
4+
// REQUIRES: concurrency
5+
// REQUIRES: distributed
6+
7+
/// The convention in this test is that the Swift declaration comes before its FileCheck lines.
8+
9+
import Distributed
10+
import FakeDistributedActorSystems
11+
12+
typealias DefaultDistributedActorSystem = FakeActorSystem
13+
14+
// ==== ----------------------------------------------------------------------------------------------------------------
15+
16+
class SomeClass {}
17+
18+
enum Err : Error {
19+
case blah
20+
}
21+
22+
func getSystem() throws -> FakeActorSystem { throw Err.blah }
23+
24+
distributed actor MyDistActor {
25+
init() throws {
26+
self.actorSystem = try getSystem()
27+
}
28+
29+
// CHECK: sil hidden @$s14default_deinit11MyDistActorCACyKcfc : $@convention(method) (@owned MyDistActor) -> (@owned MyDistActor, @error Error) {
30+
// CHECK: bb0([[SELF:%[0-9]+]] : $MyDistActor):
31+
// CHECK: builtin "initializeDefaultActor"([[SELF]] : $MyDistActor)
32+
// CHECK: try_apply {{%[0-9]+}}() : $@convention(thin) () -> (@owned FakeActorSystem, @error Error), normal [[SUCCESS_BB:bb[0-9]+]], error [[ERROR_BB:bb[0-9]+]]
33+
34+
// CHECK: [[SUCCESS_BB]]([[SYSTEM_VAL:%[0-9]+]] : $FakeActorSystem):
35+
// *** save system ***
36+
// CHECK: [[TP_FIELD1:%[0-9]+]] = ref_element_addr [[SELF]] : $MyDistActor, #MyDistActor.actorSystem
37+
// CHECK: store [[SYSTEM_VAL]] to [[TP_FIELD1]] : $*FakeActorSystem
38+
39+
// *** obtain an identity ***
40+
// CHECK: [[TP_FIELD2:%[0-9]+]] = ref_element_addr [[SELF]] : $MyDistActor, #MyDistActor.actorSystem
41+
// CHECK: [[RELOADED_SYS1:%[0-9]+]] = load [[TP_FIELD2]] : $*FakeActorSystem
42+
// CHECK: [[SELF_METATYPE:%[0-9]+]] = metatype $@thick MyDistActor.Type
43+
// CHECK: [[ASSIGN_ID_FN:%[0-9]+]] = function_ref @$s27FakeDistributedActorSystems0aC6SystemV8assignIDyAA0C7AddressVxm0B00bC0RzAF0G0RtzlF
44+
// CHECK: [[ID:%[0-9]+]] = apply [[ASSIGN_ID_FN]]<MyDistActor>([[SELF_METATYPE]], [[RELOADED_SYS1]])
45+
46+
// *** save identity ***
47+
// CHECK: [[ID_FIELD:%[0-9]+]] = ref_element_addr [[SELF]] : $MyDistActor, #MyDistActor.id
48+
// CHECK: store [[ID]] to [[ID_FIELD]] : $*ActorAddress
49+
50+
// *** invoke actorReady ***
51+
// CHECK: [[TP_FIELD3:%[0-9]+]] = ref_element_addr [[SELF]] : $MyDistActor, #MyDistActor.actorSystem
52+
// CHECK: [[RELOADED_SYS2:%[0-9]+]] = load [[TP_FIELD3]] : $*FakeActorSystem
53+
// CHECK: [[READY_FN:%[0-9]+]] = function_ref @$s27FakeDistributedActorSystems0aC6SystemV10actorReadyyyx0B00bC0RzAA0C7AddressV2IDRtzlF
54+
// CHECK: = apply [[READY_FN]]<MyDistActor>([[SELF]], [[RELOADED_SYS2]])
55+
// CHECK: return [[SELF]]
56+
57+
// CHECK: [[ERROR_BB]]([[ERRVAL:%[0-9]+]] : $Error):
58+
// CHECK-NEXT: = metatype $@thick MyDistActor.Type
59+
// CHECK-NEXT: = builtin "destroyDefaultActor"([[SELF]] : $MyDistActor) : $()
60+
// CHECK-NEXT: dealloc_partial_ref [[SELF]]
61+
// CHECK: throw [[ERRVAL]] : $Error
62+
63+
// CHECK: } // end sil function '$s14default_deinit11MyDistActorCACyKcfc'
64+
65+
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend-emit-module -emit-module-path %t/FakeDistributedActorSystems.swiftmodule -module-name FakeDistributedActorSystems -disable-availability-checking %S/../Inputs/FakeDistributedActorSystems.swift
3+
// RUN: %target-swift-frontend -module-name default_deinit -primary-file %s -emit-sil -verify -disable-availability-checking -I %t | %FileCheck %s --enable-var-scope --dump-input=fail
4+
// REQUIRES: concurrency
5+
// REQUIRES: distributed
6+
7+
/// The convention in this test is that the Swift declaration comes before its FileCheck lines.
8+
9+
import Distributed
10+
import FakeDistributedActorSystems
11+
12+
typealias DefaultDistributedActorSystem = FakeActorSystem
13+
14+
// ==== ----------------------------------------------------------------------------------------------------------------
15+
16+
class SomeClass {}
17+
18+
enum Err : Error {
19+
case blah
20+
}
21+
22+
func getSomeClass() throws -> SomeClass { throw Err.blah }
23+
func getSystem() throws -> FakeActorSystem { throw Err.blah }
24+
25+
distributed actor MyDistActor {
26+
var someField: SomeClass
27+
28+
init() throws {
29+
do {
30+
actorSystem = try getSystem()
31+
} catch {
32+
actorSystem = FakeActorSystem()
33+
}
34+
someField = try getSomeClass()
35+
}
36+
37+
// CHECK: sil hidden @$s14default_deinit11MyDistActorCACyKcfc : $@convention(method) (@owned MyDistActor) -> (@owned MyDistActor, @error Error) {
38+
// CHECK: bb0([[SELF:%[0-9]+]] : $MyDistActor):
39+
// CHECK: builtin "initializeDefaultActor"([[SELF]] : $MyDistActor)
40+
// CHECK: try_apply {{%[0-9]+}}() : $@convention(thin) () -> (@owned FakeActorSystem, @error Error), normal [[SYSTEM_SUCCESS_BB:bb[0-9]+]], error [[SYSTEM_ERROR_BB:bb[0-9]+]]
41+
42+
// CHECK: [[SYSTEM_SUCCESS_BB]]([[SYSTEM_VAL:%[0-9]+]] : $FakeActorSystem):
43+
// *** save system ***
44+
// CHECK: [[TP_FIELD1:%[0-9]+]] = ref_element_addr [[SELF]] : $MyDistActor, #MyDistActor.actorSystem
45+
// CHECK: store [[SYSTEM_VAL]] to [[TP_FIELD1]] : $*FakeActorSystem
46+
// *** obtain an identity ***
47+
// CHECK: [[TP_FIELD2:%[0-9]+]] = ref_element_addr [[SELF]] : $MyDistActor, #MyDistActor.actorSystem
48+
// CHECK: [[RELOADED_SYS1:%[0-9]+]] = load [[TP_FIELD2]] : $*FakeActorSystem
49+
// CHECK: [[SELF_METATYPE:%[0-9]+]] = metatype $@thick MyDistActor.Type
50+
// CHECK: [[ASSIGN_ID_FN:%[0-9]+]] = function_ref @$s27FakeDistributedActorSystems0aC6SystemV8assignIDyAA0C7AddressVxm0B00bC0RzAF0G0RtzlF
51+
// CHECK: [[ID:%[0-9]+]] = apply [[ASSIGN_ID_FN]]<MyDistActor>([[SELF_METATYPE]], [[RELOADED_SYS1]])
52+
// *** save identity ***
53+
// CHECK: [[ID_FIELD:%[0-9]+]] = ref_element_addr [[SELF]] : $MyDistActor, #MyDistActor.id
54+
// CHECK: store [[ID]] to [[ID_FIELD]] : $*ActorAddress
55+
// CHECK-NOT: apply
56+
// CHECK: br [[JOIN_PT:bb[0-9]+]]
57+
58+
// CHECK: [[JOIN_PT]]:
59+
// CHECK: try_apply {{.*}}() : $@convention(thin) () -> (@owned SomeClass, @error Error), normal [[CLASS_SUCCESS_BB:bb[0-9]+]], error [[CLASS_ERROR_BB:bb[0-9]+]]
60+
61+
// CHECK: [[CLASS_SUCCESS_BB]]{{.*}}:
62+
// CHECK: store {{.*}} to {{.*}} : $*SomeClass
63+
// *** invoke actorReady ***
64+
// CHECK: [[TP_FIELD3:%[0-9]+]] = ref_element_addr [[SELF]] : $MyDistActor, #MyDistActor.actorSystem
65+
// CHECK: [[RELOADED_SYS2:%[0-9]+]] = load [[TP_FIELD3]] : $*FakeActorSystem
66+
// CHECK: [[READY_FN:%[0-9]+]] = function_ref @$s27FakeDistributedActorSystems0aC6SystemV10actorReadyyyx0B00bC0RzAA0C7AddressV2IDRtzlF
67+
// CHECK: = apply [[READY_FN]]<MyDistActor>([[SELF]], [[RELOADED_SYS2]])
68+
// CHECK: return [[SELF]] : $MyDistActor
69+
70+
// CHECK: [[SYSTEM_ERROR_BB]]{{.*}}:
71+
// CHECK: function_ref @$s27FakeDistributedActorSystems0aC6SystemVACycfC
72+
// CHECK: store {{.*}} to {{.*}} : $*FakeActorSystem
73+
// CHECK: store {{.*}} to {{.*}} : $*ActorAddress
74+
// CHECK: br [[JOIN_PT]]
75+
76+
// CHECK: [[CLASS_ERROR_BB]]{{.*}}:
77+
// ** deinit the id **
78+
// CHECK: [[REF_ID_D:%[0-9]+]] = ref_element_addr [[SELF]] : $MyDistActor, #MyDistActor.id
79+
// CHECK: [[ID_D:%[0-9]+]] = begin_access [deinit] [static] [[REF_ID_D]] : $*ActorAddress
80+
// CHECK: [[REF_SYS_D:%[0-9]+]] = ref_element_addr [[SELF]] : $MyDistActor, #MyDistActor.actorSystem
81+
// CHECK: [[ID:%[0-9]+]] = load [[ID_D]] : $*ActorAddress
82+
// CHECK: [[SYS:%[0-9]+]] = load [[REF_SYS_D]] : $*FakeActorSystem
83+
// CHECK: [[RESIGN_FN:%[0-9]+]] = function_ref @$s27FakeDistributedActorSystems0aC6SystemV8resignIDyyAA0C7AddressVF
84+
// CHECK: = apply [[RESIGN_FN]]([[ID]], [[SYS]]) : $@convention(method) (@guaranteed ActorAddress, @guaranteed FakeActorSystem) -> ()
85+
// CHECK: destroy_addr [[ID_D]] : $*ActorAddress
86+
// CHECK: end_access [[ID_D]] : $*ActorAddress
87+
// ** deinit the system **
88+
// CHECK: [[REF_SYS_D2:%[0-9]+]] = ref_element_addr [[SELF]] : $MyDistActor, #MyDistActor.actorSystem
89+
// CHECK: [[SYSTEM_ACC:%[0-9]+]] = begin_access [deinit] [static] [[REF_SYS_D2]] : $*FakeActorSystem
90+
// CHECK: destroy_addr [[SYSTEM_ACC]] : $*FakeActorSystem
91+
// CHECK: end_access [[SYSTEM_ACC]] : $*FakeActorSystem
92+
// CHECK: builtin "destroyDefaultActor"([[SELF]] : $MyDistActor) : $()
93+
// CHECK: dealloc_partial_ref [[SELF]]
94+
// CHECK: throw
95+
96+
97+
}
98+

0 commit comments

Comments
 (0)