Cheerp 2.7 Released

Today we announce the general availability of Cheerp 2.7, following the recent release candidate of February 24th, announced here.

Cheerp is an open-source, enterprise-grade C/C++ compiler that can generate WebAssembly, JavaScript, or a combination of the two. It is a commercial alternative to the Emscripten toolchain, focused on providing better interoperability with JavaScript and Web APIs, allowing to generate garbage-collectable JavaScript, smaller WebAssembly build size and better performance.

While also based on the LLVM/Clang stack, Cheerp does not rely on the LLVM WebAssembly backend, as Emscripten does. Cheerp is based on a custom extended Clang frontend and a custom LLVM backend.

Cheerp 2.7 is now generally available and can be downloaded here.

New in Cheerp 2.7

Note: most of these new features were discussed in our previous release candidate post .

Cheerp 2.7 features many significant improvements since release 2.6. The most visible contributions from a user perspective are listed below.

Cheerp is an open-source fork of LLVM’s clang, rebasing allows any upstream improvement to be enjoyed by Cheerp-processed codebases. New C++ features (eg. -std=c++20) and new optimizations and enhanced warning messages will be up-to-speed with the latest developments.

Cheerp now supports throwing and catching of both C++ exceptions and ‘native’ JavaScript exceptions, allowing both porting of exception-based C++ codebases, as well as better interaction with any JavaScript library.

Here is an example of exceptions in Cheerp:

Once compiled, this code can be used in JavaScript like this:

To enable exception support, simply pass the -fexceptions flag at compile time.

Cheerp code generation has gained the ability to generate ES6 modules. This allows Cheerp-compiled libraries to be more easily included in module-based JavaScript deployments. The command-line option -cheerp-make-module=es6 allows opt-in, with other options being commonjs, closure or no-module.

Example of usage at:

These two command-line options have now been deprecated.

-cfg-legacy had effect only in the selection of the internal stackifier algorithm. -cheerp-mode has been replaced already in Cheerp 2.6 by -target option that accepts either cheerp-wasm (the default) or cheerp (equivalent to -cheerp-mode=genericjs).

On our documentation the complete list of clang options.

Following feedback from users and clients, we are always on the lookout for improvements to the parser, better optimizations and improved code generation.

Thanks to a new optimization pass we introduced to LLVM, called the Partial Executer, and the combination of numerous minor optimizations, Cheerp has maintained its status as the C/C++ tooling that generates the smallest, fastest WebAssembly output. Full benchmarks against Emscripten are available in the original release candidate post.

In every release cycle we balance expanding the scope of the compiler with new features and improving its signature optimization capabilities. In Cheerp 2.7, we are very proud to introduce an innovative optimization technique acting at the LLVM’s IR level: Partial Executer. This optimization is the result of one year of work by the Leaning Technologies team, and has been described in detail on a dedicated blog post.

The core idea behind the Partial Executer pass is the following:

Given (partial) knowledge of the call-sites, it’s possible to prove that some edges in the Control Flow Graph are never taken?

If so, then it’s trivial to remove those edges and consequently remove unreachable BasicBlocks.

The basic idea expands on PreExecute, a Cheerp pass that uses LLVM’s own ExecutionEngine to try to complete the execution of the Globals initializers. If successful then it removes those calls while updating the global state Somehow similarly here we use the infrastructure that comes with the ExecutionEngine to execute Instructions coupled with a new component that navigates a function Control Flow Graph doing partial-execution starting from a given Call Site.

Getting started with Cheerp 2.7

Cheerp 2.7 is available for WindowsmacOS and Linux.

To get started with Cheerp, please visit the main Documentation page. You will find instructions on how to download, install and use Cheerp, as well as step-by-step tutorials.

HomeByMe, a home planning service developed by Dassault Systemes using Cheerp.


Leaning Technologies is a technology company with extensive experience in solutions for the Web as a platform.

We participate in WebAssembly standardisation, pushing the standard to enable further optimizations (branch_hinting and soon tail calls), we improve browser engines (V8 and the recently started work on JSC), and we develop and evolve three unique WebAssembly+JavaScript based solutions: CheerpCheerpJ and CheerpX.

With Cheerp 2.7, we are giving developers access to the same powerful too we use to make the WebVM — an in-browser Debian terminal.

Update your Cheerp version, or give try it for the first time getting started on our documentation.