Abstract
Stack-based virtual machines (VMs) are a popular representation for implementing programming languages, and for distributing programs in a target neutral form. VMs can be implemented with an interpreter to be simple, portable, quick to start and have low memory requirements. These advantages make VM interpreters especially useful for minority-use and domain-specific languages. VM interpreters contain large amounts of repeated or similar code. Furthermore, interpreter optimisations usually involve a large number of similar changes to many parts of the interpreter source code. We present a domain-specific language for describing the instruction set architecture of a VM. Our generator takes the instruction definition and produces C code for processing the instructions in several ways: execution, VM code generation and optimisation, disassembly, tracing and profiling. The generator can apply optimisations to the generated C code for each VM instruction, and across instructions. Using profile-directed feedback and experimentation the programmer can rapidly optimise the interpreter for new architectures, environments and applications.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Lindholm, T., Yellin, F.: The Java Virtual Machine Specification, 2nd edn. Addison-Wesley, Reading (1999)
Aït-Kaci, H.: The WAM: A (real) tutorial. Warren’s Abstract Machine: A Tutorial Reconstruction. MIT Press, Cambridge (1991)
Goldberg, A., Robson, D.: Smalltalk-80: The Language and its Implementation. Addison-Wesley, Reading (1983)
Weiss, D.M.: Family-oriented abstraction specification and translation: the FAST process. In: Proceedings of the 11th Annual Conference on Computer Assurance (COMPASS), Gaithersburg, Maryland, pp. 14–22. IEEE Press, Los Alamitos (1996)
Czarnecki, K., Eisenecker, U.: Generative programming – methods tools and applications. Addison-Wesley, Reading (2000)
Lengauer, C.: Program optimization in the domain of high-performance parallelism. In: Lengauer, C., Batory, D., Consel, C., Odersky, M. (eds.) Domain-Specific Program Generation. LNCS, vol. 3016, pp. 73–91. Springer, Heidelberg (2004)
Grune, D., Bal, H., Jacobs, C., Langendoen, K.: Modern Compiler Design. Wiley, Chichester (2001)
Ertl, M.A.: Implementation of Stack-Based Languages on Register Machines. PhD thesis, Technische Universität Wien, Austria (1996)
Moore, C.H., Leach, G.C.: Forth – a language for interactive computing. Technical report, Mohasco Industries, Inc., Amsterdam, NY (1970)
Ertl, M.A., Gregg, D.: The behaviour of efficient virtual machine interpreters on modern architectures. In: Sakellariou, R., Keane, J.A., Gurd, J.R., Freeman, L. (eds.) Euro-Par 2001. LNCS, vol. 2150, pp. 403–412. Springer, Heidelberg (2001)
Ertl, M.A.: A portable Forth engine. In: EuroFORTH 1993 conference proceedings, Mariánské Láznè (Marienbad) (1993)
Paysan, B.: Ein optimierender Forth-Compiler. Vierte Dimension 7, 22–25 (1991)
Ertl, M.A., Gregg, D., Krall, A., Paysan, B.: vmgen – A generator of efficient virtual machine interpreters. Software – Practice and Experience 32, 265–294 (2002)
Krall, A., Grafl, R.: CACAO – a 64 bit JavaVM just-in-time compiler. Concurrency: Practice and Experience 9, 1017–1030 (1997)
Casey, K., Gregg, D., Ertl, M.A., Nisbet, A.: Towards Superinstructions for Java Interpreters. In: Krall, A. (ed.) SCOPES 2003. LNCS, vol. 2826, pp. 329–343. Springer, Heidelberg (2003)
Bell, J.R.: Threaded code. Communications of the ACM 16, 370–372 (1973)
Ertl, M.A.: Stack caching for interpreters. In: SIGPLAN 1995 Conference on Programming Language Design and Implementation, pp. 315–327 (1995)
Ertl, M.A., Gregg, D.: Optimizing indirect branch prediction accuracy in virtual machine interpreters. In: Proceedings of the ACM SIGPLAN 2003 Conference on Programming Language Design and Implementation (PLDI 2003), San Diego, California, pp. 278–288. ACM, New York (2003)
Proebsting, T.A.: Optimizing an ANSI C interpreter with superoperators. In: Principles of Programming Languages (POPL 1995), pp. 322–332 (1995)
Ernst, J., Evans, W., Fraser, C.W., Lucco, S., Proebsting, T.A.: Code compression. In: SIGPLAN 1997 Conference on Programming Language Design and Implementation, pp. 358–365 (1997)
Evans, W.S., Fraser, C.W.: Bytecode compression via profiled grammar rewriting. In: Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 148–155 (2001)
Klint, P.: Interpretation techniques. Software – Practice and Experience 11, 963–973 (1981)
Hoogerbrugge, J., Augusteijn, L.: Pipelined Java virtual machine interpreters. In: Watt, D.A. (ed.) CC 2000. LNCS, vol. 1781, p. 35. Springer, Heidelberg (2000)
Hoogerbrugge, J., Augusteijn, L., Trum, J., van de Wiel, R.: A code compression system based on pipelined interpreters. Software – Practice and Experience 29, 1005–1023 (1999)
Piumarta, I., Riccardi, F.: Optimizing direct threaded code by selective inlining. In: SIGPLAN 1998 Conference on Programming Language Design and Implementation, pp. 291–300 (1998)
Clausen, L., Schultz, U.P., Consel, C., Muller, G.: Java bytecode compression for low-end embedded systems. ACM Transactions on Programming Languages and Systems 22, 471–489 (2000)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2004 Springer-Verlag Berlin Heidelberg
About this chapter
Cite this chapter
Gregg, D., Ertl, M.A. (2004). A Language and Tool for Generating Efficient Virtual Machine Interpreters. In: Lengauer, C., Batory, D., Consel, C., Odersky, M. (eds) Domain-Specific Program Generation. Lecture Notes in Computer Science, vol 3016. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-25935-0_12
Download citation
DOI: https://doi.org/10.1007/978-3-540-25935-0_12
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-22119-7
Online ISBN: 978-3-540-25935-0
eBook Packages: Springer Book Archive