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