Abstract
In dynamic object-oriented languages, low-level mechanisms such as just-in-time compilation, object allocation, garbage collection (GC) and method dispatch are often handled by virtual machines (VMs). VMs are typically implemented using static languages, allowing only few changes at run time. In such systems, the VM is not part of the language and interfaces to memory management or method dispatch are fixed, not allowing for arbitrary adaptation. Furthermore, the implementation can typically not be inspected or debugged with standard tools used to work on application code.
This paper reports on our experience building Bee, a dynamic Smalltalk runtime, written in Smalltalk. Bee is a Dynamic Metacircular Runtime (DMR) and seamlessly integrates the VM into the application and thereby overcomes many restrictions of classic VMs, for instance by allowing arbitrary code modifications of the VM at run time. Furthermore, the approach enables developers to use their standard tools for application code also for the VM, allowing them to inspect, debug, understand, and modify a DMR seamlessly.
We detail our experience of implementing GC, compilation, and optimizations in a DMR. We discuss examples where we found that DMRs can improve understanding of the system, provide tighter control of the software stack, and facilitate research. We also show that the Bee DMR matches and surpass the performance of a widely used Smalltalk VM.
- B. Alpern, C. R. Attanasio, J.J. Barton, M. G. Burke, P. Cheng, J.-D. Choi, A. Cocchi, S.J. Fink, D. Grove, M. Hind, S. F. Hummel, D. Lieber, V. Litvinov, M. F. Mergen, T. Ngo, J. R. Russell, V. Sarkar, M. J. Serrano, J.C. Shepherd, S. E. Smith, V.C. Sreedhar, H. Srinivasan, and J. Whaley. 2000. The Jalapeño virtual machine. IBM Systems Journal 39, 1 (2000), 211-238. Google Scholar
Digital Library
- B. Alpern, S. Augart, S.M. Blackburn, M. Butrico, A. Cocchi, P. Cheng, J. Dolby, S. Fink, D. Grove, M. Hind, K.S. McKinley, M. Mergen, J. E B Moss, T. Ngo, V. Sarkar, and M. Trapp. 2005. The Jikes Research Virtual Machine project: Building an open-source research community. IBM Systems Journal 44, 2 (2005), 399-417. Google Scholar
Digital Library
- Stephen M Blackburn, Sergey I Salishev, Mikhail Danilov, Oleg A Mokhovikov, Anton A Nashatyrev, Peter A Novodvorsky, Vadim I Bogdanov, Xiao Feng Li, and Dennis Ushakov. 2007. The Moxie JVM experience. cluster computing (2007).Google Scholar
- Guido Chari, Diego Garbervetsky, and Stefan Marr. 2016. Building Efficient and Highly Run-time Adaptable Virtual Machines. In Proceedings of the 12th Symposium on Dynamic Languages (DLS'16). ACM, 60-71. Google Scholar
Digital Library
- Guido Chari, Diego Garbervetsky, Stefan Marr, and Stéphane Ducasse. 2015. Towards fully reflective environments. In 2015 ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software (Onward!). ACM, 240-253. Google Scholar
Digital Library
- Chris J Cheney. 1970. A nonrecursive list compacting algorithm. Commun. ACM 13, 11 (1970), 677-678. Google Scholar
Digital Library
- Maxime Chevalier-Boisvert, Erick Lavoie, Marc Feeley, and Bruno Dufour. 2011. Bootstrapping a Self-hosted Research Virtual Machine for JavaScript: An Experience Report. In Proceedings of the 7th Symposium on Dynamic Languages (DLS '11). ACM, 61-72. Google Scholar
Digital Library
- Thomas J Conroy and Eduardo Pelegri-Llopart. 1983. An assessment of method-lookup caches for Smalltalk-80 implementations. Kra83 (1983).Google Scholar
- L. Peter Deutsch and Allan M. Schiffman. 1984. Efficient Implementation of the Smalltalk-80 System. In Proceedings of the 11th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages (POPL '84). ACM, 297-302. Google Scholar
Digital Library
- Robert R Fenichel and Jerome C Yochelson. 1969. A LISP garbage-collector for virtual-memory computer systems. Commun. ACM 12, 11 (1969), 611-612. Google Scholar
Digital Library
- Daniel Frampton, Stephen M Blackburn, Perry Cheng, Robin J Garner, David Grove, J Eliot B Moss, and Sergey I Salishev. 2009. Demystifying magic: high-level low-level programming. In Proceedings of the 2009 ACM SIGPLAN/SIGOPS international conference on Virtual execution environments. ACM, 81-90. Google Scholar
Digital Library
- Urs Hölzle, Craig Chambers, and David Ungar. 1991. Optimizing Dynamically-Typed Object-Oriented Languages With Polymorphic Inline Caches. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP '91). Springer-Verlag, 21-38. http://dl.acm.org/citation.cfm?id=646149.679193 Google Scholar
Digital Library
- Urs Hölzle and David Ungar. 1994. OptimizingDynamically-dispatched Calls with Run-time Type Feedback. In Proceedings of the ACM SIGPLAN 1994 Conference on Programming Language Design and Implementation (PLDI '94). ACM, 326-336. Google Scholar
Digital Library
- Christian Humer, Christian Wimmer, Christian Wirth, Andreas Wöß, and Thomas Würthinger. 2015. A domain-specific language for building self-optimizing AST interpreters. ACM SIGPLAN Notices 50, 3 (2015), 123-132. Google Scholar
Digital Library
- Dan Ingalls, Ted Kaehler, John Maloney, Scott Wallace, and Alan Kay. 1997. Back to the Future: The Story of Squeak, a Practical Smalltalk Written in Itself. In Proceedings of the 12th ACM SIGPLAN Conference on Object-oriented Programming, Systems, Languages, and Applications (OOPSLA '97). ACM, 318-326. Google Scholar
Digital Library
- Richard Jones, Antony Hosking, and Eliot Moss. 2011. The garbage collection handbook: the art of automatic memory management. Chapman & Hall/CRC. Google Scholar
Digital Library
- HBM Jonkers. 1979. A fast garbage compaction algorithm. Inform. Process. Lett. 9, 1 (1979), 26-30.Google Scholar
Cross Ref
- Gregor Kiczales, Jim Des Rivieres, and Daniel Gureasko Bobrow. 1991. The art of the metaobject protocol. MIT. Google Scholar
Digital Library
- Dmitri Makarov and Matthias Hauswirth. 2013. Jikes RDB: a debugger for the Jikes RVM. In Proceedings of the 2013 International Conference on Principles and Practices of Programming on the Java Platform: Virtual Machines, Languages, and Tools (PPPJ '13). ACM, 169-172. Google Scholar
Digital Library
- Stefan Marr, Benoit Daloze, and Hanspeter Mössenböck. 2016. Cross-Language Compiler Benchmarking--Are We Fast Yet?. In Proceedings of the 12th Symposium on Dynamic Languages (DLS'16). ACM, 120-131. Google Scholar
Digital Library
- Bernd Mathiske. 2008. The Maxine Virtual Machine and Inspector. In Companion to the 23rd ACM SIGPLAN Conference on Object-oriented Programming Systems Languages and Applications (OOPSLA Companion '08). ACM, 739-740. Google Scholar
Digital Library
- Eliot Miranda. 2011. The cog smalltalk virtual machine. In VMIL'11: Proceedings of the 5th workshop on Virtual machines and intermediate languages for emerging modularization mechanisms.Google Scholar
- F Lockwood Morris. 1978. A time-and space-efficient garbage compaction algorithm. Commun. ACM 21, 8 (1978), 662-665. Google Scholar
Digital Library
- Young Gil Park and Benjamin Goldberg. 1992. Escape analysis on lists. In ACM SIGPLAN Notices, Vol. 27. ACM, 116-127. Google Scholar
Digital Library
- Javier Pimás, Javier Burroni, and Gerardo Richarte. 2014. Design and implementation of Bee Smalltalk runtime. (2014).Google Scholar
- Barry Redmond and Vinny Cahill. 2000. Iguana/J: Towards a dynamic and efficient reflective architecture for Java. In ECOOP 2000 Workshop on Reflection and Metalevel Architectures.Google Scholar
- Armin Rigo and Samuele Pedroni. 2006. PyPy's Approach to Virtual Machine Construction. In Companion to the 21st ACM SIGPLAN Symposium on Object-oriented Programming Systems, Languages, and Applications (OOPSLA '06). ACM, 944-953. Google Scholar
Digital Library
- Herbert Schorr and William M Waite. 1967. An efficient machine-independent procedure for garbage collection in various list structures. Commun. ACM 10, 8 (1967), 501-506. Google Scholar
Digital Library
- Brian Cantwell Smith. 1984. Reflection and semantics in Lisp. In Proceedings of the 11th ACM SIGACT-SIGPLAN symposium on Principles of programming languages. ACM, 23-35. Google Scholar
Digital Library
- Lukas Stadler, Thomas Würthinger, and Hanspeter Mössenböck. 2014. Partial escape analysis and scalar replacement for Java. In Proceedings of Annual IEEE/ACM International Symposium on Code Generation and Optimization. ACM, 165. Google Scholar
Digital Library
- David Ungar, Adam Spitz, and Alex Ausch. 2005. Constructing a metacircular Virtual machine in an exploratory programming environment. In OOPSLA '05: Companion to the 20th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications. ACM, 11-20. Google Scholar
Digital Library
- David M Ungar. 1983. Berkeley Smalltalk: Who knows where the time goes? Smalltalk-80: bits of history, words of advice (1983), 189-206.Google Scholar
- Toon Verwaest, Camillo Bruni, David Gurtner, Adrian Lienhard, and Oscar Niestrasz. 2010. Pinocchio: bringing reflection to life with firstclass interpreters. ACM Sigplan Notices 45, 10 (2010), 774-789. Google Scholar
Digital Library
- Christian Wimmer, Michael Haupt, Michael L. Van De Vanter, Mick Jordan, Laurent Daynès, and Douglas Simon. 2013. Maxine: An Approachable Virtual Machine for, and in, Java. ACM Trans. Archit. Code Optim. 9, 4, Article 30 (Jan. 2013), 24 pages. 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. ACM, 187-204. Google Scholar
Digital Library
- Thomas Würthinger, Andreas Wöß, Lukas Stadler, Gilles Duboscq, Doug Simon, and Christian Wimmer. 2012. Self-optimizing AST interpreters. In ACM SIGPLAN Notices, Vol. 48. ACM, 73-82. Google Scholar
Digital Library
Index Terms
Garbage collection and efficiency in dynamic metacircular runtimes: an experience report
Recommendations
Garbage collection and efficiency in dynamic metacircular runtimes: an experience report
DLS 2017: Proceedings of the 13th ACM SIGPLAN International Symposium on on Dynamic LanguagesIn dynamic object-oriented languages, low-level mechanisms such as just-in-time compilation, object allocation, garbage collection (GC) and method dispatch are often handled by virtual machines (VMs). VMs are typically implemented using static ...
Garbage collection hints
HiPEAC'05: Proceedings of the First international conference on High Performance Embedded Architectures and CompilersThis paper shows that Appel-style garbage collectors often make suboptimal decisions both in terms of when and how to collect. We argue that garbage collection should be done when the amount of live bytes is low (in order to minimize the collection cost)...
Age-based garbage collection
Modern generational garbage collectors look for garbage among the young objects, because they have high mortality; however, these objects include the very youngest objects, which clearly are still live. We introduce new garbage collection algorithms, ...







Comments