diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index af96cdf0e..000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "wapm-cli"] - path = wapm-cli - url = https://github.com/wasmerio/wapm-cli.git diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 085b7abbd..000000000 --- a/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -FROM circleci/rust:1.40.0-stretch as wasmer-build-env -RUN sudo apt-get update && \ - sudo apt-get install -y --no-install-recommends \ - cmake \ - && sudo rm -rf /var/lib/apt/lists/* -RUN curl -SL https://releases.llvm.org/8.0.0/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz \ - | tar -xJC /home/circleci -ENV LLVM_SYS_80_PREFIX /home/circleci/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04/ - -FROM wasmer-build-env AS wasmer-debug-env -RUN sudo apt-get update && \ - sudo apt-get install -y --no-install-recommends \ - valgrind \ - && sudo rm -rf /var/lib/apt/lists/* - -FROM wasmer-build-env AS wasmer-build -WORKDIR /home/circleci/wasmer -COPY . /home/circleci/wasmer -RUN sudo chmod -R 777 . -RUN cargo build --release --features backend-cranelift - -FROM debian:stretch AS wasmer -WORKDIR /root/ -COPY --from=wasmer-build /home/circleci/wasmer/target/release/wasmer . -ENTRYPOINT ["./wasmer"] diff --git a/README.md b/README.md index ea11c9266..730674401 100644 --- a/README.md +++ b/README.md @@ -1,269 +1,118 @@ +

- Wasmer logo + Wasmer logo

+

+[Website](https://wasmer.io) • [Docs](https://docs.wasmer.io/) • [Examples](https://github.com/wasmerio/wasmer/tree/master/examples) • [Blog](https://medium.com/wasmer) • [Slack](https://slack.wasmer.io/) • [Twitter](https://twitter.com/wasmerio) + +

Build Status - - Documentation - License Join the Wasmer Community - - Follow @wasmerio on Twitter -

-## Introduction +[Wasmer](https://wasmer.io/) is a standalone WebAssembly runtime for running WebAssembly [outside of the browser](https://webassembly.org/docs/non-web/): +* *Universal*: Wasmer is available in **Linux, macOS and Windows** (for both x86 and [ARM](https://medium.com/wasmer/running-webassembly-on-arm-7d365ed0e50c)) +* *Pluggable*: Wasmer can be used from almost **any programming language** +* *Safe*: supporting [WASI](https://github.com/WebAssembly/WASI) and [Emscripten](https://emscripten.org/) -[Wasmer](https://wasmer.io/) is a standalone WebAssembly runtime for running WebAssembly [outside of the browser](https://webassembly.org/docs/non-web/), supporting [WASI](https://github.com/WebAssembly/WASI) and [Emscripten](https://emscripten.org/). Wasmer can be used standalone (via the CLI) and embedded in different languages, running in x86 and [ARM devices](https://medium.com/wasmer/running-webassembly-on-arm-7d365ed0e50c). +It is used to run software fast, universally and safely: standalone applications and universal libraries. -Install the Wasmer and [WAPM](https://wapm.io) cli with: +## Contents + +- [Quickstart](#quickstart) +- [Language Integrations](#examples) +- [Contribute](#contribute) +- [Community](#community) + +## Quickstart + +Get started with Wasmer: + +#### 1. Install Wasmer ```sh curl https://get.wasmer.io -sSfL | sh ``` +> Note: *Wasmer is also [available on Windows](https://github.com/wasmerio/wasmer/releases)* -If [Homebrew](https://brew.sh/) is installed: +
+ Alternative: Install with Homebrew +

+ +If you have [Homebrew](https://brew.sh/) installed in your system: ```sh brew install wasmer ``` -> Note: *Wasmer is also [available on Windows](https://github.com/wasmerio/wasmer/releases)* +

+
-### Languages +#### 2. Use Wasmer -Wasmer runtime can be used as a library embedded in different languages, so you can use WebAssembly anywhere: +Download a WASM file, and use it universally! You can start with QuickJS: [qjs.wasm](https://registry-cdn.wapm.io/contents/_/quickjs/0.0.3/build/qjs.wasm) + +```bash +wasmer qjs.wasm +``` + +#### 3. Next steps + +Here is what you can do next: + +- [Use Wasmer from your Rust application](https://docs.wasmer.io/integrations/rust) +- [Publish a Wasm package on WAPM](https://docs.wasmer.io/ecosystem/wapm/publishing-your-package) +- [Read more about Wasmer](https://medium.com/wasmer/) + + +### Language Integrations + +Wasmer runtime can be used as a library embedded in different languages, so you can **use WebAssembly anywhere** 🎉 |   | Language | Docs | Author(s) | Maintenance | Release | Stars | |-|-|-|-|-|-|-| -| ![Rust logo](./docs/assets/languages/rust.svg) | [**Rust**](https://github.com/wasmerio/wasmer-rust-example) | [Docs](https://wasmerio.github.io/wasmer/crates/wasmer_runtime/) | Wasmer | actively developed | ![last release](https://img.shields.io/crates/v/wasmer-runtime?style=flat-square) | ![number of Github stars](https://img.shields.io/github/stars/wasmerio/wasmer?style=flat-square) | -| ![C logo](./docs/assets/languages/c.svg) | [**C/C++**](https://github.com/wasmerio/wasmer-c-api) | [Docs](https://wasmerio.github.io/wasmer/c/runtime-c-api/) | Wasmer | actively developed | ![last release](https://img.shields.io/github/v/release/wasmerio/wasmer?style=flat-square) | ![number of Github stars](https://img.shields.io/github/stars/wasmerio/wasmer?style=flat-square) | -| ![Python logo](./docs/assets/languages/python.svg) | [**Python**](https://github.com/wasmerio/python-ext-wasm) | [Docs](https://github.com/wasmerio/python-ext-wasm#api-of-the-wasmer-extensionmodule) | Wasmer | actively developed | ![last release](https://img.shields.io/pypi/v/wasmer?style=flat-square) | ![number of Github stars](https://img.shields.io/github/stars/wasmerio/python-ext-wasm?style=flat-square) | -| ![Go logo](./docs/assets/languages/go.svg) | [**Go**](https://github.com/wasmerio/go-ext-wasm) | [Docs](https://github.com/wasmerio/go-ext-wasm#basic-example-exported-function) | Wasmer | actively developed | ![last release](https://img.shields.io/github/v/release/wasmerio/go-ext-wasm?style=flat-square) | ![number of Github stars](https://img.shields.io/github/stars/wasmerio/go-ext-wasm?style=flat-square) | -| ![PHP logo](./docs/assets/languages/php.svg) | [**PHP**](https://github.com/wasmerio/php-ext-wasm) | [Docs](https://wasmerio.github.io/php-ext-wasm/wasm/) | Wasmer | actively developed | ![last release](https://img.shields.io/github/v/release/wasmerio/php-ext-wasm?style=flat-square) | ![number of Github stars](https://img.shields.io/github/stars/wasmerio/php-ext-wasm?style=flat-square) | -| ![Ruby logo](./docs/assets/languages/ruby.svg) | [**Ruby**](https://github.com/wasmerio/ruby-ext-wasm) | [Docs](https://www.rubydoc.info/gems/wasmer/) | Wasmer | actively developed | ![last release](https://img.shields.io/gem/v/wasmer?style=flat-square) | ![number of Github stars](https://img.shields.io/github/stars/wasmerio/ruby-ext-wasm?style=flat-square) | -| ![Postgres logo](./docs/assets/languages/postgres.svg) | [**Postgres**](https://github.com/wasmerio/postgres-ext-wasm) | | Wasmer | actively developed | ![last release](https://img.shields.io/github/v/release/wasmerio/postgres-ext-wasm?style=flat-square) | ![number of Github stars](https://img.shields.io/github/stars/wasmerio/postgres-ext-wasm?style=flat-square) | -| ![JS Logo](./docs/assets/languages/js.svg) | [**JavaScript**](https://github.com/wasmerio/wasmer-js) | [Docs](https://docs.wasmer.io/wasmer-js/wasmer-js) | Wasmer | actively developed | ![last release](https://img.shields.io/npm/v/@wasmer/wasi?style=flat-square) | ![number of Github stars](https://img.shields.io/github/stars/wasmerio/wasmer-js?style=flat-square) | -| ![C# logo](./docs/assets/languages/csharp.svg) | [**C#/.Net**](https://github.com/migueldeicaza/WasmerSharp) | [Docs](https://migueldeicaza.github.io/WasmerSharp/) |[Miguel de Icaza](https://github.com/migueldeicaza) | actively developed | ![last release](https://img.shields.io/nuget/v/WasmerSharp?style=flat-square) | ![number of Github stars](https://img.shields.io/github/stars/migueldeicaza/WasmerSharp?style=flat-square) | -| ![R logo](./docs/assets/languages/r.svg) | [**R**](https://github.com/dirkschumacher/wasmr) | [Docs](https://github.com/dirkschumacher/wasmr#example) | [Dirk Schumacher](https://github.com/dirkschumacher) | actively developed | | ![number of Github stars](https://img.shields.io/github/stars/dirkschumacher/wasmr?style=flat-square) | -| ![Elixir logo](./docs/assets/languages/elixir.png) | [**Elixir**](https://github.com/tessi/wasmex) | [Docs](https://hexdocs.pm/wasmex/api-reference.html) | [Philipp Tessenow](https://github.com/tessi) | actively developed | ![last release](https://img.shields.io/hexpm/v/wasmex?style=flat-square) | ![number of Github stars](https://img.shields.io/github/stars/tessi/wasmex?style=flat-square) | +| ![Rust logo](./assets/languages/rust.svg) | [**Rust**](https://github.com/wasmerio/wasmer-rust-example) | [Docs](https://wasmerio.github.io/wasmer/crates/wasmer_runtime/) | Wasmer | actively developed | ![last release](https://img.shields.io/crates/v/wasmer-runtime?style=flat-square) | ![number of Github stars](https://img.shields.io/github/stars/wasmerio/wasmer?style=flat-square) | +| ![C logo](./assets/languages/c.svg) | [**C/C++**](https://github.com/wasmerio/wasmer-c-api) | [Docs](https://wasmerio.github.io/wasmer/c/runtime-c-api/) | Wasmer | actively developed | ![last release](https://img.shields.io/github/v/release/wasmerio/wasmer?style=flat-square) | ![number of Github stars](https://img.shields.io/github/stars/wasmerio/wasmer?style=flat-square) | +| ![Python logo](./assets/languages/python.svg) | [**Python**](https://github.com/wasmerio/python-ext-wasm) | [Docs](https://github.com/wasmerio/python-ext-wasm#api-of-the-wasmer-extensionmodule) | Wasmer | actively developed | ![last release](https://img.shields.io/pypi/v/wasmer?style=flat-square) | ![number of Github stars](https://img.shields.io/github/stars/wasmerio/python-ext-wasm?style=flat-square) | +| ![Go logo](./assets/languages/go.svg) | [**Go**](https://github.com/wasmerio/go-ext-wasm) | [Docs](https://github.com/wasmerio/go-ext-wasm#basic-example-exported-function) | Wasmer | actively developed | ![last release](https://img.shields.io/github/v/release/wasmerio/go-ext-wasm?style=flat-square) | ![number of Github stars](https://img.shields.io/github/stars/wasmerio/go-ext-wasm?style=flat-square) | +| ![PHP logo](./assets/languages/php.svg) | [**PHP**](https://github.com/wasmerio/php-ext-wasm) | [Docs](https://wasmerio.github.io/php-ext-wasm/wasm/) | Wasmer | actively developed | ![last release](https://img.shields.io/github/v/release/wasmerio/php-ext-wasm?style=flat-square) | ![number of Github stars](https://img.shields.io/github/stars/wasmerio/php-ext-wasm?style=flat-square) | +| ![Ruby logo](./assets/languages/ruby.svg) | [**Ruby**](https://github.com/wasmerio/ruby-ext-wasm) | [Docs](https://www.rubydoc.info/gems/wasmer/) | Wasmer | actively developed | ![last release](https://img.shields.io/gem/v/wasmer?style=flat-square) | ![number of Github stars](https://img.shields.io/github/stars/wasmerio/ruby-ext-wasm?style=flat-square) | +| ![Postgres logo](./assets/languages/postgres.svg) | [**Postgres**](https://github.com/wasmerio/postgres-ext-wasm) | | Wasmer | actively developed | ![last release](https://img.shields.io/github/v/release/wasmerio/postgres-ext-wasm?style=flat-square) | ![number of Github stars](https://img.shields.io/github/stars/wasmerio/postgres-ext-wasm?style=flat-square) | +| ![JS Logo](./assets/languages/js.svg) | [**JavaScript**](https://github.com/wasmerio/wasmer-js) | [Docs](https://docs.wasmer.io/wasmer-js/wasmer-js) | Wasmer | actively developed | ![last release](https://img.shields.io/npm/v/@wasmer/wasi?style=flat-square) | ![number of Github stars](https://img.shields.io/github/stars/wasmerio/wasmer-js?style=flat-square) | +| ![C# logo](./assets/languages/csharp.svg) | [**C#/.Net**](https://github.com/migueldeicaza/WasmerSharp) | [Docs](https://migueldeicaza.github.io/WasmerSharp/) |[Miguel de Icaza](https://github.com/migueldeicaza) | actively developed | ![last release](https://img.shields.io/nuget/v/WasmerSharp?style=flat-square) | ![number of Github stars](https://img.shields.io/github/stars/migueldeicaza/WasmerSharp?style=flat-square) | +| ![R logo](./assets/languages/r.svg) | [**R**](https://github.com/dirkschumacher/wasmr) | [Docs](https://github.com/dirkschumacher/wasmr#example) | [Dirk Schumacher](https://github.com/dirkschumacher) | actively developed | | ![number of Github stars](https://img.shields.io/github/stars/dirkschumacher/wasmr?style=flat-square) | +| ![Elixir logo](./assets/languages/elixir.png) | [**Elixir**](https://github.com/tessi/wasmex) | [Docs](https://hexdocs.pm/wasmex/api-reference.html) | [Philipp Tessenow](https://github.com/tessi) | actively developed | ![last release](https://img.shields.io/hexpm/v/wasmex?style=flat-square) | ![number of Github stars](https://img.shields.io/github/stars/tessi/wasmex?style=flat-square) | | ❓ | [your language is missing?](https://github.com/wasmerio/wasmer/issues/new?assignees=&labels=%F0%9F%8E%89+enhancement&template=---feature-request.md&title=) | | | | | -### Usage -Wasmer can execute both the standard binary format (`.wasm`) and the text -format defined by the WebAssembly reference interpreter (`.wat`). +## Contribute -Once installed, you will be able to run any WebAssembly files (_including Lua, PHP, SQLite and nginx!_): +**We welcome any form of contribution, especially from new members of our community** 💜 -```sh -# Run Lua -wasmer examples/lua.wasm -``` +You can check how to build the Wasmer runtime in [our awesome docs]([https://docs.wasmer.io/ecosystem/wasmer/building-from-source](https://new-docs.wasmer.io/ecosystem/wasmer/building-from-source))! -*You can find more `wasm/wat` examples in the [examples](./examples) directory.* +### Testing -### Docs +Test you want? The [Wasmer docs will show you how](https://new-docs.wasmer.io/ecosystem/wasmer/building-from-source/testing). -Wasmer documentation lives on [docs.wasmer.io](https://docs.wasmer.io). +## Community +Wasmer has an amazing community developers and contributors. Welcome, please join us! 👋 -## Code Structure +### Channels -Wasmer is structured into different directories: - -- [`src`](./src): code related to the Wasmer executable itself -- [`lib`](./lib): modularized libraries that Wasmer uses under the hood -- [`examples`](./examples): some useful examples for getting started with Wasmer - -## Dependencies - -Building Wasmer requires [rustup](https://rustup.rs/). - -To build Wasmer on Windows, download and run [`rustup-init.exe`](https://win.rustup.rs/) -then follow the onscreen instructions. - -To build on other systems, run: - -```sh -curl https://sh.rustup.rs -sSf | sh -``` - -### Other dependencies - -Please select your operating system: - -
- macOS -

- -#### macOS - -If you have [Homebrew](https://brew.sh/) installed: - -```sh -brew install cmake -``` - -Or, if you have [MacPorts](https://www.macports.org/install.php): - -```sh -sudo port install cmake -``` - -

-
- -
- Debian-based Linuxes -

- -#### Debian-based Linuxes - -```sh -sudo apt install cmake pkg-config libssl-dev -``` - -

-
- -
- FreeBSD -

- -#### FreeBSD - -```sh -pkg install cmake -``` - -

-
- -
- Windows -

- -#### Windows (MSVC) - -Windows support is _experimental_. WASI is fully supported, but Emscripten support is in the works (this means -nginx and Lua do not work on Windows - you can track the progress on [this issue](https://github.com/wasmerio/wasmer/issues/176)). - -1. Install [Visual Studio](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=15) - -2. Install [Rust for Windows](https://win.rustup.rs) - -3. Install [Git for Windows](https://git-scm.com/download/win). Allow it to add `git.exe` to your PATH (default - settings for the installer are fine). - -4. Install [CMake](https://cmake.org/download/). Ensure CMake is in your PATH. - -5. Install [LLVM 8.0](https://prereleases.llvm.org/win-snapshots/LLVM-8.0.0-r351033-win64.exe) -

-
- -## Building - -[![Rustc Version 1.40+](https://img.shields.io/badge/rustc-1.40+-red.svg?style=flat-square)](https://blog.rust-lang.org/2019/12/19/Rust-1.40.0.html) - -Wasmer is built with [Cargo](https://crates.io/), the Rust package manager. - -The Singlepass backend requires nightly, so if you want to use it, - -Set Rust Nightly: - -``` -rustup default nightly -``` - -Otherwise an up to date (see badge above) version of stable Rust will work. - -And install Wasmer - -```sh -# checkout code -git clone https://github.com/wasmerio/wasmer.git -cd wasmer - -# install tools -make release-clif # To build with cranelift (default) - -make release-llvm # To build with llvm support - -make release-singlepass # To build with singlepass support - -# or -make release # To build with singlepass, cranelift and llvm support -``` - -## Testing - -Thanks to [spec tests](https://github.com/wasmerio/wasmer/tree/master/lib/spectests/spectests) we can ensure 100% compatibility with the WebAssembly spec test suite. - -You can run all the tests with: - -```sh -rustup default nightly -make test -``` - -### Testing backends - -Each backend can be tested separately: - -* Singlepass: `make singlepass` -* Cranelift: `make cranelift` -* LLVM: `make llvm` - -### Testing integrations - -Each integration can be tested separately: - -* Spec tests: `make spectests` -* Emscripten: `make emtests` -* WASI: `make wasitests` -* Middleware: `make middleware` -* C API: `make capi` - -## Benchmarking - -Benchmarks can be run with: - -```sh -make bench-[backend] - -# for example -make bench-singlepass -``` - -## Roadmap - -Wasmer is an open project guided by strong principles, aiming to be modular, flexible and fast. It is open to the community to help set its direction. - -Below are some of the goals of this project (in order of priority): - -- [x] It should be 100% compatible with the [WebAssembly spec tests](https://github.com/wasmerio/wasmer/tree/master/lib/spectests/spectests) -- [x] It should be fast _(partially achieved)_ -- [x] Support WASI - released in [0.3.0](https://github.com/wasmerio/wasmer/releases/tag/0.3.0) -- [x] Support Emscripten calls -- [ ] Support Go JS ABI calls _(in the works)_ - -## Architecture - -If you would like to know how Wasmer works under the hood, please see [docs/architecture.md](./docs/architecture.md). - -## License - -Wasmer is primarily distributed under the terms of the [MIT license](http://opensource.org/licenses/MIT) ([LICENSE](./LICENSE)). - -[ATTRIBUTIONS](./ATTRIBUTIONS.md) +- [Slack](https://slack.wasmer.io/) +- [Twitter](https://twitter.com/wasmerio) +- [Facebook](https://www.facebook.com/wasmerio) +- [Email](mailto:hello@wasmer.io) diff --git a/docs/assets/languages/c.svg b/assets/languages/c.svg similarity index 100% rename from docs/assets/languages/c.svg rename to assets/languages/c.svg diff --git a/docs/assets/languages/cpp.svg b/assets/languages/cpp.svg similarity index 100% rename from docs/assets/languages/cpp.svg rename to assets/languages/cpp.svg diff --git a/docs/assets/languages/csharp.svg b/assets/languages/csharp.svg similarity index 100% rename from docs/assets/languages/csharp.svg rename to assets/languages/csharp.svg diff --git a/docs/assets/languages/elixir.png b/assets/languages/elixir.png similarity index 100% rename from docs/assets/languages/elixir.png rename to assets/languages/elixir.png diff --git a/docs/assets/languages/go.svg b/assets/languages/go.svg similarity index 100% rename from docs/assets/languages/go.svg rename to assets/languages/go.svg diff --git a/docs/assets/languages/js.svg b/assets/languages/js.svg similarity index 100% rename from docs/assets/languages/js.svg rename to assets/languages/js.svg diff --git a/docs/assets/languages/php.svg b/assets/languages/php.svg similarity index 100% rename from docs/assets/languages/php.svg rename to assets/languages/php.svg diff --git a/docs/assets/languages/postgres.svg b/assets/languages/postgres.svg similarity index 100% rename from docs/assets/languages/postgres.svg rename to assets/languages/postgres.svg diff --git a/docs/assets/languages/python.svg b/assets/languages/python.svg similarity index 100% rename from docs/assets/languages/python.svg rename to assets/languages/python.svg diff --git a/docs/assets/languages/r.svg b/assets/languages/r.svg similarity index 100% rename from docs/assets/languages/r.svg rename to assets/languages/r.svg diff --git a/docs/assets/languages/ruby.svg b/assets/languages/ruby.svg similarity index 100% rename from docs/assets/languages/ruby.svg rename to assets/languages/ruby.svg diff --git a/docs/assets/languages/rust.svg b/assets/languages/rust.svg similarity index 100% rename from docs/assets/languages/rust.svg rename to assets/languages/rust.svg diff --git a/docs/assets/languages/swift.svg b/assets/languages/swift.svg similarity index 100% rename from docs/assets/languages/swift.svg rename to assets/languages/swift.svg diff --git a/logo.png b/assets/logo.png similarity index 100% rename from logo.png rename to assets/logo.png diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 24aa07d58..75bec4daf 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -13,7 +13,6 @@ jobs: vmImage: "macos-10.14" steps: - checkout: self - submodules: true - template: .azure/install-rust.yml - script: | rustup component add rustfmt @@ -28,7 +27,6 @@ jobs: vmImage: "ubuntu-18.04" steps: - checkout: self - submodules: true - template: .azure/install-rust.yml - template: .azure/install-llvm.yml - template: .azure/install-sccache.yml @@ -63,7 +61,6 @@ jobs: condition: in(variables['Build.SourceBranch'], 'refs/heads/master', 'refs/heads/staging', 'refs/heads/trying') steps: - checkout: self - submodules: true - template: .azure/install-rust.yml - template: .azure/install-llvm.yml - template: .azure/install-sccache.yml @@ -97,7 +94,6 @@ jobs: condition: in(variables['Build.SourceBranch'], 'refs/heads/master', 'refs/heads/staging', 'refs/heads/trying') steps: - checkout: self - submodules: true - template: .azure/install-rust.yml - template: .azure/install-llvm.yml - template: .azure/install-sccache.yml @@ -129,7 +125,6 @@ jobs: ) steps: - checkout: self - submodules: true - template: .azure/install-rust.yml - template: .azure/install-llvm.yml - template: .azure/install-sccache.yml @@ -148,10 +143,13 @@ jobs: displayName: Build (Windows) condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) - bash: | + git clone --branch $WAPM_VERSION https://github.com/wasmerio/wapm-cli.git make wapm displayName: Build WAPM condition: | startsWith(variables['Build.SourceBranch'], 'refs/tags') + env: + WAPM_VERSION: 0.4.3 - bash: | make build-install-package cp ./wasmer.tar.gz ./artifacts/$(./scripts/binary-name.sh) @@ -199,7 +197,6 @@ jobs: ) steps: - checkout: self - submodules: true - template: .azure/install-rust.yml - template: .azure/install-llvm.yml - template: .azure/install-sccache.yml @@ -243,7 +240,6 @@ jobs: condition: in(variables['Build.SourceBranch'], 'refs/heads/master', 'refs/heads/staging', 'refs/heads/trying') steps: - checkout: self - submodules: true - template: .azure/install-rust.yml - template: .azure/install-llvm.yml - template: .azure/install-sccache.yml diff --git a/docs/architecture.md b/docs/architecture.md deleted file mode 100644 index e1d1c4ae3..000000000 --- a/docs/architecture.md +++ /dev/null @@ -1,74 +0,0 @@ -# Wasmer Architecture - -Wasmer uses the following components: - -- Compiler backends: for compiling Wasm binaries to machine code ([more info here](https://github.com/wasmerio/wasmer/tree/master/lib#backends)) -- [wabt](https://github.com/pepyakin/wabt-rs): for transforming `.wast` files to `.wasm` and running WebAssembly spec tests -- [wasmparser](https://github.com/yurydelendik/wasmparser.rs): for parsing the `.wasm` files and translating them into WebAssembly modules - -## How Wasmer works - -The first time you run `wasmer run myfile.wasm`, Wasmer will: - -- Check if is a `.wast` file, and if so, transform it to `.wasm` -- Check that the provided binary is a valid WebAssembly one, i.e. its binary format starts with `\0asm`. -- Parse it with `wasmparser` and generate a `Module` from it -- Generate an `Instance` with the proper `import_object` (that means, if is detected to be an Emscripten file, it will add the Emscripten expected imports) -- Try to call the WebAssembly `start` function, or if it does not exist, try to search for the function that is exported as `main` - -Find a more detailed explanation of the process below: - -### Phase 1: Generating the Module / IR - -As the WebAssembly file is being parsed, it will read the sections in the WebAssembly file (memory, table, function, global and element definitions) using the `Module` (or `ModuleEnvironment`) as the structure to hold this information. - -However, the real IR initialization happens while a function body is being parsed/created, i.e. when the parser reads the section `(func ...)`. -While the function body is being parsed the corresponding `FuncEnvironment` methods will be called. - -So for example, if the function is using a table, the `make_table` method within that `FuncEnvironment` will be called. -Each of this methods will return the corresponding IR representation. - -The `Module` creation will be finished once the parsing is done, and will hold all the function IR as well as the imports/exports. - -### Phase 2: Compiling the Functions - -Now that we have a `Module` (and all its definitions living in `ModuleInfo`) we should be ready to compile its functions. - -Right now, the `Instance` is the one in charge of compiling this functions into machine code. - -When creating the `Instance`, each of the function bodies (IR) will be compiled into machine code that our architecture can understand. -Once we have the compiled values, we will push them to memory and mark them as executable, so we can call them from anywhere in our code. - -#### Relocations - -Sometimes the functions that we generate will need to call other functions, but the generated code has no idea how to link these functions together. - -For example, if a function `A` is calling function `B` (that means is having a `(call b)` on its body) while compiling `A` we will have no idea where the function `B` lives on memory (as `B` is not yet compiled nor pushed into memory). - -For that reason, we will start collecting all the calls that function `A` will need to do under the hood, and save it's offsets. -We do that, so we can patch the function calls after compilation, to point to the correct memory address. - -Note: sometimes this functions rather than living in the same WebAssembly module, they will be provided as import values. - -#### Traps - -There will be other times where the function created will cause a trap (for example, if executing `0 / 0`). -When this happens, we will save the offset of the trap (while the function is being compiled). - -Thanks to that when we execute a function, if it traps (that means a sigaction is called), we would be able to backtrack from a memory address to a specific trap case. - -### Phase 3: Finalizing - -Once all the functions are compiled and patched with the proper relocations addresses, we will initialize the corresponding tables (where we save the pointers to all the exported functions), memories and globals that the instance need. - -Once that's finished, we will have a `Instance` function that will be ready to execute any function we need. - -## Emscripten - -Wasmer's Emscripten integration tries to wrap (and emulate) all the different syscalls that Emscripten needs. -We provide this integration by filling the `import_object` with the Emscripten functions, while instantiating the WebAssembly Instance. - -## WASI - -Wasmer's WASI integration implements all the different syscalls that WASI needs. -We provide this integration by filling the `import_object` with the WASI functions, while instantiating the WebAssembly Instance. diff --git a/docs/debugging.md b/docs/debugging.md deleted file mode 100644 index 8d49d5217..000000000 --- a/docs/debugging.md +++ /dev/null @@ -1,50 +0,0 @@ -# Debugging Wasmer - -## When is this document useful? - -If you're developing wasmer or running into issues, this document will explain to useful techniques and common errors. - -## Tracing syscalls - -To trace syscalls, compile with the `debug` feature (`cargo build --features "debug"`). For even more verbose messages, use the `trace` flag. - -## Tracing calls - -TODO: did we disable tracing calls? if not talk about how to enable it -TODO: someone with more context on the backends mention which backends this works for - -If you'd like to see all calls and you're using emscripten, you can use a symbol map to get better error output with the `em-symbol-map` flag. - -## Common things that can go wrong - -### Missing imports - -If, when attempting to run a wasm module, you get an error about missing imports there are a number of things that could be going wrong. - -The most likely is that we haven't implemented those imports for your ABI. If you're targeting emscripten, this is probably the issue. - -However if that's not the case, then there's a chance that you're using an unsupported ABI (let us know!) or that the wasm is invalid for the detected ABI. (TODO: link to wasm contracts or something) - -### Hitting `undefined` - -If this happens it's because wasmer does not have full support for whatever feature you tried to use. Running with tracing on can help clarify the issue if it's not clear from the message. - -To fix this, file an issue letting us know that wasmer is missing a feature that's important to you. If you'd like, you can try to implement it yourself and send us a PR. - -### No output - -If you're seeing no output from running the wasm module then it may be that: -- this is the intended behavior of the wasm module -- or it's very slow to compile (try compiling with a faster backend like cranelift (the default) or singlepass (requires nightly)) - -### Segfault - -If you're seeing a segfault while developing wasmer, chances are that it's a cache issue. We reset the cache on every version bump, but if you're running it from source then the cache may become invalid, which can lead to segfaults. - -To fix this delete the cache with `wasmer cache clean` or run the command with the `disable-cache` flag (`wasmer run some.wasm --disable-cache`) - -If you're seeing a segfault with a released version of wasmer, please file an issue so we can ship an updated version as soon as possible. - -### Something else - -If none of this has helped with your issue, let us know and we'll do our best to help. diff --git a/docs/docker.md b/docs/docker.md deleted file mode 100644 index 2086284f7..000000000 --- a/docs/docker.md +++ /dev/null @@ -1,39 +0,0 @@ -# Dockerfile Documentation -The `Dockerfile` included in the project root directory could be used for development purposes or to build a small image containing the `wasmer` executable. - -The `wasmer-build-env` stage in the Dockerfile contains the dependencies needed to compile Wasmer including LLVM. - -The `wasmer-debug-env` stage adds the `valgrind` profiling tool to the `wasmer-build-env` stage. - -The `wasmer-build` stage in the Dockerfile will copy the current directory, assuming the build context is the `wasmer` project, and build the project using `cargo build --release`. - -The `wasmer` stage will copy the resulting `wasmer` executable from the `wasmer-build` stage into a new base image to create a smaller image containing `wasmer`. - -## Example Usages - -### Wasmer image -1. From the `wasmer` project directory, build the image: -`docker build -t wasmer --target=wasmer .` - -2. List options: -`docker run wasmer --help` - -3. Mount a directory, and run an example wasm file: -`docker run -v /Users/admin/Documents/wasmer-workspace:/root/wasmer-workspace wasmer run /root/wasmer-workspace/examples/hello.wasm` - -### Profiling -1. Build `wasmer-debug-env`: - `docker build --tag=wasmer-debug-env --target wasmer-debug-env .` - -2. Mount a directory from the host and run interactively: - `docker run -it -v /Users/admin/Documents/wasmer-workspace:/home/circleci/wasmer-workspace wasmer-debug-env /bin/bash` - -3. Inside the container, build `wasmer` and run profiling tool: -``` -cd /home/circleci/wasmer-workspace/wasmer` -cargo build -valgrind --tool=callgrind --dump-instr=yes --collect-jumps=yes --simulate-cache=yes target/debug/wasmer run test.wasm -``` - -The `callgrind.out` can be viewed with the `qcachegrind` tool on Mac OS (`brew install qcachegrind`). - diff --git a/docs/feature_matrix.md b/docs/feature_matrix.md deleted file mode 100644 index 18d303270..000000000 --- a/docs/feature_matrix.md +++ /dev/null @@ -1,42 +0,0 @@ -# Feature Table - -## Compiler Backend - -|   | Singlepass | Cranelift | LLVM | -| - | :-: | :-: | :-: | -| Caching | ✅ | ✅ | ✅ | -| Emscripten | ✅ | ✅ | ✅ | -| Metering | ✅ | ⬜ | ✅ | -| Multi-value return | ⬜ | ⬜ | ⬜ | -| OSR | 🔄 | ⬜ | 🔄 | -| SIMD | ⬜ | ⬜ | ✅ | -| WASI | ✅ | ✅ | ✅ | -| WASMER_BACKTRACE | ✅ | ⬜ | ⬜ | - -## Operating System -|   | GNU Linux | Mac OSX | Windows NT | -| - | :-: | :-: | :-: | -| Cranelift Backend | ✅ | ✅ | ✅ | -| LLVM Backend | ✅ | ✅ | ✅ | -| Singlepass Backend | ✅ | ✅ | [#347](https://github.com/wasmerio/wasmer/issues/347) | -| WASI | ✅ | ✅ | ✅* | - -* `poll_fd` is not fully implemented for Windows yet - -## Language integration - -TODO: define a set of features that are relevant and mark them here - -Current ideas: - -- Callbacks -- Metering -- Caching - -> TODO: expand this table, it's focused on new features that we haven't implemented yet and doesn't list all language integrations - -|   | Rust | C / C++ | Go | Python | Ruby | -| - | :-: | :-: | :-: | :-: | :-: | -| Terminate in host call | ✅ | ⬜ | ⬜ | ⬜ | ⬜ | -| WASI | ✅ | ✅ | 🔄 | ⬜ | ⬜ | -| WASI FS API | ✅ | ⬜ | ⬜ | ⬜ | ⬜ | diff --git a/Dockerfile.build b/scripts/Dockerfile similarity index 100% rename from Dockerfile.build rename to scripts/Dockerfile diff --git a/build b/scripts/build similarity index 95% rename from build rename to scripts/build index eee434dbb..6c6b07b07 100755 --- a/build +++ b/scripts/build @@ -7,7 +7,7 @@ # To use the script, first make sure Docker is installed. Then build the # sandbox image with: # -# docker build --file Dockerfile.build --tag wasmer-build . +# docker build --file Dockerfile --tag wasmer-build . # # After the sandbox image is built successfully, you can run commands in it # with this script. diff --git a/install.sh b/scripts/install.sh similarity index 100% rename from install.sh rename to scripts/install.sh diff --git a/wapm-cli b/wapm-cli deleted file mode 160000 index 7996b1cb0..000000000 --- a/wapm-cli +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7996b1cb0e8418af5a312f5b033f4fb1b284464a