mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-05 02:20:19 +00:00
All function calls are now working
This commit is contained in:
parent
7f7eff788d
commit
1879a14938
205
Cargo.lock
generated
205
Cargo.lock
generated
@ -1,3 +1,8 @@
|
||||
[[package]]
|
||||
name = "abort_on_panic"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.6.8"
|
||||
@ -45,6 +50,24 @@ dependencies = [
|
||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bindgen"
|
||||
version = "0.31.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cexpr 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clang-sys 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"which 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.0.4"
|
||||
@ -55,11 +78,29 @@ name = "cc"
|
||||
version = "1.0.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "cexpr"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"nom 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "clang-sys"
|
||||
version = "0.21.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libloading 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.32.0"
|
||||
@ -159,6 +200,15 @@ dependencies = [
|
||||
"strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.2.4"
|
||||
@ -225,11 +275,30 @@ name = "gcc"
|
||||
version = "0.3.55"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "glob"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "kernel32-sys"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.1.0"
|
||||
@ -243,6 +312,44 @@ name = "libc"
|
||||
version = "0.2.43"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "libffi"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"abort_on_panic 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libffi-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libffi-sys"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bindgen 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"make-cmd 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.5"
|
||||
@ -259,6 +366,19 @@ dependencies = [
|
||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "make-cmd"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.1.0"
|
||||
@ -278,6 +398,24 @@ dependencies = [
|
||||
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "3.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "peeking_take_while"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "0.4.20"
|
||||
@ -286,6 +424,11 @@ dependencies = [
|
||||
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "0.3.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "0.6.8"
|
||||
@ -327,6 +470,18 @@ dependencies = [
|
||||
"redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.0.5"
|
||||
@ -339,6 +494,14 @@ dependencies = [
|
||||
"utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.5.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.6.2"
|
||||
@ -589,6 +752,7 @@ dependencies = [
|
||||
"cranelift-wasm 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"docopt 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libffi 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"region 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -612,6 +776,19 @@ name = "wasmparser"
|
||||
version = "0.20.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "which"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.6"
|
||||
@ -621,6 +798,11 @@ dependencies = [
|
||||
"winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-build"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
@ -632,14 +814,18 @@ version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[metadata]
|
||||
"checksum abort_on_panic 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9fa948f9ec9f095cc955efbe4fd00ac5774ef933cc2442562a8fe5a57c4ef919"
|
||||
"checksum aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "68f56c7353e5a9547cbd76ed90f7bb5ffc3ba09d4ea9bd1d8c06c8b1142eeb5a"
|
||||
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
||||
"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
|
||||
"checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a"
|
||||
"checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0"
|
||||
"checksum bindgen 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)" = "57253399c086f4f29e57ffd3b5cdbc23a806a00292619351aa4cfa39cb49d4ea"
|
||||
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
|
||||
"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16"
|
||||
"checksum cexpr 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "42aac45e9567d97474a834efdee3081b3c942b2205be932092f53354ce503d6c"
|
||||
"checksum cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4e7bb64a8ebb0d856483e1e682ea3422f883c5f5615a90d51a2c82fe87fdd3"
|
||||
"checksum clang-sys 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e414af9726e1d11660801e73ccc7fb81803fb5f49e5903a25b348b2b3b480d2e"
|
||||
"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"
|
||||
"checksum cmake 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "6ec65ee4f9c9d16f335091d23693457ed4928657ba4982289d7fafee03bc614a"
|
||||
"checksum cranelift-bforest 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)" = "edd9d4c68e251628d0a224720034280ed3fe1bff90853e6199c7e3c07e7569fc"
|
||||
@ -650,6 +836,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum cranelift-native 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)" = "764e004b73b6aaa20ff2a0127094950b67f25552c9b87662b35272f670a6c17f"
|
||||
"checksum cranelift-wasm 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)" = "97dba85d4788c520458e5d75eecccca39df43747dbcfbd8d45ac0d4e8aba475e"
|
||||
"checksum docopt 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d60c92df70dfaaabecc14b409fd79f55ba0f247780529db1d73bfa601e1d3ac0"
|
||||
"checksum env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3ddf21e73e016298f5cb37d6ef8e8da8e39f91f9ec8b0df44b7deb16a9f8cd5b"
|
||||
"checksum errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2a071601ed01b988f896ab14b95e67335d1eeb50190932a1320f7fe3cadc84e"
|
||||
"checksum errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067"
|
||||
"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02"
|
||||
@ -658,20 +845,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
|
||||
"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
|
||||
"checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2"
|
||||
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
|
||||
"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b"
|
||||
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||
"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"
|
||||
"checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7"
|
||||
"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d"
|
||||
"checksum libffi 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d8a9dac273181f514d742b6b858be5153570c5b80dd4d6020093c0fa584578b1"
|
||||
"checksum libffi-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0781d97b4749c2d640f16d4d196b7fcda1c38098431a2330aa312259bd501d51"
|
||||
"checksum libloading 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fd38073de8f7965d0c17d30546d4bb6da311ab428d1c7a3fc71dff7f9d4979b9"
|
||||
"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
|
||||
"checksum log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fcce5fa49cc693c312001daf1d13411c4a5283796bac1084299ea3e567113f"
|
||||
"checksum mach 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2fd13ee2dd61cc82833ba05ade5a30bb3d63f7ced605ef827063c63078302de9"
|
||||
"checksum make-cmd 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8ca8afbe8af1785e09636acb5a41e08a765f5f0340568716c18a8700ba3c0d3"
|
||||
"checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a"
|
||||
"checksum memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4b3629fe9fdbff6daa6c33b90f7c08355c1aca05a3d01fa8063b822fcf185f3b"
|
||||
"checksum memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2ffa2c986de11a9df78620c01eeaaf27d94d3ff02bf81bfcca953102dd0c6ff"
|
||||
"checksum nom 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05aec50c70fd288702bcd93284a8444607f3292dbdf2a30de5ea5dcdbe72287b"
|
||||
"checksum peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
|
||||
"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c"
|
||||
"checksum proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "3d7b7eaaa90b4a90a932a9ea6666c95a389e424eff347f0f793979289429feee"
|
||||
"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
|
||||
"checksum quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dd636425967c33af890042c483632d33fa7a18f19ad1d7ea72e8998c6ef8dea5"
|
||||
"checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd"
|
||||
"checksum raw-cpuid 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fe3c460bd35fdb75644e94ab498372bdf29a4849367ce7ba74cf358edce590c4"
|
||||
"checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1"
|
||||
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
|
||||
"checksum regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9329abc99e39129fcceabd24cf5d85b4671ef7c29c50e972bc5afe32438ec384"
|
||||
"checksum regex 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2069749032ea3ec200ca51e4a31df41759190a88edca0d2d86ee8bedf7073341"
|
||||
"checksum regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7"
|
||||
"checksum regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "747ba3b235651f6e2f67dfa8bcdcd073ddb7c243cb21c442fc12395dfcac212d"
|
||||
"checksum region 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9d3f2bb4b7085e6996e2765b56b783bd8f3a8a4ea5b95683063ca13cded993"
|
||||
"checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5"
|
||||
@ -705,6 +907,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum wabt-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4aaa9a8fa0d698315da5611f3e113a1e688fbb8d6fa0dd9510dfa023f665e9dc"
|
||||
"checksum wasmparser 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0fc6511bad33610d7798f80d48e10495a6eb4f1e39306b0bb340b2de0816c4ca"
|
||||
"checksum wasmparser 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2a75e0c3fe9a4d4fd91901348a5be05ba4791e29dda89e8596bfe87900ba7edc"
|
||||
"checksum which 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e84a603e7e0b1ce1aa1ee2b109c7be00155ce52df5081590d1ffb93f4f515cb2"
|
||||
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
||||
"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0"
|
||||
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
|
||||
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
@ -27,6 +27,7 @@ region = "0.3.0"
|
||||
memmap = "0.6.2"
|
||||
spin = "0.4.9"
|
||||
log = "0.4.5"
|
||||
libffi = "0.6.4"
|
||||
target-lexicon = { version = "0.0.3", default-features = false }
|
||||
|
||||
[features]
|
||||
|
@ -3,9 +3,13 @@ use std::path::Path;
|
||||
use std::rc::Rc;
|
||||
|
||||
use super::{run_single_file, InvokationResult, ScriptHandler};
|
||||
use cranelift_codegen::ir::types;
|
||||
use crate::webassembly::{
|
||||
compile, instantiate, Error, ErrorKind, Export, Instance, Module, ResultObject,
|
||||
};
|
||||
use libffi::high::call::*;
|
||||
use libffi::high::types::CType;
|
||||
use std::iter::Iterator;
|
||||
use wabt::script::{Action, Value};
|
||||
// use crate::webassembly::instance::InvokeResult;
|
||||
|
||||
@ -66,7 +70,6 @@ impl<'module> ScriptHandler for StoreCtrl<'module> {
|
||||
field: String,
|
||||
args: Vec<Value>,
|
||||
) -> InvokationResult {
|
||||
println!("INVOKE");
|
||||
if let Some(result) = &mut self.last_module {
|
||||
let instance = &result.instance;
|
||||
let module = &result.module;
|
||||
@ -74,11 +77,43 @@ impl<'module> ScriptHandler for StoreCtrl<'module> {
|
||||
Some(&Export::Function(index)) => index,
|
||||
_ => panic!("Function not found"),
|
||||
};
|
||||
println!("Function index: {:?}", func_index);
|
||||
let call_args: Vec<Arg> = args
|
||||
.iter()
|
||||
.map(|a| match a {
|
||||
Value::I32(v) => arg(v),
|
||||
Value::I64(v) => arg(v),
|
||||
Value::F32(v) => arg(v),
|
||||
Value::F64(v) => arg(v),
|
||||
})
|
||||
.collect();
|
||||
let call_func: fn() = instance.get_function(func_index);
|
||||
let result: i64 = unsafe { call(CodePtr(call_func as *mut _), &call_args) };
|
||||
let signature_index = module.info.functions[func_index].entity;
|
||||
let signature = &module.info.signatures[signature_index];
|
||||
let return_values = if signature.returns.len() > 0 {
|
||||
let val = match signature.returns[0].value_type {
|
||||
types::I32 => Value::I32(result as _),
|
||||
types::I64 => Value::I64(result as _),
|
||||
types::F32 => Value::F32(result as f32),
|
||||
types::F64 => Value::F64(result as f64),
|
||||
_ => panic!("Unexpected type"),
|
||||
};
|
||||
vec![val]
|
||||
} else {
|
||||
vec![]
|
||||
};
|
||||
|
||||
instance.invoke(func_index, vec![]);
|
||||
println!(
|
||||
"Function {:?}(index: {:?}) => {:?}",
|
||||
field.to_string(),
|
||||
func_index,
|
||||
return_values
|
||||
);
|
||||
|
||||
// let result = instance.invoke(func_index, vec![]);
|
||||
return InvokationResult::Vals(return_values);
|
||||
}
|
||||
InvokationResult::Vals(vec![])
|
||||
panic!("module not found");
|
||||
// let x = modu.unwrap();
|
||||
// unimplemented!()
|
||||
// if let Some(m) = &mut self.last_module {
|
||||
@ -168,33 +203,39 @@ impl<'module> ScriptHandler for StoreCtrl<'module> {
|
||||
}
|
||||
}
|
||||
|
||||
fn do_test(test_name: String) {
|
||||
let mut handler = &mut StoreCtrl::new();
|
||||
let test_path_str = format!(
|
||||
"{}/src/spec/tests/{}.wast",
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
test_name
|
||||
);
|
||||
let test_path = Path::new(&test_path_str);
|
||||
let res = run_single_file(&test_path, handler);
|
||||
res.present()
|
||||
}
|
||||
mod tests {
|
||||
use std::path::Path;
|
||||
|
||||
macro_rules! wasm_tests {
|
||||
($($name:ident,)*) => {
|
||||
$(
|
||||
#[test]
|
||||
fn $name() {
|
||||
// let test_filename = $value;
|
||||
// assert_eq!(expected, fib(input));
|
||||
do_test(stringify!($name).to_string());
|
||||
use super::run_single_file;
|
||||
|
||||
fn do_test(test_name: String) {
|
||||
let mut handler = &mut super::StoreCtrl::new();
|
||||
let test_path_str = format!(
|
||||
"{}/src/spec/tests/{}.wast",
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
test_name
|
||||
);
|
||||
let test_path = Path::new(&test_path_str);
|
||||
let res = run_single_file(&test_path, handler);
|
||||
res.present()
|
||||
}
|
||||
|
||||
macro_rules! wasm_tests {
|
||||
($($name:ident,)*) => {
|
||||
$(
|
||||
#[test]
|
||||
fn $name() {
|
||||
// let test_filename = $value;
|
||||
// assert_eq!(expected, fib(input));
|
||||
do_test(stringify!($name).to_string());
|
||||
}
|
||||
)*
|
||||
}
|
||||
)*
|
||||
}
|
||||
|
||||
wasm_tests!{
|
||||
_type,
|
||||
br_if,
|
||||
call,
|
||||
}
|
||||
}
|
||||
|
||||
wasm_tests!{
|
||||
// _type,
|
||||
// br_if,
|
||||
call,
|
||||
}
|
||||
|
@ -318,96 +318,96 @@
|
||||
|
||||
)
|
||||
|
||||
;; (assert_return (invoke "type-i32"))
|
||||
;; (assert_return (invoke "type-i64"))
|
||||
;; (assert_return (invoke "type-f32"))
|
||||
;; (assert_return (invoke "type-f64"))
|
||||
(assert_return (invoke "type-i32"))
|
||||
(assert_return (invoke "type-i64"))
|
||||
(assert_return (invoke "type-f32"))
|
||||
(assert_return (invoke "type-f64"))
|
||||
|
||||
;; (assert_return (invoke "type-i32-value") (i32.const 1))
|
||||
;; (assert_return (invoke "type-i64-value") (i64.const 2))
|
||||
(assert_return (invoke "type-i32-value") (i32.const 1))
|
||||
(assert_return (invoke "type-i64-value") (i64.const 2))
|
||||
;; (assert_return (invoke "type-f32-value") (f32.const 3))
|
||||
;; (assert_return (invoke "type-f64-value") (f64.const 4))
|
||||
|
||||
;; (assert_return (invoke "as-block-first" (i32.const 0)) (i32.const 2))
|
||||
;; (assert_return (invoke "as-block-first" (i32.const 1)) (i32.const 3))
|
||||
;; (assert_return (invoke "as-block-mid" (i32.const 0)) (i32.const 2))
|
||||
;; (assert_return (invoke "as-block-mid" (i32.const 1)) (i32.const 3))
|
||||
;; (assert_return (invoke "as-block-last" (i32.const 0)))
|
||||
;; (assert_return (invoke "as-block-last" (i32.const 1)))
|
||||
(assert_return (invoke "as-block-first" (i32.const 0)) (i32.const 2))
|
||||
(assert_return (invoke "as-block-first" (i32.const 1)) (i32.const 3))
|
||||
(assert_return (invoke "as-block-mid" (i32.const 0)) (i32.const 2))
|
||||
(assert_return (invoke "as-block-mid" (i32.const 1)) (i32.const 3))
|
||||
(assert_return (invoke "as-block-last" (i32.const 0)))
|
||||
(assert_return (invoke "as-block-last" (i32.const 1)))
|
||||
|
||||
;; (assert_return (invoke "as-block-first-value" (i32.const 0)) (i32.const 11))
|
||||
;; (assert_return (invoke "as-block-first-value" (i32.const 1)) (i32.const 10))
|
||||
;; (assert_return (invoke "as-block-mid-value" (i32.const 0)) (i32.const 21))
|
||||
;; (assert_return (invoke "as-block-mid-value" (i32.const 1)) (i32.const 20))
|
||||
;; (assert_return (invoke "as-block-last-value" (i32.const 0)) (i32.const 11))
|
||||
;; (assert_return (invoke "as-block-last-value" (i32.const 1)) (i32.const 11))
|
||||
(assert_return (invoke "as-block-first-value" (i32.const 0)) (i32.const 11))
|
||||
(assert_return (invoke "as-block-first-value" (i32.const 1)) (i32.const 10))
|
||||
(assert_return (invoke "as-block-mid-value" (i32.const 0)) (i32.const 21))
|
||||
(assert_return (invoke "as-block-mid-value" (i32.const 1)) (i32.const 20))
|
||||
(assert_return (invoke "as-block-last-value" (i32.const 0)) (i32.const 11))
|
||||
(assert_return (invoke "as-block-last-value" (i32.const 1)) (i32.const 11))
|
||||
|
||||
;; (assert_return (invoke "as-loop-first" (i32.const 0)) (i32.const 2))
|
||||
;; (assert_return (invoke "as-loop-first" (i32.const 1)) (i32.const 3))
|
||||
;; (assert_return (invoke "as-loop-mid" (i32.const 0)) (i32.const 2))
|
||||
;; (assert_return (invoke "as-loop-mid" (i32.const 1)) (i32.const 4))
|
||||
;; (assert_return (invoke "as-loop-last" (i32.const 0)))
|
||||
;; (assert_return (invoke "as-loop-last" (i32.const 1)))
|
||||
(assert_return (invoke "as-loop-first" (i32.const 0)) (i32.const 2))
|
||||
(assert_return (invoke "as-loop-first" (i32.const 1)) (i32.const 3))
|
||||
(assert_return (invoke "as-loop-mid" (i32.const 0)) (i32.const 2))
|
||||
(assert_return (invoke "as-loop-mid" (i32.const 1)) (i32.const 4))
|
||||
(assert_return (invoke "as-loop-last" (i32.const 0)))
|
||||
(assert_return (invoke "as-loop-last" (i32.const 1)))
|
||||
|
||||
;; (assert_return (invoke "as-br-value") (i32.const 1))
|
||||
(assert_return (invoke "as-br-value") (i32.const 1))
|
||||
|
||||
;; (assert_return (invoke "as-br_if-cond"))
|
||||
;; (assert_return (invoke "as-br_if-value") (i32.const 1))
|
||||
;; (assert_return (invoke "as-br_if-value-cond" (i32.const 0)) (i32.const 2))
|
||||
;; (assert_return (invoke "as-br_if-value-cond" (i32.const 1)) (i32.const 1))
|
||||
(assert_return (invoke "as-br_if-cond"))
|
||||
(assert_return (invoke "as-br_if-value") (i32.const 1))
|
||||
(assert_return (invoke "as-br_if-value-cond" (i32.const 0)) (i32.const 2))
|
||||
(assert_return (invoke "as-br_if-value-cond" (i32.const 1)) (i32.const 1))
|
||||
|
||||
;; (assert_return (invoke "as-br_table-index"))
|
||||
;; (assert_return (invoke "as-br_table-value") (i32.const 1))
|
||||
;; (assert_return (invoke "as-br_table-value-index") (i32.const 1))
|
||||
(assert_return (invoke "as-br_table-index"))
|
||||
(assert_return (invoke "as-br_table-value") (i32.const 1))
|
||||
(assert_return (invoke "as-br_table-value-index") (i32.const 1))
|
||||
|
||||
;; (assert_return (invoke "as-return-value") (i64.const 1))
|
||||
(assert_return (invoke "as-return-value") (i64.const 1))
|
||||
|
||||
;; (assert_return (invoke "as-if-cond" (i32.const 0)) (i32.const 2))
|
||||
;; (assert_return (invoke "as-if-cond" (i32.const 1)) (i32.const 1))
|
||||
;; (assert_return (invoke "as-if-then" (i32.const 0) (i32.const 0)))
|
||||
;; (assert_return (invoke "as-if-then" (i32.const 4) (i32.const 0)))
|
||||
;; (assert_return (invoke "as-if-then" (i32.const 0) (i32.const 1)))
|
||||
;; (assert_return (invoke "as-if-then" (i32.const 4) (i32.const 1)))
|
||||
;; (assert_return (invoke "as-if-else" (i32.const 0) (i32.const 0)))
|
||||
;; (assert_return (invoke "as-if-else" (i32.const 3) (i32.const 0)))
|
||||
;; (assert_return (invoke "as-if-else" (i32.const 0) (i32.const 1)))
|
||||
;; (assert_return (invoke "as-if-else" (i32.const 3) (i32.const 1)))
|
||||
(assert_return (invoke "as-if-cond" (i32.const 0)) (i32.const 2))
|
||||
(assert_return (invoke "as-if-cond" (i32.const 1)) (i32.const 1))
|
||||
(assert_return (invoke "as-if-then" (i32.const 0) (i32.const 0)))
|
||||
(assert_return (invoke "as-if-then" (i32.const 4) (i32.const 0)))
|
||||
(assert_return (invoke "as-if-then" (i32.const 0) (i32.const 1)))
|
||||
(assert_return (invoke "as-if-then" (i32.const 4) (i32.const 1)))
|
||||
(assert_return (invoke "as-if-else" (i32.const 0) (i32.const 0)))
|
||||
(assert_return (invoke "as-if-else" (i32.const 3) (i32.const 0)))
|
||||
(assert_return (invoke "as-if-else" (i32.const 0) (i32.const 1)))
|
||||
(assert_return (invoke "as-if-else" (i32.const 3) (i32.const 1)))
|
||||
|
||||
;; (assert_return (invoke "as-select-first" (i32.const 0)) (i32.const 3))
|
||||
;; (assert_return (invoke "as-select-first" (i32.const 1)) (i32.const 3))
|
||||
;; (assert_return (invoke "as-select-second" (i32.const 0)) (i32.const 3))
|
||||
;; (assert_return (invoke "as-select-second" (i32.const 1)) (i32.const 3))
|
||||
;; (assert_return (invoke "as-select-cond") (i32.const 3))
|
||||
(assert_return (invoke "as-select-first" (i32.const 0)) (i32.const 3))
|
||||
(assert_return (invoke "as-select-first" (i32.const 1)) (i32.const 3))
|
||||
(assert_return (invoke "as-select-second" (i32.const 0)) (i32.const 3))
|
||||
(assert_return (invoke "as-select-second" (i32.const 1)) (i32.const 3))
|
||||
(assert_return (invoke "as-select-cond") (i32.const 3))
|
||||
|
||||
;; (assert_return (invoke "as-call-first") (i32.const 12))
|
||||
;; (assert_return (invoke "as-call-mid") (i32.const 13))
|
||||
;; (assert_return (invoke "as-call-last") (i32.const 14))
|
||||
(assert_return (invoke "as-call-first") (i32.const 12))
|
||||
(assert_return (invoke "as-call-mid") (i32.const 13))
|
||||
(assert_return (invoke "as-call-last") (i32.const 14))
|
||||
|
||||
;; (assert_return (invoke "as-call_indirect-func") (i32.const 4))
|
||||
;; (assert_return (invoke "as-call_indirect-first") (i32.const 4))
|
||||
;; (assert_return (invoke "as-call_indirect-mid") (i32.const 4))
|
||||
;; (assert_return (invoke "as-call_indirect-last") (i32.const 4))
|
||||
(assert_return (invoke "as-call_indirect-func") (i32.const 4))
|
||||
(assert_return (invoke "as-call_indirect-first") (i32.const 4))
|
||||
(assert_return (invoke "as-call_indirect-mid") (i32.const 4))
|
||||
(assert_return (invoke "as-call_indirect-last") (i32.const 4))
|
||||
|
||||
;; (assert_return (invoke "as-set_local-value" (i32.const 0)) (i32.const -1))
|
||||
;; (assert_return (invoke "as-set_local-value" (i32.const 1)) (i32.const 17))
|
||||
(assert_return (invoke "as-set_local-value" (i32.const 0)) (i32.const -1))
|
||||
(assert_return (invoke "as-set_local-value" (i32.const 1)) (i32.const 17))
|
||||
|
||||
;; (assert_return (invoke "as-unary-operand") (f64.const 1.0))
|
||||
;; (assert_return (invoke "as-binary-left") (i32.const 1))
|
||||
;; (assert_return (invoke "as-binary-right") (i32.const 1))
|
||||
;; (assert_return (invoke "as-memory.grow-size") (i32.const 1))
|
||||
(assert_return (invoke "as-unary-operand") (f64.const 1.0))
|
||||
(assert_return (invoke "as-binary-left") (i32.const 1))
|
||||
(assert_return (invoke "as-binary-right") (i32.const 1))
|
||||
(assert_return (invoke "as-memory.grow-size") (i32.const 1))
|
||||
|
||||
;; (assert_return (invoke "nested-block-value" (i32.const 0)) (i32.const 21))
|
||||
;; (assert_return (invoke "nested-block-value" (i32.const 1)) (i32.const 9))
|
||||
;; (assert_return (invoke "nested-br-value" (i32.const 0)) (i32.const 5))
|
||||
;; (assert_return (invoke "nested-br-value" (i32.const 1)) (i32.const 9))
|
||||
;; (assert_return (invoke "nested-br_if-value" (i32.const 0)) (i32.const 5))
|
||||
;; (assert_return (invoke "nested-br_if-value" (i32.const 1)) (i32.const 9))
|
||||
;; (assert_return (invoke "nested-br_if-value-cond" (i32.const 0)) (i32.const 5))
|
||||
;; (assert_return (invoke "nested-br_if-value-cond" (i32.const 1)) (i32.const 9))
|
||||
;; (assert_return (invoke "nested-br_table-value" (i32.const 0)) (i32.const 5))
|
||||
;; (assert_return (invoke "nested-br_table-value" (i32.const 1)) (i32.const 9))
|
||||
;; (assert_return (invoke "nested-br_table-value-index" (i32.const 0)) (i32.const 5))
|
||||
;; (assert_return (invoke "nested-br_table-value-index" (i32.const 1)) (i32.const 9))
|
||||
(assert_return (invoke "nested-block-value" (i32.const 0)) (i32.const 21))
|
||||
(assert_return (invoke "nested-block-value" (i32.const 1)) (i32.const 9))
|
||||
(assert_return (invoke "nested-br-value" (i32.const 0)) (i32.const 5))
|
||||
(assert_return (invoke "nested-br-value" (i32.const 1)) (i32.const 9))
|
||||
(assert_return (invoke "nested-br_if-value" (i32.const 0)) (i32.const 5))
|
||||
(assert_return (invoke "nested-br_if-value" (i32.const 1)) (i32.const 9))
|
||||
(assert_return (invoke "nested-br_if-value-cond" (i32.const 0)) (i32.const 5))
|
||||
(assert_return (invoke "nested-br_if-value-cond" (i32.const 1)) (i32.const 9))
|
||||
(assert_return (invoke "nested-br_table-value" (i32.const 0)) (i32.const 5))
|
||||
(assert_return (invoke "nested-br_table-value" (i32.const 1)) (i32.const 9))
|
||||
(assert_return (invoke "nested-br_table-value-index" (i32.const 0)) (i32.const 5))
|
||||
(assert_return (invoke "nested-br_table-value-index" (i32.const 1)) (i32.const 9))
|
||||
|
||||
(assert_invalid
|
||||
(module (func $type-false-i32 (block (i32.ctz (br_if 0 (i32.const 0))))))
|
||||
|
@ -13,27 +13,27 @@
|
||||
;; )
|
||||
;; )
|
||||
|
||||
(func $multiply (; 1 ;) (param i32 i32) (result i32)
|
||||
(i32.mul
|
||||
(get_local 0)
|
||||
(get_local 1)
|
||||
)
|
||||
)
|
||||
;; (func $multiply (; 1 ;) (param i32 i32) (result i32)
|
||||
;; (i32.mul
|
||||
;; (get_local 0)
|
||||
;; (get_local 1)
|
||||
;; )
|
||||
;; )
|
||||
|
||||
(func (export "multiply_direct") (; 1 ;) (param $0 i32) (result i32)
|
||||
(i32.mul
|
||||
(get_local 0)
|
||||
(i32.const 3)
|
||||
)
|
||||
)
|
||||
;; (func (export "multiply_direct") (; 1 ;) (param $0 i32) (result i32)
|
||||
;; (i32.mul
|
||||
;; (get_local 0)
|
||||
;; (i32.const 3)
|
||||
;; )
|
||||
;; )
|
||||
|
||||
(func (export "multiply_by_3") (; 1 ;) (param $0 i32) (result i32)
|
||||
(call $multiply
|
||||
(i32.const 3)
|
||||
(get_local $0)
|
||||
;; (i32.const 2)
|
||||
)
|
||||
)
|
||||
;; (func (export "multiply_by_3") (; 1 ;) (param $0 i32) (result i32)
|
||||
;; (call $multiply
|
||||
;; (i32.const 3)
|
||||
;; (get_local $0)
|
||||
;; ;; (i32.const 2)
|
||||
;; )
|
||||
;; )
|
||||
|
||||
(func (export "multiply_by_3_raw") (; 1 ;) (param $0 i32) (result i32)
|
||||
(i32.mul
|
||||
|
@ -6,25 +6,24 @@
|
||||
//! synchronously instantiate a given webassembly::Module object. However, the
|
||||
//! primary way to get an Instance is through the asynchronous
|
||||
//! webassembly::instantiateStreaming() function.
|
||||
use cranelift_codegen::{isa, Context, binemit};
|
||||
use cranelift_codegen::{binemit, isa, Context};
|
||||
use cranelift_entity::EntityRef;
|
||||
use cranelift_wasm::{FuncIndex, GlobalInit};
|
||||
use memmap::MmapMut;
|
||||
use region;
|
||||
use spin::RwLock;
|
||||
use std::iter::Iterator;
|
||||
use std::marker::PhantomData;
|
||||
use std::ptr::{self, write_unaligned};
|
||||
use std::sync::Arc;
|
||||
use std::{mem, slice};
|
||||
use std::iter::Iterator;
|
||||
|
||||
use super::super::common::slice::{BoundedSlice, UncheckedSlice};
|
||||
use super::errors::ErrorKind;
|
||||
use super::memory::LinearMemory;
|
||||
use super::module::Module;
|
||||
use super::module::{DataInitializer, Exportable, Export};
|
||||
use super::relocation::{RelocSink, TrapSink, RelocationType, Reloc};
|
||||
|
||||
use super::module::{DataInitializer, Export, Exportable};
|
||||
use super::relocation::{Reloc, RelocSink, RelocationType, TrapSink};
|
||||
|
||||
pub fn protect_codebuf(code_buf: &Vec<u8>) -> Result<(), String> {
|
||||
match unsafe {
|
||||
@ -39,7 +38,7 @@ pub fn protect_codebuf(code_buf: &Vec<u8>) -> Result<(), String> {
|
||||
"failed to give executable permission to code: {}",
|
||||
err
|
||||
))
|
||||
},
|
||||
}
|
||||
Ok(()) => Ok(()),
|
||||
}
|
||||
}
|
||||
@ -104,7 +103,6 @@ pub struct Instance {
|
||||
|
||||
/// The module start function
|
||||
start_func: Option<FuncIndex>,
|
||||
|
||||
// Region start memory location
|
||||
// code_base: *const (),
|
||||
}
|
||||
@ -131,7 +129,6 @@ pub struct Instance {
|
||||
// vmctx
|
||||
// }
|
||||
|
||||
|
||||
impl Instance {
|
||||
/// Create a new `Instance`.
|
||||
pub fn new(module: &Module) -> Result<Instance, ErrorKind> {
|
||||
@ -169,7 +166,9 @@ impl Instance {
|
||||
let mut reloc_sink = RelocSink::new();
|
||||
let mut trap_sink = binemit::NullTrapSink {};
|
||||
|
||||
func_context.compile_and_emit(&*isa, &mut code_buf, &mut reloc_sink, &mut trap_sink).map_err(|e| ErrorKind::CompileError(e.to_string()))?;
|
||||
func_context
|
||||
.compile_and_emit(&*isa, &mut code_buf, &mut reloc_sink, &mut trap_sink)
|
||||
.map_err(|e| ErrorKind::CompileError(e.to_string()))?;
|
||||
protect_codebuf(&code_buf);
|
||||
|
||||
let func_offset = code_buf;
|
||||
@ -208,13 +207,15 @@ impl Instance {
|
||||
let body = &mut functions[i];
|
||||
match reloc.reloc {
|
||||
Reloc::Abs8 => unsafe {
|
||||
let reloc_address = body.as_mut_ptr().offset(reloc.offset as isize) as i64;
|
||||
let reloc_address =
|
||||
body.as_mut_ptr().offset(reloc.offset as isize) as i64;
|
||||
let reloc_addend = reloc.addend;
|
||||
let reloc_abs = target_func_address as i64 + reloc_addend;
|
||||
write_unaligned(reloc_address as *mut i64, reloc_abs);
|
||||
},
|
||||
Reloc::X86PCRel4 => unsafe {
|
||||
let reloc_address = body.as_mut_ptr().offset(reloc.offset as isize) as isize;
|
||||
let reloc_address =
|
||||
body.as_mut_ptr().offset(reloc.offset as isize) as isize;
|
||||
let reloc_addend = reloc.addend as isize;
|
||||
// TODO: Handle overflow.
|
||||
let reloc_delta_i32 =
|
||||
@ -267,7 +268,6 @@ impl Instance {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// We only want to allocate in memory if there is more than
|
||||
// 0 functions. Otherwise reserving a 0-sized memory region
|
||||
// cause a panic error
|
||||
@ -379,12 +379,14 @@ impl Instance {
|
||||
}
|
||||
}
|
||||
|
||||
let start_func: Option<FuncIndex> = module.info.start_func.or_else(|| {
|
||||
match module.info.exports.get("main") {
|
||||
Some(Export::Function(index)) => Some(index.to_owned()),
|
||||
_ => None
|
||||
}
|
||||
});
|
||||
let start_func: Option<FuncIndex> =
|
||||
module
|
||||
.info
|
||||
.start_func
|
||||
.or_else(|| match module.info.exports.get("main") {
|
||||
Some(Export::Function(index)) => Some(index.to_owned()),
|
||||
_ => None,
|
||||
});
|
||||
|
||||
Ok(Instance {
|
||||
tables: Arc::new(tables.into_iter().collect()), // tables.into_iter().map(|table| RwLock::new(table)).collect()),
|
||||
@ -451,7 +453,7 @@ impl Instance {
|
||||
// let tables: Vec<BoundedSlice<usize>> = self.tables.iter()
|
||||
// .map(|table| table.write()[..].into())
|
||||
// .collect();
|
||||
|
||||
|
||||
// let globals: UncheckedSlice<u8> = self.globals[..].into();
|
||||
|
||||
// assert!(memories.len() >= 1, "modules must have at least one memory");
|
||||
@ -495,7 +497,6 @@ impl Clone for Instance {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extern "C" fn grow_memory(size: u32, memory_index: u32, vmctx: *mut *mut u8) -> u32 {
|
||||
unimplemented!();
|
||||
// unsafe {
|
||||
|
@ -95,7 +95,6 @@ impl RelocSink {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Implementation of a relocation sink that just saves all the information for later
|
||||
// pub struct RelocSink {
|
||||
// /// Relocations recorded for the function.
|
||||
@ -178,7 +177,6 @@ impl RelocSink {
|
||||
// CurrentMemory,
|
||||
// }
|
||||
|
||||
|
||||
pub struct TrapData {
|
||||
pub offset: usize,
|
||||
pub code: TrapCode,
|
||||
|
Loading…
Reference in New Issue
Block a user