WebAssembly is one of the hottest topics in software development right now, particularly in the web applications ecosystem.

While its internals are still mysterious to many, here at Leaning Technologies we have been working with it daily for the last several years. As a matter of fact, we have been involved in compile-to-JavaScript since 2012, way before WebAssembly was announced, let alone implemented in major browsers.

Our company makes several tools that target WebAssembly on the browser: Cheerp (C++ to JavaScript/WebAssembly compiler, an alternative to Emscripten), CheerpJ (Java to JavaScript/WebAssembly with full runtime) and CheerpX (virtualization technology to run X86 binaries in the browser).

Between all our products, we are probably among the most intensive users of WebAssembly on the planet, and since a long time the issues we have can’t be resolved by a quick search on StackOverflow.

This is in particular true for CheerpX, a virtualization technology for WebAssembly, which is quite unique and in our view transformative. With CheerpX, you will eventually be able to run full operating systems on the browser, as well as Docker containers, or Linux libraries. The possibilities are very significant.

Although CheerpX is not available to the public yet, we are eager to show you something. We are releasing today a first, unpolished, tech demo. More information at the bottom of this post.

As part of CheerpX, we have implemented a fast x86 interpreter and JIT compiler that can generate WebAssembly modules on the fly to efficiently execute arbitrary x86 applications and libraries, fully client-side.

As a first technical application of CheerpX, we are currently focusing on Linux binaries and in particular on virtualizing the Flash binary plugin, but the architecture is fully general and we plan to eventually support whole operating systems. Several early adopters are testing CheerpX right now, and the first applications to use it in production are expected in a few months.

Far from the most widespread model of ahead-of-time compilation (C++, Rust, etc), CheerpX is pushing WebAssembly to its absolute limits, and after more than 12 months of working on this project I have countless stories about things that start breaking when getting close to these limits.

This article is intended as the first of a series about the problems we have found on our way when using WebAssembly, and how we have solved them. It is also going to be, at times, a call to action to the WebAssembly community, with the purpose of shining a light on the limitations and inefficiencies of the WebAssembly VMs currently available, and how to overcome them.

To start with, I will try to explain some of the magic behind CheerpX. How can we even run arbitrary x86 code in the browser? In particular: how do we deal with the arbitrary control flow of x86 code.

#webassembly #virtualization #flash #javascript

Extreme WebAssembly 1: pushing browsers to their absolute limits
2.25 GEEK