Wasmer 3.0, a toolkit for building WebAssembly-based applications, is available

This is the third major release of the Wasmer project, which develops a runtime for executing WebAssembly modules that can be used to create universal applications that can run on different operating systems, as well as sandbox execution of untrusted code. The project code is written in Rust and distributed under the MIT license.

The ability to run the same application on different platforms is provided by compiling the code into a low-level WebAssembly intermediate code that can run on any operating system or be embedded in programs in other programming languages. Programs are lightweight containers that run WebAssembly pseudocode. These containers are not tied to the operating system and can include code originally written in any programming language. The Emscripten toolkit can be used to compile to WebAssembly. To translate WebAssembly into the machine code of the current platform, it is supported to connect different compilation backends (Singlepass, Cranelift, LLVM) and engines (using JIT or generating machine code).

Applications are isolated from the main system in a sandbox environment and have access only to the declared functionality (capability-based security mechanism - for actions with each of the resources (files, directories, sockets, system calls, etc.), the application must be given the appropriate authority). Access control and interaction with the system is provided using the WASI (WebAssembly System Interface) API, which provides programming interfaces for working with files, sockets, and other functions provided by the operating system.

The platform allows you to achieve application execution performance close to that of native assemblies. Using the Native Object Engine for a WebAssembly module, you can generate native code ("wasmer compile -native" for generating precompiled .so, .dylib and .dll object files), which requires minimal runtime to run, but retains all the features of sandbox isolation. It is possible to supply precompiled programs with built-in Wasmer. Rust API and Wasm-C-API are offered for creating add-ons and add-ons.

To launch a WebAssembly container, it is enough to install Wasmer runtime on the system, which comes without external dependencies (β€œcurl https://get.wasmer.io -sSfL | sh”), and run the necessary file (β€œwasmer test.wasm”). Programs are distributed in the form of ordinary WebAssembly modules, which can be managed using the WAPM package manager. Wasmer is also available as a library that can be used to embed WebAssembly code in Rust, C/C++, C#, D, Python, JavaScript, Go, PHP, Ruby, Elixir, and Java programs.

Major changes in Wasmer 3.0:

  • Added the ability to create native executable files for any platform. The "wasmer create-exe" command has been completely redesigned to convert a WebAssembly intermediate code file into self-contained executables for Linux, Windows and macOS platforms that can run without installing Wasmer itself.
  • The ability to run WAPM packages located in the wapm.io directory using the "wasmer run" command has been provided. For example, executing "wasmer run python/python" will download the python package from the wapm.io repository and run it.
  • The Wasmer Rust API has been completely redesigned, in which the style of working with memory has been changed and the ability to safely store Wasm objects in the Store structure has been provided. A new MemoryView structure is proposed that allows reading and writing data to a linear memory area.
  • A set of wasmer-js components has been implemented to run Wasmer in a web browser and interact with it from JavaScript using the wasm-bindgen library. Wasmer-js is similar in functionality to the wasmer-sys components designed to run Wasmer on regular operating systems.
  • Simplified engines. Instead of separate engines for JIT, dynamic and static linking (Universal, Dylib, StaticLib), one common engine is now offered and loading and saving code in which is controlled at the parameter setting level.
  • To deserialize artifacts, the rkyv framework is used, which ensures zero-copy operation, i.e. requiring no additional memory allocation and performing deserialization using only the initially provided buffer. The use of rkyv significantly increased the startup speed.
  • The Singlepass compiler has been improved to support multi-value functions, improve reliability, and add support for exception handling frames.
  • Improved implementation of the WASI (WebAssembly System Interface) API. Fixed issues in the WASI API for working with the file system. Internal types have been redesigned using WAI (WebAssembly Interfaces), which will allow a series of new features to be implemented in the future.

Source: opennet.ru

Add a comment