Commit b8f0db3
authored
threads: improve tests (#1719)
* threads: rename tests
This change simply renames the shared-everything-threads tests to use
more conventional names within the repository.
* threads: add more Binaryen tests
@tlively has been working on Binaryen support for
shared-everything-threads and has upstreamed several [tests] that are
useful here. This change incorporates some "bottom type" checks for
arrays and structs as a `shared-ref_eq.wast` test checking `ref.eq`
behavior for shared types (renamed to `ref-equivalence.wast` here).
To make these added tests pass, validation for `ref.eq` now allows it to
check both shared and ushared `eqref` types the the `ref.i31_shared`
returns the correct type.
[tests]: https://github.com/WebAssembly/binaryen/blob/main/test/spec
[shared-ref_eq.wast]: https://github.com/WebAssembly/binaryen/blob/main/test/spec/shared-ref_eq.wast
* threads: add polymorphism over `shared`
Certain instructions accept both shared and unshared references:
`ref.eq`, `i31.get_s`, `i31.get_u`, `array.len`, `any.convert_extern`,
and `extern.convert_any`. Validation needs to handle these special cases
to pass Binaryen's `polymorphism.wast` test. This change refactors the
`pop_operand` family of functions with several helpers to add
`pop_maybe_shared_ref`; `pop_maybe_shared_ref` lets the validator pass
an unshared `RefType` expectation but adapts it to being shared if that
is what is on the stack.
* Undo previous refactoring; reuse `OperatorValidatorTemp::pop_ref`
This change undoes previous work to rationalize the duplication in
`_pop_operand`, `pop_ref`, and now `pop_maybe_shared_ref`. As suggested
by @alexcrichton, this attempt keeps the status quo by reusing `pop_ref`
and doing a bit more work after the fact (re-checking the subtype
relationship).
* Handle `ref.eq` types from unreachable code
This validator's existing logic assumed that the bottom and heap bottom
types matched any reference type (see `_pop_operand`). This change
surfaces that logic to `visit_ref_eq` as well: if `pop_maybe_shared_ref`
returns `None` (a bottom or heap bottom) for either value to `ref.eq`,
we skip checking the shared-ness match, assuming like we do in
`_pop_operand` that a bottom or heap bottom matches any reference type
(we've already checked that the types are subtypes of `eqref`).
* Add TODO for unshared propagation in unreachable code
* Return shared `bool` from `pop_maybe_shared_ref`
* Rename `is_shared_ref_type` to `is_shared`1 parent 88a090d commit b8f0db3
110 files changed
Lines changed: 2884 additions & 303 deletions
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
70 | 77 | | |
71 | 78 | | |
72 | 79 | | |
| |||
161 | 168 | | |
162 | 169 | | |
163 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
164 | 174 | | |
165 | 175 | | |
166 | 176 | | |
| |||
220 | 230 | | |
221 | 231 | | |
222 | 232 | | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
223 | 237 | | |
224 | 238 | | |
225 | 239 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1322 | 1322 | | |
1323 | 1323 | | |
1324 | 1324 | | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
1325 | 1329 | | |
1326 | 1330 | | |
1327 | 1331 | | |
| |||
1394 | 1398 | | |
1395 | 1399 | | |
1396 | 1400 | | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
1397 | 1405 | | |
1398 | 1406 | | |
1399 | 1407 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
240 | | - | |
| 240 | + | |
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
291 | 294 | | |
292 | 295 | | |
293 | 296 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | 202 | | |
212 | 203 | | |
213 | 204 | | |
| |||
613 | 604 | | |
614 | 605 | | |
615 | 606 | | |
| 607 | + | |
616 | 608 | | |
617 | 609 | | |
618 | 610 | | |
| |||
625 | 617 | | |
626 | 618 | | |
627 | 619 | | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
628 | 654 | | |
629 | 655 | | |
630 | 656 | | |
| |||
2723 | 2749 | | |
2724 | 2750 | | |
2725 | 2751 | | |
2726 | | - | |
2727 | | - | |
| 2752 | + | |
| 2753 | + | |
| 2754 | + | |
| 2755 | + | |
| 2756 | + | |
| 2757 | + | |
| 2758 | + | |
| 2759 | + | |
| 2760 | + | |
| 2761 | + | |
| 2762 | + | |
| 2763 | + | |
| 2764 | + | |
| 2765 | + | |
| 2766 | + | |
| 2767 | + | |
2728 | 2768 | | |
2729 | 2769 | | |
2730 | 2770 | | |
| |||
4224 | 4264 | | |
4225 | 4265 | | |
4226 | 4266 | | |
4227 | | - | |
| 4267 | + | |
4228 | 4268 | | |
4229 | 4269 | | |
4230 | 4270 | | |
| |||
4406 | 4446 | | |
4407 | 4447 | | |
4408 | 4448 | | |
4409 | | - | |
4410 | | - | |
4411 | | - | |
4412 | | - | |
| 4449 | + | |
| 4450 | + | |
| 4451 | + | |
| 4452 | + | |
| 4453 | + | |
| 4454 | + | |
| 4455 | + | |
| 4456 | + | |
4413 | 4457 | | |
4414 | | - | |
| 4458 | + | |
4415 | 4459 | | |
4416 | 4460 | | |
4417 | 4461 | | |
4418 | 4462 | | |
4419 | 4463 | | |
4420 | 4464 | | |
4421 | | - | |
4422 | | - | |
4423 | | - | |
4424 | | - | |
| 4465 | + | |
| 4466 | + | |
| 4467 | + | |
| 4468 | + | |
| 4469 | + | |
| 4470 | + | |
| 4471 | + | |
| 4472 | + | |
4425 | 4473 | | |
4426 | | - | |
| 4474 | + | |
4427 | 4475 | | |
4428 | 4476 | | |
4429 | 4477 | | |
| |||
4539 | 4587 | | |
4540 | 4588 | | |
4541 | 4589 | | |
4542 | | - | |
| 4590 | + | |
4543 | 4591 | | |
4544 | 4592 | | |
4545 | 4593 | | |
4546 | | - | |
| 4594 | + | |
4547 | 4595 | | |
4548 | 4596 | | |
4549 | 4597 | | |
| |||
Lines changed: 25 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
118 | 142 | | |
119 | 143 | | |
120 | 144 | | |
| |||
File renamed without changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
0 commit comments