wasm3, a WebAssembly interpreter releases its first version

W3

Recently, the first version of wasm3 was released, which is an interpreter very fast of intermediate code by WebAssemblyIt is designed primarily to run WebAssembly applications on microcontrollers and platforms for which there is no JIT implementation for WebAssembly, there is not enough memory for JIT to work or the creation of executable memory pages required for JIT Implementation.

For those unfamiliar with WebAssembly, you should know that this is a low-level language, initially designed as a target format when compiling from C and C ++, although it also supports source code for other languages, such as Rust and Go. This portable binary code format is used for full execution of scripts from the client-side browser.

About wasm3

Wasm3 passes compatibility tests with the WebAssembly 1.0 specification and can be used to run many WASI applications, providing only 4-5 times less performance than JIT engines and 11.5 times less than native code execution.

Compared to other performers from WebAssembly (wac, life, wasm-micro-runtime), wasm3 was 15.8 times faster.

Wasm3 started as a research project and continues to be so by many means. Evaluation of the motor in different environments is part of the investigation. Since we have Lua, JS, Python, Lisp, (…) running on MCU, WebAssembly is actually a promising alternative. It provides a completely isolated, well-defined and predictable environment. Among the practical use cases, we can list cutting-edge computing, scripting, IoT rule execution, blockchain contracts, etc.

wasm3 requires 64Kb of memory for code and 10Kb of RAM, what you allows to use the project to run compiled applications in WebAssembly in microcontrollers like Arduino MKR *, Arduino Due, Particle Photon, ESP8266, ESP32, Air602 (W600), nRF52, nRF51 Blue Pill (STM32F103C8T6), MXChip AZ3166 (EMW3166), Maix (K210), HiFive1 (E310), AT40ga5 (ICE1284gaXNUMX) , as well as on boards and computers based on architectures x86, x64, ARM, MIPS, RISC-V, and Xtens.

High performance is achieved by using the Massey Meta Machine technique (M3) in the interpreter, in which, to reduce the overhead of decoding the bytecode, the bytecode is proactively translated in more efficient operations that generate pseudo-machine code and the execution model of the stacked virtual machine becomes a more efficient register approach the operations in M3 are C functions, whose arguments are the registers of the virtual machine, which can be reflected in the CPU registers.

Frequent workflows for optimization are turned into summary operations.

In addition, The results of the study can be observed at WebAssembly on the Web, after analyzing 948 thousand of the most popular sites rated by Alexa, the researchers found that WebAssembly is used by 1639 sites (0.17%), which is 1 in 600 sites.

In total, the websites revealed the load of 1950 WebAssembly modules, of which 150 are unique.

When considering the scope of WebAssembly, disappointing conclusions were drawn: in more than 50% of the cases, WebAssembly was used for malicious purposes, for example, to mine cryptocurrencies (55,7%) and to hide code from malicious scripts (0,2 ,XNUMX%).

Of supported operating systems for Wasm3, we can find Linux including OpenWRT based routers, Windows, macOS, Android and iOS. It was also possible to compile wasm3 into the intermediate WebAssembly code to run the interpreter in a browser or for self-hosting.

Of the legitimate uses of WebAssembly, library execution (38.8%), game creation (3.5%), and non-JavaScript native code execution (0.9%) were observed. In 14,9% of the cases, WebAssembly was used to analyze the environment for user identification (fingerprints).

Try wasm3

For those who are interested in being able to use this interpreter in their system, can consult the documentation as well as the project code which is written in C and distributed under the MIT license, In the following link.


Be the first to comment

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.