Abstract
On-stack replacement (OSR) is essential technology for adaptive optimization, allowing changes to code actively executing in a managed runtime. The engineering aspects of OSR are well-known among VM architects, with several implementations available to date. However, OSR is yet to be explored as a general means to transfer execution between related program versions, which can pave the road to unprecedented applications that stretch beyond VMs. We aim at filling this gap with a constructive and provably correct OSR framework, allowing a class of general-purpose transformation functions to yield a special-purpose replacement. We describe and evaluate an implementation of our technique in LLVM. As a novel application of OSR, we present a feasibility study on debugging of optimized code, showing how our techniques can be used to fix variables holding incorrect values at breakpoints due to optimizations.
Supplemental Material
- Ali-Reza Adl-Tabatabai. 1996. Source-Level Debugging of Globally Optimized Code. Ph.D. Dissertation. Carnegie Mellon University, Pittsburgh, PA, USA. Advisor(s) Gross, Thomas. URL http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.73.5762. Accessed: 2016-06-18.Google Scholar
- Ali-Reza Adl-Tabatabai and Thomas Gross. 1996. Source-level Debugging of Scalar Optimized Code. In Proceedings of the ACM SIGPLAN 1996 Conference on Programming Language Design and Implementation (PLDI '96). ACM, New York, NY, USA, 33-43. Google Scholar
Digital Library
- Vasanth Bala, Evelyn Duesterwald, and Sanjeev Banerjia. 2000. Dynamo: A Transparent Dynamic Optimization System. In Proceedings of the ACM SIGPLAN 2000 Conference on Programming Language Design and Implementation (PLDI '00). ACM, New York, NY, USA, 1-12. Google Scholar
Digital Library
- Roberto Baldoni, Emilio Coppa, Daniele Cono D'Elia, Camil Demetrescu, and Irene Finocchi. 2018. A Survey of Symbolic Execution Techniques. ACM Comput. Surv. 51, 3 (2018). Google Scholar
Digital Library
- Earl T. Barr and Mark Marron. 2014. TARDIS: Affordable Time-travel Debugging in Managed Runtimes. In Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages & Applications (OOPSLA '14). ACM, New York, NY, USA, 67-82. Google Scholar
Digital Library
- Gilles Barthe, Juan Manuel Crespo, and César Kunz. 2011. Relational Verification Using Product Programs. In Proceedings of the 17th International Conference on Formal Methods (FM'11). Springer-Verlag, Berlin, Heidelberg, 200-214. http://dl.acm.org/citation.cfm?id=2021296.2021319 Google Scholar
Digital Library
- Michael Bebenita, Florian Brandner, Manuel Fahndrich, Francesco Logozzo, Wolfram Schulte, Nikolai Tillmann, and Herman Venter. 2010. SPUR: A Trace-based JIT Compiler for CIL. In Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications (OOPSLA '10). ACM, New York, NY, USA, 708-725. Google Scholar
Digital Library
- Abhilash Bhandari and V. Krishna Nandivada. 2015. Loop Tiling in the Presence of Exceptions. In 29th European Conference on Object-Oriented Programming (ECOOP 2015) (Leibniz International Proceedings in Informatics (LIPIcs)), John Tang Boyland (Ed.), Vol. 37. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany, 124- 148.Google Scholar
- E. M. Clarke, E. A. Emerson, and A. P. Sistla. 1986. Automatic Verification of Finite-state Concurrent Systems Using Temporal Logic Specifications. ACM Transactions on Programming Languages and Systems 8, 2 (April 1986), 244-263. Google Scholar
Digital Library
- Keith D. Cooper, L. Taylor Simpson, and Christopher A. Vick. 2001. Operator Strength Reduction. ACM Transactions on Programming Languages and Systems 23, 5 (Sept. 2001), 603-625. Google Scholar
Digital Library
- Max Copperman and Charles E. McDowell. 1993. A Further Note on Hennessy's "Symbolic Debugging of Optimized Code". ACM Transactions Programming Languages and Systems 15, 2 (April 1993), 357-365. Google Scholar
Digital Library
- Ron Cytron, Jeanne Ferrante, Barry K. Rosen, Mark N. Wegman, and F. Kenneth Zadeck. 1991. Efficiently Computing Static Single Assignment Form and the Control Dependence Graph. ACM Transactions on Programming Languages and Systems 13, 4 (Oct. 1991), 451-490. Google Scholar
Digital Library
- Daniele Cono D'Elia and Camil Demetrescu. 2016. Flexible On-stack Replacement in LLVM. In Proceedings of the 2016 International Symposium on Code Generation and Optimization (CGO 2016). ACM, New York, NY, USA, 250-260. Google Scholar
Digital Library
- Thomas G. Evans and D. Lucille Darley. 1966. On-line Debugging Techniques: A Survey. In Proceedings of the November 7-10, 1966, Fall Joint Computer Conference (AFIPS '66 (Fall)). ACM, New York, NY, USA, 37-50. Google Scholar
Digital Library
- Stephen J Fink and Feng Qian. 2003. Design, Implementation and Evaluation of Adaptive Recompilation with On-Stack Replacement. In Proceedings of the International Symposium on Code Generation and Optimization: Feedback-directed and Runtime Optimization (CGO '03). IEEE Computer Society, 241-252. Google Scholar
Digital Library
- Olivier Flückiger, Gabriel Scherer, Ming-Ho Yee, Aviral Goel, Amal Ahmed, and Jan Vitek. 2017. Correctness of Speculative Optimizations with Dynamic Deoptimization. Proc. ACM Program. Lang. 2, POPL, Article 49 (Dec. 2017), 28 pages. Google Scholar
Digital Library
- Andreas Gal, Brendan Eich, Mike Shaver, David Anderson, David Mandelin, Mohammad R. Haghighat, Blake Kaplan, Graydon Hoare, Boris Zbarsky, Jason Orendorff, Jesse Ruderman, EdwinW. Smith, Rick Reitmaier, Michael Bebenita, Mason Chang, and Michael Franz. 2009. Trace-based Just-in-Time Type Specialization for Dynamic Languages. In Proceedings of the 30th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI '09). ACM, New York, NY, USA, 465-478. Google Scholar
Digital Library
- Shu-yu Guo and Jens Palsberg. 2011. The Essence of Compiling with Traces. In Proceedings of the 38th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL '11). ACM, New York, NY, USA, 563-574. Google Scholar
Digital Library
- Christopher M. Hayden, Stephen Magill, Michael Hicks, Nate Foster, and Jeffrey S. Foster. 2012. Specifying and Verifying the Correctness of Dynamic Software Updates. In Proceedings of the 4th International Conference on Verified Software: Theories, Tools, Experiments (VSTTE'12). Springer-Verlag, Berlin, Heidelberg, 278-293. Google Scholar
Digital Library
- John Hennessy. 1982. Symbolic Debugging of Optimized Code. ACM Transactions on Programming Languages and Systems 4, 3 (July 1982), 323-344. Google Scholar
Digital Library
- John L. Henning. 2006. SPEC CPU2006 Benchmark Descriptions. SIGARCH Computer Architecture News 34, 4 (Sept. 2006), 1-17. Google Scholar
Digital Library
- Michael Hicks and Scott Nettles. 2005. Dynamic Software Updating. ACM Trans. Program. Lang. Syst. 27, 6 (Nov. 2005), 1049-1096. Google Scholar
Digital Library
- Urs Hölzle, Craig Chambers, and David Ungar. 1992. Debugging Optimized Code with Dynamic Deoptimization. In Proceedings of the ACM SIGPLAN 1992 Conference on Programming Language Design and Implementation (PLDI '92). ACM, New York, NY, USA, 32-43. Google Scholar
Digital Library
- Urs Hölzle and David Ungar. 1994. A Third-generation SELF Implementation: Reconciling Responsiveness with Performance. In Proceedings of the Ninth Annual Conference on Object-oriented Programming Systems, Language, and Applications (OOPSLA '94). ACM, New York, NY, USA, 229-243. Google Scholar
Digital Library
- Clara Jaramillo, Rajiv Gupta, and Mary Lou Soffa. 2000. FULLDOC: A Full Reporting Debugger for Optimized Code. In Proceedings of the 7th International Symposium on Static Analysis (SAS '00). Springer, Berlin, Heidelberg, 240-259. Google Scholar
Digital Library
- Sudipta Kundu, Zachary Tatlock, and Sorin Lerner. 2009. Proving Optimizations Correct Using Parameterized Program Equivalence. In Proceedings of the 30th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI '09). ACM, New York, NY, USA, 327-337. Google Scholar
Digital Library
- David Lacey, Neil D. Jones, Eric Van Wyk, and Carl Christian Frederiksen. 2002. Proving Correctness of Compiler Optimizations by Temporal Logic. In Proceedings of the 29th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL '02). ACM, New York, NY, USA, 283-294. Google Scholar
Digital Library
- David Lacey, Neil D. Jones, Eric Van Wyk, and Carl Christian Frederiksen. 2004. Compiler Optimization Correctness by Temporal Logic. Higher-Order and Symbolic Computation 17, 3 (Sept. 2004), 173-206. Google Scholar
Digital Library
- Nurudeen A. Lameed and Laurie J. Hendren. 2013. A Modular Approach to On-Stack Replacement in LLVM. In Proceedings of the 9th ACM SIGPLAN/SIGOPS International Conference on Virtual Execution Environments (VEE '13). ACM, New York, NY, USA, 143-154. Google Scholar
Digital Library
- Sorin Lerner, Todd Millstein, and Craig Chambers. 2003. Automatically Proving the Correctness of Compiler Optimizations. In Proceedings of the ACM SIGPLAN 2003 Conference on Programming Language Design and Implementation (PLDI '03). ACM, New York, NY, USA, 220-231. Google Scholar
Digital Library
- Sorin Lerner, Todd Millstein, Erika Rice, and Craig Chambers. 2005. Automated Soundness Proofs for Dataflow Analyses and Transformations via Local Rules. In Proceedings of the 32Nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL '05). ACM, New York, NY, USA, 364-377. Google Scholar
Digital Library
- Nuno P. Lopes, David Menendez, Santosh Nagarakatte, and John Regehr. 2015. Provably Correct Peephole Optimizations with Alive. In Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI '15). ACM, New York, NY, USA, 22-32. Google Scholar
Digital Library
- Stephen Magill, Michael Hicks, Suriya Subramanian, and Kathryn S. McKinley. 2012. Automating Object Transformations for Dynamic Software Updating. In Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications (OOPSLA '12). ACM, New York, NY, USA, 265-280. Google Scholar
Digital Library
- Stephen Magill, Ming-Hsien Tsai, Peter Lee, and Yih-Kuen Tsay. 2008. THOR: A Tool for Reasoning About Shape and Arithmetic. In Proceedings of the 20th International Conference on Computer Aided Verification (CAV '08). Springer-Verlag, Berlin, Heidelberg, 428-432. Google Scholar
Digital Library
- George C. Necula. 2000. Translation Validation for an Optimizing Compiler. In Proceedings of the ACM SIGPLAN 2000 Conference on Programming Language Design and Implementation (PLDI '00). ACM, New York, NY, USA, 83-94. Google Scholar
Digital Library
- Karl J. Ottenstein, Robert A. Ballance, and Arthur B. MacCabe. 1990. The Program Dependence Web: A Representation Supporting Control-, Data-, and Demand-driven Interpretation of Imperative Languages. In Proceedings of the ACM SIGPLAN 1990 Conference on Programming Language Design and Implementation (PLDI '90). ACM, New York, NY, USA, 257-271. Google Scholar
Digital Library
- Michael Paleczny, Christopher Vick, and Cliff Click. 2001. The Java HotSpot? Server Compiler. In Proceedings of the 2001 Symposium on JavaTM Virtual Machine Research and Technology Symposium - Volume 1 (JVM'01). USENIX Association, Berkeley, CA, USA. Google Scholar
Digital Library
- Phoronix. 2016. Phoronix Test Suite (PTS). (2016). URL http://www.phoronix-test-suite.com/. Accessed: 2017-04-09.Google Scholar
- Amir Pnueli, Michael Siegel, and Eli Singerman. 1998. Translation Validation. In Proceedings of the 4th International Conference on Tools and Algorithms for Construction and Analysis of Systems (TACAS '98). Springer-Verlag, London, UK, UK, 151-166. Google Scholar
Digital Library
- David Schneider and Carl Friedrich Bolz. 2012. The Efficient Handling of Guards in the Design of RPython's Tracing JIT. In Proceedings of the Sixth ACM Workshop on Virtual Machines and Intermediate Languages (VMIL '12). ACM, New York, NY, USA, 3-12. Google Scholar
Digital Library
- Suriya Subramanian. 2010. Dynamic Software Updates: A VM-Centric Approach. Ph.D. Dissertation. The University of Texas at Austin, Austin, TX, USA. Advisor(s) McKinley, Kathryn. URL https://suriya.github.io/papers/suriya-thesis-final.pdf. Accessed: 2017-11-13.Google Scholar
- Suriya Subramanian, Michael Hicks, and Kathryn S. McKinley. 2009. Dynamic Software Updates: A VM-centric Approach. In Proceedings of the 30th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI '09). ACM, New York, NY, USA, 1-12. Google Scholar
Digital Library
- Kunshan Wang, Stephen M. Blackburn, Antony L. Hosking, and Michael Norrish. 2018. Hop, Skip, & Jump: Practical On-Stack Replacement for a Cross-Platform Language-Neutral VM. In Proceedings of the 14th ACM SIGPLAN/SIGOPS International Conference on Virtual Execution Environments (VEE '18). ACM, New York, NY, USA, 1-16. Google Scholar
Digital Library
- Kunshan Wang, Yi Lin, Stephen M. Blackburn, Michael Norrish, and Antony L. Hosking. 2015. Draining the Swamp: Micro Virtual Machines as Solid Foundation for Language Development. In 1st Summit on Advances in Programming Languages, SNAPL 2015, May 3-6, 2015, Asilomar, California, USA. 321-336.Google Scholar
- Christian Wimmer, Vojin Jovanovic, Erik Eckstein, and Thomas Würthinger. 2017. One Compiler: Deoptimization to Optimized Code. In Proceedings of the 26th International Conference on Compiler Construction (CC 2017). ACM, New York, NY, USA, 55-64. Google Scholar
Digital Library
- Christian Wimmer and Thomas Würthinger. 2012. Truffle: A Self-optimizing Runtime System. In Proceedings of the 3rd Annual Conference on Systems, Programming, and Applications: Software for Humanity (SPLASH '12). ACM, New York, NY, USA, 13-14. Google Scholar
Digital Library
- Le-Chun Wu, Rajiv Mirani, Harish Patil, Bruce Olsen, and Wen-mei W. Hwu. 1999. A New Framework for Debugging Globally Optimized Code. In Proceedings of the ACM SIGPLAN 1999 Conference on Programming Language Design and Implementation (PLDI '99). ACM, New York, NY, USA, 181-191. Google Scholar
Digital Library
- Thomas Würthinger, Christian Wimmer, Christian Humer, Andreas Wöß, Lukas Stadler, Chris Seaton, Gilles Duboscq, Doug Simon, and Matthias Grimmer. 2017. Practical Partial Evaluation for High-performance Dynamic Language Runtimes. In Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2017). ACM, New York, NY, USA, 662-676. Google Scholar
Digital Library
- Thomas Würthinger, Christian Wimmer, Andreas Wöß, Lukas Stadler, Gilles Duboscq, Christian Humer, Gregor Richards, Doug Simon, and Mario Wolczko. 2013. One VM to Rule Them All. In Proceedings of the 2013 ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming & Software (Onward! 2013). ACM, New York, NY, USA, 187-204. Google Scholar
Digital Library
- Polle T. Zellweger. 1983. An Interactive High-level Debugger for Control-flow Optimized Programs. In Proceedings of the Symposium on High-level Debugging (SIGSOFT '83). ACM, New York, NY, USA, 159-172. Google Scholar
Digital Library
- Yudi Zheng, Lubomír Bulej, and Walter Binder. 2015. Accurate Profiling in the Presence of Dynamic Compilation. In Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA 2015). ACM, New York, NY, USA, 433-450. Google Scholar
Digital Library
Index Terms
On-stack replacement, distilled
Recommendations
On-stack replacement, distilled
PLDI 2018: Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and ImplementationOn-stack replacement (OSR) is essential technology for adaptive optimization, allowing changes to code actively executing in a managed runtime. The engineering aspects of OSR are well-known among VM architects, with several implementations available to ...
Flexible on-stack replacement in LLVM
CGO '16: Proceedings of the 2016 International Symposium on Code Generation and OptimizationOn-Stack Replacement (OSR) is a technique for dynamically transferring execution between different versions of a function at run time. OSR is typically used in virtual machines to interrupt a long-running function and recompile it at a higher ...
EDO: Exception-directed optimization in java
Optimizing exception handling is critical for programs that frequently throw exceptions. We observed that there are many such exception-intensive programs written in Java. There are two commonly used exception handling techniques, stack unwinding and ...







Comments