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

通过惰性基本块版本控制简单有效地删除类型检查

Simple and Effective Type Check Removal through Lazy Basic Block Versioning

Maxime Chevalier-Boisvert, Marc Feeley

摘要:

动态类型程序设计语言(如JavaScript和Python)将类型检查推迟到运行时间。为了最大化性能,动态语言VM实现必须尝试消除冗余的动态类型检查。然而,类型推断分析通常是昂贵的,并且涉及编译时间和结果精度之间的权衡。这导致了越来越复杂的多层VM架构的创建。本文介绍了懒惰基本块版本控制,一个简单的JIT编译技术,有效地消除冗余的类型检查,从关键代码路径。这种新颖的方法在传播上下文相关的类型信息的同时,动态地生成基本块的类型专用版本。这不需要使用昂贵的程序分析,不受传统类型分析的精度限制的限制,并避免了推测优化技术的实现复杂性。我们已经在一个JavaScript JIT编译器中实现了过程内惰性基本块版本控制。这种方法相比,一个经典的基于流的类型分析。懒惰的基本块版本控制在所有基准测试中表现得一样好或更好。平均而言,71%的类型测试被消除,产生高达50%的加速。我们还表明,我们的实现生成更有效的机器码比TraceMonkey,跟踪JIT编译器JavaScript,在几个基准测试。简单的实现、低算法复杂度和良好的运行时间性能使得基本的块版本控制对于基线JIT编译器很有吸引力。

英文摘要:

Dynamically typed programming languages such as JavaScript and Python defer type checking to run time. In order to maximize performance, dynamic language VM implementations must attempt to eliminate redundant dynamic type checks. However, type inference analyses are often costly and involve tradeoffs between compilation time and resulting precision. This has lead to the creation of increasingly complex multi-tiered VM architectures. This paper introduces lazy basic block versioning, a simple JIT compilation technique which effectively removes redundant type checks from critical code paths. This novel approach lazily generates type-specialized versions of basic blocks on-the-fly while propagating context-dependent type information. This does not require the use of costly program analyses, is not restricted by the precision limitations of traditional type analyses and avoids the implementation complexity of speculative optimization techniques. We have implemented intraprocedural lazy basic block versioning in a JavaScript JIT compiler. This approach is compared with a classical flow-based type analysis. Lazy basic block versioning performs as well or better on all benchmarks. On average, 71% of type tests are eliminated, yielding speedups of up to 50%. We also show that our implementation generates more efficient machine code than TraceMonkey, a tracing JIT compiler for JavaScript, on several benchmarks. The combination of implementation simplicity, low algorithmic complexity and good run time performance makes basic block versioning attractive for baseline JIT compilers.

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

↑