arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2502.20547cs.PL
收藏

追赶 JIT 编译器的尝试:优化内联缓存的错误引导

An Attempt to Catch Up with JIT Compilers: The False Lead of Optimizing Inline Caches

Aurore Poirier, Erven Rohou, Manuel Serrano

AI总结:

本文尝试通过动态二进制修改优化内联缓存以提升 AoT JavaScript 编译器性能,但实验表明减少内存访问在当代架构上无法加速,揭示了编译器优化策略的新方向。

摘要:

背景:即时(JIT)编译器能够根据运行程序的持续剖析来特化其生成的代码。这使得它们相比必须一次性选择生成代码的前瞻(AoT)编译器具有优势。问题:通过在执行中添加动态二进制修改(DBM),是否有可能提高 AoT 编译器的性能?方法:我们在 Hopc AoT JavaScript 编译器中添加了一种基于 DBM 的新优化,应用于内联缓存(IC),这是动态语言用来高效实现对象属性访问的经典优化。知识:像新优化那样减少内存访问次数,在当代架构上并不会缩短执行时间。依据:我们实现的 DBM 优化在 x86_64 架构上完全可运行。我们进行了多项实验来评估其对性能的影响,并研究缺乏加速的原因。重要性:本文呈现的(负面)结果为实现动态语言的最佳策略提供了新的启示。它表明,过去那种总是通过移除指令或减少内存读取来加速的时代已经结束。如今,只有处理器自身无法加速代码时,实施复杂的编译器优化才值得付出努力。这一结果既适用于 AoT 编译器,也适用于 JIT 编译器。

英文摘要:

Context: Just-in-Time (JIT) compilers are able to specialize the code they generate according to a continuous profiling of the running programs. This gives them an advantage when compared to Ahead-of-Time (AoT) compilers that must choose the code to generate once for all. Inquiry: Is it possible to improve the performance of AoT compilers by adding Dynamic Binary Modification (DBM) to the executions? Approach: We added to the Hopc AoT JavaScript compiler a new optimization based on DBM to the inline cache (IC), a classical optimization dynamic languages use to implement object property accesses efficiently. Knowledge: Reducing the number of memory accesses as the new optimization does, does not shorten execution times on contemporary architectures. Grounding: The DBM optimization we have implemented is fully operational on x86_64 architectures. We have conducted several experiments to evaluate its impact on performance and to study the reasons of the lack of acceleration. Importance: The (negative) result we present in this paper sheds new light on the best strategy to be used to implement dynamic languages. It tells that the old days were removing instructions or removing memory reads always yielded to speed up is over. Nowadays, implementing sophisticated compiler optimizations is only worth the effort if the processor is not able by itself to accelerate the code. This result applies to AoT compilers as well as JIT compilers.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑