按菜单选择的堆栈替换
On-Stack Replacement à la Carte
摘要:
栈上替换(OSR)动态地在不同的代码版本之间转移执行。这种机制在主流运行时系统中使用,通过运行为实际工作负载提供最佳预期性能而定制的代码来支持自适应和推测优化。当前的方法要么限制OSR可以被激发的程序点,要么需要复杂的优化特定操作来在转换期间重新调整程序的状态。实现OSR的工程努力和抽象的缺乏使其很少被研究界所访问,留下了关于其灵活性的基本问题。在这篇文章中,我们向OSR的可证明的合理抽象框架迈出了第一步。我们表明,编译器优化可以在隔离的OSR感知,然后安全组成。我们确定了一类的转换,我们称之为活变量等效(LVE),捕获的基本编译器优化的自然属性,并设计了一种算法来自动生成所需的OSR机器在任意程序位置的LVE过渡。我们在LLVM中实现了我们的想法,并根据突出的基准对其进行了评估,表明在存在常见的,不受阻碍的全局优化的情况下,双向OSR转换几乎在代码中的任何地方都是可能的。然后,我们讨论了端到端的实用程序,我们的技术在源代码级调试的优化代码,显示我们的算法可以提供新的构建块的调试器的可执行文件和托管运行时。
英文摘要:
On-stack replacement (OSR) dynamically transfers execution between different code versions. This mechanism is used in mainstream runtime systems to support adaptive and speculative optimizations by running code tailored to provide the best expected performance for the actual workload. Current approaches either restrict the program points where OSR can be fired or require complex optimization-specific operations to realign the program's state during a transition. The engineering effort to implement OSR and the lack of abstractions make it rarely accessible to the research community, leaving fundamental question regarding its flexibility largely unexplored. In this article we make a first step towards a provably sound abstract framework for OSR. We show that compiler optimizations can be made OSR-aware in isolation, and then safely composed. We identify a class of transformations, which we call live-variable equivalent (LVE), that captures a natural property of fundamental compiler optimizations, and devise an algorithm to automatically generate the OSR machinery required for an LVE transition at arbitrary program locations. We present an implementation of our ideas in LLVM and evaluate it against prominent benchmarks, showing that bidirectional OSR transitions are possible almost everywhere in the code in the presence of common, unhindered global optimizations. We then discuss the end-to-end utility of our techniques in source-level debugging of optimized code, showing how our algorithms can provide novel building blocks for debuggers for both executables and managed runtimes.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。