Commit 630f6d0
committed
add wasm32-wasip2 support
This adds support for the new `wasm32-wasip2` target platform, which includes
more extensive support for sockets than `wasm32-wasip1` (formerly known as
`wasm32-wasi`).
The bulk of the changes are in tokio-rs/mio#1836. This
patch just tweaks a few `cfg` directives to indicate `wasm32-wasip2`'s
additional capabilities.
In the future, we could consider adding support for `ToSocketAddrs`. WASIp2
natively supports asynchronous DNS lookups and is single threaded, whereas Tokio
currently assumes DNS lookups are blocking and require multithreading to emulate
async lookups. A WASIp2-specific implementation could do the lookup directly
without multithreading.
I've tested this end-to-end using https://github.com/dicej/wasi-sockets-tests,
which includes smoke tests for `mio`, `tokio`, `tokio-postgres`, etc. I'd also
be happy to add tests to this repo if appropriate; it would require adding a
dev-dependency on e.g. `wasmtime` to actually run the test cases.
Signed-off-by: Joel Dice <[email protected]>1 parent 99a03a5 commit 630f6d0
5 files changed
+19
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
| 96 | + | |
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
| |||
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
109 | | - | |
| 110 | + | |
110 | 111 | | |
111 | 112 | | |
112 | 113 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
647 | 647 | | |
648 | 648 | | |
649 | 649 | | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
650 | 659 | | |
651 | 660 | | |
652 | 661 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
2 | 6 | | |
3 | 7 | | |
4 | | - | |
5 | 8 | | |
6 | 9 | | |
7 | 10 | | |
| |||
73 | 76 | | |
74 | 77 | | |
75 | 78 | | |
76 | | - | |
| 79 | + | |
77 | 80 | | |
78 | 81 | | |
79 | 82 | | |
| |||
0 commit comments