Generated by GPT-5-mini| emscripten-fastcomp | |
|---|---|
| Name | emscripten-fastcomp |
| Developer | |
| Initial release | 2015 |
| Latest release | discontinued (2017) |
| Programming language | C++, Python |
| Platform | Cross-platform |
| License | LLVM License |
| Website | Emscripten project archives |
emscripten-fastcomp is a discontinued fork of LLVM/Clang maintained by Google to support the Emscripten toolchain for compiling C++ and C to WebAssembly and asm.js. It served as an alternative backend that integrated custom code generation, runtime stubs, and bitcode handling to bridge native toolchains like GCC and Visual Studio with browser targets such as Google Chrome, Mozilla Firefox, Microsoft Edge, and Safari. Its development influenced later unification efforts that merged features back into upstream LLVM Project and Clang releases.
emscripten-fastcomp originated within the Emscripten project as a pragmatic fork of LLVM 3.6 and Clang 3.6 to accelerate support for web-targeted code generation. Driven by contributors from Google and the Emscripten community, the fork patched code generation paths to emit asm.js and early WebAssembly prototypes, while integrating runtime behaviors for HTML5 APIs and WebGL. As browser vendors like Mozilla and Google implemented optimizing tiers in JavaScriptCore and V8, fastcomp evolved to keep pace, leading to collaborations with projects such as Binaryen and exchanges with the LLVM Developers mailing lists. By 2017, efforts consolidated: upstream LLVM integrated many fastcomp ideas, and the Emscripten project transitioned to using standard Clang/LLVM releases, deprecating the fork.
The architecture centered on a modified backend of LLVM that produced specialized intermediate representations and object files consumable by the Emscripten JavaScript emitter. Core components included a patched Clang front end for parsing C/C++ with target triple adjustments, a customized LLVM IR optimizer pipeline, and a code generator emitting either asm.js-oriented bitcode or early WASM-oriented output. Supporting pieces were integration points with Binaryen for post-processing, runtime shims tied to POSIX-like emulation layers, and build tooling leveraging systems such as CMake, Ninja, and Autotools. The design emphasized interoperability with native toolchains like MSVC on Windows, gcc on Linux, and Clang on macOS.
A typical compilation workflow began with Clang-based parsing of C++ source into LLVM IR, followed by fastcomp-specific optimization passes. The pipeline applied link-time optimizations and custom lowering passes to adapt code for browser execution models and address sanitization adaptations where necessary. After code generation, output underwent conversion to bitcode archives and integration with Emscripten’s JavaScript runtime stubs that provided interfaces to WebGL, WebAudio API, and DOM-related functionality. The final stage used tools like Binaryen or Emscripten’s asm.js backend to produce deployable artifacts that ran on engines including V8, SpiderMonkey, and JavaScriptCore.
Fastcomp introduced several targeted features absent from contemporary upstream Clang/LLVM releases at the time. It implemented custom codegen for emitting efficient asm.js patterns, adjustments to exception handling models to match browser constraints, and tailored linking semantics that worked with Emscripten’s single-file output strategy. The fork also contained patches for 32-bit/64-bit pointer emulation and addressing differences between native ABIs and web runtimes. Unlike upstream LLVM Project releases, it prioritized compatibility with browser JIT heuristics in V8 and SpiderMonkey, and included workarounds for platform-specific toolchains such as MinGW and Cygwin on Windows.
In practice, Emscripten users selected fastcomp as an alternate "LLVM backend" via Emscripten’s SDK and build scripts, invoking emcc and em++ wrappers that targeted the forked toolchain. Integration required matching fastcomp releases to Emscripten versions and coordinating with build systems like CMake or custom Makefile workflows used by projects such as game engines and multimedia libraries. Popular projects that historically used the toolchain included ports of SDL, OpenAL, Bullet Physics, and emulations of POSIX-style APIs for ports from Linux desktops to the web. The Emscripten repository provided prebuilt binaries and build recipes to simplify adoption across continuous integration environments like Travis CI and Jenkins.
Performance behavior depended heavily on browser JIT implementations: fastcomp-generated asm.js often achieved substantial speed on V8 and SpiderMonkey due to predictable code patterns, while early WebAssembly support required additional tuning. Limitations included divergence from upstream LLVM development, necessitating maintenance overhead to rebased patches and merge conflicts, and incomplete support for modern C++11/C++14 features until later upstream merges. Other constraints involved debugging complexity when mapping source-level constructs to emitted JavaScript, and challenges with features like threading and SIMD which relied on browser capabilities in Web Workers and experimental APIs.
Category:Compilers