8 new WebAssembly tools you should know

A burgeoning tools ecosystem springs up around the WebAssembly binary format for the web

8 new WebAssembly tools you should know
luckie8 / Getty Images

WebAssembly, aka Wasm, lets you execute code in a browser, support other languages besides JavaScript on the web, and speed up applications. A tools ecosystem is growing around the technology, which is backed by browser makers Apple, Google, Microsoft, and Mozilla.

Existing WebAssembly tools inclide Rust-wasm, which provides a WebAssembly interpreter, and Wasmlib, a C# library for reading and writing WebAssembly binary files. But more tools are joining the WebAssembly ecosystem. Here are eight new ones.

Life

The Life project at cloud marketplace Perlin consists of a cross-platform VM written in Google’s Go language. Described as secure, fast, and modular, Life runs computation-heavy code on multiple devices. Originally intended as the execution environment for computational tasks at Perlin, Life was built from the WebAssembly reference manual and uses a range of optimization techniques. There is no reliance on native dependencies and it can be cross-compiled to run on platforms such as Windows, Linux, MacOS, Android, and iOS. User code is sandboxed for security.

Where to download Life

You can download Life from a Perlin GitHub repo.

Nebulet

This in-development microkernel is about executing WebAssembly modules in ring 0 and a single address space to boost performance. The intent is that Nebulet will have significantly better performance in some workloads, which are likely to be server-related. Founder Lachlan Sneff recognizes that running modules in ring 0 might raise security flags, with concerns about Spectre, Meltdown, and other speculative execution bugs; currently, it is unclear how large of an issue this will be.

A Google Summer of Code project in 2018, Nebulet allows for low-context switch overhead, system calls being function calls, and optimizations not possible on conventional operating systems.

The Cranelift code generator compiles WebAssembly to native machine code. After compilation, there are no complex interactions between the application and runtime. Nebulet’s kernel is written in Rust.

Where to download Nebulet

You can download Nebulet from GitHub.

Wasabi

Wasabi, which stands for “WebAssembly analysis using binary instrumentation,” is a dynamic analysis framework. Wasabi observes properties of a program while the program is running. Dynamic analysis is used to fix bugs and identify performance bottlenecks and security problems.

Wasabi statically instruments a WebAssembly binary, such as program.wasm, inserting instructions in the program’s original instructions. Bytecode is modified to be independent of the source code. To perform dynamic analysis, the program is executed by opening the website with the now-instrumented program.wasm. To make user-written analysis functions known to the WebAssembly program, the wasabi.js script is added to the page alongside the analysis.js. Wasabi was written in Rust with some JavaScript code.

Where to download Wasabi

You can download Wasabi from the project’s GitHub repo.

Wasmjit

The embeddable Wasmjit WebAssembly runtime, with a core written in C90, is primarily targeted as a Linux kernel module that can host Emscripten-generated WebAssembly modules. In this configuration, it runs in ring 0, with access to system calls as normal function calls. Its developer, Ryan Hunter, hopes to have it included in the Linux kernel. Hunter recently had Wasmjt running an Nginx web server.

Similar to Nebulet, there have been security questions about Wasmjit, with concerns about potential vulnerability to Spectre and Meltdown. Wasmjit is vulnerable to Spectre but mitigations are being made.

Where to download Wasmjit

You can download Wasmjit from the project’s GitHub page.

WAVM

WAVM, the WebAssembly Virtual Machine, is a standalone VM for WebAssembly. It can load both the standard binary format as well as the text format defined by the WebAssembly reference interpreter. With the text format, WAVM can load both the standard stack machine syntax and AST syntax used by the reference interpreter, as well as all testing commands.

Building WAVM requires CMake build software and the LLVM 6.0 compiler. WAVM has been tested on Windows with C++, Linux with GCC and Clang, and MacOS with Xcode/Clang.

Where to download WAVM

You can download WAVM from GitHub.

WebAssembly Binary Toolkit (WABT)

Pronounced "wabbit," the WABT toolkit inspects a WebAssembly file or converts it from one from one format to another. Its tools include:

  • WABT, to translate from the WebAssembly text format to the binary format.
  • Wasm2wat, the inverse of WABT.
  • Wasm-objdump, to print information about a WebAssembly binary.
  • Wasm-interp, to decode and run a WebAssembly binary using a stack-based interpreter.
  • Wat-desugar, for parsing the .wat text form.
  • Wasm2c, to convert a WebAssembly binary file to a C source and header.

Used in the Mozilla Developer Network, WABT is in a stable form. New features are planned for WABT, including support for SIMD (single instruction, multiple data) and threads, as these get added to WebAssembly itself.

Where to download WABT

You can download WABT from GitHub.

WebAssembly Studio

The WebAssembly Studio online IDE, currently in beta and developed by Mozilla, is a collection of tools for working with WebAssembly that also serves as a teaching tool. Basic capabilities are provided for opening, downloading, editing, and deleting files. Developers also can upload files and directories. Projects can be forked, for sharing with others. Binary modules for WebAssembly as well as text files can be edited. WebAssembly Studio supports the C, C++ and Rust languages. Some features require hosted back-end services, such as compilation, but others run in the browser.

Where to get WebAssembly Studio

You can try out the WebAssembly Studio IDE online.

WebAssembly Toolkit for VS Code

An extension to Microsoft’s open source code editor, Visual Studio Code, the WebAssembly toolkit can preview WebAssembly binary files and highlight syntax for textual representation. The main goal of the extension is to help developers learn WebAssembly. Plans call for improving debugging and syntax highlighting in the extension. The extension is from developer Dmitry Tsvettsikh.

Where to download WebAssembly Toolkit for VS Code

You can download the WebAssembly Toolkit for VS Code from the Visual Studio Marketplace.

Copyright © 2018 IDG Communications, Inc.

InfoWorld Technology of the Year Awards 2023. Now open for entries!