A modular approach to on-stack replacement in LLVM

A modular approach to on-stack replacement in LLVM
复制标题

LLVM 中栈上替换的模块化方法

DOI:
10.1145/2451512.2451541
复制
发表时间:
2013
期刊:
Proceedings of the 14th ACM SIGPLAN/SIGOPS International Conference on Virtual Execution Environments
影响因子:
--
通讯作者:
L. Hendren
L. Hendren
中科院分区:
--
文献类型:
--
作者:
Nurudeen Lameed;L. Hendren

文献摘要

被引文献

相似文献

堆栈替换(OSR)是一种允许虚拟机在执行函数/方法期间中断运行代码的技术在中断的点和状态下中断函数。 OSR对于具有可能长期循环的程序特别有用,因为它允许在这些循环变得热时进行动态优化。 本文提出了一种用于实施LLVM编译器基础架构OSR的模块化方法。这是向前迈出的重要一步,因为LLVM正在获得大众的支持,并且添加OSR功能使编译器开发人员可以开发新的动态技术。特别是,它将实现更复杂的基于LLVM的JIT编译器方法。实际上,其他编译器/VM开发人员可以使用我们的方法,因为它是标准LLVM分布的清洁模块化。此外,我们的方法是在LLVM-IR级别完全定义的,因此不需要对目标代码生成进行任何修改。 OSR实现可以由不同的编译器使用来支持各种动态优化。为了证明我们的OSR方法,我们使用它来支持MCVM中的动态内部。 MCVM是使用基于LLVM的JIT编译器的MATLAB的虚拟机。 MATLAB是一种流行的动态语言,用于科学和工程应用,通常操纵大型矩阵,通常包含长期运行的循环,因此是动态JIT汇编和OSR的理想目标。使用我们的MCVM示例,我们为我们的基准设置展示了合理的间接开销,并在使用它执行动态内衬时的性能改进。
On-stack replacement (OSR) is a technique that allows a virtual machine to interrupt running code during the execution of a function/method, to re-optimize the function on-the-fly using an optimizing JIT compiler, and then to resume the interrupted function at the point and state at which it was interrupted. OSR is particularly useful for programs with potentially long-running loops, as it allows dynamic optimization of those loops as soon as they become hot. This paper presents a modular approach to implementing OSR for the LLVM compiler infrastructure. This is an important step forward because LLVM is gaining popular support, and adding the OSR capability allows compiler developers to develop new dynamic techniques. In particular, it will enable more sophisticated LLVM-based JIT compiler approaches. Indeed, other compiler/VM developers can use our approach because it is a clean modular addition to the standard LLVM distribution. Further, our approach is defined completely at the LLVM-IR level and thus does not require any modifications to the target code generation. The OSR implementation can be used by different compilers to support a variety of dynamic optimizations. As a demonstration of our OSR approach, we have used it to support dynamic inlining in McVM. McVM is a virtual machine for MATLAB which uses a LLVM-based JIT compiler. MATLAB is a popular dynamic language for scientific and engineering applications that typically manipulate large matrices and often contain long-running loops, and is thus an ideal target for dynamic JIT compilation and OSRs. Using our McVM example, we demonstrate reasonable overheads for our benchmark set, and performance improvements when using it to perform dynamic inlining.