First release of wasm3, a fast WebAssembly interpreter

Available first edition wasm3, a very fast WebAssembly intermediate code interpreter, primarily intended to be used to run WebAssembly applications on microcontrollers and platforms that do not have a WebAssembly JIT implementation, do not have enough memory to run JIT, or cannot create executable memory pages required for JIT implementation. The project code is written in C language and spreads under the MIT license.

Wasm3 passes Tests to be compatible with the WebAssembly 1.0 specification and can be used to run many WASI applications, providing performance only 4-5 times lower than JIT engines (lift off, crane lift) and 11.5 times lower than native code execution. When compared to other WebAssembly interpreters (wAC, Life, wasm-micro-runtime), wasm3 was 15.8 times faster.

Wasm3 requires 64Kb of memory for code and 10Kb of RAM, which allows you to use the project to run applications compiled in WebAssembly on microcontrollers, such as Arduino MKR*, Arduino Due, Particle Photon, ESP8266, ESP32, Air602 (W600), nRF52, nRF51 Blue Pill (STM32F103C8T6), MXChip AZ3166 (EMW3166),
Maix (K210), HiFive1 (E310), Fomu (ICE40UP5K) and ATmega1284, as well as boards and computers based on x86, x64, ARM, MIPS, RISC-V and Xtensa architectures. Operating systems supported are Linux (including OpenWRT-based routers), Windows, macOS, Android, and iOS. It is also possible to compile wasm3 into an intermediate WebAssembly code to execute the interpreter in the browser or for nested launch (self-hosting).

High performance is achieved through the use of technology in the interpreter Massey Meta Machine (M3), which preemptively translates bytecode into more efficient pseudo-machine code-generating operations to reduce bytecode decoding overhead, and transforms the stack virtual machine execution model to a more efficient register approach. Operations in M3 are C functions whose arguments are virtual machine registers that can be mapped to CPU registers. Frequently occurring sequences of operations for optimization are converted into summary operations.

Additionally, it can be noted research results spread
WebAssembly in Web. After analyzing the 948 thousand most popular sites by Alexa rating, the researchers found out that WebAssembly is used on 1639 sites (0.17%), i.e. on 1 out of every 600 sites. In total, 1950 WebAssembly modules were detected on the sites, of which 150 are unique. When considering the scope of WebAssembly, disappointing conclusions were made - in more than 50% of cases, WebAssembly was used for malicious purposes, for example, for cryptocurrency mining (55.7%) and hiding the code of malicious scripts (0.2%). Legitimate uses of WebAssembly include executing libraries (38.8%), creating games (3.5%), and executing native non-JavaScript code (0.9%). In 14.9% of cases, WebAssembly was used to analyze the environment for user identification (fingerprinting).

First release of wasm3, a fast WebAssembly interpreter

Source: opennet.ru

Add a comment