一句话:提出通过投机性上下文分派从离线策划的代码库中选取已编译函数版本,以复用 JIT 编译代码,降低动态语言预热开销。
大多数代码会被多次执行,库在不同运行间往往不变,而即时编译器每次都重复收集信息并生成相同机器码,导致动态语言预热开销大。本文提出使用投机性上下文分派(speculative contextual dispatch)从离线策划的代码仓库中选择函数版本。该仓库是一个持久数据库,存储先前编译的函数,并以编译时的上下文为索引;通过策划去除冗余代码并优化分派。作者扩展了 R 语言的编译器 Ř,并评估其性能。结果表明,该方法在保持峰值性能的同时缩短了预热时间。
Most code is executed more than once. If not entire programs then libraries remain unchanged from one run to the next. Just-in-time compilers expend considerable effort gathering insights about code they compiled many times, and often end up generating the same binary over and over again. We explore how to reuse compiled code across runs of different programs to reduce warm-up costs of dynamic languages. We propose to use speculative contextual dispatch to select versions of functions from an off-line curated code repository . That repository is a persistent database of previously compiled functions indexed by the context under which they were compiled. The repository is curated to remove redundant code and to optimize dispatch. We assess practicality by extending Ř, a compiler for the R language, and evaluating its performance. Our results suggest that the approach improves warmup times while preserving peak performance.
@article{paperbot1880,
title = {Reusing Just-in-Time Compiled Code},
author = {Meetesh Kalpesh Mehta and Sebastián Krynski and Hugo Musso Gualandi and Manas Thakur and Jan Vitek},
journal = {Proceedings of the ACM on Programming Languages},
volume = {7},
number = {OOPSLA2},
year = {2023},
doi = {10.1145/3622839}
}