|
7 | 7 | ;; This is so even in closed world. |
8 | 8 |
|
9 | 9 | (module |
10 | | - ;; CHECK: (type $externs (array (mut externref))) |
11 | | - ;; OPEN_WORLD: (type $externs (array (mut externref))) |
12 | | - (type $externs (array (mut externref))) |
13 | | - |
14 | | - ;; CHECK: (type $funcs (array (mut funcref))) |
15 | | - ;; OPEN_WORLD: (type $funcs (array (mut funcref))) |
16 | | - (type $funcs (array (mut funcref))) |
| 10 | + ;; CHECK: (rec |
| 11 | + ;; CHECK-NEXT: (type $func-2 (func (param (ref (exact $struct))) (result (ref (exact $struct))))) |
17 | 12 |
|
18 | | - ;; CHECK: (type $bytes (array (mut i8))) |
19 | | - ;; OPEN_WORLD: (type $bytes (array (mut i8))) |
20 | | - (type $bytes (array (mut i8))) |
| 13 | + ;; CHECK: (type $func-1 (func (param anyref) (result (ref (exact $struct))))) |
21 | 14 |
|
22 | | - ;; CHECK: (rec |
23 | | - ;; CHECK-NEXT: (type $ret-any-2 (func (result (ref (exact $struct))))) |
| 15 | + ;; CHECK: (type $2 (func (result i32))) |
24 | 16 |
|
25 | 17 | ;; CHECK: (type $struct (struct)) |
26 | 18 |
|
27 | | - ;; CHECK: (type $ret-any-1 (func (result anyref))) |
| 19 | + ;; CHECK: (type $4 (func)) |
28 | 20 |
|
29 | | - ;; CHECK: (type $6 (func (result i32))) |
| 21 | + ;; CHECK: (type $externs (array (mut externref))) |
| 22 | + ;; OPEN_WORLD: (rec |
| 23 | + ;; OPEN_WORLD-NEXT: (type $func-2 (func (param (ref (exact $struct))) (result (ref (exact $struct))))) |
30 | 24 |
|
31 | | - ;; CHECK: (type $7 (func)) |
| 25 | + ;; OPEN_WORLD: (type $func-1 (func (param anyref) (result (ref (exact $struct))))) |
32 | 26 |
|
33 | | - ;; CHECK: (type $configureAll (func (param (ref null $externs) (ref null $funcs) (ref null $bytes) externref))) |
34 | | - ;; OPEN_WORLD: (rec |
35 | | - ;; OPEN_WORLD-NEXT: (type $ret-any-2 (func (result (ref (exact $struct))))) |
| 27 | + ;; OPEN_WORLD: (type $2 (func (result i32))) |
36 | 28 |
|
37 | 29 | ;; OPEN_WORLD: (type $struct (struct)) |
38 | 30 |
|
39 | | - ;; OPEN_WORLD: (type $ret-any-1 (func (result anyref))) |
| 31 | + ;; OPEN_WORLD: (type $4 (func)) |
40 | 32 |
|
41 | | - ;; OPEN_WORLD: (type $6 (func (result i32))) |
| 33 | + ;; OPEN_WORLD: (type $externs (array (mut externref))) |
| 34 | + (type $externs (array (mut externref))) |
| 35 | + |
| 36 | + ;; CHECK: (type $funcs (array (mut funcref))) |
| 37 | + ;; OPEN_WORLD: (type $funcs (array (mut funcref))) |
| 38 | + (type $funcs (array (mut funcref))) |
42 | 39 |
|
43 | | - ;; OPEN_WORLD: (type $7 (func)) |
| 40 | + ;; CHECK: (type $bytes (array (mut i8))) |
| 41 | + ;; OPEN_WORLD: (type $bytes (array (mut i8))) |
| 42 | + (type $bytes (array (mut i8))) |
44 | 43 |
|
| 44 | + ;; CHECK: (type $configureAll (func (param (ref null $externs) (ref null $funcs) (ref null $bytes) externref))) |
45 | 45 | ;; OPEN_WORLD: (type $configureAll (func (param (ref null $externs) (ref null $funcs) (ref null $bytes) externref))) |
46 | 46 | (type $configureAll (func (param (ref null $externs)) (param (ref null $funcs)) (param (ref null $bytes)) (param externref))) |
47 | 47 |
|
48 | 48 | (type $struct (struct)) |
49 | 49 |
|
50 | 50 | (rec |
51 | | - (type $ret-any-1 (func (result anyref))) |
| 51 | + (type $func-1 (func (param anyref) (result anyref))) |
52 | 52 |
|
53 | | - ;; use brands to allow $ret-any-1/2 to be optimized separately. |
| 53 | + ;; use brands to allow $func-1/2 to be optimized separately. |
54 | 54 | (type $brand1 (struct)) |
55 | 55 | ) |
56 | 56 |
|
57 | 57 | (rec |
58 | | - (type $ret-any-2 (func (result anyref))) |
| 58 | + (type $func-2 (func (param anyref) (result anyref))) |
59 | 59 |
|
60 | 60 | (type $brand2 (struct)) |
61 | 61 | (type $brand3 (struct)) |
|
88 | 88 | ;; OPEN_WORLD: (start $start) |
89 | 89 | (start $start) |
90 | 90 |
|
91 | | - ;; CHECK: (func $start (type $7) |
| 91 | + ;; CHECK: (func $start (type $4) |
92 | 92 | ;; CHECK-NEXT: (call $configureAll |
93 | 93 | ;; CHECK-NEXT: (array.new_elem $externs $externs |
94 | 94 | ;; CHECK-NEXT: (i32.const 0) |
|
105 | 105 | ;; CHECK-NEXT: (ref.null noextern) |
106 | 106 | ;; CHECK-NEXT: ) |
107 | 107 | ;; CHECK-NEXT: ) |
108 | | - ;; OPEN_WORLD: (func $start (type $7) |
| 108 | + ;; OPEN_WORLD: (func $start (type $4) |
109 | 109 | ;; OPEN_WORLD-NEXT: (call $configureAll |
110 | 110 | ;; OPEN_WORLD-NEXT: (array.new_elem $externs $externs |
111 | 111 | ;; OPEN_WORLD-NEXT: (i32.const 0) |
|
134 | 134 | ) |
135 | 135 | ) |
136 | 136 |
|
137 | | - ;; CHECK: (func $foo (type $6) (result i32) |
| 137 | + ;; CHECK: (func $calls (type $4) |
| 138 | + ;; CHECK-NEXT: (drop |
| 139 | + ;; CHECK-NEXT: (call $bar |
| 140 | + ;; CHECK-NEXT: (struct.new_default $struct) |
| 141 | + ;; CHECK-NEXT: ) |
| 142 | + ;; CHECK-NEXT: ) |
| 143 | + ;; CHECK-NEXT: (drop |
| 144 | + ;; CHECK-NEXT: (call $unconfigured |
| 145 | + ;; CHECK-NEXT: (struct.new_default $struct) |
| 146 | + ;; CHECK-NEXT: ) |
| 147 | + ;; CHECK-NEXT: ) |
| 148 | + ;; CHECK-NEXT: ) |
| 149 | + ;; OPEN_WORLD: (func $calls (type $4) |
| 150 | + ;; OPEN_WORLD-NEXT: (drop |
| 151 | + ;; OPEN_WORLD-NEXT: (call $bar |
| 152 | + ;; OPEN_WORLD-NEXT: (struct.new_default $struct) |
| 153 | + ;; OPEN_WORLD-NEXT: ) |
| 154 | + ;; OPEN_WORLD-NEXT: ) |
| 155 | + ;; OPEN_WORLD-NEXT: (drop |
| 156 | + ;; OPEN_WORLD-NEXT: (call $unconfigured |
| 157 | + ;; OPEN_WORLD-NEXT: (struct.new_default $struct) |
| 158 | + ;; OPEN_WORLD-NEXT: ) |
| 159 | + ;; OPEN_WORLD-NEXT: ) |
| 160 | + ;; OPEN_WORLD-NEXT: ) |
| 161 | + (func $calls |
| 162 | + (drop |
| 163 | + (call $bar |
| 164 | + (struct.new $struct) |
| 165 | + ) |
| 166 | + ) |
| 167 | + (drop |
| 168 | + (call $unconfigured |
| 169 | + (struct.new $struct) |
| 170 | + ) |
| 171 | + ) |
| 172 | + ) |
| 173 | + |
| 174 | + ;; CHECK: (func $foo (type $2) (result i32) |
138 | 175 | ;; CHECK-NEXT: (i32.const 42) |
139 | 176 | ;; CHECK-NEXT: ) |
140 | | - ;; OPEN_WORLD: (func $foo (type $6) (result i32) |
| 177 | + ;; OPEN_WORLD: (func $foo (type $2) (result i32) |
141 | 178 | ;; OPEN_WORLD-NEXT: (i32.const 42) |
142 | 179 | ;; OPEN_WORLD-NEXT: ) |
143 | 180 | (func $foo (result i32) |
144 | 181 | ;; Nothing to do here anyhow, but do not error. |
145 | 182 | (i32.const 42) |
146 | 183 | ) |
147 | 184 |
|
148 | | - ;; CHECK: (func $bar (type $ret-any-1) (result anyref) |
| 185 | + ;; CHECK: (func $bar (type $func-1) (param $x anyref) (result (ref (exact $struct))) |
149 | 186 | ;; CHECK-NEXT: (struct.new_default $struct) |
150 | 187 | ;; CHECK-NEXT: ) |
151 | | - ;; OPEN_WORLD: (func $bar (type $ret-any-1) (result anyref) |
| 188 | + ;; OPEN_WORLD: (func $bar (type $func-1) (param $x anyref) (result (ref (exact $struct))) |
152 | 189 | ;; OPEN_WORLD-NEXT: (struct.new_default $struct) |
153 | 190 | ;; OPEN_WORLD-NEXT: ) |
154 | | - (func $bar (type $ret-any-1) (result anyref) |
155 | | - ;; This will not be refined due to configureAll. |
| 191 | + (func $bar (type $func-1) (param $x anyref) (result anyref) |
| 192 | + ;; The params will not be refined due to configureAll, but the result will. |
156 | 193 | (struct.new $struct) |
157 | 194 | ) |
158 | 195 |
|
159 | | - ;; CHECK: (func $unconfigured (type $ret-any-2) (result (ref (exact $struct))) |
| 196 | + ;; CHECK: (func $unconfigured (type $func-2) (param $x (ref (exact $struct))) (result (ref (exact $struct))) |
160 | 197 | ;; CHECK-NEXT: (struct.new_default $struct) |
161 | 198 | ;; CHECK-NEXT: ) |
162 | | - ;; OPEN_WORLD: (func $unconfigured (type $ret-any-2) (result (ref (exact $struct))) |
| 199 | + ;; OPEN_WORLD: (func $unconfigured (type $func-2) (param $x (ref (exact $struct))) (result (ref (exact $struct))) |
163 | 200 | ;; OPEN_WORLD-NEXT: (struct.new_default $struct) |
164 | 201 | ;; OPEN_WORLD-NEXT: ) |
165 | | - (func $unconfigured (type $ret-any-2) (result anyref) |
166 | | - ;; This is not referred to by configureAll, and can be refined. |
| 202 | + (func $unconfigured (type $func-2) (param $x anyref) (result anyref) |
| 203 | + ;; This is not referred to by configureAll, and can be refined in both |
| 204 | + ;; params and result. |
167 | 205 | (struct.new $struct) |
168 | 206 | ) |
169 | 207 | ) |
0 commit comments