使用上下文驱动的基本块版本控制删除动态类型测试
Removing Dynamic Type Tests with Context-Driven Basic Block Versioning
摘要:
动态类型是动态规划语言的一个重要特性。诸如用于执行算术和比较的那些操作符之类的原语操作符通常对各种各样的输入值类型进行操作,因此,必须在内部实现某种形式的动态类型分派和类型检查。删除此类类型测试对于有效的实现非常重要。在本文中,我们研究了一种新的方法,以减少动态执行的类型测试称为上下文驱动的基本块版本的数量的有效性。这种简单的技术克隆和专门化基本块,使编译器在生成机器码时可以积累类型信息,而无需单独的类型分析过程。积累的信息允许删除一些冗余的类型测试,特别是在性能-关键路线。我们已经在一个JavaScript JIT编译器中实现了过程内上下文驱动的基本块版本控制。为了进行比较,我们还实现了一个经典的基于流的类型分析,对相同的具体类型进行操作。我们的研究结果表明,基本块版本控制在大多数基准测试中表现更好,并以适度的代码大小增加为代价删除了很大一部分类型测试。我们相信,这种技术提供了一个很好的实现复杂性和性能之间的权衡,并适合在生产JIT编译器的集成。
英文摘要:
Dynamic typing is an important feature of dynamic programming languages. Primitive operators such as those for performing arithmetic and comparisons typically operate on a wide variety of in put value types, and as such, must internally implement some form of dynamic type dispatch and type checking. Removing such type tests is important for an efficient implementation. In this paper, we examine the effectiveness of a novel approach to reducing the number of dynamically executed type tests called context-driven basic block versioning. This simple technique clones and specializes basic blocks in such a way as to allow the compiler to accumulate type information while machine code is generated, without a separate type analysis pass. The accumulated information allows the removal of some redundant type tests, particularly in performance-critical paths. We have implemented intraprocedural context-driven basic block versioning in a JavaScript JIT compiler. For comparison, we have also implemented a classical flow-based type analysis operating on the same concrete types. Our results show that basic block versioning performs better on most benchmarks and removes a large fraction of type tests at the expense of a moderate code size increase. We believe that this technique offers a good tradeoff between implementation complexity and performance, and is suitable for integration in production JIT compilers.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。