Skip to main content

Interpretizer: A Compiler-Independent Conversion of Switch-Based Dispatch into Threaded Code

  • Conference paper
  • First Online:
Software Technology: Methods and Tools (TOOLS 2019)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 11771))

Included in the following conference series:

  • 845 Accesses

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Using the GNU Compiler Collection (GCC): Labels as Values. https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html. Accessed 26 Feb 2019

  2. 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)

    Google Scholar 

  3. Bell, J.: Threaded code. Commun. ACM 16(6), 370–372 (1973)

    Article  Google Scholar 

  4. 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)

    Google Scholar 

  5. 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)

    Google Scholar 

  6. Ertl, A., Gregg, D.: Optimizing indirect branch prediction accuracy in virtual machine interpreters. SIGPLAN Not. 38(5), 278–288 (2003)

    Article  Google Scholar 

  7. 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

    Article  MATH  Google Scholar 

  8. 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)

    Google Scholar 

  9. 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)

    Google Scholar 

  10. Romer, T., et al.: The structure and performance of interpreters. SIGOPS Oper. Syst. Rev. 30(5), 150–159 (1996)

    Article  Google Scholar 

  11. 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)

    Google Scholar 

  12. 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)

    Article  Google Scholar 

  13. 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)

    Google Scholar 

  14. Zaleski, M.: YETI: a gradually extensible trace interpreter. Ph.D. thesis, University of Toronto, Toronto, Ont., Canada, Canada (2008). aAINR57946

    Google Scholar 

  15. Zhang, W.: Efficient hosted interpreter for dynamic languages. Ph.D. thesis, University of California, Irvine, Irvine, California, U.S. (2015)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Yauhen Klimiankou .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

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)

Publish with us

Policies and ethics