mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-13 22:25:40 +00:00
Merge pull request #192 from jdanford/fix-documentation-formatting-and-grammar
Fix formatting and grammar in documentation
This commit is contained in:
commit
4b618b442a
@ -2,19 +2,19 @@
|
|||||||
|
|
||||||
Wasmer uses the following components:
|
Wasmer uses the following components:
|
||||||
|
|
||||||
- [Cranelift](https://github.com/cranestation/cranelift): for compiling WASM function binaries into Machine IR
|
- [Cranelift](https://github.com/cranestation/cranelift): for compiling Wasm binaries to machine code
|
||||||
- [wabt](https://github.com/pepyakin/wabt-rs): for transforming `.wast` files to `.wasm` and also to run WebAssembly spectests
|
- [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
|
- [wasmparser](https://github.com/yurydelendik/wasmparser.rs): for parsing the `.wasm` files and translating them into WebAssembly modules
|
||||||
|
|
||||||
## How Wasmer works?
|
## How Wasmer works
|
||||||
|
|
||||||
The first time you run `wasmer run myfile.wasm`, wasmer will:
|
The first time you run `wasmer run myfile.wasm`, Wasmer will:
|
||||||
|
|
||||||
- Check if is a `.wast` file. If so, transform it to `.wasm`
|
- Check if is a `.wast` file, and if so, transform it to `.wasm`
|
||||||
- Check that the provided binary is a valid WebAssembly one. That means, that its binary format starts with `\0asm`.
|
- Check that the provided binary is a valid WebAssembly one, i.e. its binary format starts with `\0asm`.
|
||||||
- If it looks like a WebAssembly file, try to parse it with `wasmparser` and generate a `Module` from it
|
- Parse it with `wasmparser` and generate a `Module` from it
|
||||||
- Once a `Module` is generated, an `Instance` is created with the proper `import_object` (that means, if is detected as an emscripten file, it will add the emscripten expected imports)
|
- 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 unexistent try to search for the one that is exported as `main`.
|
- 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:
|
Find a more detailed explanation of the process below:
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ Find a more detailed explanation of the process below:
|
|||||||
|
|
||||||
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.
|
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. That means, when the parser reads the section `(func ...)`.
|
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.
|
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.
|
So for example, if the function is using a table, the `make_table` method within that `FuncEnvironment` will be called.
|
||||||
@ -41,15 +41,14 @@ Once we have the compiled values, we will push them to memory and mark them as e
|
|||||||
|
|
||||||
#### Relocations
|
#### Relocations
|
||||||
|
|
||||||
Sometimes the functions that we generated will need to call other functions.
|
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.
|
||||||
However the generated code have no idea how to link this functions together.
|
|
||||||
|
|
||||||
For example, if a function `A` is calling function `B` (that means is having a `(call b)` on it's 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 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.
|
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.
|
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.
|
Note: sometimes this functions rather than living in the same WebAssembly module, they will be provided as import values.
|
||||||
|
|
||||||
#### Traps
|
#### Traps
|
||||||
|
|
||||||
@ -66,5 +65,5 @@ Once that's finished, we will have a `Instance` function that will be ready to e
|
|||||||
|
|
||||||
## Emscripten
|
## Emscripten
|
||||||
|
|
||||||
The Wasmer Emscripten integration tries to wrap (and emulate) all the different syscalls that Emscripten needs.
|
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.
|
We provide this integration by filling the `import_object` with the Emscripten functions, while instantiating the WebAssembly Instance.
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Wasmer is a community effort.
|
Wasmer is a community effort.
|
||||||
In order to build the best WebAssembly runtime it's our duty to see how other runtimes are approaching the same space
|
In order to build the best WebAssembly runtime it's our duty to see how other runtimes are approaching the same space
|
||||||
and get inspired from them on the things that they got right, so wasmer and its community can benefit from a solid
|
and get inspired from them on the things that they got right, so Wasmer and its community can benefit from a solid
|
||||||
foundation.
|
foundation.
|
||||||
|
|
||||||
These are the different project that we used as inspiration:
|
These are the different project that we used as inspiration:
|
||||||
@ -10,9 +10,9 @@ These are the different project that we used as inspiration:
|
|||||||
- [Nebulet](https://github.com/nebulet/nebulet): as the base for creating a great Rust WebAssembly runtime
|
- [Nebulet](https://github.com/nebulet/nebulet): as the base for creating a great Rust WebAssembly runtime
|
||||||
- [WAVM](https://github.com/wavm/wavm): for their great integration and testing framework
|
- [WAVM](https://github.com/wavm/wavm): for their great integration and testing framework
|
||||||
- [greenwasm](https://github.com/Kimundi/greenwasm): for their [spectests framework](https://github.com/Kimundi/greenwasm/tree/master/greenwasm-spectest)
|
- [greenwasm](https://github.com/Kimundi/greenwasm): for their [spectests framework](https://github.com/Kimundi/greenwasm/tree/master/greenwasm-spectest)
|
||||||
- [wasmtime](/wasmtime): on their [mmap implementation](https://github.com/CraneStation/wasmtime/blob/3f24098edc81cd9bf0f877fb7fba018cad0f039e/lib/runtime/src/mmap.rs).
|
- [wasmtime](https://github.com/CraneStation/wasmtime): for their [mmap implementation](https://github.com/CraneStation/wasmtime/blob/3f24098edc81cd9bf0f877fb7fba018cad0f039e/lib/runtime/src/mmap.rs)
|
||||||
- [stackoverflow](https://stackoverflow.com/a/45795699/1072990): to create an efficient HashMap with pair keys.
|
- [stackoverflow](https://stackoverflow.com/a/45795699/1072990): to create an efficient HashMap with pair keys
|
||||||
- [Emscripten](https://github.com/kripken/emscripten): for emtests test sources to ensure compatibility.
|
- [Emscripten](https://github.com/kripken/emscripten): for emtests test sources to ensure compatibility
|
||||||
|
|
||||||
We would love to hear from you if you think we can take inspiration from other projects that we haven't covered here.
|
We would love to hear from you if you think we can take inspiration from other projects that we haven't covered here.
|
||||||
😊
|
😊
|
||||||
@ -21,10 +21,10 @@ We would love to hear from you if you think we can take inspiration from other p
|
|||||||
|
|
||||||
### Nebulet
|
### Nebulet
|
||||||
|
|
||||||
```
|
```text
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2018
|
Copyright (c) 2018
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
@ -47,7 +47,7 @@ SOFTWARE.
|
|||||||
|
|
||||||
### WAVM
|
### WAVM
|
||||||
|
|
||||||
```
|
```text
|
||||||
Copyright (c) 2018, Andrew Scheidecker
|
Copyright (c) 2018, Andrew Scheidecker
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ The contents of [Test/spec](Test/spec) is covered by the license in [Test/spec/L
|
|||||||
|
|
||||||
### Greenwasm
|
### Greenwasm
|
||||||
|
|
||||||
```
|
```text
|
||||||
Apache License
|
Apache License
|
||||||
Version 2.0, January 2004
|
Version 2.0, January 2004
|
||||||
http://www.apache.org/licenses/
|
http://www.apache.org/licenses/
|
||||||
@ -275,7 +275,7 @@ limitations under the License.
|
|||||||
|
|
||||||
### Wasmtime
|
### Wasmtime
|
||||||
|
|
||||||
```
|
```text
|
||||||
Apache License
|
Apache License
|
||||||
Version 2.0, January 2004
|
Version 2.0, January 2004
|
||||||
http://www.apache.org/licenses/
|
http://www.apache.org/licenses/
|
||||||
@ -497,7 +497,7 @@ Software.
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Emscripten
|
### Emscripten
|
||||||
```
|
```text
|
||||||
Emscripten is available under 2 licenses, the MIT license and the
|
Emscripten is available under 2 licenses, the MIT license and the
|
||||||
University of Illinois/NCSA Open Source License.
|
University of Illinois/NCSA Open Source License.
|
||||||
|
|
||||||
@ -557,7 +557,7 @@ the following conditions:
|
|||||||
Neither the names of Mozilla,
|
Neither the names of Mozilla,
|
||||||
nor the names of its contributors may be used to endorse
|
nor the names of its contributors may be used to endorse
|
||||||
or promote products derived from this Software without specific prior
|
or promote products derived from this Software without specific prior
|
||||||
written permission.
|
written permission.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
4
LICENSE
4
LICENSE
@ -1,6 +1,4 @@
|
|||||||
The MIT License (MIT)
|
Copyright (c) 2019 Syrus Akbary
|
||||||
|
|
||||||
Copyright (c) 2018-Present Syrus Akbary
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
64
README.md
64
README.md
@ -1,16 +1,24 @@
|
|||||||
<p align="center"><a href="https://wasmer.io" target="_blank" rel="noopener noreferrer"><img width="400" src="https://raw.githubusercontent.com/wasmerio/wasmer/master/logo.png" alt="Wasmer logo"></a></p>
|
<p align="center">
|
||||||
|
<a href="https://wasmer.io" target="_blank" rel="noopener noreferrer">
|
||||||
|
<img width="400" src="https://raw.githubusercontent.com/wasmerio/wasmer/master/logo.png" alt="Wasmer logo">
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://circleci.com/gh/wasmerio/wasmer/"><img src="https://img.shields.io/circleci/project/github/wasmerio/wasmer/master.svg" alt="Build Status"></a>
|
<a href="https://circleci.com/gh/wasmerio/wasmer/">
|
||||||
<a href="https://github.com/wasmerio/wasmer/blob/master/LICENSE"><img src="https://img.shields.io/github/license/wasmerio/wasmer.svg" alt="License"></a>
|
<img src="https://img.shields.io/circleci/project/github/wasmerio/wasmer/master.svg" alt="Build Status">
|
||||||
|
</a>
|
||||||
|
<a href="https://github.com/wasmerio/wasmer/blob/master/LICENSE">
|
||||||
|
<img src="https://img.shields.io/github/license/wasmerio/wasmer.svg" alt="License">
|
||||||
|
</a>
|
||||||
<a href="https://spectrum.chat/wasmer">
|
<a href="https://spectrum.chat/wasmer">
|
||||||
<img alt="Join the Wasmer Community" src="https://withspectrum.github.io/badge/badge.svg" />
|
<img src="https://withspectrum.github.io/badge/badge.svg" alt="Join the Wasmer Community">
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
[Wasmer](https://wasmer.io/) is a Standalone JIT WebAssembly runtime, aiming to be fully compatible with Emscripten, Rust and Go.
|
[Wasmer](https://wasmer.io/) is a standalone JIT WebAssembly runtime, aiming to be fully compatible with Emscripten, Rust and Go.
|
||||||
|
|
||||||
Install Wasmer with:
|
Install Wasmer with:
|
||||||
|
|
||||||
@ -18,20 +26,20 @@ Install Wasmer with:
|
|||||||
curl https://get.wasmer.io -sSfL | sh
|
curl https://get.wasmer.io -sSfL | sh
|
||||||
```
|
```
|
||||||
|
|
||||||
_**NEW ✨**: Now you can also embed Wasmer in your Rust application, check our [example repo](https://github.com/wasmerio/wasmer-rust-example) to see how to do it!_
|
_**NEW ✨**: You can now embed Wasmer in your Rust application, check our [example repo](https://github.com/wasmerio/wasmer-rust-example) to see how!_
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
`wasmer` can execute both the standard binary format (`.wasm`) and the text
|
Wasmer can execute both the standard binary format (`.wasm`) and the text
|
||||||
format defined by the WebAssembly reference interpreter (`.wat`).
|
format defined by the WebAssembly reference interpreter (`.wat`).
|
||||||
|
|
||||||
Once installed, you will be able to run any WebAssembly files (_including Nginx, and Lua!_):
|
Once installed, you will be able to run any WebAssembly files (_including nginx and Lua!_):
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Run Lua
|
# Run Lua
|
||||||
wasmer run examples/lua.wasm
|
wasmer run examples/lua.wasm
|
||||||
|
|
||||||
# Run Nginx
|
# Run nginx
|
||||||
wasmer run examples/nginx/nginx.wasm -- -p examples/nginx -c nginx.conf
|
wasmer run examples/nginx/nginx.wasm -- -p examples/nginx -c nginx.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -39,13 +47,13 @@ wasmer run examples/nginx/nginx.wasm -- -p examples/nginx -c nginx.conf
|
|||||||
|
|
||||||
Wasmer is structured into different directories:
|
Wasmer is structured into different directories:
|
||||||
|
|
||||||
- [`src`](./src): code related to the wasmer excutable binary itself
|
- [`src`](./src): code related to the Wasmer executable itself
|
||||||
- [`lib`](./lib): modularized libraries that Wasmer uses under the hood
|
- [`lib`](./lib): modularized libraries that Wasmer uses under the hood
|
||||||
- [`examples`](./examples): some useful examples to getting started with wasmer
|
- [`examples`](./examples): some useful examples to getting started with Wasmer
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
Building wasmer requires [rustup](https://rustup.rs/).
|
Building Wasmer requires [rustup](https://rustup.rs/).
|
||||||
|
|
||||||
To build on Windows, download and run [`rustup-init.exe`](https://win.rustup.rs/)
|
To build on Windows, download and run [`rustup-init.exe`](https://win.rustup.rs/)
|
||||||
then follow the onscreen instructions.
|
then follow the onscreen instructions.
|
||||||
@ -66,13 +74,13 @@ Please select your operating system:
|
|||||||
|
|
||||||
#### macOS
|
#### macOS
|
||||||
|
|
||||||
If you have [homebrew](https://brew.sh/) installed:
|
If you have [Homebrew](https://brew.sh/) installed:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
brew install cmake
|
brew install cmake
|
||||||
```
|
```
|
||||||
|
|
||||||
Or, in case you have [ports](https://www.macports.org/install.php):
|
Or, in case you have [MacPorts](https://www.macports.org/install.php):
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sudo port install cmake
|
sudo port install cmake
|
||||||
@ -86,16 +94,16 @@ sudo apt install cmake
|
|||||||
|
|
||||||
#### Windows (MSVC)
|
#### Windows (MSVC)
|
||||||
|
|
||||||
Windows support is _highly experimental_. Only simple wasm programs may be run, and no syscalls are allowed. This means
|
Windows support is _highly experimental_. Only simple Wasm programs may be run, and no syscalls are allowed. This means
|
||||||
nginx and lua do not work on Windows. See [this issue for ongoing Emscripten syscall polyfills for Windows](https://github.com/wasmerio/wasmer/pull/176).
|
nginx and Lua do not work on Windows. See [this issue](https://github.com/wasmerio/wasmer/issues/176) regarding Emscripten syscall polyfills for Windows.
|
||||||
|
|
||||||
1. Install Python for Windows (https://www.python.org/downloads/release/python-2714/). The Windows x86-64 MSI installer is fine.
|
1. Install [Python for Windows](https://www.python.org/downloads/release/python-2714/). The Windows x86-64 MSI installer is fine.
|
||||||
You should change the installation to install the "Add python.exe to Path" feature.
|
Make sure to enable "Add python.exe to Path" during installation.
|
||||||
|
|
||||||
2. Install Git for Windows (https://git-scm.com/download/win). DO allow it to add git.exe to the PATH (default
|
2. 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).
|
settings for the installer are fine).
|
||||||
|
|
||||||
3. Install CMake (https://cmake.org/download/). Ensure CMake is in the PATH.
|
3. Install [CMake](https://cmake.org/download/). Ensure CMake is in your PATH.
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
@ -113,7 +121,7 @@ cargo install --path .
|
|||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
Thanks to [spectests](https://github.com/wasmerio/wasmer/tree/master/lib/runtime-core/spectests) we can assure 100% compatibility with the WebAssembly spec test suite.
|
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.
|
||||||
|
|
||||||
Tests can be run with:
|
Tests can be run with:
|
||||||
|
|
||||||
@ -121,7 +129,7 @@ Tests can be run with:
|
|||||||
make test
|
make test
|
||||||
```
|
```
|
||||||
|
|
||||||
If you need to re-generate the Rust tests from the spectests
|
If you need to regenerate the Rust tests from the spec tests
|
||||||
you can run:
|
you can run:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@ -138,20 +146,20 @@ make integration-tests
|
|||||||
|
|
||||||
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.
|
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 (written with order) of this project:
|
Below are some of the goals of this project (in order of priority):
|
||||||
|
|
||||||
- [x] It should be 100% compatible with the [WebAssembly Spectest](https://github.com/wasmerio/wasmer/tree/master/spectests)
|
- [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] It should be fast _(partially achieved)_
|
||||||
- [ ] Support Emscripten calls _(in the works)_
|
- [ ] Support Emscripten calls _(in the works)_
|
||||||
- [ ] Support Rust ABI calls
|
- [ ] Support Rust ABI calls
|
||||||
- [ ] Support GO ABI calls
|
- [ ] Support Go ABI calls
|
||||||
|
|
||||||
## Architecture
|
## Architecture
|
||||||
|
|
||||||
If you would like to know how Wasmer works under the hood, please visit our [ARCHITECTURE](https://github.com/wasmerio/wasmer/blob/master/ARCHITECTURE.md) document.
|
If you would like to know how Wasmer works under the hood, please see [ARCHITECTURE.md](./ARCHITECTURE.md).
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
MIT/Apache-2.0
|
Wasmer is primarily distributed under the terms of the [MIT license](http://opensource.org/licenses/MIT) ([LICENSE](./LICENSE)).
|
||||||
|
|
||||||
<small>[Attributions](./ATTRIBUTIONS.md)</small>.
|
[ATTRIBUTIONS](./ATTRIBUTIONS.md)
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# `lua` integration test
|
# `lua` integration test
|
||||||
|
|
||||||
|
|
||||||
This starts wasmer with the lua wasm file. The test asserts on
|
This starts Wasmer with the Lua Wasm file. The test makes assertions on
|
||||||
the output of wasmer. Run test with:
|
the output of Wasmer. Run test with:
|
||||||
|
|
||||||
```
|
```
|
||||||
> ./integration_tests/lua/test.sh
|
> ./integration_tests/lua/test.sh
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
# `nginx` integration test
|
# `nginx` integration test
|
||||||
|
|
||||||
|
|
||||||
This starts wasmer with the nginx wasm file and serves an html
|
This starts Wasmer with the nginx Wasm file and serves an HTML
|
||||||
file with some simple text to assert on. The test script does
|
file with some simple text to assert on. The test script does
|
||||||
the assertion.
|
the assertion.
|
||||||
|
|
||||||
Run test with:
|
Run test with:
|
||||||
|
|
||||||
```
|
```
|
||||||
> ./integration_tests/nginx/test.sh
|
> ./integration_tests/nginx/test.sh
|
||||||
|
@ -2,34 +2,34 @@
|
|||||||
|
|
||||||
Wasmer is modularized into different libraries, separated into three main sections:
|
Wasmer is modularized into different libraries, separated into three main sections:
|
||||||
|
|
||||||
- [Runtime](#Runtime)
|
- [Runtime](#runtime)
|
||||||
- [Integrations](#Integrations)
|
- [Integrations](#integrations)
|
||||||
- [Backends](#Backends)
|
- [Backends](#backends)
|
||||||
|
|
||||||
## Runtime
|
## Runtime
|
||||||
|
|
||||||
The core of Wasmer is the runtime, which provides the necessary
|
The core of Wasmer is the runtime, which provides the necessary
|
||||||
abstractions to create a good user-experience when embedding.
|
abstractions to create a good user experience when embedding.
|
||||||
|
|
||||||
The runtime is divided into two main libraries:
|
The runtime is divided into two main libraries:
|
||||||
|
|
||||||
- [runtime-core](./runtime-core/): The main implementation of the runtime.
|
- [runtime-core](./runtime-core/): The main implementation of the runtime.
|
||||||
- [runtime](./runtime/): Easy-to-use api on top of runtime-core.
|
- [runtime](./runtime/): Easy-to-use API on top of `runtime-core`.
|
||||||
|
|
||||||
## Integrations
|
## Integrations
|
||||||
|
|
||||||
The intergration run on-top of the Wasmer runtime and allow us to run WebAssembly files compiled for different environments.
|
The integration builds on the Wasmer runtime and allow us to run WebAssembly files compiled for different environments.
|
||||||
|
|
||||||
Wasmer intends to support different integrations:
|
Wasmer intends to support different integrations:
|
||||||
|
|
||||||
- [emscripten](./emscripten): run emscripten-generated WebAssembly files, such as [Lua](../examples/lua.wasm) or [Nginx](../examples/nginx/nginx.wasm).
|
- [emscripten](./emscripten): run Emscripten-generated WebAssembly files, such as [Lua](../examples/lua.wasm) or [nginx](../examples/nginx/nginx.wasm).
|
||||||
- Go ABI: _we will work on this soon! Want to give us a hand? ✋_
|
- Go ABI: _we will work on this soon! Want to give us a hand? ✋_
|
||||||
- Blazor: _researching period, see [tracking issue](https://github.com/wasmerio/wasmer/issues/97)_
|
- Blazor: _research period, see [tracking issue](https://github.com/wasmerio/wasmer/issues/97)_
|
||||||
|
|
||||||
## Backends
|
## Backends
|
||||||
|
|
||||||
The Wasmer [runtime](./runtime) is designed to support multiple compiler backends, allowing the user
|
The Wasmer [runtime](./runtime) is designed to support multiple compiler backends, allowing the user
|
||||||
to tune the codegen properties (compile speed, performance, etc) to fit your usecase best.
|
to tune the codegen properties (compile speed, performance, etc) to best fit their use case.
|
||||||
|
|
||||||
Currently, we support a Cranelift compiler backend:
|
Currently, we support a Cranelift compiler backend:
|
||||||
|
|
||||||
|
199
lib/spectests/spectests/README.md
vendored
199
lib/spectests/spectests/README.md
vendored
@ -1,136 +1,135 @@
|
|||||||
This directory contains tests for the core WebAssembly semantics, as described in [Semantics.md](https://github.com/WebAssembly/design/blob/master/Semantics.md) and specified by the [spec interpreter](https://github.com/WebAssembly/spec/blob/master/interpreter/spec).
|
This directory contains tests for the core WebAssembly semantics, as described in [Semantics.md](https://github.com/WebAssembly/design/blob/master/Semantics.md) and specified by the [spec interpreter](https://github.com/WebAssembly/spec/blob/master/interpreter/spec).
|
||||||
|
|
||||||
This files should be a direct copy of the original [WebAssembly spec tests](https://github.com/WebAssembly/spec/tree/master/test/core).
|
These files should be a direct copy of the original [WebAssembly spec tests](/test/core).
|
||||||
|
|
||||||
Tests are written in the [S-Expression script format](https://github.com/WebAssembly/spec/blob/master/interpreter/README.md#s-expression-syntax) defined by the interpreter.
|
Tests are written in the [S-Expression script format](https://github.com/WebAssembly/spec/blob/master/interpreter/README.md#s-expression-syntax) defined by the interpreter.
|
||||||
|
|
||||||
## Autogenerated Rust test cases
|
## Autogenerated Rust test cases
|
||||||
|
|
||||||
This files will serve as base for autogenerating Rust testcases
|
These files will serve as a base for autogenerating Rust testcases
|
||||||
when `WASM_GENERATE_SPECTESTS=1 cargo build` is executed
|
when `WASM_GENERATE_SPECTESTS=1 cargo build` is executed
|
||||||
([src/build_spectests.rs](https://github.com/wasmerio/wasmer/blob/master/src/build_spectests.rs)).
|
([src/build_spectests.rs](/src/build_spectests.rs)).
|
||||||
|
|
||||||
The result autogenerated spectests live in the [src/spectests](https://github.com/wasmerio/wasmer/tree/master/src/spectests)
|
The resulting autogenerated spec tests live in the [src/spectests](/src/spectests).
|
||||||
directory.
|
|
||||||
|
|
||||||
## Testcases
|
## Testcases
|
||||||
|
|
||||||
Currently supported command assertions:
|
Currently supported command assertions:
|
||||||
|
|
||||||
- [x] Module _mostly implemented_ (it should support named modules `(module $Xx)`).
|
- [x] `module` _mostly implemented_ (it should support named modules `(module $Xx)`).
|
||||||
- [x] AssertReturn _mostly implemented_ (it should support calls to named modules `(invoke $Xx "call")`).
|
- [x] `assert_return` _mostly implemented_ (it should support calls to named modules `(invoke $Xx "call")`).
|
||||||
- [x] AssertReturnCanonicalNan _fully implemented_
|
- [x] `assert_return_canonical_nan` _fully implemented_
|
||||||
- [x] AssertReturnArithmeticNan _fully implemented_
|
- [x] `assert_return_arithmetic_nan` _fully implemented_
|
||||||
- [x] AssertTrap _fully implemented_
|
- [x] `assert_trap` _fully implemented_
|
||||||
- [x] AssertInvalid _Fully implemented_ (it should not require to do validation separate from compilation)
|
- [x] `assert_invalid` _fully implemented_ (it should not require validation to be performed separate from compilation)
|
||||||
- [x] AssertMalformed _Fully implemented_
|
- [x] `assert_malformed` _fully implemented_
|
||||||
- [ ] AssertUninstantiable _not implemented yet_
|
- [ ] `assert_uninstantiable` _not implemented yet_
|
||||||
- [ ] AssertExhaustion _not implemented yet_
|
- [ ] `assert_exhaustion` _not implemented yet_
|
||||||
- [ ] Register _not implemented yet_
|
- [ ] `register` _not implemented yet_
|
||||||
- [x] PerformAction _partially implemented, only function invokations for now_
|
- [x] `perform_action` _partially implemented, only function invocations for now_
|
||||||
|
|
||||||
### Covered spectests
|
### Covered spec tests
|
||||||
|
|
||||||
This spectests are currently covered:
|
The following spec tests are currently covered:
|
||||||
|
|
||||||
- address.wast ✅
|
- [x] address.wast
|
||||||
- align.wast ✅
|
- [x] align.wast
|
||||||
- binary.wast ✅
|
- [x] binary.wast
|
||||||
- block.wast ✅
|
- [x] block.wast
|
||||||
- br.wast ✅
|
- [x] br.wast
|
||||||
- br_if.wast ✅
|
- [x] br_if.wast
|
||||||
- br_table.wast ✅
|
- [x] br_table.wast
|
||||||
- break-drop.wast ✅
|
- [x] break-drop.wast
|
||||||
- call.wast ✅
|
- [x] call.wast
|
||||||
- call_indirect.wast ✅
|
- [x] call_indirect.wast
|
||||||
- comments.wast ✅
|
- [x] comments.wast
|
||||||
- const.wast ✅
|
- [x] const.wast
|
||||||
- conversions.wast ✅
|
- [x] conversions.wast
|
||||||
- custom.wast ✅
|
- [x] custom.wast
|
||||||
- data.wast ✅
|
- [x] data.wast
|
||||||
- elem.wast
|
- [ ] elem.wast
|
||||||
- endianness.wast ✅
|
- [x] endianness.wast
|
||||||
- exports.wast ✅
|
- [x] exports.wast
|
||||||
- f32.wast ✅
|
- [x] f32.wast
|
||||||
- f32_bitwise.wast ✅
|
- [x] f32_bitwise.wast
|
||||||
- f32_cmp.wast ✅
|
- [x] f32_cmp.wast
|
||||||
- f64.wast ✅
|
- [x] f64.wast
|
||||||
- f64_bitwise.wast ✅
|
- [x] f64_bitwise.wast
|
||||||
- f64_cmp.wast ✅
|
- [x] f64_cmp.wast
|
||||||
- fac.wast ✅
|
- [x] fac.wast
|
||||||
- float_exprs.wast ✅
|
- [x] float_exprs.wast
|
||||||
- float_literals.wast ✅
|
- [x] float_literals.wast
|
||||||
- float_memory.wast ✅
|
- [x] float_memory.wast
|
||||||
- float_misc.wast ✅
|
- [x] float_misc.wast
|
||||||
- forward.wast ✅
|
- [x] forward.wast
|
||||||
- func.wast ✅
|
- [x] func.wast
|
||||||
- func_ptrs.wast ✅
|
- [x] func_ptrs.wast
|
||||||
- get_local.wast ✅
|
- [x] get_local.wast
|
||||||
- globals.wast ✅
|
- [x] globals.wast
|
||||||
- i32.wast ✅
|
- [x] i32.wast
|
||||||
- i64.wast ✅
|
- [x] i64.wast
|
||||||
- if.wast ✅
|
- [x] if.wast
|
||||||
- imports.wast
|
- [ ] imports.wast
|
||||||
- inline-module.wast
|
- [ ] inline-module.wast
|
||||||
- int_exprs.wast ✅
|
- [x] int_exprs.wast
|
||||||
- int_literals.wast ✅
|
- [x] int_literals.wast
|
||||||
- labels.wast ✅
|
- [x] labels.wast
|
||||||
- left-to-right.wast ✅
|
- [x] left-to-right.wast
|
||||||
- linking.wast
|
- [ ] linking.wast
|
||||||
- loop.wast ✅
|
- [x] loop.wast
|
||||||
- memory.wast ✅
|
- [x] memory.wast
|
||||||
- memory_grow.wast ✅
|
- [x] memory_grow.wast
|
||||||
- memory_redundancy.wast ✅
|
- [x] memory_redundancy.wast
|
||||||
- memory_trap.wast ✅
|
- [x] memory_trap.wast
|
||||||
- names.wast ✅
|
- [x] names.wast
|
||||||
- nop.wast ✅
|
- [x] nop.wast
|
||||||
- return.wast ✅
|
- [x] return.wast
|
||||||
- select.wast ✅
|
- [x] select.wast
|
||||||
- set_local.wast ✅
|
- [x] set_local.wast
|
||||||
- skip-stack-guard-page.wast
|
- [ ] skip-stack-guard-page.wast
|
||||||
- stack.wast ✅
|
- [x] stack.wast
|
||||||
- start.wast ✅
|
- [x] start.wast
|
||||||
- store_retval.wast ✅
|
- [x] store_retval.wast
|
||||||
- switch.wast ✅
|
- [x] switch.wast
|
||||||
- tee_local.wast ✅
|
- [x] tee_local.wast
|
||||||
- token.wast ✅
|
- [x] token.wast
|
||||||
- traps.wast ✅
|
- [x] traps.wast
|
||||||
- type.wast ✅
|
- [x] type.wast
|
||||||
- typecheck.wast ✅
|
- [x] typecheck.wast
|
||||||
- unreachable.wast
|
- [ ] unreachable.wast
|
||||||
- unreached-invalid.wast
|
- [ ] unreached-invalid.wast
|
||||||
- unwind.wast ✅
|
- [x] unwind.wast
|
||||||
- utf8-custom-section-id.wast
|
- [ ] utf8-custom-section-id.wast
|
||||||
- utf8-import-field.wast
|
- [ ] utf8-import-field.wast
|
||||||
- utf8-import-module.wast
|
- [ ] utf8-import-module.wast
|
||||||
- utf8-invalid-encoding.wast
|
- [ ] utf8-invalid-encoding.wast
|
||||||
|
|
||||||
### Specific non-supported cases
|
### Specific non-supported cases
|
||||||
|
|
||||||
There are some cases that we decided to skip for now to fasten the time to release:
|
There are some cases that we decided to skip for now to accelerate the release schedule:
|
||||||
|
|
||||||
- `SKIP_MUTABLE_GLOBALS`: Right now the WASM parser can't validate a module with imported/exported mut globals. We decided to skip the tests until Cranelift and wasmparser can handle this (original spec proposal: https://github.com/WebAssembly/mutable-global). Spectests affected:
|
- `SKIP_MUTABLE_GLOBALS`: Right now the Wasm parser can't validate a module with imported/exported `mut` globals. We decided to skip the tests until Cranelift and wasmparser can handle this (see [original spec proposal](https://github.com/WebAssembly/mutable-global)). Spec tests affected:
|
||||||
- `globals.wast`
|
- `globals.wast`
|
||||||
- `SKIP_CALL_INDIRECT_TYPE_MISMATCH`: we implemented traps in a fast way. We haven't covered yet the type mismatch on `call_indirect`. Specs affected:
|
- `SKIP_CALL_INDIRECT_TYPE_MISMATCH`: we implemented traps in a fast way. We haven't yet covered the type mismatch on `call_indirect`. Specs affected:
|
||||||
|
|
||||||
- `call_indirect.wast`
|
- `call_indirect.wast`
|
||||||
|
|
||||||
- `SKIP_CALL_UNDEFINED_ELEMENT`
|
- `SKIP_CALL_UNDEFINED_ELEMENT`
|
||||||
Tables are imported into every spec module, even for modules that don't expect it. We need to figure out a way to prevent import of objects that are not explicitly imported into the module.
|
Tables are imported into every spec module, even for modules that don't expect it. We need to figure out a way to prevent importing of objects that are not explicitly imported into the module.
|
||||||
|
|
||||||
Currently cranelift_wasm::ModuleEnvironment does not provide `declare_table_import`, etc. so there is no meaningful way of fixing this yet.
|
Currently `cranelift_wasm::ModuleEnvironment` does not provide `declare_table_import`, etc. so there is no meaningful way of fixing this yet.
|
||||||
|
|
||||||
- `call_indirect.wast`
|
- `call_indirect.wast`
|
||||||
|
|
||||||
- `SKIP_SHARED_TABLE` [elem.wast]
|
- `SKIP_SHARED_TABLE` [elem.wast]
|
||||||
Currently sharing tables between instances/modules does not work. Below are some of the reasons it is hard to achieve.
|
Currently sharing tables between instances/modules does not work. Below are some of the reasons it is hard to achieve:
|
||||||
|
|
||||||
- Rust naturally prevents such because of the possibility of race conditions
|
- Rust naturally prevents such because of the possibility of race conditions
|
||||||
- ImportObject is just a wrapper, what we really care about is references to its content.
|
- `ImportObject` is just a wrapper, what we really care about is references to its content.
|
||||||
- Instance::new contains a mutation points, the part where after getting the object (memory or table) we push values to it
|
- `Instance::new` contains a mutation points, the part where after getting the object (memory or table) we push values to it
|
||||||
table[table_element_index] = func_addr
|
`table[table_element_index] = func_addr`
|
||||||
- Instance has its own created memories and tables and references to them must outlive Instance::new()
|
- Instance has its own created memories and tables and references to them must outlive `Instance::new()`
|
||||||
- Possible strategy
|
- Possible strategy:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
// ImportObject should be passed by ref
|
// ImportObject should be passed by ref
|
||||||
|
Loading…
Reference in New Issue
Block a user