WebAssembly

WebAssembly Linux Binary Format

This past week, I setup a custom binary format on my workstation for WebAssembly. Such formats can be setup without modifying the kernel thru the binfmt_misc capability built into the Linux kernel. This allows specifying an interpreter for files that are neither a native binary format nor a script starting with #!. In my case, I setup an interpreter for WebAssembly using the wasmtime runtime. To do so, I created a file at /etc/binfmt.

Minimal JavaScript Shim

Recently, I was reading this article about compiling Ada to WebAssembly and running in the browser. I haven’t used Ada and I don’t plan to, but because I was curious about how they were doing OpenGL from WebAssembly, I took a peak at the JavaScript shim they were using and found code like this: __adawebpack__html__Button__disabled_getter: function(identifier) { return +(__adawebpack_o2i.too(identifier).disabled); }, __adawebpack__html__Button__disabled_setter: function(identifier,to) { __adawebpack_o2i.too (identifier).disabled = (to !== 0); }, __adawebpack__html__Canvas__height_getter: function(identifier) { return __adawebpack_o2i.

WebAssembly Compiler

One milestone I will be looking forward to in the WebAssembly space is when a compiler that can output WebAssembly has been compiled to WebAssembly and is capable of compiling itself. The first compiler to do this will be the first native WebAssembly compiler. Right now, all compilers that output WebAssembly do so as a cross compiler, where the compiler is one instruction set (x86_64, aarm64, etc.) and outputs binaries in a different instruction set (WebAssembly aka.

WebAssembly Gateway Interface (WAGI)+IPFS

When I first came across WebAssembly, I was already aware of the IPFS project, and immediately thought that the two would work well together. Specifically, I thought that WebAssembly modules stored in IPFS could be loaded automatically by an edge web server to allow for dynamic content without a centralized server and without requiring IPFS on the device utilizing the service. The latter is important for supporting legacy devices and services that cannot be updated.

Crystal Wasm

Another weekend, another wabt-hole. I got crystal to compile to WebAsembly and then run in Brave, and it only took two days to get setup and get it to print out “Hello, World!” in the console. I have tried to use WebAssembly a couple of years ago, but dropped it once I failed to get a simple hello world program to function. This is the same reason I don’t have Haskell under my programming utility belt, no hello world.