Abstract
Performance of program bytecode interpretation depends significantly from instruction dispatch technique implemented in the virtual machine. Threaded code is a well-known approach of instruction dispatch implementation of efficient interpreters. However, the plurality of current high-level programming languages and popular compilers are limited in support of threaded code and enforce designers of interpreters to either stick to GCC compiler which supports “Labels as Values” custom C extension or to resort to the implementation of a dispatch loop in assembler. In this work, we present the Interpretizer, a standalone tool which can be integrated into arbitrary interpreter build toolchain readily and transparently and which effectively converts switch-based dispatch loops into efficient threaded code. Therefore, Interpretizer reverts to the virtual machine designers flexibility of choice of programming language and compiler while it preserves the efficiency of the produced interpreter.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
References
Using the GNU Compiler Collection (GCC): Labels as Values. https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html. Accessed 26 Feb 2019
Adams, K., et al.: The HipHop virtual machine. In: Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages and Applications, OOPSLA 2014, pp. 777–790. ACM, New York (2014)
Bell, J.: Threaded code. Commun. ACM 16(6), 370–372 (1973)
Berndl, M., Vitale, B., Zaleski, M., Brown, A.: Context threading: a flexible and efficient dispatch technique for virtual machine interpreters. In: Proceedings of the International Symposium on Code Generation and Optimization, CGO 2005, pp. 15–26. IEEE Computer Society, Washington, DC (2005)
Bolz, C., Cuni, A., Fijalkowski, M., Rigo, A.: Tracing the meta-level: PyPy’s tracing JIT compiler. In: Proceedings of the 4th Workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems, ICOOOLPS 2009, pp. 18–25. ACM, New York (2009)
Ertl, A., Gregg, D.: Optimizing indirect branch prediction accuracy in virtual machine interpreters. SIGPLAN Not. 38(5), 278–288 (2003)
Ertl, A., Gregg, D., Krall, A., Paysan, B.: Vmgen: a generator of efficient virtual machine interpreters. Softw. Pract. Exper. 32(3), 265–294 (2002). https://doi.org/10.1002/spe.434
Levis, P., Gay, D., Culler, D.: Bridging the gap: programming sensor networks with application specific virtual machines. In: Submitted to Proceedings 6th Symposium on Operating Systems Design and Implementation, OSDI 2004 (2004)
Rohou, E., Swamy, B., Seznec, A.: Branch prediction and the performance of interpreters: don’t trust folklore. In: Proceedings of the 13th Annual IEEE/ACM International Symposium on Code Generation and Optimization, pp. 103–114, CGO 2015. IEEE Computer Society, Washington, DC, USA (2015)
Romer, T., et al.: The structure and performance of interpreters. SIGOPS Oper. Syst. Rev. 30(5), 150–159 (1996)
Savrun-Yeniçeri, G., et al.: Efficient interpreter optimizations for the JVM. In: Proceedings of the 2013 International Conference on Principles and Practices of Programming on the Java Platform: Virtual Machines, Languages, and Tools, PPPJ 2013, pp. 113–123. ACM, New York (2013)
Shi, Y., Casey, K., Ertl, A., Gregg, D.: Virtual machine showdown: stack versus registers. ACM Trans. Archit. Code Optim. 4(4), 2:1–2:36 (2008)
Würthinger, T., Wöß, A., Stadler, L., Duboscq, G., Simon, D., Wimmer, C.: Self-optimizing AST interpreters. In: Proceedings of the 8th Symposium on Dynamic Languages, DLS 2012, pp. 73–82. ACM, New York (2012)
Zaleski, M.: YETI: a gradually extensible trace interpreter. Ph.D. thesis, University of Toronto, Toronto, Ont., Canada, Canada (2008). aAINR57946
Zhang, W.: Efficient hosted interpreter for dynamic languages. Ph.D. thesis, University of California, Irvine, Irvine, California, U.S. (2015)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2019 Springer Nature Switzerland AG
About this paper
Cite this paper
Klimiankou, Y. (2019). Interpretizer: A Compiler-Independent Conversion of Switch-Based Dispatch into Threaded Code. In: Mazzara, M., Bruel, JM., Meyer, B., Petrenko, A. (eds) Software Technology: Methods and Tools. TOOLS 2019. Lecture Notes in Computer Science(), vol 11771. Springer, Cham. https://doi.org/10.1007/978-3-030-29852-4_4
Download citation
DOI: https://doi.org/10.1007/978-3-030-29852-4_4
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-29851-7
Online ISBN: 978-3-030-29852-4
eBook Packages: Computer ScienceComputer Science (R0)