mirror of
https://github.com/fluencelabs/wasmer
synced 2025-03-16 16:20:49 +00:00
Merge branch 'master' into feature/llvm-use-floats
This commit is contained in:
commit
10dccd9556
@ -2,6 +2,7 @@ arch:
|
||||
- arm64
|
||||
|
||||
language: rust
|
||||
install: travis_retry
|
||||
rust:
|
||||
- nightly-2019-08-15
|
||||
|
||||
@ -14,7 +15,7 @@ script:
|
||||
# Sccache
|
||||
# - curl -L https://github.com/mozilla/sccache/releases/download/0.2.10/sccache-0.2.10-x86_64-unknown-linux-musl.tar.gz | tar xzf -
|
||||
# - export RUSTC_WRAPPER=`pwd`/sccache-0.2.10-x86_64-unknown-linux-musl/sccache
|
||||
- test -f /home/travis/.cargo/bin/sccache || cargo install sccache
|
||||
- test -f /home/travis/.cargo/bin/sccache || travis_retry cargo install sccache
|
||||
- export RUSTC_WRAPPER=/home/travis/.cargo/bin/sccache
|
||||
- mkdir -p /home/travis/.sccache/
|
||||
- export SCCACHE_DIR="/home/travis/.sccache/"
|
||||
|
270
Cargo.lock
generated
270
Cargo.lock
generated
@ -102,12 +102,12 @@ version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"toml 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@ -132,7 +132,7 @@ dependencies = [
|
||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@ -176,7 +176,7 @@ dependencies = [
|
||||
"cranelift-entity 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"target-lexicon 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@ -231,7 +231,7 @@ dependencies = [
|
||||
"rayon-core 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@ -312,7 +312,7 @@ version = "0.1.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -334,7 +334,7 @@ dependencies = [
|
||||
"owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -393,7 +393,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@ -441,7 +441,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -459,7 +459,7 @@ name = "goblin"
|
||||
version = "0.0.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"log 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"plain 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"scroll 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@ -474,7 +474,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.3"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -502,7 +502,7 @@ dependencies = [
|
||||
"either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"inkwell_internals 0.1.0 (git+https://github.com/TheDan64/inkwell?rev=0a864ebf68b33d4d514b67796264b03898aa0944)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"llvm-sys 80.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"llvm-sys 80.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"once_cell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -535,7 +535,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -576,7 +576,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "llvm-sys"
|
||||
version = "80.1.1"
|
||||
version = "80.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cc 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -596,7 +596,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.10"
|
||||
version = "0.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -637,6 +637,19 @@ dependencies = [
|
||||
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "minifb"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cc 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"orbclient 0.3.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"x11-dl 2.18.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.15.0"
|
||||
@ -649,6 +662,35 @@ dependencies = [
|
||||
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num"
|
||||
version = "0.1.42"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.41"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-iter"
|
||||
version = "0.1.39"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.10"
|
||||
@ -662,7 +704,7 @@ name = "num_cpus"
|
||||
version = "1.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"hermit-abi 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hermit-abi 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@ -671,6 +713,15 @@ name = "once_cell"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "orbclient"
|
||||
version = "0.3.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sdl2 0.32.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "owning_ref"
|
||||
version = "0.4.0"
|
||||
@ -753,6 +804,11 @@ dependencies = [
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "plain"
|
||||
version = "0.2.3"
|
||||
@ -774,7 +830,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -809,6 +865,24 @@ dependencies = [
|
||||
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.6.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.7.2"
|
||||
@ -821,6 +895,15 @@ dependencies = [
|
||||
"rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.2.1"
|
||||
@ -851,6 +934,14 @@ dependencies = [
|
||||
"getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_hc"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_hc"
|
||||
version = "0.2.0"
|
||||
@ -859,6 +950,24 @@ dependencies = [
|
||||
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_isaac"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_jitter"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_os"
|
||||
version = "0.1.3"
|
||||
@ -872,6 +981,23 @@ dependencies = [
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_pcg"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_xorshift"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_xoshiro"
|
||||
version = "0.1.0"
|
||||
@ -926,6 +1052,11 @@ name = "redox_syscall"
|
||||
version = "0.1.56"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "ref_thread_local"
|
||||
version = "0.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.3.1"
|
||||
@ -1003,6 +1134,28 @@ dependencies = [
|
||||
"syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sdl2"
|
||||
version = "0.32.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sdl2-sys 0.32.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sdl2-sys"
|
||||
version = "0.32.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "0.9.0"
|
||||
@ -1048,12 +1201,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.42"
|
||||
version = "1.0.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1102,7 +1255,7 @@ dependencies = [
|
||||
"proc-macro-error 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1117,7 +1270,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.8"
|
||||
version = "1.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1132,7 +1285,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@ -1143,7 +1296,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1164,7 +1317,7 @@ name = "textwrap"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1191,7 +1344,7 @@ version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1226,7 +1379,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1236,7 +1389,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.6"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
@ -1266,7 +1419,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wabt-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@ -1319,6 +1472,7 @@ dependencies = [
|
||||
"wasmer-runtime-core 0.11.0",
|
||||
"wasmer-singlepass-backend 0.11.0",
|
||||
"wasmer-wasi 0.11.0",
|
||||
"wasmer-wasi-experimental-io-devices 0.11.0",
|
||||
"wasmer-wasi-tests 0.11.0",
|
||||
]
|
||||
|
||||
@ -1352,7 +1506,7 @@ version = "0.44.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cranelift-codegen 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"target-lexicon 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@ -1366,7 +1520,7 @@ dependencies = [
|
||||
"cranelift-entity 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasmer-clif-fork-frontend 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasmparser 0.39.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@ -1565,7 +1719,7 @@ dependencies = [
|
||||
"generational-arena 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"typetag 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1573,6 +1727,18 @@ dependencies = [
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-wasi-experimental-io-devices"
|
||||
version = "0.11.0"
|
||||
dependencies = [
|
||||
"minifb 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ref_thread_local 0.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"typetag 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasmer-runtime-core 0.11.0",
|
||||
"wasmer-wasi 0.11.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-wasi-tests"
|
||||
version = "0.11.0"
|
||||
@ -1638,6 +1804,17 @@ name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "x11-dl"
|
||||
version = "2.18.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[metadata]
|
||||
"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d"
|
||||
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
||||
@ -1693,7 +1870,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
||||
"checksum goblin 0.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "e3fa261d919c1ae9d1e4533c4a2f99e10938603c4208d56c05bec7a872b661b0"
|
||||
"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
|
||||
"checksum hermit-abi 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "307c3c9f937f38e3534b1d6447ecf090cafcc9744e4a6360e8b037b2cf5af120"
|
||||
"checksum hermit-abi 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f629dc602392d3ec14bfc8a09b5e644d7ffd725102b48b81e59f90f2633621d7"
|
||||
"checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77"
|
||||
"checksum indexmap 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712d7b3ea5827fcb9d4fda14bf4da5f136f0db2ae9c8f4bd4e2d1c6fde4e6db2"
|
||||
"checksum inkwell 0.1.0 (git+https://github.com/TheDan64/inkwell?rev=0a864ebf68b33d4d514b67796264b03898aa0944)" = "<none>"
|
||||
@ -1705,24 +1882,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
|
||||
"checksum llvm-sys 80.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2110cd4daf9cd8e39dd3b933b1a2a2ac7315e91f7c92b3a20beab526c63b5978"
|
||||
"checksum llvm-sys 80.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cf2969773884a5701f0c255e2a14d48d4522a66db898ec1088cb21879a228377"
|
||||
"checksum lock_api 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e57b3997725d2b60dbec1297f6c2e2957cc383db1cebd6be812163f969c7d586"
|
||||
"checksum log 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "1b9ad466a945c9c40f6f9a449c55675547e59bc75a2722d4689042ab3ae80c9c"
|
||||
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
|
||||
"checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
|
||||
"checksum md5 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e6bcd6433cff03a4bfc3d9834d504467db1f1cf6d0ea765d37d330249ed629d"
|
||||
"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
|
||||
"checksum memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b"
|
||||
"checksum memoffset 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "75189eb85871ea5c2e2c15abbdd541185f63b408415e5051f5cac122d8c774b9"
|
||||
"checksum minifb 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "55cbdf43445926b65e07992f06019321e7481df8fd656dcb6871d00cdbd9fc73"
|
||||
"checksum nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3b2e0b4f3320ed72aaedb9a5ac838690a8047c7b275da22711fddff4f8a14229"
|
||||
"checksum num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "4703ad64153382334aa8db57c637364c322d3372e097840c72000dabdcf6156e"
|
||||
"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09"
|
||||
"checksum num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "76bd5272412d173d6bf9afdf98db8612bbabc9a7a830b7bfc9c188911716132e"
|
||||
"checksum num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c81ffc11c212fa327657cb19dd85eb7419e163b5b076bede2bdb5c974c07e4"
|
||||
"checksum num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "76dac5ed2a876980778b8b85f75a71b6cbf0db0b1232ee12f826bccb00d09d72"
|
||||
"checksum once_cell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "891f486f630e5c5a4916c7e16c4b24a53e78c860b646e9f8e005e4f16847bfed"
|
||||
"checksum orbclient 0.3.27 (registry+https://github.com/rust-lang/crates.io-index)" = "f8b18f57ab94fbd058e30aa57f712ec423c0bb7403f8493a6c58eef0c36d9402"
|
||||
"checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13"
|
||||
"checksum page_size 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f89ef58b3d32420dbd1a43d2f38ae92f6239ef12bb556ab09ca55445f5a67242"
|
||||
"checksum parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "92e98c49ab0b7ce5b222f2cc9193fc4efe11c6d0bd4f648e374684a6857b1cfc"
|
||||
"checksum parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252"
|
||||
"checksum parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b"
|
||||
"checksum parking_lot_core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7582838484df45743c8434fbff785e8edf260c28748353d44bc0da32e0ceabf1"
|
||||
"checksum pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677"
|
||||
"checksum plain 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6"
|
||||
"checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b"
|
||||
"checksum proc-macro-error 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aeccfe4d5d8ea175d5f0e4a2ad0637e0f4121d63bd99d356fb1f39ab2e7c6097"
|
||||
@ -1730,19 +1913,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27"
|
||||
"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
|
||||
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
|
||||
"checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca"
|
||||
"checksum rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3ae1b169243eaf61759b8475a998f0a385e42042370f3a7dbaf35246eacc8412"
|
||||
"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef"
|
||||
"checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853"
|
||||
"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
|
||||
"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
|
||||
"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
|
||||
"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4"
|
||||
"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
|
||||
"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08"
|
||||
"checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b"
|
||||
"checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071"
|
||||
"checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44"
|
||||
"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c"
|
||||
"checksum rand_xoshiro 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "03b418169fb9c46533f326efd6eed2576699c44ca92d3052a066214a8d828929"
|
||||
"checksum raw-cpuid 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "30a9d219c32c9132f7be513c18be77c9881c7107d2ab5569d205a6a0f0e6dc7d"
|
||||
"checksum rayon 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "43739f8831493b276363637423d3622d4bd6394ab6f0a9c4a552e208aeb7fddd"
|
||||
"checksum rayon-core 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f8bf17de6f23b05473c437eb958b9c850bfc8af0961fe17b4cc92d5a627b4791"
|
||||
"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
|
||||
"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
|
||||
"checksum ref_thread_local 0.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d813022b2e00774a48eaf43caaa3c20b45f040ba8cbf398e2e8911a06668dbe6"
|
||||
"checksum regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dc220bd33bdce8f093101afe22a037b8eb0e5af33592e6a9caafff0d4cb81cbd"
|
||||
"checksum regex-automata 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "92b73c2a1770c255c240eaa4ee600df1704a38dc3feaa6e949e7fcd4f8dc09f9"
|
||||
"checksum regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716"
|
||||
@ -1753,13 +1944,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d"
|
||||
"checksum scroll 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2f84d114ef17fd144153d608fba7c446b0145d038985e7a8cc5d08bb0ce20383"
|
||||
"checksum scroll_derive 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8f1aa96c45e7f5a91cb7fabe7b279f02fea7126239fc40b732316e8b6a2d0fcb"
|
||||
"checksum sdl2 0.32.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d051a07231e303f5f719da78cb6f7394f6d5b54f733aef5b0b447804a83edd7b"
|
||||
"checksum sdl2-sys 0.32.6 (registry+https://github.com/rust-lang/crates.io-index)" = "34e71125077d297d57e4c1acfe8981b5bdfbf5a20e7b589abfdcb33bf1127f86"
|
||||
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
|
||||
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||
"checksum serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449"
|
||||
"checksum serde-bench 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "d733da87e79faaac25616e33d26299a41143fd4cd42746cbb0e91d8feea243fd"
|
||||
"checksum serde_bytes 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "325a073952621257820e7a3469f55ba4726d8b28657e7e36653d1c36dc2c84ae"
|
||||
"checksum serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64"
|
||||
"checksum serde_json 1.0.42 (registry+https://github.com/rust-lang/crates.io-index)" = "1a3351dcbc1f067e2c92ab7c3c1f288ad1a4cffc470b5aaddb4c2e0a3ae80043"
|
||||
"checksum serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)" = "48c575e0cc52bdd09b47f330f646cf59afc586e9c4e3ccd6fc1f625b8ea1dad7"
|
||||
"checksum smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6"
|
||||
"checksum smallvec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ecf3b85f68e8abaa7555aa5abdb1153079387e60b718283d732f03897fcfc86"
|
||||
"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
|
||||
@ -1767,7 +1960,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum structopt 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "30b3a3e93f5ad553c38b3301c8a0a0cec829a36783f6a0c467fc4bf553a5f5bf"
|
||||
"checksum structopt-derive 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea692d40005b3ceba90a9fe7a78fa8d4b82b0ce627eebbffc329aab850f3410e"
|
||||
"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5"
|
||||
"checksum syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "661641ea2aa15845cddeb97dad000d22070bb5c1fb456b96c1cba883ec691e92"
|
||||
"checksum syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "dff0acdb207ae2fe6d5976617f887eb1e35a2ba52c13c7234c790960cdad9238"
|
||||
"checksum synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545"
|
||||
"checksum target-lexicon 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7975cb2c6f37d77b190bc5004a2bb015971464756fde9514651a525ada2a741a"
|
||||
"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
|
||||
@ -1780,7 +1973,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum typetag 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6ebb2c484029d695fb68a06d80e1536c68d491b3e0cf874c66abed255e831cfe"
|
||||
"checksum typetag-impl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b63fd4799e4d0ec5cf0b055ebb8e2c3a657bbf76a84f6edc77ca60780e000204"
|
||||
"checksum unicode-segmentation 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0"
|
||||
"checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20"
|
||||
"checksum unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479"
|
||||
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
||||
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
|
||||
"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
|
||||
@ -1798,3 +1991,4 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9"
|
||||
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
"checksum x11-dl 2.18.4 (registry+https://github.com/rust-lang/crates.io-index)" = "be65e1342a3baae65439cd03306778831a3d133b0d20243a7fb83fd5cf403c58"
|
||||
|
@ -37,6 +37,7 @@ wasmer-dev-utils = { path = "lib/dev-utils", optional = true }
|
||||
wasmer-wasi-tests = { path = "lib/wasi-tests", optional = true }
|
||||
wasmer-middleware-common-tests = { path = "lib/middleware-common-tests", optional = true }
|
||||
wasmer-emscripten-tests = { path = "lib/emscripten-tests", optional = true }
|
||||
wasmer-wasi-experimental-io-devices = { path = "lib/wasi-experimental-io-devices", optional = true }
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
@ -56,6 +57,7 @@ members = [
|
||||
"lib/kernel-loader",
|
||||
"lib/kernel-net",
|
||||
"lib/dev-utils",
|
||||
"lib/wasi-experimental-io-devices",
|
||||
"lib/wasi-tests",
|
||||
"lib/emscripten-tests",
|
||||
"lib/middleware-common-tests",
|
||||
@ -101,6 +103,7 @@ backend-singlepass = [
|
||||
"wasmer-middleware-common-tests/singlepass",
|
||||
]
|
||||
wasi = ["wasmer-wasi"]
|
||||
experimental-io-devices = ["wasmer-wasi-experimental-io-devices"]
|
||||
managed = ["backend-singlepass", "wasmer-runtime-core/managed"]
|
||||
|
||||
[[example]]
|
||||
|
4
Makefile
4
Makefile
@ -257,7 +257,7 @@ check: check-bench
|
||||
|
||||
# Release
|
||||
release:
|
||||
cargo build --release --features backend-singlepass,backend-cranelift,backend-llvm,loader-kernel
|
||||
cargo build --release --features backend-singlepass,backend-cranelift,backend-llvm,loader-kernel,experimental-io-devices
|
||||
|
||||
# Only one backend (cranelift)
|
||||
release-clif:
|
||||
@ -269,7 +269,7 @@ release-singlepass:
|
||||
cargo build --release --features backend-singlepass
|
||||
|
||||
release-llvm:
|
||||
cargo build --release --features backend-llvm
|
||||
cargo build --release --features backend-llvm,experimental-io-devices
|
||||
|
||||
bench-singlepass:
|
||||
cargo bench --all --no-default-features --features "backend-singlepass" \
|
||||
|
19
lib/wasi-experimental-io-devices/Cargo.toml
Normal file
19
lib/wasi-experimental-io-devices/Cargo.toml
Normal file
@ -0,0 +1,19 @@
|
||||
[package]
|
||||
name = "wasmer-wasi-experimental-io-devices"
|
||||
version = "0.11.0"
|
||||
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
|
||||
edition = "2018"
|
||||
repository = "https://github.com/wasmerio/wasmer"
|
||||
publish = true
|
||||
description = "An experimental non-standard WASI extension for graphics"
|
||||
|
||||
[badges]
|
||||
maintenance = { status = "experimental" }
|
||||
|
||||
[dependencies]
|
||||
minifb = "0.13"
|
||||
wasmer-wasi = { version = "0.11.0", path = "../wasi" }
|
||||
wasmer-runtime-core = { version = "0.11.0", path = "../runtime-core" }
|
||||
ref_thread_local = "0.0"
|
||||
serde = "1"
|
||||
typetag = "0.1"
|
7
lib/wasi-experimental-io-devices/README.md
Normal file
7
lib/wasi-experimental-io-devices/README.md
Normal file
@ -0,0 +1,7 @@
|
||||
# WASI Framebuffer
|
||||
|
||||
An experimental extension of WASI for basic graphics.
|
||||
|
||||
This is not part of the WASI standard right now so use at your own risk -- it may break or be removed
|
||||
|
||||
TODO add usage instructions here
|
530
lib/wasi-experimental-io-devices/src/lib.rs
Normal file
530
lib/wasi-experimental-io-devices/src/lib.rs
Normal file
@ -0,0 +1,530 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::{BTreeSet, VecDeque};
|
||||
use std::convert::TryInto;
|
||||
use std::io::{Read, Seek, SeekFrom, Write};
|
||||
use wasmer_runtime_core::debug;
|
||||
use wasmer_wasi::{
|
||||
state::{Fd, WasiFile, WasiFs, WasiFsError, ALL_RIGHTS, VIRTUAL_ROOT_FD},
|
||||
types::*,
|
||||
};
|
||||
|
||||
use minifb::{Key, KeyRepeat, MouseButton, Scale, Window, WindowOptions};
|
||||
|
||||
mod util;
|
||||
|
||||
use util::*;
|
||||
|
||||
use std::cell::RefCell;
|
||||
std::thread_local! {
|
||||
pub(crate) static FRAMEBUFFER_STATE: RefCell<FrameBufferState> =
|
||||
RefCell::new(FrameBufferState::new()
|
||||
);
|
||||
}
|
||||
|
||||
pub const MAX_X: u32 = 8192;
|
||||
pub const MAX_Y: u32 = 4320;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum FrameBufferFileType {
|
||||
Buffer,
|
||||
Resolution,
|
||||
IndexDisplay,
|
||||
Input,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct FrameBufferState {
|
||||
// double buffered
|
||||
pub data_1: Vec<u32>,
|
||||
pub data_2: Vec<u32>,
|
||||
|
||||
pub x_size: u32,
|
||||
pub y_size: u32,
|
||||
pub front_buffer: bool,
|
||||
|
||||
pub window: Window,
|
||||
|
||||
pub last_mouse_pos: (u32, u32),
|
||||
pub inputs: VecDeque<InputEvent>,
|
||||
pub keys_pressed: BTreeSet<minifb::Key>,
|
||||
}
|
||||
|
||||
impl FrameBufferState {
|
||||
/// an arbitrary large number
|
||||
const MAX_INPUTS: usize = 128;
|
||||
|
||||
pub fn new() -> Self {
|
||||
let x = 100;
|
||||
let y = 200;
|
||||
|
||||
let window = Self::create_window(x, y);
|
||||
|
||||
Self {
|
||||
data_1: vec![0; x * y],
|
||||
data_2: vec![0; x * y],
|
||||
|
||||
x_size: x as u32,
|
||||
y_size: y as u32,
|
||||
front_buffer: true,
|
||||
|
||||
window,
|
||||
last_mouse_pos: (0, 0),
|
||||
inputs: VecDeque::with_capacity(Self::MAX_INPUTS),
|
||||
keys_pressed: BTreeSet::new(),
|
||||
}
|
||||
}
|
||||
|
||||
fn create_window(x: usize, y: usize) -> Window {
|
||||
Window::new(
|
||||
"Wasmer Experimental FrameBuffer",
|
||||
x,
|
||||
y,
|
||||
WindowOptions {
|
||||
resize: true,
|
||||
scale: Scale::X4,
|
||||
..WindowOptions::default()
|
||||
},
|
||||
)
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
pub fn resize(&mut self, x: u32, y: u32) -> Option<()> {
|
||||
if x >= MAX_X || y >= MAX_Y {
|
||||
return None;
|
||||
}
|
||||
self.x_size = x;
|
||||
self.y_size = x;
|
||||
|
||||
self.data_1.resize((x * y) as usize, 0);
|
||||
self.data_2.resize((x * y) as usize, 0);
|
||||
|
||||
self.window = Self::create_window(x as usize, y as usize);
|
||||
|
||||
Some(())
|
||||
}
|
||||
|
||||
fn push_input_event(&mut self, input_event: InputEvent) -> Option<()> {
|
||||
if self.inputs.len() >= Self::MAX_INPUTS {
|
||||
return None;
|
||||
}
|
||||
|
||||
self.inputs.push_back(input_event);
|
||||
Some(())
|
||||
}
|
||||
|
||||
pub fn fill_input_buffer(&mut self) -> Option<()> {
|
||||
let keys_pressed = self.keys_pressed.iter().cloned().collect::<Vec<Key>>();
|
||||
for key in keys_pressed {
|
||||
if self.window.is_key_released(key) {
|
||||
self.keys_pressed.remove(&key);
|
||||
self.push_input_event(InputEvent::KeyRelease(key))?;
|
||||
}
|
||||
}
|
||||
let keys = self.window.get_keys_pressed(KeyRepeat::No)?;
|
||||
for key in keys {
|
||||
self.keys_pressed.insert(key.clone());
|
||||
self.push_input_event(InputEvent::KeyPress(key))?;
|
||||
}
|
||||
|
||||
let mouse_position = self.window.get_mouse_pos(minifb::MouseMode::Clamp)?;
|
||||
if mouse_position.0 as u32 != self.last_mouse_pos.0
|
||||
|| mouse_position.1 as u32 != self.last_mouse_pos.1
|
||||
{
|
||||
self.last_mouse_pos = (mouse_position.0 as u32, mouse_position.1 as u32);
|
||||
self.push_input_event(InputEvent::MouseMoved(
|
||||
self.last_mouse_pos.0,
|
||||
self.last_mouse_pos.1,
|
||||
))?;
|
||||
}
|
||||
|
||||
if self.window.get_mouse_down(MouseButton::Left) {
|
||||
self.push_input_event(InputEvent::MouseEvent(
|
||||
mouse_position.0 as u32,
|
||||
mouse_position.1 as u32,
|
||||
MouseButton::Left,
|
||||
))?;
|
||||
}
|
||||
if self.window.get_mouse_down(MouseButton::Right) {
|
||||
self.push_input_event(InputEvent::MouseEvent(
|
||||
mouse_position.0 as u32,
|
||||
mouse_position.1 as u32,
|
||||
MouseButton::Right,
|
||||
))?;
|
||||
}
|
||||
if self.window.get_mouse_down(MouseButton::Middle) {
|
||||
self.push_input_event(InputEvent::MouseEvent(
|
||||
mouse_position.0 as u32,
|
||||
mouse_position.1 as u32,
|
||||
MouseButton::Middle,
|
||||
))?;
|
||||
}
|
||||
Some(())
|
||||
}
|
||||
|
||||
pub fn draw(&mut self) {
|
||||
self.window
|
||||
.update_with_buffer(if self.front_buffer {
|
||||
&self.data_1[..]
|
||||
} else {
|
||||
&self.data_2[..]
|
||||
})
|
||||
.expect("Internal error! Failed to draw to framebuffer");
|
||||
}
|
||||
|
||||
#[inline]
|
||||
// the real index into u32s and whether to use the front buffer or the back buffer
|
||||
fn get_idx_info(&self, idx: usize) -> Option<(usize, bool)> {
|
||||
let mut base_idx = idx / 4;
|
||||
let mut front_buffer = true;
|
||||
|
||||
if base_idx >= self.data_1.len() {
|
||||
base_idx -= self.data_1.len();
|
||||
front_buffer = false;
|
||||
|
||||
if base_idx >= self.data_2.len() {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
||||
Some((base_idx, front_buffer))
|
||||
}
|
||||
|
||||
pub fn get_byte(&self, idx: usize) -> Option<u8> {
|
||||
let (base_idx, front_buffer) = self.get_idx_info(idx)?;
|
||||
|
||||
let shift = idx % 4;
|
||||
let shift_amt = 8 * shift;
|
||||
|
||||
if front_buffer {
|
||||
Some((self.data_1[base_idx] >> shift_amt) as u8)
|
||||
} else {
|
||||
Some((self.data_2[base_idx] >> shift_amt) as u8)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_byte(&mut self, idx: usize, val: u8) -> Option<()> {
|
||||
let (base_idx, front_buffer) = self.get_idx_info(idx)?;
|
||||
|
||||
let shift = idx % 4;
|
||||
let shift_amt = 8 * shift;
|
||||
|
||||
if front_buffer {
|
||||
self.data_1[base_idx] &= !(0xFF << shift_amt);
|
||||
self.data_1[base_idx] |= ((val as u32) << shift_amt) & (0xFF << shift_amt);
|
||||
} else {
|
||||
self.data_2[base_idx] &= !(0xFF << shift_amt);
|
||||
self.data_2[base_idx] |= ((val as u32) << shift_amt) & (0xFF << shift_amt);
|
||||
}
|
||||
Some(())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct FrameBuffer {
|
||||
fb_type: FrameBufferFileType,
|
||||
cursor: u32,
|
||||
}
|
||||
|
||||
impl Read for FrameBuffer {
|
||||
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
|
||||
let cursor = self.cursor as usize;
|
||||
FRAMEBUFFER_STATE.with(|fb| {
|
||||
let mut fb_state = fb.borrow_mut();
|
||||
match self.fb_type {
|
||||
FrameBufferFileType::Buffer => {
|
||||
let mut bytes_copied = 0;
|
||||
|
||||
for i in 0..buf.len() {
|
||||
if let Some(byte) = fb_state.get_byte(cursor + i) {
|
||||
buf[i] = byte;
|
||||
bytes_copied += 1;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
self.cursor += bytes_copied;
|
||||
Ok(bytes_copied as usize)
|
||||
}
|
||||
FrameBufferFileType::Resolution => {
|
||||
let resolution_data = format!("{}x{}", fb_state.x_size, fb_state.y_size);
|
||||
|
||||
let mut bytes = resolution_data.bytes().skip(cursor);
|
||||
let bytes_to_copy = std::cmp::min(buf.len(), bytes.clone().count());
|
||||
|
||||
for i in 0..bytes_to_copy {
|
||||
buf[i] = bytes.next().unwrap();
|
||||
}
|
||||
|
||||
self.cursor += bytes_to_copy as u32;
|
||||
Ok(bytes_to_copy)
|
||||
}
|
||||
|
||||
FrameBufferFileType::IndexDisplay => {
|
||||
if buf.len() == 0 {
|
||||
Ok(0)
|
||||
} else {
|
||||
buf[0] = fb_state.front_buffer as u8 + b'0';
|
||||
Ok(1)
|
||||
}
|
||||
}
|
||||
|
||||
FrameBufferFileType::Input => {
|
||||
let mut idx = 0;
|
||||
fb_state.fill_input_buffer();
|
||||
|
||||
while let Some(next_elem) = fb_state.inputs.front() {
|
||||
let remaining_length = buf.len() - idx;
|
||||
let (tag_byte, data, size) = bytes_for_input_event(*next_elem);
|
||||
if remaining_length > 1 + size {
|
||||
buf[idx] = tag_byte;
|
||||
for i in 0..size {
|
||||
buf[idx + 1 + i] = data[i];
|
||||
}
|
||||
idx += 1 + size;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
fb_state.inputs.pop_front().unwrap();
|
||||
}
|
||||
Ok(idx)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fn read_to_end(&mut self, _buf: &mut Vec<u8>) -> std::io::Result<usize> {
|
||||
unimplemented!()
|
||||
}
|
||||
fn read_to_string(&mut self, _buf: &mut String) -> std::io::Result<usize> {
|
||||
unimplemented!()
|
||||
}
|
||||
fn read_exact(&mut self, _buf: &mut [u8]) -> std::io::Result<()> {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
impl Seek for FrameBuffer {
|
||||
fn seek(&mut self, pos: SeekFrom) -> std::io::Result<u64> {
|
||||
match pos {
|
||||
SeekFrom::Current(offset) => {
|
||||
let result: std::io::Result<u64> = (self.cursor as i64)
|
||||
.checked_add(offset)
|
||||
.and_then(|v| v.try_into().ok())
|
||||
.ok_or_else(|| std::io::Error::from(std::io::ErrorKind::InvalidInput));
|
||||
|
||||
if let Ok(n) = result {
|
||||
self.cursor = n as u32;
|
||||
}
|
||||
result
|
||||
}
|
||||
SeekFrom::Start(offset) => {
|
||||
self.cursor = offset as u32;
|
||||
Ok(offset)
|
||||
}
|
||||
SeekFrom::End(_) => unimplemented!("Seek from end not yet implemented"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Write for FrameBuffer {
|
||||
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
|
||||
let cursor = self.cursor as usize;
|
||||
FRAMEBUFFER_STATE.with(|fb| {
|
||||
let mut fb_state = fb.borrow_mut();
|
||||
match self.fb_type {
|
||||
FrameBufferFileType::Buffer => {
|
||||
let mut bytes_copied = 0;
|
||||
|
||||
for i in 0..buf.len() {
|
||||
if fb_state.set_byte(cursor + i, buf[i]).is_none() {
|
||||
// TODO: check if we should return an error here
|
||||
break;
|
||||
}
|
||||
bytes_copied += 1;
|
||||
}
|
||||
|
||||
self.cursor += bytes_copied;
|
||||
Ok(bytes_copied as usize)
|
||||
}
|
||||
FrameBufferFileType::Resolution => {
|
||||
let resolution_data = format!("{}x{}", fb_state.x_size, fb_state.y_size);
|
||||
let mut byte_vec: Vec<u8> = resolution_data.bytes().collect();
|
||||
let upper_limit = std::cmp::min(buf.len(), byte_vec.len() - cursor as usize);
|
||||
|
||||
for i in 0..upper_limit {
|
||||
byte_vec[i] = buf[i];
|
||||
}
|
||||
|
||||
let mut parse_str = String::new();
|
||||
for b in byte_vec.iter() {
|
||||
parse_str.push(*b as char);
|
||||
}
|
||||
let result: Vec<&str> = parse_str.split('x').collect();
|
||||
if result.len() != 2 {
|
||||
return Ok(0);
|
||||
}
|
||||
if let Ok((n1, n2)) = result[0]
|
||||
.parse::<u32>()
|
||||
.and_then(|n1| result[1].parse::<u32>().map(|n2| (n1, n2)))
|
||||
{
|
||||
if fb_state.resize(n1, n2).is_some() {
|
||||
return Ok(upper_limit);
|
||||
}
|
||||
}
|
||||
Ok(0)
|
||||
}
|
||||
|
||||
FrameBufferFileType::IndexDisplay => {
|
||||
if buf.len() == 0 {
|
||||
Ok(0)
|
||||
} else {
|
||||
match buf[0] {
|
||||
b'0' => fb_state.front_buffer = true,
|
||||
b'1' => fb_state.front_buffer = false,
|
||||
_ => (),
|
||||
}
|
||||
// TODO: probably remove this
|
||||
//fb_state.fill_input_buffer();
|
||||
fb_state.draw();
|
||||
Ok(1)
|
||||
}
|
||||
}
|
||||
FrameBufferFileType::Input => Ok(0),
|
||||
}
|
||||
})
|
||||
}
|
||||
fn flush(&mut self) -> std::io::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
fn write_all(&mut self, buf: &[u8]) -> std::io::Result<()> {
|
||||
self.write(buf).map(|_| ())
|
||||
}
|
||||
fn write_fmt(&mut self, _fmt: std::fmt::Arguments) -> std::io::Result<()> {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
#[typetag::serde]
|
||||
impl WasiFile for FrameBuffer {
|
||||
fn last_accessed(&self) -> u64 {
|
||||
0
|
||||
}
|
||||
fn last_modified(&self) -> u64 {
|
||||
0
|
||||
}
|
||||
fn created_time(&self) -> u64 {
|
||||
0
|
||||
}
|
||||
fn size(&self) -> u64 {
|
||||
0
|
||||
}
|
||||
fn set_len(&mut self, _new_size: __wasi_filesize_t) -> Result<(), WasiFsError> {
|
||||
Ok(())
|
||||
}
|
||||
fn unlink(&mut self) -> Result<(), WasiFsError> {
|
||||
panic!("TODO(mark): actually implement this");
|
||||
}
|
||||
fn bytes_available(&self) -> Result<usize, WasiFsError> {
|
||||
Ok(0)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn initialize(fs: &mut WasiFs) -> Result<(), String> {
|
||||
let frame_buffer_file = Box::new(FrameBuffer {
|
||||
fb_type: FrameBufferFileType::Buffer,
|
||||
cursor: 0,
|
||||
});
|
||||
let resolution_file = Box::new(FrameBuffer {
|
||||
fb_type: FrameBufferFileType::Resolution,
|
||||
cursor: 0,
|
||||
});
|
||||
let index_file = Box::new(FrameBuffer {
|
||||
fb_type: FrameBufferFileType::IndexDisplay,
|
||||
cursor: 0,
|
||||
});
|
||||
let input_file = Box::new(FrameBuffer {
|
||||
fb_type: FrameBufferFileType::Input,
|
||||
cursor: 0,
|
||||
});
|
||||
|
||||
let dev_fd = unsafe {
|
||||
fs.open_dir_all(
|
||||
VIRTUAL_ROOT_FD,
|
||||
"dev".to_string(),
|
||||
ALL_RIGHTS,
|
||||
ALL_RIGHTS,
|
||||
0,
|
||||
)
|
||||
.map_err(|e| format!("fb: Failed to create dev folder {:?}", e))?
|
||||
};
|
||||
|
||||
let fb_fd = unsafe {
|
||||
fs.open_dir_all(
|
||||
VIRTUAL_ROOT_FD,
|
||||
"sys/class/graphics/wasmerfb0".to_string(),
|
||||
ALL_RIGHTS,
|
||||
ALL_RIGHTS,
|
||||
0,
|
||||
)
|
||||
.map_err(|e| format!("fb: Failed to create dev folder {:?}", e))?
|
||||
};
|
||||
|
||||
let _fd = fs
|
||||
.open_file_at(
|
||||
dev_fd,
|
||||
input_file,
|
||||
Fd::READ,
|
||||
"input".to_string(),
|
||||
ALL_RIGHTS,
|
||||
ALL_RIGHTS,
|
||||
0,
|
||||
)
|
||||
.map_err(|e| format!("fb: Failed to init framebuffer {:?}", e))?;
|
||||
|
||||
debug!("Input open on fd {}", _fd);
|
||||
|
||||
let _fd = fs
|
||||
.open_file_at(
|
||||
dev_fd,
|
||||
frame_buffer_file,
|
||||
Fd::READ | Fd::WRITE,
|
||||
"wasmerfb0".to_string(),
|
||||
ALL_RIGHTS,
|
||||
ALL_RIGHTS,
|
||||
0,
|
||||
)
|
||||
.map_err(|e| format!("fb: Failed to init framebuffer {:?}", e))?;
|
||||
|
||||
debug!("Framebuffer open on fd {}", _fd);
|
||||
|
||||
let _fd = fs
|
||||
.open_file_at(
|
||||
fb_fd,
|
||||
resolution_file,
|
||||
Fd::READ | Fd::WRITE,
|
||||
"virtual_size".to_string(),
|
||||
ALL_RIGHTS,
|
||||
ALL_RIGHTS,
|
||||
0,
|
||||
)
|
||||
.map_err(|e| format!("fb_resolution: Failed to init framebuffer {:?}", e))?;
|
||||
|
||||
debug!("Framebuffer resolution open on fd {}", _fd);
|
||||
|
||||
let _fd = fs
|
||||
.open_file_at(
|
||||
fb_fd,
|
||||
index_file,
|
||||
Fd::READ | Fd::WRITE,
|
||||
"buffer_index_display".to_string(),
|
||||
ALL_RIGHTS,
|
||||
ALL_RIGHTS,
|
||||
0,
|
||||
)
|
||||
.map_err(|e| format!("fb_index_display: Failed to init framebuffer {:?}", e))?;
|
||||
|
||||
debug!("Framebuffer draw open on fd {}", _fd);
|
||||
|
||||
Ok(())
|
||||
}
|
177
lib/wasi-experimental-io-devices/src/util.rs
Normal file
177
lib/wasi-experimental-io-devices/src/util.rs
Normal file
@ -0,0 +1,177 @@
|
||||
// input encoding
|
||||
|
||||
pub const KEY_PRESS: u8 = 1;
|
||||
pub const MOUSE_MOVE: u8 = 2;
|
||||
pub const KEY_RELEASE: u8 = 3;
|
||||
pub const MOUSE_PRESS_LEFT: u8 = 4;
|
||||
pub const MOUSE_PRESS_RIGHT: u8 = 5;
|
||||
pub const MOUSE_PRESS_MIDDLE: u8 = 7;
|
||||
|
||||
use minifb::{Key, MouseButton};
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum InputEvent {
|
||||
KeyPress(Key),
|
||||
KeyRelease(Key),
|
||||
MouseEvent(u32, u32, MouseButton),
|
||||
MouseMoved(u32, u32),
|
||||
}
|
||||
|
||||
/// Returns the tag as the first return value
|
||||
/// The data as the second return value
|
||||
/// and the amount of data to read from it as the third value
|
||||
pub fn bytes_for_input_event(input_event: InputEvent) -> (u8, [u8; 8], usize) {
|
||||
let mut data = [0u8; 8];
|
||||
match input_event {
|
||||
InputEvent::KeyPress(k) => {
|
||||
data[0] = map_key_to_bytes(k);
|
||||
(KEY_PRESS, data, 1)
|
||||
}
|
||||
InputEvent::KeyRelease(k) => {
|
||||
data[0] = map_key_to_bytes(k);
|
||||
(KEY_RELEASE, data, 1)
|
||||
}
|
||||
InputEvent::MouseEvent(x, y, btn) => {
|
||||
let tag = match btn {
|
||||
MouseButton::Left => MOUSE_PRESS_LEFT,
|
||||
MouseButton::Right => MOUSE_PRESS_RIGHT,
|
||||
MouseButton::Middle => MOUSE_PRESS_MIDDLE,
|
||||
};
|
||||
let x_bytes = x.to_le_bytes();
|
||||
for i in 0..4 {
|
||||
data[i] = x_bytes[i];
|
||||
}
|
||||
let y_bytes = y.to_le_bytes();
|
||||
for i in 0..4 {
|
||||
data[i + 4] = y_bytes[i];
|
||||
}
|
||||
(tag, data, 8)
|
||||
}
|
||||
InputEvent::MouseMoved(x, y) => {
|
||||
let x_bytes = x.to_le_bytes();
|
||||
for i in 0..4 {
|
||||
data[i] = x_bytes[i];
|
||||
}
|
||||
let y_bytes = y.to_le_bytes();
|
||||
for i in 0..4 {
|
||||
data[i + 4] = y_bytes[i];
|
||||
}
|
||||
(MOUSE_MOVE, data, 8)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn map_key_to_bytes(key: Key) -> u8 {
|
||||
match key {
|
||||
Key::Backspace => 8,
|
||||
Key::Tab => 9,
|
||||
Key::NumPadEnter | Key::Enter => 13,
|
||||
Key::LeftShift | Key::RightShift => 16,
|
||||
Key::LeftCtrl | Key::RightCtrl => 17,
|
||||
Key::LeftAlt | Key::RightAlt => 18,
|
||||
Key::Pause => 19,
|
||||
Key::CapsLock => 20,
|
||||
Key::Escape => 27,
|
||||
Key::Space => 32,
|
||||
Key::PageUp => 33,
|
||||
Key::PageDown => 34,
|
||||
Key::End => 35,
|
||||
Key::Home => 36,
|
||||
|
||||
Key::Left => 37,
|
||||
Key::Up => 38,
|
||||
Key::Right => 39,
|
||||
Key::Down => 40,
|
||||
|
||||
Key::Insert => 45,
|
||||
Key::Delete => 46,
|
||||
|
||||
Key::Key0 => 48,
|
||||
Key::Key1 => 49,
|
||||
Key::Key2 => 50,
|
||||
Key::Key3 => 51,
|
||||
Key::Key4 => 52,
|
||||
Key::Key5 => 53,
|
||||
Key::Key6 => 54,
|
||||
Key::Key7 => 55,
|
||||
Key::Key8 => 56,
|
||||
Key::Key9 => 57,
|
||||
|
||||
Key::A => b'A',
|
||||
Key::B => b'B',
|
||||
Key::C => b'C',
|
||||
Key::D => b'D',
|
||||
Key::E => b'E',
|
||||
Key::F => b'F',
|
||||
Key::G => b'G',
|
||||
Key::H => b'H',
|
||||
Key::I => b'I',
|
||||
Key::J => b'J',
|
||||
Key::K => b'K',
|
||||
Key::L => b'L',
|
||||
Key::M => b'M',
|
||||
Key::N => b'N',
|
||||
Key::O => b'O',
|
||||
Key::P => b'P',
|
||||
Key::Q => b'Q',
|
||||
Key::R => b'R',
|
||||
Key::S => b'S',
|
||||
Key::T => b'T',
|
||||
Key::U => b'U',
|
||||
Key::V => b'V',
|
||||
Key::W => b'W',
|
||||
Key::X => b'X',
|
||||
Key::Y => b'Y',
|
||||
Key::Z => b'Z',
|
||||
|
||||
Key::LeftSuper => 91,
|
||||
Key::RightSuper => 92,
|
||||
|
||||
Key::NumPad0 => 96,
|
||||
Key::NumPad1 => 97,
|
||||
Key::NumPad2 => 98,
|
||||
Key::NumPad3 => 99,
|
||||
Key::NumPad4 => 100,
|
||||
Key::NumPad5 => 101,
|
||||
Key::NumPad6 => 102,
|
||||
Key::NumPad7 => 103,
|
||||
Key::NumPad8 => 104,
|
||||
Key::NumPad9 => 105,
|
||||
Key::NumPadAsterisk => 106,
|
||||
Key::NumPadPlus => 107,
|
||||
Key::NumPadMinus => 109,
|
||||
Key::NumPadDot => 110,
|
||||
Key::NumPadSlash => 111,
|
||||
|
||||
Key::F1 => 112,
|
||||
Key::F2 => 113,
|
||||
Key::F3 => 114,
|
||||
Key::F4 => 115,
|
||||
Key::F5 => 116,
|
||||
Key::F6 => 117,
|
||||
Key::F7 => 118,
|
||||
Key::F8 => 119,
|
||||
Key::F9 => 120,
|
||||
Key::F10 => 121,
|
||||
Key::F11 => 122,
|
||||
Key::F12 => 123,
|
||||
|
||||
Key::NumLock => 144,
|
||||
Key::ScrollLock => 145,
|
||||
|
||||
Key::Semicolon => 186,
|
||||
Key::Equal => 187,
|
||||
Key::Comma => 188,
|
||||
Key::Minus => 189,
|
||||
Key::Period => 190,
|
||||
Key::Slash => 191,
|
||||
Key::Backquote => 192,
|
||||
Key::Backslash => 220,
|
||||
Key::Apostrophe => 220,
|
||||
|
||||
Key::LeftBracket => 219,
|
||||
Key::RightBracket => 221,
|
||||
|
||||
_ => 255,
|
||||
}
|
||||
}
|
@ -64,7 +64,6 @@ pub fn generate_import_object(
|
||||
}
|
||||
let preopened_files = preopened_files.clone();
|
||||
let mapped_dirs = mapped_dirs.clone();
|
||||
//let wasi_builder = create_wasi_instance();
|
||||
|
||||
let state = Box::new(WasiState {
|
||||
fs: WasiFs::new(&preopened_files, &mapped_dirs).expect("Could not create WASI FS"),
|
||||
@ -77,56 +76,39 @@ pub fn generate_import_object(
|
||||
state_destructor as fn(*mut c_void),
|
||||
)
|
||||
};
|
||||
imports! {
|
||||
// This generates the wasi state.
|
||||
state_gen,
|
||||
"wasi_snapshot_preview1" => {
|
||||
"args_get" => func!(args_get),
|
||||
"args_sizes_get" => func!(args_sizes_get),
|
||||
"clock_res_get" => func!(clock_res_get),
|
||||
"clock_time_get" => func!(clock_time_get),
|
||||
"environ_get" => func!(environ_get),
|
||||
"environ_sizes_get" => func!(environ_sizes_get),
|
||||
"fd_advise" => func!(fd_advise),
|
||||
"fd_allocate" => func!(fd_allocate),
|
||||
"fd_close" => func!(fd_close),
|
||||
"fd_datasync" => func!(fd_datasync),
|
||||
"fd_fdstat_get" => func!(fd_fdstat_get),
|
||||
"fd_fdstat_set_flags" => func!(fd_fdstat_set_flags),
|
||||
"fd_fdstat_set_rights" => func!(fd_fdstat_set_rights),
|
||||
"fd_filestat_get" => func!(fd_filestat_get),
|
||||
"fd_filestat_set_size" => func!(fd_filestat_set_size),
|
||||
"fd_filestat_set_times" => func!(fd_filestat_set_times),
|
||||
"fd_pread" => func!(fd_pread),
|
||||
"fd_prestat_get" => func!(fd_prestat_get),
|
||||
"fd_prestat_dir_name" => func!(fd_prestat_dir_name),
|
||||
"fd_pwrite" => func!(fd_pwrite),
|
||||
"fd_read" => func!(fd_read),
|
||||
"fd_readdir" => func!(fd_readdir),
|
||||
"fd_renumber" => func!(fd_renumber),
|
||||
"fd_seek" => func!(fd_seek),
|
||||
"fd_sync" => func!(fd_sync),
|
||||
"fd_tell" => func!(fd_tell),
|
||||
"fd_write" => func!(fd_write),
|
||||
"path_create_directory" => func!(path_create_directory),
|
||||
"path_filestat_get" => func!(path_filestat_get),
|
||||
"path_filestat_set_times" => func!(path_filestat_set_times),
|
||||
"path_link" => func!(path_link),
|
||||
"path_open" => func!(path_open),
|
||||
"path_readlink" => func!(path_readlink),
|
||||
"path_remove_directory" => func!(path_remove_directory),
|
||||
"path_rename" => func!(path_rename),
|
||||
"path_symlink" => func!(path_symlink),
|
||||
"path_unlink_file" => func!(path_unlink_file),
|
||||
"poll_oneoff" => func!(poll_oneoff),
|
||||
"proc_exit" => func!(proc_exit),
|
||||
"proc_raise" => func!(proc_raise),
|
||||
"random_get" => func!(random_get),
|
||||
"sched_yield" => func!(sched_yield),
|
||||
"sock_recv" => func!(sock_recv),
|
||||
"sock_send" => func!(sock_send),
|
||||
"sock_shutdown" => func!(sock_shutdown),
|
||||
},
|
||||
|
||||
generate_import_object_snapshot1_inner(state_gen)
|
||||
}
|
||||
|
||||
/// Create an [`ImportObject`] with an existing [`WasiState`]. [`WasiState`]
|
||||
/// can be constructed from a [`WasiStateBuilder`].
|
||||
pub fn generate_import_object_from_state(
|
||||
wasi_state: WasiState,
|
||||
version: WasiVersion,
|
||||
) -> ImportObject {
|
||||
// HACK(mark): this is really quite nasty and inefficient, a proper fix will
|
||||
// require substantial changes to the internals of the WasiFS
|
||||
// copy WasiState by serializing and deserializing
|
||||
let wasi_state_bytes = wasi_state.freeze().unwrap();
|
||||
let state_gen = move || {
|
||||
fn state_destructor(data: *mut c_void) {
|
||||
unsafe {
|
||||
drop(Box::from_raw(data as *mut WasiState));
|
||||
}
|
||||
}
|
||||
|
||||
let wasi_state = Box::new(WasiState::unfreeze(&wasi_state_bytes).unwrap());
|
||||
|
||||
(
|
||||
Box::into_raw(wasi_state) as *mut c_void,
|
||||
state_destructor as fn(*mut c_void),
|
||||
)
|
||||
};
|
||||
match version {
|
||||
WasiVersion::Snapshot0 => generate_import_object_snapshot0_inner(state_gen),
|
||||
WasiVersion::Snapshot1 | WasiVersion::Latest => {
|
||||
generate_import_object_snapshot1_inner(state_gen)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,8 +159,15 @@ fn generate_import_object_snapshot0(
|
||||
state_destructor as fn(*mut c_void),
|
||||
)
|
||||
};
|
||||
generate_import_object_snapshot0_inner(state_gen)
|
||||
}
|
||||
|
||||
/// Combines a state generating function with the import list for legacy WASI
|
||||
fn generate_import_object_snapshot0_inner<F>(state_gen: F) -> ImportObject
|
||||
where
|
||||
F: Fn() -> (*mut c_void, fn(*mut c_void)) + Send + Sync + 'static,
|
||||
{
|
||||
imports! {
|
||||
// This generates the wasi state.
|
||||
state_gen,
|
||||
"wasi_unstable" => {
|
||||
"args_get" => func!(args_get),
|
||||
@ -229,3 +218,60 @@ fn generate_import_object_snapshot0(
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/// Combines a state generating function with the import list for snapshot 1
|
||||
fn generate_import_object_snapshot1_inner<F>(state_gen: F) -> ImportObject
|
||||
where
|
||||
F: Fn() -> (*mut c_void, fn(*mut c_void)) + Send + Sync + 'static,
|
||||
{
|
||||
imports! {
|
||||
state_gen,
|
||||
"wasi_snapshot_preview1" => {
|
||||
"args_get" => func!(args_get),
|
||||
"args_sizes_get" => func!(args_sizes_get),
|
||||
"clock_res_get" => func!(clock_res_get),
|
||||
"clock_time_get" => func!(clock_time_get),
|
||||
"environ_get" => func!(environ_get),
|
||||
"environ_sizes_get" => func!(environ_sizes_get),
|
||||
"fd_advise" => func!(fd_advise),
|
||||
"fd_allocate" => func!(fd_allocate),
|
||||
"fd_close" => func!(fd_close),
|
||||
"fd_datasync" => func!(fd_datasync),
|
||||
"fd_fdstat_get" => func!(fd_fdstat_get),
|
||||
"fd_fdstat_set_flags" => func!(fd_fdstat_set_flags),
|
||||
"fd_fdstat_set_rights" => func!(fd_fdstat_set_rights),
|
||||
"fd_filestat_get" => func!(fd_filestat_get),
|
||||
"fd_filestat_set_size" => func!(fd_filestat_set_size),
|
||||
"fd_filestat_set_times" => func!(fd_filestat_set_times),
|
||||
"fd_pread" => func!(fd_pread),
|
||||
"fd_prestat_get" => func!(fd_prestat_get),
|
||||
"fd_prestat_dir_name" => func!(fd_prestat_dir_name),
|
||||
"fd_pwrite" => func!(fd_pwrite),
|
||||
"fd_read" => func!(fd_read),
|
||||
"fd_readdir" => func!(fd_readdir),
|
||||
"fd_renumber" => func!(fd_renumber),
|
||||
"fd_seek" => func!(fd_seek),
|
||||
"fd_sync" => func!(fd_sync),
|
||||
"fd_tell" => func!(fd_tell),
|
||||
"fd_write" => func!(fd_write),
|
||||
"path_create_directory" => func!(path_create_directory),
|
||||
"path_filestat_get" => func!(path_filestat_get),
|
||||
"path_filestat_set_times" => func!(path_filestat_set_times),
|
||||
"path_link" => func!(path_link),
|
||||
"path_open" => func!(path_open),
|
||||
"path_readlink" => func!(path_readlink),
|
||||
"path_remove_directory" => func!(path_remove_directory),
|
||||
"path_rename" => func!(path_rename),
|
||||
"path_symlink" => func!(path_symlink),
|
||||
"path_unlink_file" => func!(path_unlink_file),
|
||||
"poll_oneoff" => func!(poll_oneoff),
|
||||
"proc_exit" => func!(proc_exit),
|
||||
"proc_raise" => func!(proc_raise),
|
||||
"random_get" => func!(random_get),
|
||||
"sched_yield" => func!(sched_yield),
|
||||
"sock_recv" => func!(sock_recv),
|
||||
"sock_send" => func!(sock_send),
|
||||
"sock_shutdown" => func!(sock_shutdown),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
use crate::state::{WasiFs, WasiState};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::rc::Rc;
|
||||
|
||||
/// Creates an empty [`WasiStateBuilder`].
|
||||
pub(crate) fn create_wasi_state(program_name: &str) -> WasiStateBuilder {
|
||||
@ -12,12 +13,25 @@ pub(crate) fn create_wasi_state(program_name: &str) -> WasiStateBuilder {
|
||||
}
|
||||
|
||||
/// Type for building an instance of [`WasiState`]
|
||||
#[derive(Debug, Default, Clone, PartialEq)]
|
||||
#[derive(Default, Clone)]
|
||||
pub struct WasiStateBuilder {
|
||||
args: Vec<Vec<u8>>,
|
||||
envs: Vec<Vec<u8>>,
|
||||
preopened_files: Vec<PathBuf>,
|
||||
mapped_dirs: Vec<(String, PathBuf)>,
|
||||
setup_fs_fn: Option<Rc<dyn Fn(&mut WasiFs) -> Result<(), String> + Send>>,
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for WasiStateBuilder {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("WasiStateBuilder")
|
||||
.field("args", &self.args)
|
||||
.field("envs", &self.envs)
|
||||
.field("preopend_files", &self.preopened_files)
|
||||
.field("mapped_dirs", &self.mapped_dirs)
|
||||
.field("setup_fs_fn exists", &self.setup_fs_fn.is_some())
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
/// Error type returned when bad data is given to [`WasiStateBuilder`].
|
||||
@ -28,6 +42,7 @@ pub enum WasiStateCreationError {
|
||||
PreopenedDirectoryNotFound(PathBuf),
|
||||
MappedDirAliasFormattingError(String),
|
||||
WasiFsCreationError(String),
|
||||
WasiFsSetupError(String),
|
||||
}
|
||||
|
||||
fn validate_mapped_dir_alias(alias: &str) -> Result<(), WasiStateCreationError> {
|
||||
@ -174,6 +189,31 @@ impl WasiStateBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
/// Preopen directorys with a different names exposed to the WASI.
|
||||
pub fn map_dirs<I, FilePath>(&mut self, mapped_dirs: I) -> &mut Self
|
||||
where
|
||||
I: IntoIterator<Item = (String, FilePath)>,
|
||||
FilePath: AsRef<Path>,
|
||||
{
|
||||
for (alias, dir) in mapped_dirs {
|
||||
let path = dir.as_ref();
|
||||
self.mapped_dirs.push((alias, path.to_path_buf()));
|
||||
}
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
/// Setup the WASI filesystem before running
|
||||
// TODO: improve ergonomics on this function
|
||||
pub fn setup_fs(
|
||||
&mut self,
|
||||
setup_fs_fn: Rc<dyn Fn(&mut WasiFs) -> Result<(), String> + Send>,
|
||||
) -> &mut Self {
|
||||
self.setup_fs_fn = Some(setup_fs_fn);
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
/// Consumes the [`WasiStateBuilder`] and produces a [`WasiState`]
|
||||
///
|
||||
/// Returns the error from `WasiFs::new` if there's an error
|
||||
@ -239,9 +279,13 @@ impl WasiStateBuilder {
|
||||
}
|
||||
validate_mapped_dir_alias(&alias)?;
|
||||
}
|
||||
let mut wasi_fs = WasiFs::new(&self.preopened_files, &self.mapped_dirs)
|
||||
.map_err(WasiStateCreationError::WasiFsCreationError)?;
|
||||
if let Some(f) = &self.setup_fs_fn {
|
||||
f(&mut wasi_fs).map_err(WasiStateCreationError::WasiFsSetupError)?;
|
||||
}
|
||||
Ok(WasiState {
|
||||
fs: WasiFs::new(&self.preopened_files, &self.mapped_dirs)
|
||||
.map_err(WasiStateCreationError::WasiFsCreationError)?,
|
||||
fs: wasi_fs,
|
||||
args: self.args.clone(),
|
||||
envs: self.envs.clone(),
|
||||
})
|
||||
|
@ -80,6 +80,11 @@ pub enum Kind {
|
||||
/// The path on the host system where the file is located
|
||||
/// This is deprecated and will be removed soon
|
||||
path: PathBuf,
|
||||
/// Marks the file as a special file that only one `fd` can exist for
|
||||
/// This is useful when dealing with host-provided special files that
|
||||
/// should be looked up by path
|
||||
/// TOOD: clarify here?
|
||||
fd: Option<u32>,
|
||||
},
|
||||
Dir {
|
||||
/// Parent directory
|
||||
@ -383,6 +388,71 @@ impl WasiFs {
|
||||
next
|
||||
}
|
||||
|
||||
/// like create dir all, but it also opens it
|
||||
/// Function is unsafe because it may break invariants and hasn't been tested.
|
||||
/// This is an experimental function and may be removed
|
||||
// dead code because this is an API for external use
|
||||
#[allow(dead_code)]
|
||||
pub unsafe fn open_dir_all(
|
||||
&mut self,
|
||||
base: __wasi_fd_t,
|
||||
name: String,
|
||||
rights: __wasi_rights_t,
|
||||
rights_inheriting: __wasi_rights_t,
|
||||
flags: __wasi_fdflags_t,
|
||||
) -> Result<__wasi_fd_t, WasiFsError> {
|
||||
let base_fd = self.get_fd(base).map_err(WasiFsError::from_wasi_err)?;
|
||||
// TODO: check permissions here? probably not, but this should be
|
||||
// an explicit choice, so justify it in a comment when we remove this one
|
||||
let mut cur_inode = base_fd.inode;
|
||||
|
||||
let path: &Path = Path::new(&name);
|
||||
//let n_components = path.components().count();
|
||||
for c in path.components() {
|
||||
let segment_name = c.as_os_str().to_string_lossy().to_string();
|
||||
match &self.inodes[cur_inode].kind {
|
||||
Kind::Dir { ref entries, .. } | Kind::Root { ref entries } => {
|
||||
if let Some(_entry) = entries.get(&segment_name) {
|
||||
// TODO: this should be fixed
|
||||
return Err(WasiFsError::AlreadyExists);
|
||||
}
|
||||
|
||||
let kind = Kind::Dir {
|
||||
parent: Some(cur_inode),
|
||||
path: PathBuf::from(""),
|
||||
entries: HashMap::new(),
|
||||
};
|
||||
|
||||
let inode =
|
||||
self.create_inode_with_default_stat(kind, false, segment_name.clone());
|
||||
// reborrow to insert
|
||||
match &mut self.inodes[cur_inode].kind {
|
||||
Kind::Dir {
|
||||
ref mut entries, ..
|
||||
}
|
||||
| Kind::Root { ref mut entries } => {
|
||||
entries.insert(segment_name, inode);
|
||||
}
|
||||
_ => unreachable!("Dir or Root became not Dir or Root"),
|
||||
}
|
||||
|
||||
cur_inode = inode;
|
||||
}
|
||||
_ => return Err(WasiFsError::BaseNotDirectory),
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: review open flags (read, write); they were added without consideration
|
||||
self.create_fd(
|
||||
rights,
|
||||
rights_inheriting,
|
||||
flags,
|
||||
Fd::READ | Fd::WRITE,
|
||||
cur_inode,
|
||||
)
|
||||
.map_err(WasiFsError::from_wasi_err)
|
||||
}
|
||||
|
||||
/// Opens a user-supplied file in the directory specified with the
|
||||
/// name and flags given
|
||||
// dead code because this is an API for external use
|
||||
@ -412,6 +482,7 @@ impl WasiFs {
|
||||
let kind = Kind::File {
|
||||
handle: Some(file),
|
||||
path: PathBuf::from(""),
|
||||
fd: Some(self.next_fd.get()),
|
||||
};
|
||||
|
||||
let inode = self
|
||||
@ -423,7 +494,7 @@ impl WasiFs {
|
||||
ref mut entries, ..
|
||||
}
|
||||
| Kind::Root { ref mut entries } => {
|
||||
entries.insert(name, inode).ok_or(WasiFsError::IOError)?;
|
||||
entries.insert(name, inode);
|
||||
}
|
||||
_ => unreachable!("Dir or Root became not Dir or Root"),
|
||||
}
|
||||
@ -580,6 +651,7 @@ impl WasiFs {
|
||||
Kind::File {
|
||||
handle: None,
|
||||
path: file.clone(),
|
||||
fd: None,
|
||||
}
|
||||
} else if file_type.is_symlink() {
|
||||
let link_value = file.read_link().ok().ok_or(__WASI_EIO)?;
|
||||
@ -1053,6 +1125,7 @@ impl WasiFs {
|
||||
..__wasi_filestat_t::default()
|
||||
};
|
||||
let kind = Kind::File {
|
||||
fd: Some(raw_fd),
|
||||
handle: Some(handle),
|
||||
path: "".into(),
|
||||
};
|
||||
@ -1078,7 +1151,7 @@ impl WasiFs {
|
||||
|
||||
pub fn get_stat_for_kind(&self, kind: &Kind) -> Option<__wasi_filestat_t> {
|
||||
let md = match kind {
|
||||
Kind::File { handle, path } => match handle {
|
||||
Kind::File { handle, path, .. } => match handle {
|
||||
Some(wf) => {
|
||||
return Some(__wasi_filestat_t {
|
||||
st_filetype: __WASI_FILETYPE_REGULAR_FILE,
|
||||
|
@ -1682,7 +1682,6 @@ pub fn path_open(
|
||||
);
|
||||
|
||||
let mut open_flags = 0;
|
||||
|
||||
// TODO: traverse rights of dirs properly
|
||||
// COMMENTED OUT: WASI isn't giving appropriate rights here when opening
|
||||
// TODO: look into this; file a bug report if this is a bug
|
||||
@ -1693,7 +1692,14 @@ pub fn path_open(
|
||||
Kind::File {
|
||||
ref mut handle,
|
||||
path,
|
||||
fd,
|
||||
} => {
|
||||
if let Some(special_fd) = fd {
|
||||
// short circuit if we're dealing with a special file
|
||||
assert!(handle.is_some());
|
||||
fd_cell.set(*special_fd);
|
||||
return __WASI_ESUCCESS;
|
||||
}
|
||||
if o_flags & __WASI_O_DIRECTORY != 0 {
|
||||
return __WASI_ENOTDIR;
|
||||
}
|
||||
@ -1813,6 +1819,7 @@ pub fn path_open(
|
||||
let kind = Kind::File {
|
||||
handle,
|
||||
path: new_file_host_path,
|
||||
fd: None,
|
||||
};
|
||||
wasi_try!(state.fs.create_inode(kind, false, new_entity_name.clone()))
|
||||
};
|
||||
@ -2050,6 +2057,7 @@ pub fn path_rename(
|
||||
Kind::File {
|
||||
handle,
|
||||
ref mut path,
|
||||
..
|
||||
} => {
|
||||
let result = if let Some(h) = handle {
|
||||
h.rename_file(&host_adjusted_target_path)
|
||||
@ -2218,7 +2226,7 @@ pub fn path_unlink_file(
|
||||
state.fs.inodes[removed_inode].stat.st_nlink -= 1;
|
||||
if state.fs.inodes[removed_inode].stat.st_nlink == 0 {
|
||||
match &mut state.fs.inodes[removed_inode].kind {
|
||||
Kind::File { handle, path } => {
|
||||
Kind::File { handle, path, .. } => {
|
||||
if let Some(h) = handle {
|
||||
wasi_try!(h.unlink().map_err(WasiFsError::into_wasi_err));
|
||||
} else {
|
||||
@ -2288,11 +2296,14 @@ pub fn poll_oneoff(
|
||||
let out_ptr = wasi_try!(nevents.deref(memory));
|
||||
|
||||
let mut fds = vec![];
|
||||
let mut clock_subs = vec![];
|
||||
let mut in_events = vec![];
|
||||
let mut total_ns_slept = 0;
|
||||
|
||||
for sub in subscription_array.iter() {
|
||||
let s: WasiSubscription = wasi_try!(sub.get().try_into());
|
||||
let mut peb = PollEventBuilder::new();
|
||||
let mut ns_to_sleep = 0;
|
||||
|
||||
let fd = match s.event_type {
|
||||
EventType::Read(__wasi_subscription_fs_readwrite_t { fd }) => {
|
||||
@ -2322,7 +2333,17 @@ pub fn poll_oneoff(
|
||||
in_events.push(peb.add(PollEvent::PollOut).build());
|
||||
Some(fd)
|
||||
}
|
||||
_ => unimplemented!("Clock eventtypes in wasi::poll_oneoff"),
|
||||
EventType::Clock(clock_info) => {
|
||||
if clock_info.clock_id == __WASI_CLOCK_REALTIME {
|
||||
// this is a hack
|
||||
// TODO: do this properly
|
||||
ns_to_sleep = clock_info.timeout;
|
||||
clock_subs.push(clock_info);
|
||||
None
|
||||
} else {
|
||||
unimplemented!("Polling not implemented for clocks yet");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if let Some(fd) = fd {
|
||||
@ -2368,7 +2389,13 @@ pub fn poll_oneoff(
|
||||
};
|
||||
fds.push(wasi_file_ref);
|
||||
} else {
|
||||
unimplemented!("Clock events are not yet implemented!");
|
||||
let remaining_ns = ns_to_sleep as i64 - total_ns_slept as i64;
|
||||
if remaining_ns > 0 {
|
||||
debug!("Sleeping for {} nanoseconds", remaining_ns);
|
||||
let duration = std::time::Duration::from_nanos(remaining_ns as u64);
|
||||
std::thread::sleep(duration);
|
||||
total_ns_slept += remaining_ns;
|
||||
}
|
||||
}
|
||||
}
|
||||
let mut seen_events = vec![Default::default(); in_events.len()];
|
||||
@ -2417,6 +2444,24 @@ pub fn poll_oneoff(
|
||||
event_array[events_seen].set(event);
|
||||
events_seen += 1;
|
||||
}
|
||||
for clock_info in clock_subs {
|
||||
let event = __wasi_event_t {
|
||||
// TOOD: review userdata value
|
||||
userdata: 0,
|
||||
error: __WASI_ESUCCESS,
|
||||
type_: __WASI_EVENTTYPE_CLOCK,
|
||||
u: unsafe {
|
||||
__wasi_event_u {
|
||||
fd_readwrite: __wasi_event_fd_readwrite_t {
|
||||
nbytes: 0,
|
||||
flags: 0,
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
event_array[events_seen].set(event);
|
||||
events_seen += 1;
|
||||
}
|
||||
out_ptr.set(events_seen as u32);
|
||||
__WASI_ESUCCESS
|
||||
}
|
||||
|
@ -240,6 +240,11 @@ struct Run {
|
||||
#[structopt(flatten)]
|
||||
features: PrestandardFeatures,
|
||||
|
||||
/// Enable non-standard experimental IO devices
|
||||
#[cfg(feature = "experimental-io-devices")]
|
||||
#[structopt(long = "enable-experimental-io-devices", hidden = true)]
|
||||
enable_experimental_io_devices: bool,
|
||||
|
||||
/// Application arguments
|
||||
#[structopt(name = "--", multiple = true)]
|
||||
args: Vec<String>,
|
||||
@ -383,29 +388,32 @@ fn execute_wasi(
|
||||
mapped_dirs: Vec<(String, PathBuf)>,
|
||||
_wasm_binary: &[u8],
|
||||
) -> Result<(), String> {
|
||||
let args = if let Some(cn) = &options.command_name {
|
||||
[cn.clone()]
|
||||
let name = if let Some(cn) = &options.command_name {
|
||||
cn.clone()
|
||||
} else {
|
||||
[options.path.to_str().unwrap().to_owned()]
|
||||
}
|
||||
.iter()
|
||||
.chain(options.args.iter())
|
||||
.cloned()
|
||||
.map(|arg| arg.into_bytes())
|
||||
.collect();
|
||||
let envs = env_vars
|
||||
.into_iter()
|
||||
.map(|(k, v)| format!("{}={}", k, v).into_bytes())
|
||||
.collect();
|
||||
let preopened_files = options.pre_opened_directories.clone();
|
||||
options.path.to_str().unwrap().to_owned()
|
||||
};
|
||||
|
||||
let import_object = wasmer_wasi::generate_import_object_for_version(
|
||||
wasi_version,
|
||||
args,
|
||||
envs,
|
||||
preopened_files,
|
||||
mapped_dirs,
|
||||
);
|
||||
let args = options.args.iter().cloned().map(|arg| arg.into_bytes());
|
||||
let preopened_files = options.pre_opened_directories.clone();
|
||||
let mut wasi_state_builder = wasmer_wasi::state::WasiState::new(&name);
|
||||
wasi_state_builder
|
||||
.args(args)
|
||||
.envs(env_vars)
|
||||
.preopen_dirs(preopened_files)
|
||||
.map_dirs(mapped_dirs);
|
||||
|
||||
#[cfg(feature = "experimental-io-devices")]
|
||||
{
|
||||
if options.enable_experimental_io_devices {
|
||||
wasi_state_builder.setup_fs(std::rc::Rc::new(
|
||||
wasmer_wasi_experimental_io_devices::initialize,
|
||||
));
|
||||
}
|
||||
}
|
||||
let wasi_state = wasi_state_builder.build().map_err(|e| format!("{:?}", e))?;
|
||||
|
||||
let import_object = wasmer_wasi::generate_import_object_from_state(wasi_state, wasi_version);
|
||||
|
||||
#[allow(unused_mut)] // mut used in feature
|
||||
let mut instance = module
|
||||
|
Loading…
x
Reference in New Issue
Block a user