diff --git a/.circleci/config.yml b/.circleci/config.yml index f76c635b084..4a3b445888f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -357,6 +357,8 @@ jobs: VERSION=$(cat ./artifacts/version) # VERSION_TAG=${CIRCLE_TAG} VERSION_TAG=$(cat ./artifacts/git_version) + LATEST_VERSION_PUBLISHED_ON_CRATES=$(curl -s https://raw.githubusercontent.com/rust-lang/crates.io-index/master/wa/sm/wasmer-runtime | tail -n 1 | sed 's/.*"vers":"\([^"]*\)".*/\1/') + if ( [ $VERSION_TAG -ne $LATEST_VERSION_PUBLISHED_ON_CRATES ] ) then { echo "Could not detect version published to crates.io; make sure we've published the crates before publishing the Wasmer binary"; exit 1; } else { true; } fi rm ./artifacts/version rm ./artifacts/git_version # VERSION_TAG=$(git describe --exact-match --tags) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47c2658a9b6..7b490f36e44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,18 @@ All PRs to the Wasmer repository must add to this file. Blocks of changes will separated by version increments. ## **[Unreleased]** + +Special thanks to @YaronWittenstein @penberg for their contributions. + - [#608](https://github.com/wasmerio/wasmer/issues/608) Implement wasi syscalls `fd_allocate`, `fd_sync`, `fd_pread`, `path_link`, `path_filestat_set_times`; update WASI fs API in a WIP way; reduce coupling of WASI code to host filesystem; make debug messages from WASI more readable; improve rights-checking when calling syscalls; implement reference counting on inodes; misc bug fixes and improvements +- [#616](https://github.com/wasmerio/wasmer/issues/616) Create the import object separately from instance instantiation in `runtime-c-api` +- [#620](https://github.com/wasmerio/wasmer/issues/620) Replace one `throw()` with `noexcept` in llvm backend +- [#618](https://github.com/wasmerio/wasmer/issues/618) Implement `InternalEvent::Breakpoint` in the llvm backend to allow metering in llvm +- [#615](https://github.com/wasmerio/wasmer/issues/615) Eliminate `FunctionEnvironment` construction in `feed_event()` speeding up to 70% of compilation in clif - [#609](https://github.com/wasmerio/wasmer/issues/609) Update dependencies +- [#602](https://github.com/wasmerio/wasmer/issues/602) C api extract instance context from instance +- [#590](https://github.com/wasmerio/wasmer/issues/590) Error visibility changes in wasmer-c-api +- [#589](https://github.com/wasmerio/wasmer/issues/589) Make `wasmer_byte_array` fields `public` in wasmer-c-api ## 0.6.0 - 2019-07-31 - [#603](https://github.com/wasmerio/wasmer/pull/603) Update Wapm-cli, bump version numbers diff --git a/Cargo.lock b/Cargo.lock index d9b47e9c74f..1bd05a8d339 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,7 +2,7 @@ # It is not intended for manual editing. [[package]] name = "aho-corasick" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -66,7 +66,7 @@ name = "backtrace-sys" version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -97,7 +97,7 @@ dependencies = [ "peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -109,7 +109,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "blake2b_simd" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -144,7 +144,7 @@ name = "capstone-sys" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -180,7 +180,7 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -243,7 +243,7 @@ name = "cmake" version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -453,7 +453,7 @@ dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -603,7 +603,7 @@ dependencies = [ "inkwell_internal_macros 0.1.0 (git+https://github.com/wasmerio/inkwell?branch=llvm8-0)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "llvm-sys 80.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -658,7 +658,7 @@ name = "libloading" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -667,10 +667,10 @@ name = "llvm-sys" version = "80.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -730,7 +730,7 @@ version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -956,7 +956,7 @@ version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1005,23 +1005,19 @@ dependencies = [ [[package]] name = "regex" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.11 (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.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" -version = "0.6.10" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ucd-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "remove_dir_all" @@ -1326,11 +1322,6 @@ name = "typenum" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "ucd-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "unicode-segmentation" version = "1.3.0" @@ -1351,11 +1342,6 @@ name = "unicode-xid" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "utf8-ranges" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "vec_map" version = "0.8.1" @@ -1387,7 +1373,7 @@ name = "wabt-sys" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", "cmake 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1520,13 +1506,13 @@ name = "wasmer-llvm-backend" version = "0.6.0" dependencies = [ "capstone 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", "goblin 0.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "inkwell 0.1.0 (git+https://github.com/wasmerio/inkwell?branch=llvm8-0)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1578,8 +1564,8 @@ name = "wasmer-runtime-core" version = "0.6.0" dependencies = [ "bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "blake2b_simd 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "blake2b_simd 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", "colored 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1662,7 +1648,7 @@ dependencies = [ "bindgen 0.51.0 (registry+https://github.com/rust-lang/crates.io-index)", "cmake 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "wasmer-runtime-core 0.6.0", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1739,7 +1725,7 @@ dependencies = [ ] [metadata] -"checksum aho-corasick 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "36b7aa1ccb7d7ea3f437cf025a2ab1c47cc6c1bc9fc84918ff449def12f5e282" +"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" "checksum approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08abcc3b4e9339e33a3d0a5ed15d84a687350c05689d825e0f6655eef9e76a94" "checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" @@ -1751,7 +1737,7 @@ dependencies = [ "checksum bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9f04a5e50dc80b3d5d35320889053637d15011aed5e66b66b37ae798c65da6f7" "checksum bindgen 0.51.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18270cdd7065ec045a6bb4bdcd5144d14a78b3aedb3bc5111e688773ac8b9ad0" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" -"checksum blake2b_simd 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "627892644fc13118fa3fc40f66723bb45b6b1fb086afcb772f9284cba5db09d5" +"checksum blake2b_simd 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "461f4b879a8eb70c1debf7d0788a9a5ff15f1ea9d25925fea264ef4258bed6b2" "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" "checksum c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d64d04786e0f528460fc884753cf8dddcc466be308f6026f8e355c41a0e4101" "checksum capstone 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "031ba51c39151a1d6336ec859646153187204b0147c7b3f6fe2de636f1b8dbb3" @@ -1759,7 +1745,7 @@ dependencies = [ "checksum cargo_toml 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "097f5ce64ba566a83d9d914fd005de1e5937fdd57d8c5d99a7593040955d75a9" "checksum cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "926013f2860c46252efceabb19f4a6b308197505082c609025aa6706c011d427" "checksum cbindgen 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0e7e19db9a3892c88c74cbbdcd218196068a928f1b60e736c448b13a1e81f277" -"checksum cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)" = "39f75544d7bbaf57560d2168f28fd649ff9c76153874db88bdbdfd839b1a7e7d" +"checksum cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)" = "ce400c638d48ee0e9ab75aef7997609ec57367ccfe1463f21bf53c3eca67bf46" "checksum cexpr 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a7fa24eb00d5ffab90eaeaf1092ac85c04c64aaf358ea6f84505b8116d24c6af" "checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" "checksum cgmath 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)" = "64a4b57c8f4e3a2e9ac07e0f6abc9c24b6fc9e1b54c3478cfb598f3d0023e51c" @@ -1854,8 +1840,8 @@ dependencies = [ "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)" = "12229c14a0f65c4f1cb046a3b52047cdd9da1f4b30f8a39c5063c8bae515e252" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" -"checksum regex 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6b23da8dfd98a84bd7e08700190a5d9f7d2d38abd4369dd1dae651bc40bfd2cc" -"checksum regex-syntax 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "cd5485bf1523a9ed51c4964273f22f63f24e31632adb5dad134f488f86a3875c" +"checksum regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88c3d9193984285d544df4a30c23a4e62ead42edf70a4452ceb76dac1ce05c26" +"checksum regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b143cceb2ca5e56d5671988ef8b15615733e7ee16cd348e064333b251b89343f" "checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5" "checksum rgb 0.8.13 (registry+https://github.com/rust-lang/crates.io-index)" = "4f089652ca87f5a82a62935ec6172a534066c7b97be003cc8f702ee9a7a59c92" "checksum rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af" @@ -1894,12 +1880,10 @@ dependencies = [ "checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" "checksum toml 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b8c96d7873fa7ef8bdeb3a9cda3ac48389b4154f32b9803b4bc26220b677b039" "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" -"checksum ucd-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fa9b3b49edd3468c0e6565d85783f51af95212b6fa3986a5500954f00b460874" "checksum unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1967f4cdfc355b37fd76d2a954fb2ed3871034eb4f26d60537d88795cfc332a9" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" -"checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" diff --git a/examples/no_abi_simple_plugin.rs b/examples/no_abi_simple_plugin.rs new file mode 100644 index 00000000000..15ea39f98b0 --- /dev/null +++ b/examples/no_abi_simple_plugin.rs @@ -0,0 +1,11 @@ +extern "C" { + fn it_works() -> i32; +} + +#[no_mangle] +pub fn plugin_entrypoint(n: i32) -> i32 { + let result = unsafe { it_works() }; + result + n +} + +fn main() {} diff --git a/examples/no_abi_simple_plugin.wasm b/examples/no_abi_simple_plugin.wasm new file mode 100755 index 00000000000..84066e68f32 Binary files /dev/null and b/examples/no_abi_simple_plugin.wasm differ diff --git a/lib/emscripten/src/utils.rs b/lib/emscripten/src/utils.rs index 4bf8fe2d394..37d3ae870aa 100644 --- a/lib/emscripten/src/utils.rs +++ b/lib/emscripten/src/utils.rs @@ -34,11 +34,19 @@ pub fn is_emscripten_module(module: &Module) -> bool { } pub fn get_emscripten_table_size(module: &Module) -> (u32, Option) { + assert!( + module.info().imported_tables.len() > 0, + "Emscripten requires at least one imported table" + ); let (_, table) = &module.info().imported_tables[ImportedTableIndex::new(0)]; (table.minimum, table.maximum) } pub fn get_emscripten_memory_size(module: &Module) -> (Pages, Option, bool) { + assert!( + module.info().imported_tables.len() > 0, + "Emscripten requires at least one imported memory" + ); let (_, memory) = &module.info().imported_memories[ImportedMemoryIndex::new(0)]; (memory.minimum, memory.maximum, memory.shared) } diff --git a/lib/llvm-backend/Cargo.toml b/lib/llvm-backend/Cargo.toml index a7873d2f596..964d97d01cf 100644 --- a/lib/llvm-backend/Cargo.toml +++ b/lib/llvm-backend/Cargo.toml @@ -26,7 +26,7 @@ winapi = { version = "0.3.7", features = ["memoryapi"] } [build-dependencies] cc = "1.0" lazy_static = "1.3.0" -regex = "1.2.0" +regex = "1.2.1" semver = "0.9" rustc_version = "0.2.3" diff --git a/lib/runtime-c-api/wasmer.h b/lib/runtime-c-api/wasmer.h index 11c6cb0ce3f..297428ee275 100644 --- a/lib/runtime-c-api/wasmer.h +++ b/lib/runtime-c-api/wasmer.h @@ -555,7 +555,7 @@ void wasmer_module_destroy(wasmer_module_t *module); /** * Given: - * A prepared `wasmer svm` import-object + * A prepared `wasmer` import-object * A compiled wasmer module * Instantiates a wasmer instance */ diff --git a/lib/runtime-c-api/wasmer.hh b/lib/runtime-c-api/wasmer.hh index eaaa2879902..cf7a1c7b321 100644 --- a/lib/runtime-c-api/wasmer.hh +++ b/lib/runtime-c-api/wasmer.hh @@ -438,7 +438,7 @@ wasmer_result_t wasmer_module_deserialize(wasmer_module_t **module, void wasmer_module_destroy(wasmer_module_t *module); /// Given: -/// A prepared `wasmer svm` import-object +/// A prepared `wasmer` import-object /// A compiled wasmer module /// Instantiates a wasmer instance wasmer_result_t wasmer_module_import_instantiate(wasmer_instance_t **instance, diff --git a/lib/runtime-core/Cargo.toml b/lib/runtime-core/Cargo.toml index 3cde703518d..9c994cf1247 100644 --- a/lib/runtime-core/Cargo.toml +++ b/lib/runtime-core/Cargo.toml @@ -36,7 +36,7 @@ version = "0.11.1" [dependencies.serde-bench] version = "0.0.7" [dependencies.blake2b_simd] -version = "0.5.5" +version = "0.5.6" [dependencies.digest] version = "0.8.1" @@ -47,7 +47,7 @@ winapi = { version = "0.3.7", features = ["memoryapi"] } field-offset = "0.1.1" [build-dependencies] -blake2b_simd = "0.5.5" +blake2b_simd = "0.5.6" rustc_version = "0.2.3" cc = "1.0" diff --git a/lib/runtime-core/src/backing.rs b/lib/runtime-core/src/backing.rs index 39f232bc89f..54efdc80e60 100644 --- a/lib/runtime-core/src/backing.rs +++ b/lib/runtime-core/src/backing.rs @@ -55,19 +55,23 @@ pub struct LocalBacking { } impl LocalBacking { - pub(crate) fn new(module: &ModuleInner, imports: &ImportBacking, vmctx: *mut vm::Ctx) -> Self { + pub(crate) fn new( + module: &ModuleInner, + imports: &ImportBacking, + vmctx: *mut vm::Ctx, + ) -> LinkResult { let mut memories = Self::generate_memories(module); let mut tables = Self::generate_tables(module); let mut globals = Self::generate_globals(module, imports); - let vm_memories = Self::finalize_memories(module, imports, &mut memories); + let vm_memories = Self::finalize_memories(module, imports, &mut memories)?; let vm_tables = Self::finalize_tables(module, imports, &mut tables, vmctx); let vm_globals = Self::finalize_globals(&mut globals); let dynamic_sigindices = Self::generate_sigindices(&module.info); let local_functions = Self::generate_local_functions(module); - Self { + Ok(Self { memories, tables, globals, @@ -80,7 +84,7 @@ impl LocalBacking { local_functions, internals: Internals([0; INTERNALS_SIZE]), - } + }) } fn generate_local_functions(module: &ModuleInner) -> BoxedMap { @@ -124,7 +128,7 @@ impl LocalBacking { module: &ModuleInner, imports: &ImportBacking, memories: &mut SliceMap, - ) -> BoxedMap { + ) -> LinkResult> { // For each init that has some data... for init in module .info @@ -148,7 +152,12 @@ impl LocalBacking { LocalOrImport::Local(local_memory_index) => { let memory_desc = module.info.memories[local_memory_index]; let data_top = init_base + init.data.len(); - assert!(memory_desc.minimum.bytes().0 >= data_top); + + if memory_desc.minimum.bytes().0 < data_top || data_top < init_base { + return Err(vec![LinkError::Generic { + message: "data segment does not fit".to_string(), + }]); + } let mem = &memories[local_memory_index]; for (mem_byte, data_byte) in mem.view()[init_base..init_base + init.data.len()] @@ -163,6 +172,14 @@ impl LocalBacking { // we think the imported memory is. unsafe { let local_memory = &*imports.vm_memories[imported_memory_index]; + + let data_top = init_base + init.data.len(); + if local_memory.bound < data_top || data_top < init_base { + return Err(vec![LinkError::Generic { + message: "data segment does not fit".to_string(), + }]); + } + let memory_slice = slice::from_raw_parts_mut(local_memory.base, local_memory.bound); @@ -174,11 +191,11 @@ impl LocalBacking { } } - memories + Ok(memories .iter_mut() .map(|(_, mem)| mem.vm_local_memory()) .collect::>() - .into_boxed_map() + .into_boxed_map()) } fn generate_tables(module: &ModuleInner) -> BoxedMap { diff --git a/lib/runtime-core/src/error.rs b/lib/runtime-core/src/error.rs index f07620b2359..9aac82fabfb 100644 --- a/lib/runtime-core/src/error.rs +++ b/lib/runtime-core/src/error.rs @@ -80,6 +80,9 @@ pub enum LinkError { expected: GlobalDescriptor, found: GlobalDescriptor, }, + Generic { + message: String, + }, } impl PartialEq for LinkError { @@ -107,6 +110,9 @@ impl std::fmt::Display for LinkError { LinkError::IncorrectTableDescriptor{namespace, name,expected,found} => { write!(f, "Incorrect table descriptor, namespace: {}, name: {}, expected table descriptor: {:?}, found table descriptor: {:?}", namespace, name, expected, found) }, + LinkError::Generic { message } => { + write!(f, "{}", message) + }, } } } diff --git a/lib/runtime-core/src/instance.rs b/lib/runtime-core/src/instance.rs index 3e9d3c4ce4e..675a6bb29fd 100644 --- a/lib/runtime-core/src/instance.rs +++ b/lib/runtime-core/src/instance.rs @@ -55,7 +55,7 @@ impl Instance { Box::new(mem::MaybeUninit::::zeroed()); let import_backing = ImportBacking::new(&module, &imports, vmctx.as_mut_ptr())?; - let backing = LocalBacking::new(&module, &import_backing, vmctx.as_mut_ptr()); + let backing = LocalBacking::new(&module, &import_backing, vmctx.as_mut_ptr())?; let mut inner = Box::pin(InstanceInner { backing, diff --git a/lib/runtime/Cargo.toml b/lib/runtime/Cargo.toml index a8e595d7032..4be2d29b721 100644 --- a/lib/runtime/Cargo.toml +++ b/lib/runtime/Cargo.toml @@ -45,3 +45,7 @@ default-backend-cranelift = ["cranelift"] [[bench]] name = "nginx" harness = false + +[[bench]] +name = "many_instances" +harness = false diff --git a/lib/runtime/benches/many_instances.rs b/lib/runtime/benches/many_instances.rs new file mode 100644 index 00000000000..e1c655c789d --- /dev/null +++ b/lib/runtime/benches/many_instances.rs @@ -0,0 +1,84 @@ +#[macro_use] +extern crate criterion; +use criterion::Criterion; +use tempfile::tempdir; +use wasmer_runtime::{ + cache::{Cache, FileSystemCache, WasmHash}, + compile, func, imports, instantiate, validate, ImportObject, +}; +use wasmer_runtime_core::vm::Ctx; + +fn it_works(_ctx: &mut Ctx) -> i32 { + 5 +} + +static SIMPLE_WASM: &[u8] = include_bytes!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/../../examples/no_abi_simple_plugin.wasm" +)); + +fn hashing_benchmark(c: &mut Criterion) { + c.bench_function("HASH", |b| b.iter(|| WasmHash::generate(SIMPLE_WASM))); +} + +fn validate_benchmark(c: &mut Criterion) { + c.bench_function("validate", |b| b.iter(|| validate(SIMPLE_WASM))); +} + +fn compile_benchmark(c: &mut Criterion) { + c.bench_function("compile", |b| b.iter(|| compile(SIMPLE_WASM))); +} + +fn create_instance_benchmark(c: &mut Criterion) { + let imports = imports!( + "env" => { + "it_works" => func!(it_works), + }, + ); + c.bench_function("instantiate", move |b| { + b.iter(|| instantiate(&SIMPLE_WASM[..], &imports).unwrap()) + }); +} + +fn create_instance_from_cache_benchmark(c: &mut Criterion) { + let imports = imports!( + "env" => { + "it_works" => func!(it_works), + }, + ); + let tempdir = tempdir().unwrap(); + let mut cache = unsafe { + FileSystemCache::new(tempdir.path()).expect("unable to create file system cache") + }; + let module = compile(SIMPLE_WASM).unwrap(); + let hash = WasmHash::generate(SIMPLE_WASM); + cache + .store(hash, module) + .expect("unable to store into cache"); + c.bench_function("instantiate from cache", move |b| { + b.iter(|| { + let module = cache.load(hash).unwrap(); + module.instantiate(&imports).unwrap(); + }) + }); +} + +fn calling_fn_benchmark(c: &mut Criterion) { + let imports = imports!( + "env" => { + "it_works" => func!(it_works), + }, + ); + let instance = instantiate(SIMPLE_WASM, &imports).unwrap(); + c.bench_function("calling fn", move |b| { + let entry_point = instance.func::<(i32), i32>("plugin_entrypoint").unwrap(); + b.iter(|| entry_point.call(2).unwrap()) + }); +} + +criterion_group! { + name = instance_bench; + config = Criterion::default().sample_size(20); + targets = compile_benchmark, validate_benchmark, hashing_benchmark, create_instance_from_cache_benchmark, calling_fn_benchmark, create_instance_benchmark, +} +criterion_main!(instance_bench); diff --git a/lib/win-exception-handler/Cargo.toml b/lib/win-exception-handler/Cargo.toml index dff905cb916..17d1bfc3f09 100644 --- a/lib/win-exception-handler/Cargo.toml +++ b/lib/win-exception-handler/Cargo.toml @@ -15,4 +15,4 @@ libc = "0.2.60" [build-dependencies] cmake = "0.1.40" bindgen = "0.51.0" -regex = "1.2.0" +regex = "1.2.1" diff --git a/src/installer/wasmer.iss b/src/installer/wasmer.iss index c836fddc59d..308802efa73 100644 --- a/src/installer/wasmer.iss +++ b/src/installer/wasmer.iss @@ -14,6 +14,12 @@ WizardSmallImageFile=media\wizard_logo_small.bmp SetupIconFile=media\wizard_logo.ico DisableWelcomePage=no +[Registry] +Root: HKCU; Subkey: "Environment"; ValueType:string; ValueName: "WASMER_DIR"; \ + ValueData: "{%USERPROFILE}\.wasmer"; Flags: preservestringtype +Root: HKCU; Subkey: "Environment"; ValueType:string; ValueName: "WASMER_CACHE_DIR"; \ + ValueData: "{%USERPROFILE}\.wasmer\cache"; Flags: preservestringtype + [Files] Source: "..\..\target\release\wasmer.exe"; DestDir: "{app}\bin" Source: "..\..\wapm-cli\target\release\wapm.exe"; DestDir: "{app}\bin"