|
1 | | -// RUN: %target-swift-frontend -emit-silgen %s -module-name test -swift-version 5 -enable-experimental-concurrency | %FileCheck --enable-var-scope %s |
| 1 | +// RUN: %target-swift-frontend -emit-silgen %s -module-name test -swift-version 5 -enable-experimental-concurrency | %FileCheck --enable-var-scope %s --implicit-check-not 'hop_to_executor {{%[0-9]+}}' |
2 | 2 | // REQUIRES: concurrency |
3 | 3 |
|
4 | 4 |
|
@@ -45,7 +45,14 @@ actor MyActor { |
45 | 45 | await callee(p) |
46 | 46 | } |
47 | 47 |
|
| 48 | + ///// MyActor.testClosure() |
| 49 | + // CHECK: sil hidden [ossa] @$s4test7MyActorC0A7ClosureSiyYaF : $@convention(method) @async (@guaranteed MyActor) -> Int { |
| 50 | + // CHECK: hop_to_executor [[A:%[0-9]+]] : $MyActor |
| 51 | + // CHECK: {{%[0-9]+}} = apply |
| 52 | + // CHECK: hop_to_executor [[A]] : $MyActor |
| 53 | + // CHECK: } // end sil function '$s4test7MyActorC0A7ClosureSiyYaF' |
48 | 54 |
|
| 55 | + ///// closure #1 in MyActor.testClosure() |
49 | 56 | // CHECK-LABEL: sil private [ossa] @$s4test7MyActorC0A7ClosureSiyYaFSiyYaXEfU_ : $@convention(thin) @async (@guaranteed MyActor) -> Int { |
50 | 57 | // CHECK: [[COPIED_SELF:%[0-9]+]] = copy_value %0 : $MyActor |
51 | 58 | // CHECK: [[BORROWED_SELF:%[0-9]+]] = begin_borrow [[COPIED_SELF]] : $MyActor |
@@ -86,6 +93,14 @@ struct GlobalActor { |
86 | 93 | func testGlobalActor() async { |
87 | 94 | } |
88 | 95 |
|
| 96 | +///// testGlobalActorWithClosure() |
| 97 | +// CHECK: sil hidden [ossa] @$s4test0A22GlobalActorWithClosureyyYaF : $@convention(thin) @async () -> () { |
| 98 | +// CHECK: hop_to_executor [[A:%[0-9]+]] : $MyActor |
| 99 | +// CHECK: {{%[0-9]+}} = apply |
| 100 | +// CHECK: hop_to_executor [[A]] : $MyActor |
| 101 | +// CHECK: // end sil function '$s4test0A22GlobalActorWithClosureyyYaF' |
| 102 | + |
| 103 | +///// closure #1 in testGlobalActorWithClosure() |
89 | 104 | // CHECK-LABEL: sil private [ossa] @$s4test0A22GlobalActorWithClosureyyYaFyyYaXEfU_ : $@convention(thin) @async () -> () { |
90 | 105 | // CHECK: [[F:%[0-9]+]] = function_ref @$s4test11GlobalActorV6sharedAA02MyC0Cvau : $@convention(thin) () -> Builtin.RawPointer |
91 | 106 | // CHECK: [[P:%[0-9]+]] = apply [[F]]() : $@convention(thin) () -> Builtin.RawPointer |
@@ -129,14 +144,11 @@ actor BlueActorImpl { |
129 | 144 | // CHECK-LABEL: sil hidden [ossa] @$s4test13BlueActorImplC4poke6personyAA03RedcD0C_tYaF : $@convention(method) @async (@guaranteed RedActorImpl, @guaranteed BlueActorImpl) -> () { |
130 | 145 | // CHECK: bb0([[RED:%[0-9]+]] : @guaranteed $RedActorImpl, [[BLUE:%[0-9]+]] : @guaranteed $BlueActorImpl): |
131 | 146 | // CHECK: hop_to_executor [[BLUE]] : $BlueActorImpl |
132 | | -// CHECK-NOT: hop_to_executor |
133 | 147 | // CHECK: [[INTARG:%[0-9]+]] = apply {{%[0-9]+}}({{%[0-9]+}}, {{%[0-9]+}}) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int |
134 | | -// CHECK-NOT: hop_to_executor |
135 | 148 | // CHECK: [[METH:%[0-9]+]] = class_method [[RED]] : $RedActorImpl, #RedActorImpl.hello : (isolated RedActorImpl) -> (Int) -> (), $@convention(method) (Int, @guaranteed RedActorImpl) -> () |
136 | 149 | // CHECK: hop_to_executor [[RED]] : $RedActorImpl |
137 | 150 | // CHECK-NEXT: {{%[0-9]+}} = apply [[METH]]([[INTARG]], [[RED]]) : $@convention(method) (Int, @guaranteed RedActorImpl) -> () |
138 | 151 | // CHECK-NEXT: hop_to_executor [[BLUE]] : $BlueActorImpl |
139 | | -// CHECK-NOT: hop_to_executor |
140 | 152 | // CHECK: } // end sil function '$s4test13BlueActorImplC4poke6personyAA03RedcD0C_tYaF' |
141 | 153 | func poke(person red : RedActorImpl) async { |
142 | 154 | await red.hello(42) |
@@ -203,31 +215,26 @@ struct BlueActor { |
203 | 215 | // CHECK: destroy_value [[R]] : $RedActorImpl |
204 | 216 | // CHECK: end_borrow [[BLUEEXE]] : $BlueActorImpl |
205 | 217 | // CHECK: destroy_value [[B]] : $BlueActorImpl |
206 | | -// CHECK-NOT: hop_to_executor |
207 | 218 | // CHECK: } // end sil function '$s4test6blueFnyyYaF' |
208 | 219 | @BlueActor func blueFn() async { |
209 | 220 | await redFn(100) |
210 | 221 | } |
211 | 222 |
|
212 | 223 | // CHECK-LABEL: sil hidden [ossa] @$s4test20unspecifiedAsyncFuncyyYaF : $@convention(thin) @async () -> () { |
213 | | -// CHECK-NOT: hop_to_executor |
214 | 224 | // CHECK: [[BORROW:%[0-9]+]] = begin_borrow {{%[0-9]+}} : $RedActorImpl |
215 | 225 | // CHECK-NEXT: [[PREV_EXEC:%.*]] = builtin "getCurrentExecutor"() |
216 | 226 | // CHECK-NEXT: hop_to_executor [[BORROW]] : $RedActorImpl |
217 | 227 | // CHECK-NEXT: {{%[0-9]+}} = apply {{%[0-9]+}}({{%[0-9]+}}) : $@convention(thin) (Int) -> () |
218 | 228 | // CHECK-NEXT: hop_to_executor [[PREV_EXEC]] |
219 | 229 | // CHECK-NEXT: end_borrow [[BORROW]] : $RedActorImpl |
220 | | -// CHECK-NOT: hop_to_executor |
221 | 230 | // CHECK: } // end sil function '$s4test20unspecifiedAsyncFuncyyYaF' |
222 | 231 | func unspecifiedAsyncFunc() async { |
223 | 232 | await redFn(200) |
224 | 233 | } |
225 | 234 |
|
226 | 235 | // CHECK-LABEL: sil hidden [ossa] @$s4test27anotherUnspecifiedAsyncFuncyyAA12RedActorImplCYaF : $@convention(thin) @async (@guaranteed RedActorImpl) -> () { |
227 | 236 | // CHECK: bb0([[RED:%[0-9]+]] : @guaranteed $RedActorImpl): |
228 | | -// CHECK-NOT: hop_to_executor |
229 | 237 | // CHECK: [[INTARG:%[0-9]+]] = apply {{%[0-9]+}}({{%[0-9]+}}, {{%[0-9]+}}) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int |
230 | | -// CHECK-NOT: hop_to_executor |
231 | 238 | // CHECK: [[METH:%[0-9]+]] = class_method [[RED]] : $RedActorImpl, #RedActorImpl.hello : (isolated RedActorImpl) -> (Int) -> (), $@convention(method) (Int, @guaranteed RedActorImpl) -> () |
232 | 239 | // CHECK-NEXT: [[PREV_EXEC:%.*]] = builtin "getCurrentExecutor"() |
233 | 240 | // CHECK-NEXT: hop_to_executor [[RED]] : $RedActorImpl |
|
0 commit comments