Skip to content

Commit 85ade03

Browse files
committed
[Test] Moved all IRGen/async tests off runAndBlockThread.
1 parent 187f4db commit 85ade03

File tree

40 files changed

+491
-533
lines changed

40 files changed

+491
-533
lines changed

test/IRGen/async/run-call-classinstance-int64-to-void.sil

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@ sil_vtable S {
8686
#S.deinit!deallocator: @S_deallocating_deinit
8787
}
8888

89-
// Defined in _Concurrency
90-
sil public_external @swift_task_runAndBlockThread : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> ()
91-
9289
sil @test_case : $@convention(thin) @async () -> () {
9390
%s_type = metatype $@thick S.Type
9491
%allocating_init = function_ref @S_allocating_init : $@convention(method) (@thick S.Type) -> @owned S
@@ -104,15 +101,18 @@ sil @test_case : $@convention(thin) @async () -> () {
104101
return %void : $()
105102
}
106103

104+
// Defined in _Concurrency
105+
sil @$s12_Concurrency13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> ()
106+
107+
// main
107108
sil @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 {
108109
bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>):
109-
110-
%2 = function_ref @test_case : $@convention(thin) @async () -> ()
111-
%3 = thin_to_thick_function %2 : $@convention(thin) @async () -> () to $@async @callee_guaranteed () -> ()
112-
%4 = function_ref @swift_task_runAndBlockThread : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> ()
113-
%5 = apply %4(%3) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> ()
114-
115-
%6 = integer_literal $Builtin.Int32, 0
116-
%7 = struct $Int32 (%6 : $Builtin.Int32)
117-
return %7 : $Int32
110+
%test_case_nothrow = function_ref @test_case : $@convention(thin) @async () -> ()
111+
%test_case = convert_function %test_case_nothrow : $@convention(thin) @async () -> () to $@convention(thin) @async () -> @error Error
112+
%thick_test_case = thin_to_thick_function %test_case : $@convention(thin) @async () -> @error Error to $@callee_guaranteed @async () -> @error Error
113+
%runAsyncMain = function_ref @$s12_Concurrency13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> ()
114+
%result = apply %runAsyncMain(%thick_test_case) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> ()
115+
%out_literal = integer_literal $Builtin.Int32, 0
116+
%out = struct $Int32 (%out_literal : $Builtin.Int32)
117+
return %out : $Int32
118118
}

test/IRGen/async/run-call-classinstance-void-to-void.sil

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@ sil_vtable S {
8686
#S.deinit!deallocator: @S_deallocating_deinit
8787
}
8888

89-
// Defined in _Concurrency
90-
sil public_external @swift_task_runAndBlockThread : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> ()
91-
9289
sil @test_case : $@convention(thin) @async () -> () {
9390
%s_type = metatype $@thick S.Type
9491
%allocating_init = function_ref @S_allocating_init : $@convention(method) (@thick S.Type) -> @owned S
@@ -102,15 +99,18 @@ sil @test_case : $@convention(thin) @async () -> () {
10299
return %void : $()
103100
}
104101

102+
// Defined in _Concurrency
103+
sil @$s12_Concurrency13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> ()
104+
105+
// main
105106
sil @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 {
106107
bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>):
107-
108-
%2 = function_ref @test_case : $@convention(thin) @async () -> ()
109-
%3 = thin_to_thick_function %2 : $@convention(thin) @async () -> () to $@async @callee_guaranteed () -> ()
110-
%4 = function_ref @swift_task_runAndBlockThread : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> ()
111-
%5 = apply %4(%3) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> ()
112-
113-
%6 = integer_literal $Builtin.Int32, 0
114-
%7 = struct $Int32 (%6 : $Builtin.Int32)
115-
return %7 : $Int32
108+
%test_case_nothrow = function_ref @test_case : $@convention(thin) @async () -> ()
109+
%test_case = convert_function %test_case_nothrow : $@convention(thin) @async () -> () to $@convention(thin) @async () -> @error Error
110+
%thick_test_case = thin_to_thick_function %test_case : $@convention(thin) @async () -> @error Error to $@callee_guaranteed @async () -> @error Error
111+
%runAsyncMain = function_ref @$s12_Concurrency13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> ()
112+
%result = apply %runAsyncMain(%thick_test_case) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> ()
113+
%out_literal = integer_literal $Builtin.Int32, 0
114+
%out = struct $Int32 (%out_literal : $Builtin.Int32)
115+
return %out : $Int32
116116
}

test/IRGen/async/run-call-existential-to-void.sil

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ bb0:
6969
return %result : $()
7070
}
7171

72-
// Defined in _Concurrency
73-
sil public_external @swift_task_runAndBlockThread : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> ()
74-
7572
sil @test_case : $@convention(thin) @async () -> () {
7673
%call = function_ref @call : $@async @convention(thin) () -> () // CHECK: 7384783
7774
%result = apply %call() : $@async @convention(thin) () -> ()
@@ -80,15 +77,18 @@ sil @test_case : $@convention(thin) @async () -> () {
8077
return %void : $()
8178
}
8279

80+
// Defined in _Concurrency
81+
sil @$s12_Concurrency13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> ()
82+
83+
// main
8384
sil @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 {
8485
bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>):
85-
86-
%2 = function_ref @test_case : $@convention(thin) @async () -> ()
87-
%3 = thin_to_thick_function %2 : $@convention(thin) @async () -> () to $@async @callee_guaranteed () -> ()
88-
%4 = function_ref @swift_task_runAndBlockThread : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> ()
89-
%5 = apply %4(%3) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> ()
90-
91-
%6 = integer_literal $Builtin.Int32, 0
92-
%7 = struct $Int32 (%6 : $Builtin.Int32)
93-
return %7 : $Int32
86+
%test_case_nothrow = function_ref @test_case : $@convention(thin) @async () -> ()
87+
%test_case = convert_function %test_case_nothrow : $@convention(thin) @async () -> () to $@convention(thin) @async () -> @error Error
88+
%thick_test_case = thin_to_thick_function %test_case : $@convention(thin) @async () -> @error Error to $@callee_guaranteed @async () -> @error Error
89+
%runAsyncMain = function_ref @$s12_Concurrency13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> ()
90+
%result = apply %runAsyncMain(%thick_test_case) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> ()
91+
%out_literal = integer_literal $Builtin.Int32, 0
92+
%out = struct $Int32 (%out_literal : $Builtin.Int32)
93+
return %out : $Int32
9494
}

test/IRGen/async/run-call-generic-to-generic.sil

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ bb0(%out : $*T, %in : $*T):
2828
return %result : $()
2929
}
3030

31-
// Defined in _Concurrency
32-
sil public_external @swift_task_runAndBlockThread : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> ()
33-
3431
sil @test_case : $@convention(thin) @async () -> () {
3532
%int_literal = integer_literal $Builtin.Int64, 42
3633
%int = struct $Int64 (%int_literal : $Builtin.Int64)
@@ -52,15 +49,18 @@ sil @test_case : $@convention(thin) @async () -> () {
5249
return %void : $()
5350
}
5451

52+
// Defined in _Concurrency
53+
sil @$s12_Concurrency13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> ()
54+
55+
// main
5556
sil @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 {
5657
bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>):
57-
58-
%2 = function_ref @test_case : $@convention(thin) @async () -> ()
59-
%3 = thin_to_thick_function %2 : $@convention(thin) @async () -> () to $@async @callee_guaranteed () -> ()
60-
%4 = function_ref @swift_task_runAndBlockThread : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> ()
61-
%5 = apply %4(%3) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> ()
62-
63-
%6 = integer_literal $Builtin.Int32, 0
64-
%7 = struct $Int32 (%6 : $Builtin.Int32)
65-
return %7 : $Int32
58+
%test_case_nothrow = function_ref @test_case : $@convention(thin) @async () -> ()
59+
%test_case = convert_function %test_case_nothrow : $@convention(thin) @async () -> () to $@convention(thin) @async () -> @error Error
60+
%thick_test_case = thin_to_thick_function %test_case : $@convention(thin) @async () -> @error Error to $@callee_guaranteed @async () -> @error Error
61+
%runAsyncMain = function_ref @$s12_Concurrency13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> ()
62+
%result = apply %runAsyncMain(%thick_test_case) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> ()
63+
%out_literal = integer_literal $Builtin.Int32, 0
64+
%out = struct $Int32 (%out_literal : $Builtin.Int32)
65+
return %out : $Int32
6666
}

test/IRGen/async/run-call-generic-to-void.sil

Lines changed: 0 additions & 57 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-build-swift -Xfrontend -enable-experimental-concurrency %s -parse-as-library -module-name main -emit-ir | %FileCheck %s --check-prefix=CHECK-LL
3+
// RUN: %target-build-swift -Xfrontend -enable-experimental-concurrency %s -parse-as-library -module-name main -o %t/main
4+
// RUN: %target-codesign %t/main
5+
// RUN: %target-run %t/main | %FileCheck %s
6+
7+
// REQUIRES: executable_test
8+
// REQUIRES: swift_test_mode_optimize_none
9+
// REQUIRES: concurrency
10+
// UNSUPPORTED: use_os_stdlib
11+
12+
import _Concurrency
13+
14+
// CHECK-LL: @genericToVoidTu =
15+
// CHECK-LL: define hidden swiftcc void @genericToVoid(%swift.task* {{%[0-9]+}}, %swift.executor* {{%[0-9]+}}, %swift.context* swiftasync {{%[0-9]+}}) {{#[0-9]*}} {
16+
@_silgen_name("genericToVoid")
17+
func genericToVoid<T>(_ t: T) async {
18+
print(t) // CHECK: 922337203685477580
19+
20+
}
21+
22+
@_silgen_name("test_case")
23+
func test_case() async {
24+
await genericToVoid(922337203685477580 as Int64)
25+
}
26+
27+
@main struct Main {
28+
static func main() async {
29+
await test_case()
30+
}
31+
}

test/IRGen/async/run-call-genericEquatable-x2-to-bool.sil

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ bb0(%0 : $*T, %1 : $*T):
2929
return %6 : $Bool
3030
}
3131

32-
// Defined in _Concurrency
33-
sil public_external @swift_task_runAndBlockThread : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> ()
34-
3532
sil @test_case : $@convention(thin) @async () -> () {
3633
%int1_literal = integer_literal $Builtin.Int64, 42
3734
%int1 = struct $Int64 (%int1_literal : $Builtin.Int64)
@@ -60,15 +57,18 @@ sil @test_case : $@convention(thin) @async () -> () {
6057
return %void : $()
6158
}
6259

60+
// Defined in _Concurrency
61+
sil @$s12_Concurrency13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> ()
62+
63+
// main
6364
sil @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 {
6465
bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>):
65-
66-
%2 = function_ref @test_case : $@convention(thin) @async () -> ()
67-
%3 = thin_to_thick_function %2 : $@convention(thin) @async () -> () to $@async @callee_guaranteed () -> ()
68-
%4 = function_ref @swift_task_runAndBlockThread : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> ()
69-
%5 = apply %4(%3) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> ()
70-
71-
%6 = integer_literal $Builtin.Int32, 0
72-
%7 = struct $Int32 (%6 : $Builtin.Int32)
73-
return %7 : $Int32
66+
%test_case_nothrow = function_ref @test_case : $@convention(thin) @async () -> ()
67+
%test_case = convert_function %test_case_nothrow : $@convention(thin) @async () -> () to $@convention(thin) @async () -> @error Error
68+
%thick_test_case = thin_to_thick_function %test_case : $@convention(thin) @async () -> @error Error to $@callee_guaranteed @async () -> @error Error
69+
%runAsyncMain = function_ref @$s12_Concurrency13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> ()
70+
%result = apply %runAsyncMain(%thick_test_case) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> ()
71+
%out_literal = integer_literal $Builtin.Int32, 0
72+
%out = struct $Int32 (%out_literal : $Builtin.Int32)
73+
return %out : $Int32
7474
}

test/IRGen/async/run-call-int64-and-int64-to-void.sil

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ entry(%int1: $Int64, %int2: $Int64):
2929
return %result2 : $()
3030
}
3131

32-
// Defined in _Concurrency
33-
sil public_external @swift_task_runAndBlockThread : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> ()
34-
3532
sil @test_case : $@convention(thin) @async () -> () {
3633
%int_literal1 = integer_literal $Builtin.Int64, 42
3734
%int1 = struct $Int64 (%int_literal1 : $Builtin.Int64)
@@ -45,15 +42,18 @@ sil @test_case : $@convention(thin) @async () -> () {
4542
return %void : $()
4643
}
4744

45+
// Defined in _Concurrency
46+
sil @$s12_Concurrency13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> ()
47+
48+
// main
4849
sil @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 {
4950
bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>):
50-
51-
%2 = function_ref @test_case : $@convention(thin) @async () -> ()
52-
%3 = thin_to_thick_function %2 : $@convention(thin) @async () -> () to $@async @callee_guaranteed () -> ()
53-
%4 = function_ref @swift_task_runAndBlockThread : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> ()
54-
%5 = apply %4(%3) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> ()
55-
56-
%6 = integer_literal $Builtin.Int32, 0
57-
%7 = struct $Int32 (%6 : $Builtin.Int32)
58-
return %7 : $Int32
51+
%test_case_nothrow = function_ref @test_case : $@convention(thin) @async () -> ()
52+
%test_case = convert_function %test_case_nothrow : $@convention(thin) @async () -> () to $@convention(thin) @async () -> @error Error
53+
%thick_test_case = thin_to_thick_function %test_case : $@convention(thin) @async () -> @error Error to $@callee_guaranteed @async () -> @error Error
54+
%runAsyncMain = function_ref @$s12_Concurrency13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> ()
55+
%result = apply %runAsyncMain(%thick_test_case) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> ()
56+
%out_literal = integer_literal $Builtin.Int32, 0
57+
%out = struct $Int32 (%out_literal : $Builtin.Int32)
58+
return %out : $Int32
5959
}

test/IRGen/async/run-call-int64-to-void.sil

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ entry(%int: $Int64):
2828
return %result : $()
2929
}
3030

31-
// Defined in _Concurrency
32-
sil public_external @swift_task_runAndBlockThread : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> ()
33-
3431
sil @test_case : $@convention(thin) @async () -> () {
3532
%int_literal = integer_literal $Builtin.Int64, 42
3633
%int = struct $Int64 (%int_literal : $Builtin.Int64)
@@ -42,15 +39,18 @@ sil @test_case : $@convention(thin) @async () -> () {
4239
return %void : $()
4340
}
4441

42+
// Defined in _Concurrency
43+
sil @$s12_Concurrency13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> ()
44+
45+
// main
4546
sil @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 {
4647
bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>):
47-
48-
%2 = function_ref @test_case : $@convention(thin) @async () -> ()
49-
%3 = thin_to_thick_function %2 : $@convention(thin) @async () -> () to $@async @callee_guaranteed () -> ()
50-
%4 = function_ref @swift_task_runAndBlockThread : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> ()
51-
%5 = apply %4(%3) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> ()) -> ()
52-
53-
%6 = integer_literal $Builtin.Int32, 0
54-
%7 = struct $Int32 (%6 : $Builtin.Int32)
55-
return %7 : $Int32
48+
%test_case_nothrow = function_ref @test_case : $@convention(thin) @async () -> ()
49+
%test_case = convert_function %test_case_nothrow : $@convention(thin) @async () -> () to $@convention(thin) @async () -> @error Error
50+
%thick_test_case = thin_to_thick_function %test_case : $@convention(thin) @async () -> @error Error to $@callee_guaranteed @async () -> @error Error
51+
%runAsyncMain = function_ref @$s12_Concurrency13_runAsyncMainyyyyYKcF : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> ()
52+
%result = apply %runAsyncMain(%thick_test_case) : $@convention(thin) (@guaranteed @async @callee_guaranteed () -> @error Error) -> ()
53+
%out_literal = integer_literal $Builtin.Int32, 0
54+
%out = struct $Int32 (%out_literal : $Builtin.Int32)
55+
return %out : $Int32
5656
}

0 commit comments

Comments
 (0)