The release of the Wasmer 5.0 project has been presented, which develops a runtime for executing WebAssembly modules that can be used to create universal applications capable of running on various operating systems. Wasmer can also be applied for securely executing untrusted code blocks within conventional applications. The project's code is written in Rust and is distributed under the MIT license.
The ability to run a single application on multiple platforms is implemented through compilation into low-level intermediate WebAssembly code, which can run on any OS or be embedded in programs written in other programming languages. The programs are lightweight containers that execute WebAssembly pseudocode. These containers are not tied to any operating system and can include code originally written in any programming language.
Different backends are offered for executing WebAssembly intermediate code or translating it into machine code for the target platform:
- A backend based on the Singlepass compiler, optimal for use in blockchains.
- A backend based on the Cranelift code generator, optimal for use in the development process.
- A backend based on the LLVM compiler, optimal for use in production environments.
- A backend for execution in a web browser.
- A backend based on the JavascriptCore JavaScript engine, optimal for use on the macOS platform.
- A backend based on the V8 JavaScript engine, optimal for applications on iOS and Android platforms.
- A backend based on the Wasmi interpreter, optimal for blockchains and Rust projects that do not use the standard library (nostd).
- A backend based on the WAMR runtime, optimal for the iOS platform.
Applications are isolated from the main system in a sandbox environment and only have access to the declared functionality. A capability-based control mechanism is used for isolation — each resource (files, directories, sockets, system calls, etc.) requires the appropriate permissions granted to the application for actions. Access control and interaction with the system are provided through the WASI (WebAssembly System Interface) API, which offers software interfaces for working with files, sockets, and other system functions.
The platform enables application performance close to that of native builds. Using the Native Object Engine for the WebAssembly module, machine code can be generated that requires minimal runtime to execute, while retaining all sandbox isolation capabilities. Precompiled programs with embedded Wasmer can also be supplied. Rust API and Wasm-C-API are offered for creating extensions and add-ons.
To run a WebAssembly container, it is sufficient to install the Wasmer runtime on your system, which comes without external dependencies ("curl https://get.wasmer.io -sSfL | sh"), and run the necessary file ("wasmer test.wasm"). Programs are distributed as regular 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 programs written in Rust, C/C++, C#, D, Python, JavaScript, Go, PHP, Ruby, Elixir, and Java.
Key Innovations of Wasmer 5.0:
- The ability to use WebAssembly interpreters has been implemented.
- An experimental backend based on the lightweight Wasmi interpreter has been added, allowing the execution of intermediate WebAssembly code in resource-constrained environments.
- An experimental backend based on the WAMR (WebAssembly Micro Runtime), optimized for minimal resource consumption and suitable for devices with limited RAM, has been added.
- An experimental backend based on the V8 JavaScript engine, used in Chromium-based browsers, has been added. A major advantage of using the V8 backend is the access to the integrated debugger and tooling for web developers, as well as the availability of advanced WebAssembly functionality in V8, such as exception handling and garbage collection.
- Experimental support for the Loongarch64 architecture has been added to the LLVM backend.
- iOS platform support has been added, available when using the WAMR, Wasmi, and V8 backends.
- Support for the Emscripten compiler has been discontinued.
- Dependencies have been updated, including LLVM 18, Cranelift code generator 27, and rkyv framework 0.8.
- Performance optimizations have been made. For example, during module deserialization operations, performance improvements of up to 50% have been observed.







Source: opennet.ru







