Merge branch 'master' into feat-memory-usage

This commit is contained in:
Ivan Enderlin
2021-03-23 11:22:23 +01:00
9 changed files with 639 additions and 37 deletions

View File

@ -515,6 +515,7 @@ test-packages:
cargo test -p wasmer-cache --release
cargo test -p wasmer-engine --release
cargo test -p wasmer-derive --release
cargo check --manifest-path fuzz/Cargo.toml $(compiler_features) --release
# We want to run all the tests for all available compilers. The C API
@ -739,9 +740,11 @@ lint-packages:
RUSTFLAGS=${RUSTFLAGS} cargo clippy --manifest-path lib/cli/Cargo.toml $(compiler_features)
RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer-cache
RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer-engine
RUSTFLAGS=${RUSTFLAGS} cargo clippy --manifest-path fuzz/Cargo.toml $(compiler_features)
lint-formatting:
cargo fmt --all -- --check
cargo fmt --manifest-path fuzz/Cargo.toml -- --check
lint: lint-formatting lint-packages

View File

@ -29,6 +29,8 @@
[Wasmer](https://wasmer.io/) enables super lightweight containers based on [WebAssembly](https://webassembly.org/) that can run anywhere: from Desktop to the Cloud and IoT devices, and also embedded in [*any programming language*](https://github.com/wasmerio/wasmer#language-integrations).
> This readme is also available in: [🇨🇳 中文-Chinese](https://github.com/wasmerio/wasmer/blob/master/docs/cn/README.md) • [🇪🇸 Español-Spanish](https://github.com/wasmerio/wasmer/blob/master/docs/es/README.md) • [🇫🇷 Français-French](https://github.com/wasmerio/wasmer/blob/master/docs/es/README.md).
## Features
* **Fast & Safe**. Wasmer runs WebAssembly at *near-native* speed in a fully sandboxed environment.
@ -103,66 +105,66 @@ qjs >
[👋 Missing a language?](https://github.com/wasmerio/wasmer/issues/new?assignees=&labels=%F0%9F%8E%89+enhancement&template=---feature-request.md&title=)
[rust logo]: ./assets/languages/rust.svg
[rust logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/rust.svg
[rust integration]: https://github.com/wasmerio/wasmer/tree/master/lib/api
[`wasmer` rust crate]: https://crates.io/crates/wasmer/
[rust docs]: https://wasmerio.github.io/wasmer/crates/wasmer_runtime
[c logo]: ./assets/languages/c.svg
[c logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/c.svg
[c integration]: https://github.com/wasmerio/wasmer/tree/master/lib/c-api
[`wasmer.h` headers]: https://wasmerio.github.io/wasmer/c/
[c docs]: https://wasmerio.github.io/wasmer/c/
[c# logo]: ./assets/languages/csharp.svg
[c# logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/csharp.svg
[c# integration]: https://github.com/migueldeicaza/WasmerSharp
[`wasmersharp` nuget package]: https://www.nuget.org/packages/WasmerSharp/
[c# docs]: https://migueldeicaza.github.io/WasmerSharp/
[d logo]: ./assets/languages/d.svg
[d logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/d.svg
[d integration]: https://github.com/chances/wasmer-d
[`wasmer` Dub package]: https://code.dlang.org/packages/wasmer
[d docs]: https://chances.github.io/wasmer-d
[python logo]: ./assets/languages/python.svg
[python logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/python.svg
[python integration]: https://github.com/wasmerio/wasmer-python
[`wasmer` pypi package]: https://pypi.org/project/wasmer/
[python docs]: https://github.com/wasmerio/wasmer-python#api-of-the-wasmer-extensionmodule
[go logo]: ./assets/languages/go.svg
[go logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/go.svg
[go integration]: https://github.com/wasmerio/wasmer-go
[`wasmer` go package]: https://pkg.go.dev/github.com/wasmerio/wasmer-go/wasmer
[go docs]: https://pkg.go.dev/github.com/wasmerio/wasmer-go/wasmer?tab=doc
[php logo]: ./assets/languages/php.svg
[php logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/php.svg
[php integration]: https://github.com/wasmerio/wasmer-php
[`wasm` pecl package]: https://pecl.php.net/package/wasm
[php docs]: https://wasmerio.github.io/wasmer-php/wasm/
[js logo]: ./assets/languages/js.svg
[js logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/js.svg
[js integration]: https://github.com/wasmerio/wasmer-js
[`@wasmerio` npm packages]: https://www.npmjs.com/org/wasmer
[js docs]: https://docs.wasmer.io/integrations/js/reference-api
[ruby logo]: ./assets/languages/ruby.svg
[ruby logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/ruby.svg
[ruby integration]: https://github.com/wasmerio/wasmer-ruby
[`wasmer` ruby gem]: https://rubygems.org/gems/wasmer
[ruby docs]: https://www.rubydoc.info/gems/wasmer/
[java logo]: ./assets/languages/java.svg
[java logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/java.svg
[java integration]: https://github.com/wasmerio/wasmer-java
[`wasmer/wasmer-jni` bintray package]: https://bintray.com/wasmer/wasmer-jni/wasmer-jni
[java docs]: https://github.com/wasmerio/wasmer-java/#api-of-the-wasmer-library
[elixir logo]: ./assets/languages/elixir.svg
[elixir logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/elixir.svg
[elixir integration]: https://github.com/tessi/wasmex
[elixir docs]: https://hexdocs.pm/wasmex/api-reference.html
[`wasmex` hex package]: https://hex.pm/packages/wasmex
[r logo]: ./assets/languages/r.svg
[r logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/r.svg
[r integration]: https://github.com/dirkschumacher/wasmr
[r docs]: https://github.com/dirkschumacher/wasmr#example
[postgres logo]: ./assets/languages/postgres.svg
[postgres logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/postgres.svg
[postgres integration]: https://github.com/wasmerio/wasmer-postgres
[postgres docs]: https://github.com/wasmerio/wasmer-postgres#usage--documentation

192
docs/cn/README.md Normal file
View File

@ -0,0 +1,192 @@
<div align="center">
<a href="https://wasmer.io" target="_blank" rel="noopener noreferrer">
<img width="300" src="https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/logo.png" alt="Wasmer logo">
</a>
<p>
<a href="https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild">
<img src="https://github.com/wasmerio/wasmer/workflows/build/badge.svg?style=flat-square" 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?style=flat-square" alt="License">
</a>
<a href="https://slack.wasmer.io">
<img src="https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square" alt="Slack channel">
</a>
</p>
<h3>
<a href="https://wasmer.io/">网站</a>
<span></span>
<a href="https://docs.wasmer.io">文件资料</a>
<span></span>
<a href="https://slack.wasmer.io/">聊天</a>
</h3>
</div>
<br />
[Wasmer](https://wasmer.io/) 使得能够基于 [WebAssembly](https://webassembly.org/)其可以在任何地方运行超轻型容器从桌面到云和的IoT装置并且也嵌入在 [*任何编程语言*](https://github.com/wasmerio/wasmer#language-integrations).
> This readme is also available in: [🇬🇧 English-英文](https://github.com/wasmerio/wasmer/blob/master/README.md) • [🇪🇸 Español-西班牙语](https://github.com/wasmerio/wasmer/blob/master/docs/es/README.md) • [🇫🇷 Français-法语/法语](https://github.com/wasmerio/wasmer/blob/master/docs/es/README.md).
## 特征
* **快速又安全**. Wasmer 在完全沙盒化的环境中以“接近本机”的速度运行 WebAssembly。
* **可插拔**. Wasmer支持不同的编译框架以最适合您的需求LLVMCranelift ...).
* **普遍的**. 您可以在任何*平台*macOSLinux和Windows和*芯片组*中运行Wasmer.
* **符合标准**. 运行时通过了[官方WebAssembly测试
套件](https://github.com/WebAssembly/testsuite) 支持[WASI](https://github.com/WebAssembly/WASI) 和[Emscripten](https://emscripten.org/).
## 快速开始
Wasmer出厂时没有任何依赖关系. 您可以使用以下安装程序进行安装:
```sh
curl https://get.wasmer.io -sSfL | sh
```
<details>
<summary>使用Powershell (Windows)</summary>
<p>
```powershell
iwr https://win.wasmer.io -useb | iex
```
</p>
</details>
> 有关更多安装选项,请参见 [wasmer-install](https://github.com/wasmerio/wasmer-install): Homebrew, Scoop, Cargo...
#### 执行WebAssembly文件
安装Wasmer之后您应该已经准备好执行第一个WebAssemby文件! 🎉
您可以通过运行QuickJS开始: [qjs.wasm](https://registry-cdn.wapm.io/contents/_/quickjs/0.0.3/build/qjs.wasm)
```bash
$ wasmer qjs.wasm
QuickJS - Type "\h" for help
qjs >
```
#### 接下来是您可以做的:
- [在您的Rust应用程序中使用Wasmer](https://docs.wasmer.io/integrations/rust)
- [在WAPM上发布Wasm程序包](https://docs.wasmer.io/ecosystem/wapm/publishing-your-package)
- [阅读有关Wasmer的更多信息](https://medium.com/wasmer/)
## 语言整合
📦 Wasmer运行时可以用作**以不同语言嵌入的库**因此您可以在任何位置使用WebAssembly.
| &nbsp; | 语言 | 箱 | 文件资料 |
|-|-|-|-|
| ![Rust logo] | [**Rust**][Rust integration] | [`wasmer` Rust crate] | [文件资料][rust docs]
| ![C logo] | [**C/C++**][C integration] | [`wasmer.h` headers] | [文件资料][c docs] |
| ![C# logo] | [**C#**][C# integration] | [`WasmerSharp` NuGet package] | [文件资料][c# docs] |
| ![D logo] | [**D**][D integration] | [`wasmer` Dub package] | [文件资料][d docs] |
| ![Python logo] | [**Python**][Python integration] | [`wasmer` PyPI package] | [文件资料][python docs] |
| ![JS logo] | [**Javascript**][JS integration] | [`@wasmerio` NPM packages] | [文件资料][js docs] |
| ![Go logo] | [**Go**][Go integration] | [`wasmer` Go package] | [文件资料][go docs] |
| ![PHP logo] | [**PHP**][PHP integration] | [`wasm` PECL package] | [文件资料][php docs] |
| ![Ruby logo] | [**Ruby**][Ruby integration] | [`wasmer` Ruby Gem] | [文件资料][ruby docs] |
| ![Java logo] | [**Java**][Java integration] | [`wasmer/wasmer-jni` Bintray package] | [文件资料][java docs] |
| ![Elixir logo] | [**Elixir**][Elixir integration] | [`wasmex` hex package] | [文件资料][elixir docs] |
| ![R logo] | [**R**][R integration] | *没有已发布的软件包* | [文件资料][r docs] |
| ![Postgres logo] | [**Postgres**][Postgres integration] | *没有已发布的软件包* | [文件资料][postgres docs] |
| | [**Swift**][Swift integration] | *没有已发布的软件包* | |
[👋 缺少语言?](https://github.com/wasmerio/wasmer/issues/new?assignees=&labels=%F0%9F%8E%89+enhancement&template=---feature-request.md&title=)
[rust logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/rust.svg
[rust integration]: https://github.com/wasmerio/wasmer/tree/master/lib/api
[`wasmer` rust crate]: https://crates.io/crates/wasmer/
[rust docs]: https://wasmerio.github.io/wasmer/crates/wasmer_runtime
[c logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/c.svg
[c integration]: https://github.com/wasmerio/wasmer/tree/master/lib/c-api
[`wasmer.h` headers]: https://wasmerio.github.io/wasmer/c/
[c docs]: https://wasmerio.github.io/wasmer/c/
[c# logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/csharp.svg
[c# integration]: https://github.com/migueldeicaza/WasmerSharp
[`wasmersharp` nuget package]: https://www.nuget.org/packages/WasmerSharp/
[c# docs]: https://migueldeicaza.github.io/WasmerSharp/
[d logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/d.svg
[d integration]: https://github.com/chances/wasmer-d
[`wasmer` Dub package]: https://code.dlang.org/packages/wasmer
[d docs]: https://chances.github.io/wasmer-d
[python logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/python.svg
[python integration]: https://github.com/wasmerio/wasmer-python
[`wasmer` pypi package]: https://pypi.org/project/wasmer/
[python docs]: https://github.com/wasmerio/wasmer-python#api-of-the-wasmer-extensionmodule
[go logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/go.svg
[go integration]: https://github.com/wasmerio/wasmer-go
[`wasmer` go package]: https://pkg.go.dev/github.com/wasmerio/wasmer-go/wasmer
[go docs]: https://pkg.go.dev/github.com/wasmerio/wasmer-go/wasmer?tab=doc
[php logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/php.svg
[php integration]: https://github.com/wasmerio/wasmer-php
[`wasm` pecl package]: https://pecl.php.net/package/wasm
[php docs]: https://wasmerio.github.io/wasmer-php/wasm/
[js logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/js.svg
[js integration]: https://github.com/wasmerio/wasmer-js
[`@wasmerio` npm packages]: https://www.npmjs.com/org/wasmer
[js docs]: https://docs.wasmer.io/integrations/js/reference-api
[ruby logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/ruby.svg
[ruby integration]: https://github.com/wasmerio/wasmer-ruby
[`wasmer` ruby gem]: https://rubygems.org/gems/wasmer
[ruby docs]: https://www.rubydoc.info/gems/wasmer/
[java logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/java.svg
[java integration]: https://github.com/wasmerio/wasmer-java
[`wasmer/wasmer-jni` bintray package]: https://bintray.com/wasmer/wasmer-jni/wasmer-jni
[java docs]: https://github.com/wasmerio/wasmer-java/#api-of-the-wasmer-library
[elixir logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/elixir.svg
[elixir integration]: https://github.com/tessi/wasmex
[elixir docs]: https://hexdocs.pm/wasmex/api-reference.html
[`wasmex` hex package]: https://hex.pm/packages/wasmex
[r logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/r.svg
[r integration]: https://github.com/dirkschumacher/wasmr
[r docs]: https://github.com/dirkschumacher/wasmr#example
[postgres logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/postgres.svg
[postgres integration]: https://github.com/wasmerio/wasmer-postgres
[postgres docs]: https://github.com/wasmerio/wasmer-postgres#usage--documentation
[swift integration]: https://github.com/AlwaysRightInstitute/SwiftyWasmer
## 贡献
**我们欢迎任何形式的贡献,尤其是来自社区新成员的贡献** 💜
您可以在[我们的出色文档](https://docs.wasmer.io/ecosystem/wasmer/building-from-source) 中检查如何构建Wasmer运行时!
### 测试
要测试吗? The [Wasmer文档将向您展示如何](https://docs.wasmer.io/ecosystem/wasmer/building-from-source/testing).
## 社区
Wasmer拥有一个了不起的开发人员和贡献者社区。 欢迎您,请加入我们! 👋
### 频道
- [Slack](https://slack.wasmer.io/)
- [Twitter](https://twitter.com/wasmerio)
- [Facebook](https://www.facebook.com/wasmerio)
- [Email](mailto:hello@wasmer.io)

191
docs/es/README.md Normal file
View File

@ -0,0 +1,191 @@
<div align="center">
<a href="https://wasmer.io" target="_blank" rel="noopener noreferrer">
<img width="300" src="https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/logo.png" alt="Wasmer logo">
</a>
<p>
<a href="https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild">
<img src="https://github.com/wasmerio/wasmer/workflows/build/badge.svg?style=flat-square" 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?style=flat-square" alt="License">
</a>
<a href="https://slack.wasmer.io">
<img src="https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square" alt="Slack channel">
</a>
</p>
<h3>
<a href="https://wasmer.io/">Web</a>
<span></span>
<a href="https://docs.wasmer.io">Documentación</a>
<span></span>
<a href="https://slack.wasmer.io/">Chat</a>
</h3>
</div>
<br />
[Wasmer](https://wasmer.io/) hace posible tener contenedores ultraligeros basados en [WebAssembly](https://webassembly.org/) que pueden ser ejecutados en cualquier sitio: desde tu ordenador hasta la nube y dispositivos de IoT, además de poder ser ejecutados [*en cualquier lenguaje de programación*](https://github.com/wasmerio/wasmer#language-integrations).
> This README is also available in: [🇬🇧 English-Inglés](https://github.com/wasmerio/wasmer/blob/master/README.md) • [🇫🇷 Français-Francés](https://github.com/wasmerio/wasmer/blob/master/docs/fr/README.md) • [🇨🇳 中文-Chino](https://github.com/wasmerio/wasmer/blob/master/docs/cn/README.md).
## Funcionalidades
* **Rápido y Seguro**. Wasmer ejecuta WebAssembly a velocidades *nativas* en un entorno completamente protegido.
* **Extendible**. Wasmer soporta diferentes métodos de compilación dependiendo de tus necesidades (LLVM, Cranelift...).
* **Universal**. Puedes ejecutar Wasmer en cualquier *platforma* (macOS, Linux y Windows) y *chip*.
* **Respeta los estándares**. Wasmer pasa los [tests oficiales de WebAssembly](https://github.com/WebAssembly/testsuite) siendo compatible con [WASI](https://github.com/WebAssembly/WASI) y [Emscripten](https://emscripten.org/).
## Empezamos?
Wasmer no requiere ninguna dependencia. Puedes instalarlo con uno de éstos instaladores:
```sh
curl https://get.wasmer.io -sSfL | sh
```
<details>
<summary>Con PowerShell (Windows)</summary>
<p>
```powershell
iwr https://win.wasmer.io -useb | iex
```
</p>
</details>
> Visita [wasmer-install](https://github.com/wasmerio/wasmer-install) para más opciones de instalación: Homebrew, Scoop, Cargo...
#### Ejecuta un archivo WebAssembly
¡Después de instalar Wasmer deberías estar listo para ejecutar tu primer módulo de WebAssembly! 🎉
Puedes empezar corriendo QuickJS: [qjs.wasm](https://registry-cdn.wapm.io/contents/_/quickjs/0.0.3/build/qjs.wasm)
```bash
$ wasmer qjs.wasm
QuickJS - Type "\h" for help
qjs >
```
#### Esto es lo que puedes hacer:
- [Usa Wasmer desde tu aplicación de Rust](https://docs.wasmer.io/integrations/rust)
- [Publica un paquete de Wasm en WAPM](https://docs.wasmer.io/ecosystem/wapm/publishing-your-package)
- [Lee más sobre Wasmer](https://medium.com/wasmer/)
## Integraciones en diferentes Lenguajes
📦 Wasmer puede ser usado como una librería **integrado en diferentes lenguajes de programación**, para que puedas ejecutar WebAssembly _en cualquier sitio_.
| &nbsp; | Lenguaje | Librería | Documentación |
|-|-|-|-|
| ![Rust logo] | [**Rust**][Rust integration] | [`wasmer` en crates.io] | [Documentación][rust docs]
| ![C logo] | [**C/C++**][C integration] | [cabecera `wasmer.h`] | [Documentación][c docs] |
| ![C# logo] | [**C#**][C# integration] | [`WasmerSharp` en NuGet] | [Documentación][c# docs] |
| ![D logo] | [**D**][D integration] | [`wasmer` en Dug] | [Documentación][d docs] |
| ![Python logo] | [**Python**][Python integration] | [`wasmer` en PyPI] | [Documentación][python docs] |
| ![JS logo] | [**Javascript**][JS integration] | [`@wasmerio` en NPM] | [Documentación][js docs] |
| ![Go logo] | [**Go**][Go integration] | [`wasmer` en Go] | [Documentación][go docs] |
| ![PHP logo] | [**PHP**][PHP integration] | [`wasm` en PECL] | [Documentación][php docs] |
| ![Ruby logo] | [**Ruby**][Ruby integration] | [`wasmer` en Ruby Gems] | [Documentación][ruby docs] |
| ![Java logo] | [**Java**][Java integration] | [`wasmer/wasmer-jni` en Bintray] | [Documentación][java docs] |
| ![Elixir logo] | [**Elixir**][Elixir integration] | [`wasmex` en hex] | [Documentación][elixir docs] |
| ![R logo] | [**R**][R integration] | *sin paquete publicado* | [Documentación][r docs] |
| ![Postgres logo] | [**Postgres**][Postgres integration] | *sin paquete publicado* | [Documentación][postgres docs] |
| | [**Swift**][Swift integration] | *sin paquete publicado* | |
[👋 Falta algún lenguaje?](https://github.com/wasmerio/wasmer/issues/new?assignees=&labels=%F0%9F%8E%89+enhancement&template=---feature-request.md&title=)
[rust logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/rust.svg
[rust integration]: https://github.com/wasmerio/wasmer/tree/master/lib/api
[`wasmer` en crates.io]: https://crates.io/crates/wasmer/
[rust docs]: https://wasmerio.github.io/wasmer/crates/wasmer_runtime
[c logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/c.svg
[c integration]: https://github.com/wasmerio/wasmer/tree/master/lib/c-api
[cabecera `wasmer.h`]: https://wasmerio.github.io/wasmer/c/
[c docs]: https://wasmerio.github.io/wasmer/c/
[c# logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/csharp.svg
[c# integration]: https://github.com/migueldeicaza/WasmerSharp
[`wasmersharp` en NuGet]: https://www.nuget.org/packages/WasmerSharp/
[c# docs]: https://migueldeicaza.github.io/WasmerSharp/
[d logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/d.svg
[d integration]: https://github.com/chances/wasmer-d
[`wasmer` en Dub]: https://code.dlang.org/packages/wasmer
[d docs]: https://chances.github.io/wasmer-d
[python logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/python.svg
[python integration]: https://github.com/wasmerio/wasmer-python
[`wasmer` en pypi]: https://pypi.org/project/wasmer/
[python docs]: https://github.com/wasmerio/wasmer-python#api-of-the-wasmer-extensionmodule
[go logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/go.svg
[go integration]: https://github.com/wasmerio/wasmer-go
[`wasmer` en go]: https://pkg.go.dev/github.com/wasmerio/wasmer-go/wasmer
[go docs]: https://pkg.go.dev/github.com/wasmerio/wasmer-go/wasmer?tab=doc
[php logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/php.svg
[php integration]: https://github.com/wasmerio/wasmer-php
[php docs]: https://wasmerio.github.io/wasmer-php/wasm/
[`wasm` en pecl]: https://pecl.php.net/package/wasm
[js logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/js.svg
[js integration]: https://github.com/wasmerio/wasmer-js
[`@wasmerio` en npm]: https://www.npmjs.com/org/wasmer
[js docs]: https://docs.wasmer.io/integrations/js/reference-api
[ruby logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/ruby.svg
[ruby integration]: https://github.com/wasmerio/wasmer-ruby
[`wasmer` en ruby gems]: https://rubygems.org/gems/wasmer
[ruby docs]: https://www.rubydoc.info/gems/wasmer/
[java logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/java.svg
[java integration]: https://github.com/wasmerio/wasmer-java
[`wasmer/wasmer-jni` en bintray]: https://bintray.com/wasmer/wasmer-jni/wasmer-jni
[java docs]: https://github.com/wasmerio/wasmer-java/#api-of-the-wasmer-library
[elixir logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/elixir.svg
[elixir integration]: https://github.com/tessi/wasmex
[elixir docs]: https://hexdocs.pm/wasmex/api-reference.html
[`wasmex` en hex]: https://hex.pm/packages/wasmex
[r logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/r.svg
[r integration]: https://github.com/dirkschumacher/wasmr
[r docs]: https://github.com/dirkschumacher/wasmr#example
[postgres logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/postgres.svg
[postgres integration]: https://github.com/wasmerio/wasmer-postgres
[postgres docs]: https://github.com/wasmerio/wasmer-postgres#usage--documentation
[swift integration]: https://github.com/AlwaysRightInstitute/SwiftyWasmer
## Contribuye
**Damos la bienvenida a cualquier forma de contribución, especialmente a los nuevos miembros de la comunidad** 💜
¡Puedes ver cómo crear el binario de Wasmer con [nuestros increíbles documentos](https://docs.wasmer.io/ecosystem/wasmer/building-from-source)!
### Tests
Testear quieres? Los [documentos de Wasmer te enseñarán cómo](https://docs.wasmer.io/ecosystem/wasmer/building-from-source/testing).
## Comunidad
Wasmer tiene una comunidad increíble de desarrolladores y colaboradores ¡Bienvenido, únete a nosotros! 👋
### Medios
- [Slack](https://slack.wasmer.io/)
- [Twitter](https://twitter.com/wasmerio)
- [Facebook](https://www.facebook.com/wasmerio)
- [Email](mailto:hello@wasmer.io)

191
docs/fr/README.md Normal file
View File

@ -0,0 +1,191 @@
<div align="center">
<a href="https://wasmer.io" target="_blank" rel="noopener noreferrer">
<img width="300" src="https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/logo.png" alt="Logo Wasmer">
</a>
<p>
<a href="https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild">
<img src="https://github.com/wasmerio/wasmer/workflows/build/badge.svg?style=flat-square" alt="État des tests">
</a>
<a href="https://github.com/wasmerio/wasmer/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square" alt="Licence">
</a>
<a href="https://slack.wasmer.io">
<img src="https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square" alt="Salon Slack">
</a>
</p>
<h3>
<a href="https://wasmer.io/">Web</a>
<span></span>
<a href="https://docs.wasmer.io">Documentation</a>
<span></span>
<a href="https://slack.wasmer.io/">Chat</a>
</h3>
</div>
<br />
[Wasmer](https://wasmer.io/) permet l'utilisation de conteneurs super légers basés sur [WebAssembly](https://webassembly.org/) qui peuvent fonctionner n'importe où : du bureau au cloud en passant par les appareils IoT, et également intégrés dans [*une multitude de langages de programmation*](https://github.com/wasmerio/wasmer#language-integrations).
> This readme is also available in: [🇬🇧 English-Anglaise](https://github.com/wasmerio/wasmer/blob/master/README.md) • [🇪🇸 Español-Espagnol](https://github.com/wasmerio/wasmer/blob/master/docs/es/README.md) • [🇨🇳 中文-Chinoise](https://github.com/wasmerio/wasmer/blob/master/docs/cn/README.md)
## Fonctionnalités
* **Rapide et sûr**. Wasmer exécute WebAssembly à une vitesse *quasi native* dans un environnement entièrement contrôlé (bac à sable, _sandbox_).
* **Modulaire**. Wasmer prend en charge différents frameworks de compilation pour répondre au mieux à vos besoins (LLVM, Cranelift ...).
* **Universel**. Vous pouvez exécuter Wasmer sur n'importe quelle *plate-forme* (macOS, Linux et Windows) et *processeur*.
* **Conforme aux normes**. Wasmer passe [la suite de tests officielle de WebAssembly](https://github.com/WebAssembly/testsuite) prenant en charge [WASI](https://github.com/WebAssembly/WASI) et [Emscripten](https://emscripten.org/)
## Quickstart
Wasmer est livré sans aucune dépendance. Vous pouvez l'installer à l'aide des programmes d'installation ci-dessous :
```sh
curl https://get.wasmer.io -sSfL | sh
```
<details>
<summary>Avec PowerShell (Windows)</summary>
<p>
```powershell
iwr https://win.wasmer.io -useb | iex
```
</p>
</details>
> Voir [wasmer-install](https://github.com/wasmerio/wasmer-install) pour plus d'options d'installation: Homebrew, Scoop, Cargo...
#### Exécution d'un fichier WebAssembly
Après avoir installé Wasmer, vous devriez être prêt à exécuter votre premier fichier WebAssemby ! 🎉
Vous pouvez commencer par exécuter QuickJS : [qjs.wasm](https://registry-cdn.wapm.io/contents/_/quickjs/0.0.3/build/qjs.wasm)
```bash
$ wasmer qjs.wasm
QuickJS - Type "\h" for help
qjs >
```
#### Voici ce que vous pouvez faire ensuite
- [Utilisez Wasmer depuis votre application Rust](https://docs.wasmer.io/integrations/rust)
- [Publier un paquet Wasm sur WAPM](https://docs.wasmer.io/ecosystem/wapm/publishing-your-package)
- [En savoir plus sur Wasmer](https://medium.com/wasmer/)
## Intégrations
📦 Wasmer peut être utilisé comme une bibliothèque **intégrée dans différents langages**, vous pouvez donc utiliser WebAssembly _n'import où_.
| &nbsp; | Langage de programmation | Package | Docs |
|-|-|-|-|
| ![Rust logo] | [**Rust**][Rust integration] | [`wasmer` Rust crate] | [Docs][rust docs]
| ![C logo] | [**C/C++**][C integration] | [`wasmer.h` headers] | [Docs][c docs] |
| ![C# logo] | [**C#**][C# integration] | [`WasmerSharp` NuGet package] | [Docs][c# docs] |
| ![D logo] | [**D**][D integration] | [`wasmer` Dub package] | [Docs][d docs] |
| ![Python logo] | [**Python**][Python integration] | [`wasmer` PyPI package] | [Docs][python docs] |
| ![JS logo] | [**Javascript**][JS integration] | [`@wasmerio` NPM packages] | [Docs][js docs] |
| ![Go logo] | [**Go**][Go integration] | [`wasmer` Go package] | [Docs][go docs] |
| ![PHP logo] | [**PHP**][PHP integration] | [`wasm` PECL package] | [Docs][php docs] |
| ![Ruby logo] | [**Ruby**][Ruby integration] | [`wasmer` Ruby Gem] | [Docs][ruby docs] |
| ![Java logo] | [**Java**][Java integration] | [`wasmer/wasmer-jni` Bintray package] | [Docs][java docs] |
| ![Elixir logo] | [**Elixir**][Elixir integration] | [`wasmex` hex package] | [Docs][elixir docs] |
| ![R logo] | [**R**][R integration] | *no published package* | [Docs][r docs] |
| ![Postgres logo] | [**Postgres**][Postgres integration] | *no published package* | [Docs][postgres docs] |
| | [**Swift**][Swift integration] | *no published package* | |
[👋 Il manque un langage ?](https://github.com/wasmerio/wasmer/issues/new?assignees=&labels=%F0%9F%8E%89+enhancement&template=---feature-request.md&title=)
[rust logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/rust.svg
[rust integration]: https://github.com/wasmerio/wasmer/tree/master/lib/api
[`wasmer` rust crate]: https://crates.io/crates/wasmer/
[rust docs]: https://wasmerio.github.io/wasmer/crates/wasmer_runtime
[c logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/c.svg
[c integration]: https://github.com/wasmerio/wasmer/tree/master/lib/c-api
[`wasmer.h` headers]: https://wasmerio.github.io/wasmer/c/
[c docs]: https://wasmerio.github.io/wasmer/c/
[c# logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/csharp.svg
[c# integration]: https://github.com/migueldeicaza/WasmerSharp
[`wasmersharp` nuget package]: https://www.nuget.org/packages/WasmerSharp/
[c# docs]: https://migueldeicaza.github.io/WasmerSharp/
[d logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/d.svg
[d integration]: https://github.com/chances/wasmer-d
[`wasmer` Dub package]: https://code.dlang.org/packages/wasmer
[d docs]: https://chances.github.io/wasmer-d
[python logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/python.svg
[python integration]: https://github.com/wasmerio/wasmer-python
[`wasmer` pypi package]: https://pypi.org/project/wasmer/
[python docs]: https://github.com/wasmerio/wasmer-python#api-of-the-wasmer-extensionmodule
[go logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/go.svg
[go integration]: https://github.com/wasmerio/wasmer-go
[`wasmer` go package]: https://pkg.go.dev/github.com/wasmerio/wasmer-go/wasmer
[go docs]: https://pkg.go.dev/github.com/wasmerio/wasmer-go/wasmer?tab=doc
[php logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/php.svg
[php integration]: https://github.com/wasmerio/wasmer-php
[`wasm` pecl package]: https://pecl.php.net/package/wasm
[php docs]: https://wasmerio.github.io/wasmer-php/wasm/
[js logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/js.svg
[js integration]: https://github.com/wasmerio/wasmer-js
[`@wasmerio` npm packages]: https://www.npmjs.com/org/wasmer
[js docs]: https://docs.wasmer.io/integrations/js/reference-api
[ruby logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/ruby.svg
[ruby integration]: https://github.com/wasmerio/wasmer-ruby
[`wasmer` ruby gem]: https://rubygems.org/gems/wasmer
[ruby docs]: https://www.rubydoc.info/gems/wasmer/
[java logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/java.svg
[java integration]: https://github.com/wasmerio/wasmer-java
[`wasmer/wasmer-jni` bintray package]: https://bintray.com/wasmer/wasmer-jni/wasmer-jni
[java docs]: https://github.com/wasmerio/wasmer-java/#api-of-the-wasmer-library
[elixir logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/elixir.svg
[elixir integration]: https://github.com/tessi/wasmex
[elixir docs]: https://hexdocs.pm/wasmex/api-reference.html
[`wasmex` hex package]: https://hex.pm/packages/wasmex
[r logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/r.svg
[r integration]: https://github.com/dirkschumacher/wasmr
[r docs]: https://github.com/dirkschumacher/wasmr#example
[postgres logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/postgres.svg
[postgres integration]: https://github.com/wasmerio/wasmer-postgres
[postgres docs]: https://github.com/wasmerio/wasmer-postgres#usage--documentation
[swift integration]: https://github.com/AlwaysRightInstitute/SwiftyWasmer
## Contribuer
**Nous accueillons toutes formes de contributions, en particulier de la part des nouveaux membres de notre communauté**. 💜
Vous pouvez vérifier comment compiler Wasmer dans [notre documentation](https://docs.wasmer.io/ecosystem/wasmer/building-from-source)!
### Test
Vous voulez des tests ? La [documentation de Wasmer](https://docs.wasmer.io/ecosystem/wasmer/building-from-source/testing) vous montrera comment les exécuter.
## Communauté
Wasmer a une incroyable communauté de développeurs et de contributeurs. Bienvenue et rejoignez-nous ! 👋
### Canaux de communications
- [Slack](https://slack.wasmer.io/)
- [Twitter](https://twitter.com/wasmerio)
- [Facebook](https://www.facebook.com/wasmerio)
- [Email](mailto:hello@wasmer.io)

View File

@ -12,20 +12,20 @@ cargo-fuzz = true
anyhow = "1"
wasm-smith = { git = "https://github.com/bytecodealliance/wasm-tools" }
libfuzzer-sys = "0.4.0"
[dependencies.wasmer]
path = "../lib/api"
[dependencies.wasmer-compiler-cranelift]
path = "../lib/compiler-cranelift"
[dependencies.wasmer-compiler-llvm]
path = "../lib/compiler-llvm"
[dependencies.wasmer-compiler-singlepass]
path = "../lib/compiler-singlepass"
[dependencies.wasmer-engine-jit]
path = "../lib/engine-jit"
[dependencies.wasmer-engine-native]
path = "../lib/engine-native"
[dependencies.wasmer-middlewares]
path = "../lib/middlewares"
wasmer = { path = "../lib/api" }
wasmer-compiler-cranelift = { path = "../lib/compiler-cranelift", optional = true }
wasmer-compiler-llvm = { path = "../lib/compiler-llvm", optional = true }
wasmer-compiler-singlepass = { path = "../lib/compiler-singlepass", optional = true }
wasmer-engine-jit = { path = "../lib/engine-jit", optional = true }
wasmer-engine-native = { path = "../lib/engine-native", optional = true }
wasmer-middlewares = { path = "../lib/middlewares" }
[features]
cranelift = [ "wasmer-compiler-cranelift" ]
llvm = [ "wasmer-compiler-llvm" ]
singlepass = [ "wasmer-compiler-singlepass" ]
jit = [ "wasmer-engine-jit" ]
native = [ "wasmer-engine-native" ]
# Prevent this from interfering with workspaces
[workspace]
@ -34,27 +34,34 @@ members = ["."]
[[bin]]
name = "equivalence_jit"
path = "fuzz_targets/equivalence_jit.rs"
required-features = ["jit"]
[[bin]]
name = "jit_cranelift"
path = "fuzz_targets/jit_cranelift.rs"
required-features = ["jit", "cranelift"]
[[bin]]
name = "jit_llvm"
path = "fuzz_targets/jit_llvm.rs"
required-features = ["jit", "llvm"]
[[bin]]
name = "jit_singlepass"
path = "fuzz_targets/jit_singlepass.rs"
required-features = ["jit", "singlepass"]
[[bin]]
name = "metering"
path = "fuzz_targets/metering.rs"
required-features = ["jit", "cranelift"]
[[bin]]
name = "native_cranelift"
path = "fuzz_targets/native_cranelift.rs"
required-features = ["native", "cranelift"]
[[bin]]
name = "validate"
path = "fuzz_targets/validate.rs"
required-features = ["jit", "cranelift"]

View File

@ -1,11 +1,15 @@
#![no_main]
#![deny(unused_variables)]
use anyhow::Result;
use libfuzzer_sys::{arbitrary, arbitrary::Arbitrary, fuzz_target};
use wasm_smith::{Config, ConfiguredModule};
use wasmer::{imports, CompilerConfig, Instance, Module, Store, Val};
#[cfg(feature = "cranelift")]
use wasmer_compiler_cranelift::Cranelift;
#[cfg(feature = "llvm")]
use wasmer_compiler_llvm::LLVM;
#[cfg(feature = "singlepass")]
use wasmer_compiler_singlepass::Singlepass;
use wasmer_engine_jit::JIT;
@ -27,6 +31,7 @@ impl Config for ExportedFunctionConfig {
}
}
#[cfg(feature = "singlepass")]
fn maybe_instantiate_singlepass(wasm_bytes: &[u8]) -> Result<Option<Instance>> {
let compiler = Singlepass::default();
let store = Store::new(&JIT::new(compiler).engine());
@ -45,6 +50,7 @@ fn maybe_instantiate_singlepass(wasm_bytes: &[u8]) -> Result<Option<Instance>> {
Ok(Some(instance))
}
#[cfg(feature = "cranelift")]
fn maybe_instantiate_cranelift(wasm_bytes: &[u8]) -> Result<Option<Instance>> {
let mut compiler = Cranelift::default();
compiler.canonicalize_nans(true);
@ -55,6 +61,7 @@ fn maybe_instantiate_cranelift(wasm_bytes: &[u8]) -> Result<Option<Instance>> {
Ok(Some(instance))
}
#[cfg(feature = "llvm")]
fn maybe_instantiate_llvm(wasm_bytes: &[u8]) -> Result<Option<Instance>> {
let mut compiler = LLVM::default();
compiler.canonicalize_nans(true);
@ -78,15 +85,14 @@ impl PartialEq for InstanceResult {
if let InstanceResult::Error(other_message) = other {
return self_message == other_message;
}
return false;
}
InstanceResult::Values(self_values) => {
if let InstanceResult::Values(other_values) = other {
return self_values == other_values;
}
return false;
}
}
false
}
}
@ -109,8 +115,7 @@ fn evaluate_instance(instance: Result<Instance>) -> Vec<InstanceResult> {
// TODO: support functions which take params.
if f.ty().params().is_empty() {
let result = f.call(&[]);
let result = if result.is_ok() {
let values = result.unwrap();
let result = if let Ok(values) = result {
InstanceResult::Values(values.into())
} else {
let err = result.unwrap_err();
@ -129,16 +134,28 @@ fuzz_target!(|module: ConfiguredModule<ExportedFunctionConfig>| {
module.ensure_termination(100000);
let wasm_bytes = module.to_bytes();
let singlepass = maybe_instantiate_singlepass(&wasm_bytes).transpose().map(evaluate_instance);
let cranelift = maybe_instantiate_cranelift(&wasm_bytes).transpose().map(evaluate_instance);
let llvm = maybe_instantiate_llvm(&wasm_bytes).transpose().map(evaluate_instance);
#[cfg(feature = "singlepass")]
let singlepass = maybe_instantiate_singlepass(&wasm_bytes)
.transpose()
.map(evaluate_instance);
#[cfg(feature = "cranelift")]
let cranelift = maybe_instantiate_cranelift(&wasm_bytes)
.transpose()
.map(evaluate_instance);
#[cfg(feature = "llvm")]
let llvm = maybe_instantiate_llvm(&wasm_bytes)
.transpose()
.map(evaluate_instance);
#[cfg(all(feature = "singlepass", feature = "cranelift"))]
if singlepass.is_some() && cranelift.is_some() {
assert_eq!(singlepass.as_ref().unwrap(), cranelift.as_ref().unwrap());
}
#[cfg(all(feature = "singlepass", feature = "llvm"))]
if singlepass.is_some() && llvm.is_some() {
assert_eq!(singlepass.as_ref().unwrap(), llvm.as_ref().unwrap());
}
#[cfg(all(feature = "cranelift", feature = "llvm"))]
if cranelift.is_some() && llvm.is_some() {
assert_eq!(cranelift.as_ref().unwrap(), llvm.as_ref().unwrap());
}

View File

@ -40,8 +40,7 @@ fuzz_target!(|module: ConfiguredModule<NoImportsConfig>| {
Ok(_) => {}
Err(e) => {
let error_message = format!("{}", e);
if
error_message
if error_message
.contains("RuntimeError: memory out of bounds: data segment does not fit")
|| error_message
.contains("RuntimeError: table out of bounds: elements segment does not fit")

View File

@ -3,8 +3,8 @@
use libfuzzer_sys::{arbitrary, arbitrary::Arbitrary, fuzz_target};
use std::sync::Arc;
use wasm_smith::{Config, ConfiguredModule};
use wasmer::{imports, CompilerConfig, Instance, Module, Store};
use wasmer::wasmparser::Operator;
use wasmer::{imports, CompilerConfig, Instance, Module, Store};
use wasmer_compiler_cranelift::Cranelift;
use wasmer_engine_jit::JIT;
use wasmer_middlewares::Metering;