arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 1909.08815cs.PL
收藏

用循环重构和抽取支持非结构化语言的栈上替换

Supporting On-Stack Replacement in Unstructured Languages by Loop Reconstruction and Extraction

Raphael Mosaner, David Leopoldseder, Manuel Rigger, Roland Schatz, Hanspeter Mössenböck

摘要:

栈上替换(OSR)是动态编译器用来减少程序预热待用时间的常用技术。OSR允许在代码执行期间从解释代码切换到编译代码。主要目标是长时间运行的循环,需要显式表示,并使用有关条件和主体的专用信息,以便在运行时间进行优化。然而,字节码解释器通过非结构化跳转隐式地表示控制流,因此不表现出所需的高级循环表示。为了使OSR也跳跃为基础的-通常称为非结构化的语言,我们提出了部分重建循环,以明确表示它们在字节码解释器。除了概述总体思路外,我们还在Sulong中实现了我们的方法,Sulong是LLVM位代码的字节码解释器,它允许执行C/C++。我们使用一组C基准测试进行了评估,结果显示某些基准测试的预热速度高达9倍。这有助于在很少调用的函数中执行长时间运行循环的程序,如果没有OSR,这将导致显着的速度下降。虽然显示了一个原型实现,我们的方法的总体思想是概括所有字节码解释器。

英文摘要:

On-stack replacement (OSR) is a common technique employed by dynamic compilers to reduce program warm-up time. OSR allows switching from interpreted to compiled code during the execution of this code. The main targets are long running loops, which need to be represented explicitly, with dedicated information about condition and body, to be optimized at run time. Bytecode interpreters, however, represent control flow implicitly via unstructured jumps and thus do not exhibit the required high-level loop representation. To enable OSR also for jump-based - often called unstructured - languages, we propose the partial reconstruction of loops in order to explicitly represent them in a bytecode interpreter. Besides an outline of the general idea, we implemented our approach in Sulong, a bytecode interpreter for LLVM bitcode, which allows the execution of C/C++. We conducted an evaluation with a set of C benchmarks, which showed speed-ups in warm-up of up to 9x for certain benchmarks. This facilitates execution of programs with long-running loops in rarely called functions, which would yield significant slowdown without OSR. While shown with a prototype implementation, the overall idea of our approach is generalizable for all bytecode interpreters.

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

↑