Merge branch 'master' into feature/llvm-cgapi

This commit is contained in:
Brandon Fish 2019-05-05 13:25:51 -05:00
commit 1864733ab8
38 changed files with 351 additions and 119 deletions

View File

@ -5,8 +5,14 @@ All PRs to the Wasmer repository must add to this file.
Blocks of changes will separated by version increments. Blocks of changes will separated by version increments.
## **[Unreleased]** ## **[Unreleased]**
- [#409](https://github.com/wasmerio/wasmer/pull/409) Improved Emscripten functions to run JavascriptCore compiled to wasm
- [#399](https://github.com/wasmerio/wasmer/pull/399) Add example of using a plugin extended from WASI
- [#397](https://github.com/wasmerio/wasmer/pull/397) Fix WASI fs abstraction to work on Windows - [#397](https://github.com/wasmerio/wasmer/pull/397) Fix WASI fs abstraction to work on Windows
- [#390](https://github.com/wasmerio/wasmer/pull/390) Pin released wapm version and add it as a git submodule - [#390](https://github.com/wasmerio/wasmer/pull/390) Pin released wapm version and add it as a git submodule
- [#408](https://github.com/wasmerio/wasmer/pull/408) Add images to windows installer and update installer to add wapm bin directory to path
## 0.4.0 - 2018-04-23
- [#383](https://github.com/wasmerio/wasmer/pull/383) Hook up wasi exit code to wasmer cli. - [#383](https://github.com/wasmerio/wasmer/pull/383) Hook up wasi exit code to wasmer cli.
- [#382](https://github.com/wasmerio/wasmer/pull/382) Improve error message on `--backend` flag to only suggest currently enabled backends - [#382](https://github.com/wasmerio/wasmer/pull/382) Improve error message on `--backend` flag to only suggest currently enabled backends
- [#381](https://github.com/wasmerio/wasmer/pull/381) Allow retrieving propagated user errors. - [#381](https://github.com/wasmerio/wasmer/pull/381) Allow retrieving propagated user errors.
@ -22,3 +28,17 @@ Blocks of changes will separated by version increments.
- [#351](https://github.com/wasmerio/wasmer/pull/351) Add hidden option to specify wasm program name (can be used to improve error messages) - [#351](https://github.com/wasmerio/wasmer/pull/351) Add hidden option to specify wasm program name (can be used to improve error messages)
- [#350](https://github.com/wasmerio/wasmer/pull/350) Enforce that CHANGELOG.md is updated through CI. - [#350](https://github.com/wasmerio/wasmer/pull/350) Enforce that CHANGELOG.md is updated through CI.
- [#349](https://github.com/wasmerio/wasmer/pull/349) Add [CHANGELOG.md](https://github.com/wasmerio/wasmer/blob/master/CHANGELOG.md). - [#349](https://github.com/wasmerio/wasmer/pull/349) Add [CHANGELOG.md](https://github.com/wasmerio/wasmer/blob/master/CHANGELOG.md).
## 0.3.0 - 2018-04-12
- [#276](https://github.com/wasmerio/wasmer/pull/276) [#288](https://github.com/wasmerio/wasmer/pull/288) [#344](https://github.com/wasmerio/wasmer/pull/344) Use new singlepass backend (with the `--backend=singlepass` when running Wasmer)
- [#338](https://github.com/wasmerio/wasmer/pull/338) Actually catch traps/panics/etc when using a typed func.
- [#325](https://github.com/wasmerio/wasmer/pull/325) Fixed func_index in debug mode
- [#323](https://github.com/wasmerio/wasmer/pull/323) Add validate subcommand to validate Wasm files
- [#321](https://github.com/wasmerio/wasmer/pull/321) Upgrade to Cranelift 0.3.0
- [#319](https://github.com/wasmerio/wasmer/pull/319) Add Export and GlobalDescriptor to Runtime API
- [#310](https://github.com/wasmerio/wasmer/pull/310) Cleanup warnings
- [#299](https://github.com/wasmerio/wasmer/pull/299) [#300](https://github.com/wasmerio/wasmer/pull/300) [#301](https://github.com/wasmerio/wasmer/pull/301) [#303](https://github.com/wasmerio/wasmer/pull/303) [#304](https://github.com/wasmerio/wasmer/pull/304) [#305](https://github.com/wasmerio/wasmer/pull/305) [#306](https://github.com/wasmerio/wasmer/pull/306) [#307](https://github.com/wasmerio/wasmer/pull/307) Add support for WASI 🎉
- [#286](https://github.com/wasmerio/wasmer/pull/286) Add extend to imports
- [#278](https://github.com/wasmerio/wasmer/pull/278) Add versioning to cache
- [#250](https://github.com/wasmerio/wasmer/pull/250) Setup bors

100
Cargo.lock generated
View File

@ -1317,6 +1317,10 @@ name = "plain"
version = "0.2.3" version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "plugin-for-example"
version = "0.1.0"
[[package]] [[package]]
name = "podio" name = "podio"
version = "0.1.6" version = "0.1.6"
@ -2230,20 +2234,20 @@ dependencies = [
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"structopt 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "structopt 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)",
"wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-clif-backend 0.3.0", "wasmer-clif-backend 0.4.0",
"wasmer-emscripten 0.3.0", "wasmer-emscripten 0.4.0",
"wasmer-llvm-backend 0.3.0", "wasmer-llvm-backend 0.4.0",
"wasmer-middleware-common 0.3.0", "wasmer-middleware-common 0.4.0",
"wasmer-runtime 0.3.0", "wasmer-runtime 0.4.0",
"wasmer-runtime-abi 0.3.0", "wasmer-runtime-abi 0.4.0",
"wasmer-runtime-core 0.3.0", "wasmer-runtime-core 0.4.0",
"wasmer-singlepass-backend 0.3.0", "wasmer-singlepass-backend 0.4.0",
"wasmer-wasi 0.3.0", "wasmer-wasi 0.4.0",
] ]
[[package]] [[package]]
name = "wasmer-clif-backend" name = "wasmer-clif-backend"
version = "0.3.0" version = "0.4.0"
dependencies = [ dependencies = [
"byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cranelift-codegen 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", "cranelift-codegen 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2259,15 +2263,15 @@ dependencies = [
"serde_bytes 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde_bytes 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
"target-lexicon 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "target-lexicon 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-runtime-core 0.3.0", "wasmer-runtime-core 0.4.0",
"wasmer-win-exception-handler 0.3.0", "wasmer-win-exception-handler 0.4.0",
"wasmparser 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)", "wasmparser 0.29.2 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "wasmer-emscripten" name = "wasmer-emscripten"
version = "0.3.0" version = "0.4.0"
dependencies = [ dependencies = [
"byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2276,15 +2280,15 @@ dependencies = [
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
"wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-clif-backend 0.3.0", "wasmer-clif-backend 0.4.0",
"wasmer-llvm-backend 0.3.0", "wasmer-llvm-backend 0.4.0",
"wasmer-runtime-core 0.3.0", "wasmer-runtime-core 0.4.0",
"wasmer-singlepass-backend 0.3.0", "wasmer-singlepass-backend 0.4.0",
] ]
[[package]] [[package]]
name = "wasmer-llvm-backend" name = "wasmer-llvm-backend"
version = "0.3.0" version = "0.4.0"
dependencies = [ dependencies = [
"capstone 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "capstone 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2299,60 +2303,60 @@ dependencies = [
"semver 0.9.0 (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.9 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
"wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-runtime-core 0.3.0", "wasmer-runtime-core 0.4.0",
"wasmparser 0.29.2 (registry+https://github.com/rust-lang/crates.io-index)", "wasmparser 0.29.2 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "wasmer-middleware-common" name = "wasmer-middleware-common"
version = "0.3.0" version = "0.4.0"
dependencies = [ dependencies = [
"wasmer-runtime-core 0.3.0", "wasmer-runtime-core 0.4.0",
] ]
[[package]] [[package]]
name = "wasmer-runtime" name = "wasmer-runtime"
version = "0.3.0" version = "0.4.0"
dependencies = [ dependencies = [
"criterion 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "criterion 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
"wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-clif-backend 0.3.0", "wasmer-clif-backend 0.4.0",
"wasmer-llvm-backend 0.3.0", "wasmer-llvm-backend 0.4.0",
"wasmer-runtime-core 0.3.0", "wasmer-runtime-core 0.4.0",
"wasmer-singlepass-backend 0.3.0", "wasmer-singlepass-backend 0.4.0",
] ]
[[package]] [[package]]
name = "wasmer-runtime-abi" name = "wasmer-runtime-abi"
version = "0.3.0" version = "0.4.0"
dependencies = [ dependencies = [
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
"tar 0.4.22 (registry+https://github.com/rust-lang/crates.io-index)", "tar 0.4.22 (registry+https://github.com/rust-lang/crates.io-index)",
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-runtime-core 0.3.0", "wasmer-runtime-core 0.4.0",
"wasmparser 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)", "wasmparser 0.29.2 (registry+https://github.com/rust-lang/crates.io-index)",
"zbox 0.6.1 (git+https://github.com/wasmerio/zbox?branch=bundle-libsodium)", "zbox 0.6.1 (git+https://github.com/wasmerio/zbox?branch=bundle-libsodium)",
"zstd 0.4.22+zstd.1.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "zstd 0.4.22+zstd.1.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "wasmer-runtime-c-api" name = "wasmer-runtime-c-api"
version = "0.3.0" version = "0.4.0"
dependencies = [ dependencies = [
"cbindgen 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", "cbindgen 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-runtime 0.3.0", "wasmer-runtime 0.4.0",
"wasmer-runtime-core 0.3.0", "wasmer-runtime-core 0.4.0",
] ]
[[package]] [[package]]
name = "wasmer-runtime-core" name = "wasmer-runtime-core"
version = "0.3.0" version = "0.4.0"
dependencies = [ dependencies = [
"blake2b_simd 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "blake2b_simd 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2378,7 +2382,7 @@ dependencies = [
[[package]] [[package]]
name = "wasmer-singlepass-backend" name = "wasmer-singlepass-backend"
version = "0.3.0" version = "0.4.0"
dependencies = [ dependencies = [
"byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"dynasm 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "dynasm 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2388,24 +2392,24 @@ dependencies = [
"libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
"nix 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-runtime-core 0.3.0", "wasmer-runtime-core 0.4.0",
"wasmparser 0.29.2 (registry+https://github.com/rust-lang/crates.io-index)", "wasmparser 0.29.2 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "wasmer-spectests" name = "wasmer-spectests"
version = "0.3.0" version = "0.4.0"
dependencies = [ dependencies = [
"wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-clif-backend 0.3.0", "wasmer-clif-backend 0.4.0",
"wasmer-llvm-backend 0.3.0", "wasmer-llvm-backend 0.4.0",
"wasmer-runtime-core 0.3.0", "wasmer-runtime-core 0.4.0",
"wasmer-singlepass-backend 0.3.0", "wasmer-singlepass-backend 0.4.0",
] ]
[[package]] [[package]]
name = "wasmer-wasi" name = "wasmer-wasi"
version = "0.3.0" version = "0.4.0"
dependencies = [ dependencies = [
"byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"generational-arena 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "generational-arena 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2413,26 +2417,21 @@ dependencies = [
"libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-runtime-core 0.3.0", "wasmer-runtime-core 0.4.0",
] ]
[[package]] [[package]]
name = "wasmer-win-exception-handler" name = "wasmer-win-exception-handler"
version = "0.3.0" version = "0.4.0"
dependencies = [ dependencies = [
"bindgen 0.46.0 (registry+https://github.com/rust-lang/crates.io-index)", "bindgen 0.46.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cmake 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", "cmake 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-runtime-core 0.3.0", "wasmer-runtime-core 0.4.0",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "wasmparser"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "wasmparser" name = "wasmparser"
version = "0.29.2" version = "0.29.2"
@ -2826,7 +2825,6 @@ dependencies = [
"checksum wabt-sys 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a6265b25719e82598d104b3717375e37661d41753e2c84cde3f51050c7ed7e3c" "checksum wabt-sys 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a6265b25719e82598d104b3717375e37661d41753e2c84cde3f51050c7ed7e3c"
"checksum walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d9d7ed3431229a144296213105a390676cc49c9b6a72bd19f3176c98e129fa1" "checksum walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d9d7ed3431229a144296213105a390676cc49c9b6a72bd19f3176c98e129fa1"
"checksum want 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "797464475f30ddb8830cc529aaaae648d581f99e2036a928877dfde027ddf6b3" "checksum want 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "797464475f30ddb8830cc529aaaae648d581f99e2036a928877dfde027ddf6b3"
"checksum wasmparser 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b5e01c420bc7d36e778bd242e1167b079562ba8b34087122cc9057187026d060"
"checksum wasmparser 0.29.2 (registry+https://github.com/rust-lang/crates.io-index)" = "981a8797cf89762e0233ec45fae731cb79a4dfaee12d9f0fe6cee01e4ac58d00" "checksum wasmparser 0.29.2 (registry+https://github.com/rust-lang/crates.io-index)" = "981a8797cf89762e0233ec45fae731cb79a4dfaee12d9f0fe6cee01e4ac58d00"
"checksum which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b57acb10231b9493c8472b20cb57317d0679a49e0bdbee44b3b803a6473af164" "checksum which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b57acb10231b9493c8472b20cb57317d0679a49e0bdbee44b3b803a6473af164"
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"

View File

@ -34,7 +34,7 @@ wasmer-llvm-backend = { path = "lib/llvm-backend", optional = true }
wasmer-wasi = { path = "lib/wasi", optional = true } wasmer-wasi = { path = "lib/wasi", optional = true }
[workspace] [workspace]
members = ["lib/clif-backend", "lib/singlepass-backend", "lib/runtime", "lib/runtime-abi", "lib/runtime-core", "lib/emscripten", "lib/spectests", "lib/win-exception-handler", "lib/runtime-c-api", "lib/llvm-backend", "lib/wasi", "lib/middleware-common"] members = ["lib/clif-backend", "lib/singlepass-backend", "lib/runtime", "lib/runtime-abi", "lib/runtime-core", "lib/emscripten", "lib/spectests", "lib/win-exception-handler", "lib/runtime-c-api", "lib/llvm-backend", "lib/wasi", "lib/middleware-common", "examples/plugin-for-example"]
[build-dependencies] [build-dependencies]
wabt = "0.7.2" wabt = "0.7.2"
@ -50,3 +50,7 @@ fast-tests = []
"backend:singlepass" = ["wasmer-singlepass-backend"] "backend:singlepass" = ["wasmer-singlepass-backend"]
wasi = ["wasmer-wasi"] wasi = ["wasmer-wasi"]
vfs = ["wasmer-runtime-abi"] vfs = ["wasmer-runtime-abi"]
[[example]]
name = "plugin"
crate-type = ["bin"]

View File

@ -27,10 +27,12 @@ curl https://get.wasmer.io -sSfL | sh
``` ```
Wasmer runtime can also be embedded in different languages, so you can use WebAssembly anywhere ✨: Wasmer runtime can also be embedded in different languages, so you can use WebAssembly anywhere ✨:
* [**Rust**](https://github.com/wasmerio/wasmer-rust-example) * [**Rust**](https://github.com/wasmerio/wasmer-rust-example)
* [**C/C++**](https://github.com/wasmerio/wasmer-c-api) * [**C/C++**](https://github.com/wasmerio/wasmer-c-api)
* [**PHP**](https://github.com/wasmerio/php-ext-wasm) * [**🐘 PHP**](https://github.com/wasmerio/php-ext-wasm)
* [**Python**](https://github.com/wasmerio/python-ext-wasm) * [**🐍 Python**](https://github.com/wasmerio/python-ext-wasm)
* [**💎 Ruby**](https://github.com/wasmerio/ruby-ext-wasm)
### Usage ### Usage

BIN
examples/plugin-for-example.wasm Executable file

Binary file not shown.

View File

@ -0,0 +1,7 @@
[package]
name = "plugin-for-example"
version = "0.1.0"
authors = ["The Wasmer Engineering Team <enigneering@wasmer.io>"]
edition = "2018"
[dependencies]

View File

@ -0,0 +1,43 @@
# WASI plugin example
In this example we extend the imports of Wasmer's WASI ABI to demonstrate how custom plugins work.
See the `wasmer/examples/plugin.rs` file for the source code of the host system.
## Compiling
_Attention Windows users: WASI target only works with the `nightly-x86_64-pc-windows-gnu` toolchain._
```
# Install an up to date version of Rust nightly
# Add the target
rustup target add wasm32-unknown-wasi
# build it
cargo +nightly build --release --target=wasm32-unknown-wasi
# copy it to examples folder
cp ../../target/wasm32-unknown-wasi/release/plugin-for-example.wasm ../
```
## Running
```
# Go back to top level Wasmer dir
cd ..
# Run the example
cargo run --example plugin
```
## Inspecting the plugin
```
# Install wabt via wapm; installed globally with the `g` flag
wapm install -g wabt
# Turn the binary WASM file in to a readable WAT text file
wapm run wasm2wat examples/plugin-for-example.wasm
```
At the top of the file we can see which functions this plugin expects. Most are covered by WASI, but we handle the rest.
## Explanation
In this example, we instantiate a system with an extended (WASI)[wasi] ABI, allowing our program to rely on Wasmer's implementation of the syscalls defined by WASI as well as our own that we made. This allows us to use the full power of an existing ABI, like WASI, and give it super-powers for our specific use case.
Because the Rust WASI doesn't support the crate type of `cdylib`, we have to include a main function which we don't use. This is being discussed [here](https://github.com/WebAssembly/WASI/issues/24).
[wasi]: https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/

View File

@ -0,0 +1,12 @@
extern "C" {
fn it_works() -> i32;
}
#[no_mangle]
pub fn plugin_entrypoint(n: i32) -> i32 {
println!("Hello from inside WASI");
let result = unsafe { it_works() };
result + n
}
pub fn main() {}

View File

@ -0,0 +1,12 @@
[package]
name = "plugin-for-example"
version = "0.1.0"
description = "A plugin for our example system"
readme = "README.md"
repository = "https://github.com/wasmerio/wasmer/examples/plugin-for-example"
license = "MIT"
[[module]]
name = "plugin-for-example"
source = "../../target/wasm32-unknown-wasi/release/plugin-for-example.wasm"
abi = "none"

38
examples/plugin.rs Normal file
View File

@ -0,0 +1,38 @@
use wasmer_runtime::{func, imports, instantiate};
use wasmer_runtime_core::vm::Ctx;
use wasmer_wasi::generate_import_object;
static PLUGIN_LOCATION: &'static str = "examples/plugin-for-example.wasm";
fn it_works(_ctx: &mut Ctx) -> i32 {
println!("Hello from outside WASI");
5
}
fn main() {
// Load the plugin data
let wasm_bytes = std::fs::read(PLUGIN_LOCATION).expect(&format!(
"Could not read in WASM plugin at {}",
PLUGIN_LOCATION
));
// WASI imports
let mut base_imports = generate_import_object(vec![], vec![], vec![]);
// env is the default namespace for extern functions
let custom_imports = imports! {
"env" => {
"it_works" => func!(it_works),
},
};
// The WASI imports object contains all required import functions for a WASI module to run.
// Extend this imports with our custom imports containing "it_works" function so that our custom wasm code may run.
base_imports.extend(custom_imports);
let instance =
instantiate(&wasm_bytes[..], &base_imports).expect("failed to instantiate wasm module");
// get a reference to the function "plugin_entrypoint" which takes an i32 and returns an i32
let entry_point = instance.func::<(i32), i32>("plugin_entrypoint").unwrap();
// call the "entry_point" function in WebAssembly with the number "2" as the i32 argument
let result = entry_point.call(2).expect("failed to execute plugin");
println!("result: {}", result);
}

View File

@ -130,11 +130,11 @@ wasmer_detect_profile() {
wasmer_link() { wasmer_link() {
printf "$cyan> Adding to bash profile...$reset\n" printf "$cyan> Adding to bash profile...$reset\n"
WASMER_PROFILE="$(wasmer_detect_profile)" WASMER_PROFILE="$(wasmer_detect_profile)"
LOAD_STR="\n# Wasmer\nexport WASMER_DIR=\"\$HOME/.wasmer\"\n[ -s \"\$WASMER_DIR/wasmer.sh\" ] && source \"\$WASMER_DIR/wasmer.sh\" # This loads wasmer\n" LOAD_STR="\n# Wasmer\nexport WASMER_DIR=\"$INSTALL_DIRECTORY\"\n[ -s \"\$WASMER_DIR/wasmer.sh\" ] && source \"\$WASMER_DIR/wasmer.sh\" # This loads wasmer\n"
SOURCE_STR="# Wasmer config\nexport WASMER_DIR=\"\$HOME/.wasmer\"\nexport WASMER_CACHE_DIR=\"\$WASMER_DIR/cache\"\nexport PATH=\"\$HOME/.wasmer/bin:\$PATH\"\n" SOURCE_STR="# Wasmer config\nexport WASMER_DIR=\"$INSTALL_DIRECTORY\"\nexport WASMER_CACHE_DIR=\"\$WASMER_DIR/cache\"\nexport PATH=\"\$WASMER_DIR/bin:\$WASMER_DIR/globals/wapm_packages/.bin:\$PATH\"\n"
# We create the wasmer.sh file # We create the wasmer.sh file
printf "$SOURCE_STR" > "$HOME/.wasmer/wasmer.sh" printf "$SOURCE_STR" > "$INSTALL_DIRECTORY/wasmer.sh"
if [ -z "${WASMER_PROFILE-}" ] ; then if [ -z "${WASMER_PROFILE-}" ] ; then
printf "${red}Profile not found. Tried:\n* ${WASMER_PROFILE} (as defined in \$PROFILE)\n* ~/.bashrc\n* ~/.bash_profile\n* ~/.zshrc\n* ~/.profile.\n" printf "${red}Profile not found. Tried:\n* ${WASMER_PROFILE} (as defined in \$PROFILE)\n* ~/.bashrc\n* ~/.bash_profile\n* ~/.zshrc\n* ~/.profile.\n"
@ -156,12 +156,12 @@ wasmer_link() {
echo "If this isn't the profile of your current shell then please add the following to your correct profile:" echo "If this isn't the profile of your current shell then please add the following to your correct profile:"
printf "$LOAD_STR$reset\n" printf "$LOAD_STR$reset\n"
version=`$HOME/.wasmer/bin/wasmer --version` || ( version=`$INSTALL_DIRECTORY/bin/wasmer --version` || (
printf "$red> wasmer was installed, but doesn't seem to be working :($reset\n" printf "$red> wasmer was installed, but doesn't seem to be working :($reset\n"
exit 1; exit 1;
) )
printf "$green> Successfully installed $version!\n\n${reset}If you want to have the command available now please execute:\nsource $HOME/.wasmer/wasmer.sh$reset\n" printf "$green> Successfully installed $version!\n\n${reset}If you want to have the command available now please execute:\nsource $INSTALL_DIRECTORY/wasmer.sh$reset\n"
printf "\nOtherwise, wasmer and wapm will be available the next time you open the terminal.\n" printf "\nOtherwise, wasmer and wapm will be available the next time you open the terminal.\n"
echo "Note: during the alpha release of wapm, telemetry is enabled by default; if you would like to opt out, run \`wapm config set telemetry.enabled false\`." echo "Note: during the alpha release of wapm, telemetry is enabled by default; if you would like to opt out, run \`wapm config set telemetry.enabled false\`."
echo "If you notice anything wrong or have any issues, please file a bug at https://github.com/wasmerio/wapm-cli :)" echo "If you notice anything wrong or have any issues, please file a bug at https://github.com/wasmerio/wapm-cli :)"
@ -257,7 +257,7 @@ wasmer_install() {
" "
fi fi
# if [ -d "$HOME/.wasmer" ]; then # if [ -d "$INSTALL_DIRECTORY" ]; then
# if which wasmer; then # if which wasmer; then
# local latest_url # local latest_url
# local specified_version # local specified_version
@ -286,11 +286,11 @@ wasmer_install() {
# exit 0 # exit 0
# else # else
# printf "$yellow> $wasmer_alt_version is already installed, Specified version: $specified_version.$reset\n" # printf "$yellow> $wasmer_alt_version is already installed, Specified version: $specified_version.$reset\n"
# rm -rf "$HOME/.wasmer" # rm -rf "$INSTALL_DIRECTORY"
# fi # fi
# else # else
# printf "$red> $HOME/.wasmer already exists, possibly from a past Wasmer install.$reset\n" # printf "$red> $INSTALL_DIRECTORY already exists, possibly from a past Wasmer install.$reset\n"
# printf "$red> Remove it (rm -rf $HOME/.wasmer) and run this script again.$reset\n" # printf "$red> Remove it (rm -rf $INSTALL_DIRECTORY) and run this script again.$reset\n"
# exit 0 # exit 0
# fi # fi
# fi # fi

View File

@ -1,6 +1,6 @@
[package] [package]
name = "wasmer-clif-backend" name = "wasmer-clif-backend"
version = "0.3.0" version = "0.4.0"
description = "Wasmer runtime Cranelift compiler backend" description = "Wasmer runtime Cranelift compiler backend"
license = "MIT" license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"] authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
@ -8,14 +8,14 @@ repository = "https://github.com/wasmerio/wasmer"
edition = "2018" edition = "2018"
[dependencies] [dependencies]
wasmer-runtime-core = { path = "../runtime-core", version = "0.3.0" } wasmer-runtime-core = { path = "../runtime-core", version = "0.4.0" }
cranelift-native = "0.30.0" cranelift-native = "0.30.0"
cranelift-codegen = "0.30.0" cranelift-codegen = "0.30.0"
cranelift-entity = "0.30.0" cranelift-entity = "0.30.0"
cranelift-wasm = "0.30.0" cranelift-wasm = "0.30.0"
hashbrown = "0.1" hashbrown = "0.1"
target-lexicon = "0.3.0" target-lexicon = "0.3.0"
wasmparser = "0.23.0" wasmparser = "0.29.2"
byteorder = "1" byteorder = "1"
nix = "0.13.0" nix = "0.13.0"
libc = "0.2.49" libc = "0.2.49"
@ -33,7 +33,7 @@ version = "0.0.7"
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
winapi = { version = "0.3", features = ["errhandlingapi", "minwindef", "minwinbase", "winnt"] } winapi = { version = "0.3", features = ["errhandlingapi", "minwindef", "minwinbase", "winnt"] }
wasmer-win-exception-handler = { path = "../win-exception-handler", version = "0.3.0" } wasmer-win-exception-handler = { path = "../win-exception-handler", version = "0.4.0" }
[features] [features]
debug = ["wasmer-runtime-core/debug"] debug = ["wasmer-runtime-core/debug"]

View File

@ -1,6 +1,6 @@
[package] [package]
name = "wasmer-emscripten" name = "wasmer-emscripten"
version = "0.3.0" version = "0.4.0"
description = "Wasmer runtime emscripten implementation library" description = "Wasmer runtime emscripten implementation library"
license = "MIT" license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"] authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
@ -9,14 +9,14 @@ edition = "2018"
build = "build/mod.rs" build = "build/mod.rs"
[dependencies] [dependencies]
wasmer-runtime-core = { path = "../runtime-core", version = "0.3.0" } wasmer-runtime-core = { path = "../runtime-core", version = "0.4.0" }
lazy_static = "1.2.0" lazy_static = "1.2.0"
libc = "0.2.49" libc = "0.2.49"
byteorder = "1" byteorder = "1"
time = "0.1.41" time = "0.1.41"
wasmer-clif-backend = { path = "../clif-backend", version = "0.3.0" } wasmer-clif-backend = { path = "../clif-backend", version = "0.4.0" }
wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.3.0", optional = true } wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.4.0", optional = true }
wasmer-llvm-backend = { path = "../llvm-backend", version = "0.3.0", optional = true } wasmer-llvm-backend = { path = "../llvm-backend", version = "0.4.0", optional = true }
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
rand = "0.6" rand = "0.6"

View File

@ -15,6 +15,15 @@ pub fn getTempRet0(ctx: &mut Ctx) -> i32 {
get_emscripten_data(ctx).temp_ret_0 get_emscripten_data(ctx).temp_ret_0
} }
pub fn _atexit(_ctx: &mut Ctx, _func: i32) -> i32 {
debug!("emscripten::_atexit");
// TODO: implement atexit properly
// __ATEXIT__.unshift({
// func: func,
// arg: arg
// });
0
}
pub fn __Unwind_Backtrace(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 { pub fn __Unwind_Backtrace(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 {
debug!("emscripten::__Unwind_Backtrace"); debug!("emscripten::__Unwind_Backtrace");
0 0
@ -45,14 +54,42 @@ pub fn _dladdr(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 {
debug!("emscripten::_dladdr"); debug!("emscripten::_dladdr");
0 0
} }
pub fn _pthread_attr_init(_ctx: &mut Ctx, _a: i32) -> i32 {
debug!("emscripten::_pthread_attr_init");
0
}
pub fn _pthread_attr_destroy(_ctx: &mut Ctx, _a: i32) -> i32 {
debug!("emscripten::_pthread_attr_destroy");
0
}
pub fn _pthread_attr_getstack(
_ctx: &mut Ctx,
_stackaddr: i32,
_stacksize: i32,
_other: i32,
) -> i32 {
debug!("emscripten::_pthread_attr_getstack");
// TODO: Translate from Emscripten
// HEAP32[stackaddr >> 2] = STACK_BASE;
// HEAP32[stacksize >> 2] = TOTAL_STACK;
0
}
pub fn _pthread_cond_destroy(_ctx: &mut Ctx, _a: i32) -> i32 { pub fn _pthread_cond_destroy(_ctx: &mut Ctx, _a: i32) -> i32 {
debug!("emscripten::_pthread_cond_destroy"); debug!("emscripten::_pthread_cond_destroy");
0 0
} }
pub fn _pthread_cond_timedwait(_ctx: &mut Ctx, _a: i32, _b: i32, _c: i32) -> i32 {
debug!("emscripten::_pthread_cond_timedwait");
0
}
pub fn _pthread_getspecific(_ctx: &mut Ctx, _a: i32) -> i32 { pub fn _pthread_getspecific(_ctx: &mut Ctx, _a: i32) -> i32 {
debug!("emscripten::_pthread_getspecific"); debug!("emscripten::_pthread_getspecific");
0 0
} }
pub fn _pthread_getattr_np(_ctx: &mut Ctx, _thread: i32, _attr: i32) -> i32 {
debug!("emscripten::_pthread_getattr_np");
0
}
pub fn _pthread_setspecific(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 { pub fn _pthread_setspecific(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 {
debug!("emscripten::_pthread_setspecific"); debug!("emscripten::_pthread_setspecific");
0 0
@ -69,6 +106,10 @@ pub fn _pthread_create(_ctx: &mut Ctx, _a: i32, _b: i32, _c: i32, _d: i32) -> i3
debug!("emscripten::_pthread_create"); debug!("emscripten::_pthread_create");
0 0
} }
pub fn _pthread_detach(_ctx: &mut Ctx, _a: i32) -> i32 {
debug!("emscripten::_pthread_detach");
0
}
pub fn _pthread_join(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 { pub fn _pthread_join(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 {
debug!("emscripten::_pthread_join"); debug!("emscripten::_pthread_join");
0 0

View File

@ -28,3 +28,9 @@ pub fn ___cxa_uncaught_exception(_ctx: &mut Ctx) -> i32 {
debug!("emscripten::___cxa_uncaught_exception"); debug!("emscripten::___cxa_uncaught_exception");
-1 -1
} }
pub fn ___cxa_pure_virtual(_ctx: &mut Ctx) {
debug!("emscripten::___cxa_pure_virtual");
// ABORT = true
panic!("Pure virtual function called!");
}

View File

@ -619,6 +619,7 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject
"_llvm_eh_typeid_for" => func!(crate::process::_llvm_eh_typeid_for), "_llvm_eh_typeid_for" => func!(crate::process::_llvm_eh_typeid_for),
"_raise" => func!(crate::process::_raise), "_raise" => func!(crate::process::_raise),
"_sem_init" => func!(crate::process::_sem_init), "_sem_init" => func!(crate::process::_sem_init),
"_sem_destroy" => func!(crate::process::_sem_destroy),
"_sem_post" => func!(crate::process::_sem_post), "_sem_post" => func!(crate::process::_sem_post),
"_sem_wait" => func!(crate::process::_sem_wait), "_sem_wait" => func!(crate::process::_sem_wait),
"_getgrent" => func!(crate::process::_getgrent), "_getgrent" => func!(crate::process::_getgrent),
@ -646,6 +647,9 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject
"_emscripten_get_heap_size" => func!(crate::memory::_emscripten_get_heap_size), "_emscripten_get_heap_size" => func!(crate::memory::_emscripten_get_heap_size),
"_emscripten_resize_heap" => func!(crate::memory::_emscripten_resize_heap), "_emscripten_resize_heap" => func!(crate::memory::_emscripten_resize_heap),
"enlargeMemory" => func!(crate::memory::enlarge_memory), "enlargeMemory" => func!(crate::memory::enlarge_memory),
"segfault" => func!(crate::memory::segfault),
"alignfault" => func!(crate::memory::alignfault),
"ftfault" => func!(crate::memory::ftfault),
"getTotalMemory" => func!(crate::memory::get_total_memory), "getTotalMemory" => func!(crate::memory::get_total_memory),
"___map_file" => func!(crate::memory::___map_file), "___map_file" => func!(crate::memory::___map_file),
@ -655,6 +659,7 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject
"___cxa_begin_catch" => func!(crate::exception::___cxa_begin_catch), "___cxa_begin_catch" => func!(crate::exception::___cxa_begin_catch),
"___cxa_end_catch" => func!(crate::exception::___cxa_end_catch), "___cxa_end_catch" => func!(crate::exception::___cxa_end_catch),
"___cxa_uncaught_exception" => func!(crate::exception::___cxa_uncaught_exception), "___cxa_uncaught_exception" => func!(crate::exception::___cxa_uncaught_exception),
"___cxa_pure_virtual" => func!(crate::exception::___cxa_pure_virtual),
// Time // Time
"_gettimeofday" => func!(crate::time::_gettimeofday), "_gettimeofday" => func!(crate::time::_gettimeofday),
@ -683,6 +688,7 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject
"_llvm_cos_f64" => func!(crate::math::_llvm_cos_f64), "_llvm_cos_f64" => func!(crate::math::_llvm_cos_f64),
"_llvm_exp2_f32" => func!(crate::math::_llvm_exp2_f32), "_llvm_exp2_f32" => func!(crate::math::_llvm_exp2_f32),
"_llvm_exp2_f64" => func!(crate::math::_llvm_exp2_f64), "_llvm_exp2_f64" => func!(crate::math::_llvm_exp2_f64),
"_llvm_trunc_f64" => func!(crate::math::_llvm_trunc_f64),
"_emscripten_random" => func!(crate::math::_emscripten_random), "_emscripten_random" => func!(crate::math::_emscripten_random),
// Jump // Jump
@ -701,6 +707,7 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject
"_dlsym" => func!(crate::linking::_dlsym), "_dlsym" => func!(crate::linking::_dlsym),
// wasm32-unknown-emscripten // wasm32-unknown-emscripten
"_atexit" => func!(crate::emscripten_target::_atexit),
"setTempRet0" => func!(crate::emscripten_target::setTempRet0), "setTempRet0" => func!(crate::emscripten_target::setTempRet0),
"getTempRet0" => func!(crate::emscripten_target::getTempRet0), "getTempRet0" => func!(crate::emscripten_target::getTempRet0),
"invoke_i" => func!(crate::emscripten_target::invoke_i), "invoke_i" => func!(crate::emscripten_target::invoke_i),
@ -723,10 +730,15 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject
"___resumeException" => func!(crate::emscripten_target::___resumeException), "___resumeException" => func!(crate::emscripten_target::___resumeException),
"_dladdr" => func!(crate::emscripten_target::_dladdr), "_dladdr" => func!(crate::emscripten_target::_dladdr),
"_pthread_create" => func!(crate::emscripten_target::_pthread_create), "_pthread_create" => func!(crate::emscripten_target::_pthread_create),
"_pthread_detach" => func!(crate::emscripten_target::_pthread_detach),
"_pthread_join" => func!(crate::emscripten_target::_pthread_join), "_pthread_join" => func!(crate::emscripten_target::_pthread_join),
"_pthread_cond_destroy" => func!(crate::emscripten_target::_pthread_cond_destroy), "_pthread_attr_init" => func!(crate::emscripten_target::_pthread_attr_init),
"_pthread_attr_destroy" => func!(crate::emscripten_target::_pthread_attr_destroy),
"_pthread_attr_getstack" => func!(crate::emscripten_target::_pthread_attr_getstack),
"_pthread_cond_init" => func!(crate::emscripten_target::_pthread_cond_init), "_pthread_cond_init" => func!(crate::emscripten_target::_pthread_cond_init),
"_pthread_cond_destroy" => func!(crate::emscripten_target::_pthread_cond_destroy),
"_pthread_cond_signal" => func!(crate::emscripten_target::_pthread_cond_signal), "_pthread_cond_signal" => func!(crate::emscripten_target::_pthread_cond_signal),
"_pthread_cond_timedwait" => func!(crate::emscripten_target::_pthread_cond_timedwait),
"_pthread_cond_wait" => func!(crate::emscripten_target::_pthread_cond_wait), "_pthread_cond_wait" => func!(crate::emscripten_target::_pthread_cond_wait),
"_pthread_condattr_destroy" => func!(crate::emscripten_target::_pthread_condattr_destroy), "_pthread_condattr_destroy" => func!(crate::emscripten_target::_pthread_condattr_destroy),
"_pthread_condattr_init" => func!(crate::emscripten_target::_pthread_condattr_init), "_pthread_condattr_init" => func!(crate::emscripten_target::_pthread_condattr_init),
@ -740,6 +752,7 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject
"_pthread_rwlock_unlock" => func!(crate::emscripten_target::_pthread_rwlock_unlock), "_pthread_rwlock_unlock" => func!(crate::emscripten_target::_pthread_rwlock_unlock),
"_pthread_setcancelstate" => func!(crate::emscripten_target::_pthread_setcancelstate), "_pthread_setcancelstate" => func!(crate::emscripten_target::_pthread_setcancelstate),
"_pthread_getspecific" => func!(crate::emscripten_target::_pthread_getspecific), "_pthread_getspecific" => func!(crate::emscripten_target::_pthread_getspecific),
"_pthread_getattr_np" => func!(crate::emscripten_target::_pthread_getattr_np),
"_pthread_setspecific" => func!(crate::emscripten_target::_pthread_setspecific), "_pthread_setspecific" => func!(crate::emscripten_target::_pthread_setspecific),
"_pthread_once" => func!(crate::emscripten_target::_pthread_once), "_pthread_once" => func!(crate::emscripten_target::_pthread_once),
"_pthread_key_create" => func!(crate::emscripten_target::_pthread_key_create), "_pthread_key_create" => func!(crate::emscripten_target::_pthread_key_create),

View File

@ -44,6 +44,11 @@ pub fn _llvm_exp2_f64(_ctx: &mut Ctx, value: f64) -> f64 {
2f64.powf(value) 2f64.powf(value)
} }
pub fn _llvm_trunc_f64(_ctx: &mut Ctx, value: f64) -> f64 {
debug!("emscripten::_llvm_trunc_f64");
value.trunc()
}
pub fn _emscripten_random(_ctx: &mut Ctx) -> f64 { pub fn _emscripten_random(_ctx: &mut Ctx) -> f64 {
debug!("emscripten::_emscripten_random"); debug!("emscripten::_emscripten_random");
-1.0 -1.0

View File

@ -95,6 +95,24 @@ pub fn abort_on_cannot_grow_memory_old(ctx: &mut Ctx) -> u32 {
0 0
} }
/// emscripten: segfault
pub fn segfault(ctx: &mut Ctx) {
debug!("emscripten::segfault");
abort_with_message(ctx, "segmentation fault");
}
/// emscripten: alignfault
pub fn alignfault(ctx: &mut Ctx) {
debug!("emscripten::alignfault");
abort_with_message(ctx, "alignment fault");
}
/// emscripten: ftfault
pub fn ftfault(ctx: &mut Ctx) {
debug!("emscripten::ftfault");
abort_with_message(ctx, "Function table mask error");
}
/// emscripten: ___map_file /// emscripten: ___map_file
pub fn ___map_file(_ctx: &mut Ctx, _one: u32, _two: u32) -> c_int { pub fn ___map_file(_ctx: &mut Ctx, _one: u32, _two: u32) -> c_int {
debug!("emscripten::___map_file"); debug!("emscripten::___map_file");

View File

@ -83,7 +83,12 @@ pub fn _raise(_ctx: &mut Ctx, _one: i32) -> i32 {
pub fn _sem_init(_ctx: &mut Ctx, _one: i32, _two: i32, _three: i32) -> i32 { pub fn _sem_init(_ctx: &mut Ctx, _one: i32, _two: i32, _three: i32) -> i32 {
debug!("emscripten::_sem_init"); debug!("emscripten::_sem_init");
-1 0
}
pub fn _sem_destroy(_ctx: &mut Ctx, _one: i32) -> i32 {
debug!("emscripten::_sem_destroy");
0
} }
pub fn _sem_post(_ctx: &mut Ctx, _one: i32) -> i32 { pub fn _sem_post(_ctx: &mut Ctx, _one: i32) -> i32 {
@ -159,7 +164,7 @@ pub fn _system(_ctx: &mut Ctx, _one: i32) -> c_int {
debug!("emscripten::_system"); debug!("emscripten::_system");
// TODO: May need to change this Em impl to a working version // TODO: May need to change this Em impl to a working version
eprintln!("Can't call external programs"); eprintln!("Can't call external programs");
return EAGAIN; EAGAIN
} }
pub fn _popen(_ctx: &mut Ctx, _one: i32, _two: i32) -> c_int { pub fn _popen(_ctx: &mut Ctx, _one: i32, _two: i32) -> c_int {

View File

@ -345,7 +345,7 @@ pub fn _strftime(
// pad for null? // pad for null?
let bytes = result_str.chars().count(); let bytes = result_str.chars().count();
if bytes as u32 > maxsize { if bytes as u32 > maxsize {
return 0; 0
} else { } else {
// write output string // write output string
for (i, c) in result_str.chars().enumerate() { for (i, c) in result_str.chars().enumerate() {

View File

@ -1,11 +1,11 @@
[package] [package]
name = "wasmer-llvm-backend" name = "wasmer-llvm-backend"
version = "0.3.0" version = "0.4.0"
authors = ["Lachlan Sneff <lachlan.sneff@gmail.com>"] authors = ["Lachlan Sneff <lachlan.sneff@gmail.com>"]
edition = "2018" edition = "2018"
[dependencies] [dependencies]
wasmer-runtime-core = { path = "../runtime-core", version = "0.3.0" } wasmer-runtime-core = { path = "../runtime-core", version = "0.4.0" }
inkwell = { git = "https://github.com/wasmerio/inkwell", branch = "llvm7-0" } inkwell = { git = "https://github.com/wasmerio/inkwell", branch = "llvm7-0" }
wasmparser = "0.29.2" wasmparser = "0.29.2"
hashbrown = "0.1.8" hashbrown = "0.1.8"

View File

@ -1473,7 +1473,7 @@ fn parse_function(
context, context,
&function, &function,
-2147483904.0, -2147483904.0,
2147483648.0, 2_147_483_648.0,
v1, v1,
); );
let res = let res =
@ -1487,8 +1487,8 @@ fn parse_function(
intrinsics, intrinsics,
context, context,
&function, &function,
-2147483649.0, -2_147_483_649.0,
2147483648.0, 2_147_483_648.0,
v1, v1,
); );
let res = let res =
@ -1508,8 +1508,8 @@ fn parse_function(
intrinsics, intrinsics,
context, context,
&function, &function,
-9223373136366403584.0, -9_223_373_136_366_403_584.0,
9223372036854775808.0, 9_223_372_036_854_775_808.0,
v1, v1,
); );
let res = let res =

View File

@ -1,6 +1,6 @@
[package] [package]
name = "wasmer-middleware-common" name = "wasmer-middleware-common"
version = "0.3.0" version = "0.4.0"
repository = "https://github.com/wasmerio/wasmer" repository = "https://github.com/wasmerio/wasmer"
description = "Wasmer runtime common middlewares" description = "Wasmer runtime common middlewares"
license = "MIT" license = "MIT"
@ -8,4 +8,4 @@ authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
edition = "2018" edition = "2018"
[dependencies] [dependencies]
wasmer-runtime-core = { path = "../runtime-core", version = "0.3.0" } wasmer-runtime-core = { path = "../runtime-core", version = "0.4.0" }

View File

@ -1,6 +1,6 @@
[package] [package]
name = "wasmer-runtime-abi" name = "wasmer-runtime-abi"
version = "0.3.0" version = "0.4.0"
description = "Wasmer runtime core library" description = "Wasmer runtime core library"
license = "MIT" license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"] authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
@ -13,7 +13,7 @@ wasmer-runtime-core = { path = "../runtime-core" }
hashbrown = "0.1" hashbrown = "0.1"
failure = "0.1" failure = "0.1"
tar = "0.4" tar = "0.4"
wasmparser = "0.23.0" wasmparser = "0.29.2"
zstd = "0.4" zstd = "0.4"
[target.'cfg(unix)'.dependencies.zbox] [target.'cfg(unix)'.dependencies.zbox]

View File

@ -1,6 +1,6 @@
[package] [package]
name = "wasmer-runtime-c-api" name = "wasmer-runtime-c-api"
version = "0.3.0" version = "0.4.0"
description = "Wasmer C API library" description = "Wasmer C API library"
license = "MIT" license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"] authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
@ -16,11 +16,11 @@ libc = "0.2"
[dependencies.wasmer-runtime] [dependencies.wasmer-runtime]
path = "../runtime" path = "../runtime"
version = "0.3.0" version = "0.4.0"
[dependencies.wasmer-runtime-core] [dependencies.wasmer-runtime-core]
path = "../runtime-core" path = "../runtime-core"
version = "0.3.0" version = "0.4.0"
[features] [features]
debug = ["wasmer-runtime/debug"] debug = ["wasmer-runtime/debug"]

View File

@ -1,6 +1,6 @@
[package] [package]
name = "wasmer-runtime-core" name = "wasmer-runtime-core"
version = "0.3.0" version = "0.4.0"
description = "Wasmer runtime core library" description = "Wasmer runtime core library"
license = "MIT" license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"] authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]

View File

@ -52,6 +52,7 @@ macro_rules! intcast {
} }
intcast! { u8 i8 u16 i16 u32 i32 u64 i64 } intcast! { u8 i8 u16 i16 u32 i32 u64 i64 }
#[repr(transparent)]
pub struct Atomic<T> { pub struct Atomic<T> {
v: UnsafeCell<Wrapping<T>>, v: UnsafeCell<Wrapping<T>>,
} }

View File

@ -1,6 +1,6 @@
[package] [package]
name = "wasmer-runtime" name = "wasmer-runtime"
version = "0.3.0" version = "0.4.0"
description = "Wasmer runtime library" description = "Wasmer runtime library"
license = "MIT" license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"] authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
@ -9,17 +9,17 @@ edition = "2018"
readme = "README.md" readme = "README.md"
[dependencies] [dependencies]
wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.3.0", optional = true } wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.4.0", optional = true }
lazy_static = "1.2.0" lazy_static = "1.2.0"
memmap = "0.7.0" memmap = "0.7.0"
[dependencies.wasmer-runtime-core] [dependencies.wasmer-runtime-core]
path = "../runtime-core" path = "../runtime-core"
version = "0.3.0" version = "0.4.0"
[dependencies.wasmer-clif-backend] [dependencies.wasmer-clif-backend]
path = "../clif-backend" path = "../clif-backend"
version = "0.3.0" version = "0.4.0"
optional = true optional = true
[dev-dependencies] [dev-dependencies]

View File

@ -1,6 +1,6 @@
[package] [package]
name = "wasmer-singlepass-backend" name = "wasmer-singlepass-backend"
version = "0.3.0" version = "0.4.0"
repository = "https://github.com/wasmerio/wasmer" repository = "https://github.com/wasmerio/wasmer"
description = "Wasmer runtime single pass compiler backend" description = "Wasmer runtime single pass compiler backend"
license = "MIT" license = "MIT"
@ -8,7 +8,7 @@ authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
edition = "2018" edition = "2018"
[dependencies] [dependencies]
wasmer-runtime-core = { path = "../runtime-core", version = "0.3.0" } wasmer-runtime-core = { path = "../runtime-core", version = "0.4.0" }
wasmparser = "0.29.2" wasmparser = "0.29.2"
dynasm = "0.3.1" dynasm = "0.3.1"
dynasmrt = "0.3.1" dynasmrt = "0.3.1"

View File

@ -1,6 +1,6 @@
[package] [package]
name = "wasmer-spectests" name = "wasmer-spectests"
version = "0.3.0" version = "0.4.0"
description = "Wasmer spectests library" description = "Wasmer spectests library"
license = "MIT" license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"] authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
@ -9,10 +9,10 @@ edition = "2018"
build = "build/mod.rs" build = "build/mod.rs"
[dependencies] [dependencies]
wasmer-runtime-core = { path = "../runtime-core", version = "0.3.0" } wasmer-runtime-core = { path = "../runtime-core", version = "0.4.0" }
wasmer-clif-backend = { path = "../clif-backend", version = "0.3.0" } wasmer-clif-backend = { path = "../clif-backend", version = "0.4.0" }
wasmer-llvm-backend = { path = "../llvm-backend", version = "0.3.0", optional = true } wasmer-llvm-backend = { path = "../llvm-backend", version = "0.4.0", optional = true }
wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.3.0", optional = true } wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.4.0", optional = true }
[build-dependencies] [build-dependencies]
wabt = "0.7.2" wabt = "0.7.2"

View File

@ -1,6 +1,6 @@
[package] [package]
name = "wasmer-wasi" name = "wasmer-wasi"
version = "0.3.0" version = "0.4.0"
description = "Wasmer runtime WASI implementation library" description = "Wasmer runtime WASI implementation library"
license = "MIT" license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"] authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
@ -8,7 +8,7 @@ repository = "https://github.com/wasmerio/wasmer"
edition = "2018" edition = "2018"
[dependencies] [dependencies]
wasmer-runtime-core = { path = "../runtime-core", version = "0.3.0" } wasmer-runtime-core = { path = "../runtime-core", version = "0.4.0" }
libc = "0.2.50" libc = "0.2.50"
rand = "0.6.5" rand = "0.6.5"
# wasmer-runtime-abi = { path = "../runtime-abi" } # wasmer-runtime-abi = { path = "../runtime-abi" }

View File

@ -1,6 +1,6 @@
[package] [package]
name = "wasmer-win-exception-handler" name = "wasmer-win-exception-handler"
version = "0.3.0" version = "0.4.0"
description = "Wasmer runtime exception handling for Windows" description = "Wasmer runtime exception handling for Windows"
license = "MIT" license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"] authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
@ -8,7 +8,7 @@ repository = "https://github.com/wasmerio/wasmer"
edition = "2018" edition = "2018"
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
wasmer-runtime-core = { path = "../runtime-core", version = "0.3.0" } wasmer-runtime-core = { path = "../runtime-core", version = "0.4.0" }
winapi = { version = "0.3", features = ["winbase", "errhandlingapi", "minwindef", "minwinbase", "winnt"] } winapi = { version = "0.3", features = ["winbase", "errhandlingapi", "minwindef", "minwinbase", "winnt"] }
libc = "0.2.49" libc = "0.2.49"

BIN
media/wizard_logo.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
media/wizard_logo_2.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 958 KiB

BIN
media/wizard_logo_small.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -1,6 +1,6 @@
[Setup] [Setup]
AppName=Wasmer AppName=Wasmer
AppVersion=1.5 AppVersion=0.4.0
DefaultDirName={pf}\Wasmer DefaultDirName={pf}\Wasmer
DefaultGroupName=Wasmer DefaultGroupName=Wasmer
Compression=lzma2 Compression=lzma2
@ -9,9 +9,17 @@ OutputDir=.\
DisableProgramGroupPage=yes DisableProgramGroupPage=yes
ChangesEnvironment=yes ChangesEnvironment=yes
OutputBaseFilename=WasmerInstaller OutputBaseFilename=WasmerInstaller
WizardImageFile=..\..\media\wizard_logo_2.bmp
WizardSmallImageFile=..\..\media\wizard_logo_small.bmp
SetupIconFile=..\..\media\wizard_logo.ico
DisableWelcomePage=no
[Files] [Files]
Source: "..\..\target\release\wasmer.exe"; DestDir: "{app}\bin" Source: "..\..\target\release\wasmer.exe"; DestDir: "{app}\bin"
Source: "..\..\wapm-cli\target\release\wapm.exe"; DestDir: "{app}\bin"
[Dirs]
Name: "{%USERPROFILE}\.wasmer"
[Code] [Code]
const EnvironmentKey = 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment'; const EnvironmentKey = 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment';
@ -61,11 +69,17 @@ end;
procedure CurStepChanged(CurStep: TSetupStep); procedure CurStepChanged(CurStep: TSetupStep);
begin begin
if CurStep = ssPostInstall if CurStep = ssPostInstall
then EnvAddPath(ExpandConstant('{app}') +'\bin'); then begin
EnvAddPath(ExpandConstant('{app}') +'\bin');
EnvAddPath(ExpandConstant('{%USERPROFILE}') +'\globals\wapm_packages\.bin');
end
end; end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin begin
if CurUninstallStep = usPostUninstall if CurUninstallStep = usPostUninstall
then EnvRemovePath(ExpandConstant('{app}') +'\bin'); then begin
EnvRemovePath(ExpandConstant('{app}') +'\bin');
EnvAddPath(ExpandConstant('{%USERPROFILE}') +'\globals\wapm_packages\.bin');
end
end; end;

View File

@ -1,13 +1,6 @@
use std::panic; use std::panic;
pub use wasmer_runtime::compile_with_config_with; pub use wasmer_runtime::compile_with_config_with;
use wasmer_runtime::{ use wasmer_runtime::{self as runtime, error::Result, ImportObject, Instance, Module};
self as runtime,
error::{CallResult, Result},
ImportObject, Instance, Module,
};
use wasmer_runtime_core::types::Value;
use wasmer_emscripten::run_emscripten_instance;
pub struct ResultObject { pub struct ResultObject {
/// A webassembly::Module object representing the compiled WebAssembly module. /// A webassembly::Module object representing the compiled WebAssembly module.

View File

@ -1,5 +1,5 @@
PREVIOUS_VERSION='0.2.1' PREVIOUS_VERSION='0.3.0'
NEXT_VERSION='0.3.0' NEXT_VERSION='0.4.0'
# quick hack # quick hack
fd Cargo.toml --exec sed -i '' "s/version = \"$PREVIOUS_VERSION\"/version = \"$NEXT_VERSION\"/" fd Cargo.toml --exec sed -i '' "s/version = \"$PREVIOUS_VERSION\"/version = \"$NEXT_VERSION\"/"