Abstract
Reversible programming languages have been a focus of research for more than the last decade mostly due to the work of Glück, Yokoyama, Mogensen, and many others. In this paper we report about our recent activities to optimize reversible code with respect to execution time. Based on our rc3-compiler which compiles Janus to reversible static-single-assignment form RSSA, we had explored and implemented optimization algorithms for local common-subexpression elimination, constant propagation, and folding and have presented those at SOAP 2021. This paper focuses on new achievements for procedure inlining as well as elimination of dead code. Our compiler is—to our knowledge—the first optimizing compiler for reversible languages. Whereas these optimizations are well established for “traditional” languages, programs that can be executed forwards and backwards require different and novel approaches.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
Aho, A., Sethi, R., Ullman, J.: Compilers: Principles, Techniques and Tools. Addison-Wesley, Boston (1986)
Appel, A.W.: Modern Compiler Implementation in Java. Cambridge University Press, Cambridge (1998)
Axelsen, H.B.: Clean translation of an imperative reversible programming language. In: Knoop, J. (ed.) CC 2011. LNCS, vol. 6601, pp. 144–163. Springer, Heidelberg (2011). https://doi.org/10.1007/978-3-642-19861-8_9
Deworetzki, N., Meyer, U.: Program analysis for reversible languages. In: Proceedings of the 10th ACM SIGPLAN International Workshop on the State of the Art in Program Analysis, SOAP 2021, pp. 13–18. Association for Computing Machinery, New York (2021). https://doi.org/10.1145/3460946.3464314
Deworetzki, N., Meyer, U.: Designing a reversible stack machine. In: Mezzina, C.A., Podlaski, K. (Eds.): RC 2022, LNCS 13354, pp. 65–72. Springer, Cham (2022, to appear)
Frank, M.P.: The future of computing depends on making it reversible. IEEE Spectrum, September 2017
Hudson, S.E., Flannery, F., Ananian, S.C., Wang, D., Petter, M.: Cup user’s manual, June 2014. http://www2.in.tum.de/projects/cup/docs.php
Kildall, G.A.: A unified approach to global program optimization. In: Fischer, P.C., Ullman, J.D. (eds.) POPL, pp. 194–206. ACM Press (1973). http://dblp.uni-trier.de/db/conf/popl/popl73.html
Klein, G., Rowe, S., Décamps, R.: Jflex user’s manual, version 1.8.2 edn., February 2020. https://www.jflex.de/manual.html
Kutrib, M., Meyer, U., Deworetzki, N., Schuster, M.: Compiling Janus to RSSA. In: Yamashita, S., Yokoyama, T. (eds.) RC 2021. LNCS, vol. 12805, pp. 64–78. Springer, Cham (2021). https://doi.org/10.1007/978-3-030-79837-6_4
Landauer, R.: Irreversibility and heat generation in the computing process. IBM J. Res. Dev. 5(3), 183–191 (1961)
Lutz, C.: Janus - A Time-Reversible Language (1986). http://tetsuo.jp/ref/janus.pdf. Letter to R. Landauer
Mogensen, T.Æ.: Partial evaluation of the reversible language Janus. In: Khoo, S.C., Siek, J.G. (eds.) PEPM, pp. 23–32. ACM (2011). http://dblp.uni-trier.de/db/conf/pepm/pepm2011.html
Mogensen, T.Æ.: RSSA: a reversible SSA form. In: Mazzara, M., Voronkov, A. (eds.) PSI 2015. LNCS, vol. 9609, pp. 203–217. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-41579-6_16http://dblp.unitrier.de/db/conf/ershov/ershov2015.html
Muchnick, S.S.: Advanced Compiler Design and Implementation. Morgan Kaufmann (1997)
Rosen, B.K., Wegman, M.N., Zadeck, F.K.: Global value numbers and redundant computations. In: Ferrante, J., Mager, P. (eds.) POPL, pp. 12–27. ACM Press (1988). http://dblp.uni-trier.de/db/conf/popl/popl88.html
Technische Hochschule Mittelhessen: Reversible computing compiler collection (rc3), February 2022. https://git.thm.de/thm-rc3/release
Yokoyama, T., Axelsen, H.B., Glück, R.: Principles of a reversible programming language. In: Ramírez, A., Bilardi, G., Gschwind, M. (eds.) Conference Computing Frontiers, pp. 43–54. ACM (2008). http://dblp.uni-trier.de/db/conf/cf/cf2008.html
Yokoyama, T., Axelsen, H.B., Glück, R.: Fundamentals of reversible flowchart languages. Theor. Comput. Sci. 611, 87–115 (2016). http://dblp.uni-trier.de/db/journals/tcs/tcs611.html
Yokoyama, T., Glück, R.: A reversible programming language and its invertible self-interpreter. In: Ramalingam, G., Visser, E. (eds.) PEPM, pp. 144–153. ACM (2007). http://dblp.uni-trier.de/db/conf/pepm/pepm2007.html
Acknowledgements
We would like to thank the reviewers who had provided valuable feedback and suggestions for improvement.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
Deworetzki, N., Kutrib, M., Meyer, U., Ritzke, PD. (2022). Optimizing Reversible Programs. In: Mezzina, C.A., Podlaski, K. (eds) Reversible Computation. RC 2022. Lecture Notes in Computer Science, vol 13354. Springer, Cham. https://doi.org/10.1007/978-3-031-09005-9_16
Download citation
DOI: https://doi.org/10.1007/978-3-031-09005-9_16
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-09004-2
Online ISBN: 978-3-031-09005-9
eBook Packages: Computer ScienceComputer Science (R0)