TL;DR
The paper introduces copy-and-patch, a rapid compilation technique that stitches together precompiled code snippets to generate efficient binary code for high-level languages and bytecode, significantly reducing compilation time.
Contribution
It presents a novel copy-and-patch algorithm and stencil library construction method for fast, high-quality code generation in runtime compilation scenarios.
Findings
Code generation is two orders of magnitude faster than LLVM -O0 on TPC-H benchmarks.
WebAssembly compilation is 4.9X-6.5X faster than Liftoff.
Generated code outperforms Liftoff and LLVM in benchmarks.
Abstract
Fast compilation is important when compilation occurs at runtime, such as query compilers in modern database systems and WebAssembly virtual machines in modern browsers. We present copy-and-patch, an extremely fast compilation technique that also produces good quality code. It is capable of lowering both high-level languages and low-level bytecode programs to binary code, by stitching together code from a large library of binary implementation variants. We call these binary implementations stencils because they have holes where missing values must be inserted during code generation. We show how to construct a stencil library and describe the copy-and-patch algorithm that generates optimized binary code. We demonstrate two use cases of copy-and-patch: a compiler for a high-level C-like language intended for metaprogramming and a compiler for WebAssembly. Our high-level language…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
