Haoran Xu presents a groundbreaking compilation technique called copy-and-patch that rapidly compiles high-level languages and bytecode programs to binary code by leveraging a library of binary implementation variants known as stencils. This technique is used in compilers for a C-like language and WebAssembly, showing significantly faster code generation than traditional compilation methods like LLVM. The WebAssembly compiler outperforms Google Chrome’s Liftoff compiler on benchmarks. The system also demonstrates minimal compilation costs, producing code from an Abstract Syntax Tree faster than constructing the AST itself. This innovative approach challenges traditional compiler optimization levels and showcases impressive speed and performance gains.
https://arxiv.org/abs/2011.13127