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 compiler has negligible compilation cost: it produces code from an AST in less time than it takes to construct the AST. We have implemented an SQL database query compiler on top of this metaprogramming system and show that on TPC-H database benchmarks, copy-and-patch generates code two orders of magnitude faster than LLVM -O0 and three orders of magnitude faster than higher optimization levels. The generated code runs an order of magnitude faster than interpretation and 14% faster than LLVM -O0. Our WebAssembly compiler generates code 4.9X-6.5X faster than Liftoff, the WebAssembly baseline compiler in Google Chrome. The generated code also outperforms Liftoff's by 39%-63% on the Coremark and PolyBenchC WebAssembly benchmarks.


翻译:当在运行时进行编译,例如现代数据库系统中的查询汇编器和现代浏览器中的WebAssembly 虚拟机器中的查询汇编器等,快速编译非常重要。我们展示了极快的编译技术,这是一个极快的编译技术,它也产生高质量的代码。它能够将高层次语言和低层次的字节程序降低到二进制代码,从一个大型的二进制执行变量库中缝合代码。我们将这些二进制执行程序称为“小”标准,因为它们有在代码生成过程中必须插入缺失值的洞洞。我们展示了如何在Stenciil库中建一个存储器库并描述生成优化的基线二进制代码代码的复制和批配算算法。我们展示了两个版本的复制和批录案例:一个用于元程序编排的高C类语言的编译器,而我们高层次的语言编译器的编译器比创建AST要快得多。我们还在两个版本系统顶端上安装了一个SQLLLLC的调调调调快的代码, 以比我们更高级的版本的版本的版本的LPSerma的版本的调调调调调调调调调调调调快。

0
下载
关闭预览

相关内容

【EMNLP2020】自然语言生成,Neural Language Generation
专知会员服务
38+阅读 · 2020年11月20日
【文本生成现代方法】Modern Methods for Text Generation
专知会员服务
43+阅读 · 2020年9月11日
【Manning新书】现代Java实战,592页pdf
专知会员服务
98+阅读 · 2020年5月22日
因果图,Causal Graphs,52页ppt
专知会员服务
242+阅读 · 2020年4月19日
强化学习最新教程,17页pdf
专知会员服务
171+阅读 · 2019年10月11日
【泡泡汇总】CVPR2019 SLAM Paperlist
泡泡机器人SLAM
14+阅读 · 2019年6月12日
Call for Participation: Shared Tasks in NLPCC 2019
中国计算机学会
5+阅读 · 2019年3月22日
无监督元学习表示学习
CreateAMind
26+阅读 · 2019年1月4日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 2019年1月3日
disentangled-representation-papers
CreateAMind
26+阅读 · 2018年9月12日
Hierarchical Disentangled Representations
CreateAMind
4+阅读 · 2018年4月15日
条件GAN重大改进!cGANs with Projection Discriminator
CreateAMind
8+阅读 · 2018年2月7日
gan生成图像at 1024² 的 代码 论文
CreateAMind
4+阅读 · 2017年10月31日
Adversarial Variational Bayes: Unifying VAE and GAN 代码
CreateAMind
7+阅读 · 2017年10月4日
Auto-Encoding GAN
CreateAMind
7+阅读 · 2017年8月4日
Arxiv
6+阅读 · 2021年6月24日
Arxiv
5+阅读 · 2019年8月22日
Arxiv
5+阅读 · 2019年4月21日
Arxiv
7+阅读 · 2018年1月21日
VIP会员
相关VIP内容
【EMNLP2020】自然语言生成,Neural Language Generation
专知会员服务
38+阅读 · 2020年11月20日
【文本生成现代方法】Modern Methods for Text Generation
专知会员服务
43+阅读 · 2020年9月11日
【Manning新书】现代Java实战,592页pdf
专知会员服务
98+阅读 · 2020年5月22日
因果图,Causal Graphs,52页ppt
专知会员服务
242+阅读 · 2020年4月19日
强化学习最新教程,17页pdf
专知会员服务
171+阅读 · 2019年10月11日
相关资讯
【泡泡汇总】CVPR2019 SLAM Paperlist
泡泡机器人SLAM
14+阅读 · 2019年6月12日
Call for Participation: Shared Tasks in NLPCC 2019
中国计算机学会
5+阅读 · 2019年3月22日
无监督元学习表示学习
CreateAMind
26+阅读 · 2019年1月4日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 2019年1月3日
disentangled-representation-papers
CreateAMind
26+阅读 · 2018年9月12日
Hierarchical Disentangled Representations
CreateAMind
4+阅读 · 2018年4月15日
条件GAN重大改进!cGANs with Projection Discriminator
CreateAMind
8+阅读 · 2018年2月7日
gan生成图像at 1024² 的 代码 论文
CreateAMind
4+阅读 · 2017年10月31日
Adversarial Variational Bayes: Unifying VAE and GAN 代码
CreateAMind
7+阅读 · 2017年10月4日
Auto-Encoding GAN
CreateAMind
7+阅读 · 2017年8月4日
Top
微信扫码咨询专知VIP会员