@@ -170,3 +170,30 @@ func testGeneric2<T: AnyObject, U>(x: GenericObject<T>, y: U) async throws {
170
170
// CHECK: [[RESULT_1_BUF:%.*]] = tuple_element_addr [[RESULT_BUF]] {{.*}}, 1
171
171
// CHECK: store %2 to [trivial] [[RESULT_1_BUF]]
172
172
173
+ // CHECK-LABEL: sil {{.*}}@${{.*}}22testSlowServerFromMain
174
+ @MainActor
175
+ func testSlowServerFromMain( slowServer: SlowServer ) async throws {
176
+ // CHECK: hop_to_executor %6 : $MainActor
177
+ // CHECK: [[RESUME_BUF:%.*]] = alloc_stack $Int
178
+ // CHECK: [[STRINGINIT:%.*]] = function_ref @$sSS10FoundationE19_bridgeToObjectiveCSo8NSStringCyF :
179
+ // CHECK: [[ARG:%.*]] = apply [[STRINGINIT]]
180
+ // CHECK: [[METHOD:%.*]] = objc_method {{.*}} $@convention(objc_method) (NSString, @convention(block) (Int) -> (), SlowServer) -> ()
181
+ // CHECK: [[CONT:%.*]] = get_async_continuation_addr Int, [[RESUME_BUF]]
182
+ // CHECK: [[WRAPPED:%.*]] = struct $UnsafeContinuation<Int, Never> ([[CONT]] : $Builtin.RawUnsafeContinuation)
183
+ // CHECK: [[BLOCK_STORAGE:%.*]] = alloc_stack $@block_storage UnsafeContinuation<Int, Never>
184
+ // CHECK: [[CONT_SLOT:%.*]] = project_block_storage [[BLOCK_STORAGE]]
185
+ // CHECK: store [[WRAPPED]] to [trivial] [[CONT_SLOT]]
186
+ // CHECK: [[BLOCK_IMPL:%.*]] = function_ref @[[INT_COMPLETION_BLOCK:.*]] : $@convention(c) (@inout_aliasable @block_storage UnsafeContinuation<Int, Never>, Int) -> ()
187
+ // CHECK: [[BLOCK:%.*]] = init_block_storage_header [[BLOCK_STORAGE]] {{.*}}, invoke [[BLOCK_IMPL]]
188
+ // CHECK: apply [[METHOD]]([[ARG]], [[BLOCK]], %0)
189
+ // CHECK: [[COPY:%.*]] = copy_value [[ARG]]
190
+ // CHECK: destroy_value [[ARG]]
191
+ // CHECK: await_async_continuation [[CONT]] {{.*}}, resume [[RESUME:bb[0-9]+]]
192
+ // CHECK: [[RESUME]]:
193
+ // CHECK: [[RESULT:%.*]] = load [trivial] [[RESUME_BUF]]
194
+ // CHECK: fix_lifetime [[COPY]]
195
+ // CHECK: destroy_value [[COPY]]
196
+ // CHECK: hop_to_executor %6 : $MainActor
197
+ // CHECK: dealloc_stack [[RESUME_BUF]]
198
+ let _: Int = await slowServer. doSomethingSlow ( " mail " )
199
+ }
0 commit comments