skip to main content
article

Garbage collection and efficiency in dynamic metacircular runtimes: an experience report

Published:24 October 2017Publication History
Skip Abstract Section

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.

References

  1. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  2. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  3. 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 ScholarGoogle Scholar
  4. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  5. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  6. Chris J Cheney. 1970. A nonrecursive list compacting algorithm. Commun. ACM 13, 11 (1970), 677-678. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  8. Thomas J Conroy and Eduardo Pelegri-Llopart. 1983. An assessment of method-lookup caches for Smalltalk-80 implementations. Kra83 (1983).Google ScholarGoogle Scholar
  9. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  10. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  11. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  12. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  13. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  14. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  15. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  16. Richard Jones, Antony Hosking, and Eliot Moss. 2011. The garbage collection handbook: the art of automatic memory management. Chapman & Hall/CRC. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. HBM Jonkers. 1979. A fast garbage compaction algorithm. Inform. Process. Lett. 9, 1 (1979), 26-30.Google ScholarGoogle ScholarCross RefCross Ref
  18. Gregor Kiczales, Jim Des Rivieres, and Daniel Gureasko Bobrow. 1991. The art of the metaobject protocol. MIT. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  20. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  21. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  22. 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 ScholarGoogle Scholar
  23. F Lockwood Morris. 1978. A time-and space-efficient garbage compaction algorithm. Commun. ACM 21, 8 (1978), 662-665. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Young Gil Park and Benjamin Goldberg. 1992. Escape analysis on lists. In ACM SIGPLAN Notices, Vol. 27. ACM, 116-127. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Javier Pimás, Javier Burroni, and Gerardo Richarte. 2014. Design and implementation of Bee Smalltalk runtime. (2014).Google ScholarGoogle Scholar
  26. 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 ScholarGoogle Scholar
  27. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  28. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  29. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  30. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  31. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  32. David M Ungar. 1983. Berkeley Smalltalk: Who knows where the time goes? Smalltalk-80: bits of history, words of advice (1983), 189-206.Google ScholarGoogle Scholar
  33. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  34. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  35. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  36. 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 ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Garbage collection and efficiency in dynamic metacircular runtimes: an experience report

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        • Published in

          cover image ACM SIGPLAN Notices
          ACM SIGPLAN Notices  Volume 52, Issue 11
          DLS '17
          November 2017
          86 pages
          ISSN:0362-1340
          EISSN:1558-1160
          DOI:10.1145/3170472
          Issue’s Table of Contents
          • cover image ACM Conferences
            DLS 2017: Proceedings of the 13th ACM SIGPLAN International Symposium on on Dynamic Languages
            October 2017
            86 pages
            ISBN:9781450355261
            DOI:10.1145/3133841

          Copyright © 2017 ACM

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 24 October 2017

          Check for updates

          Qualifiers

          • article
        • Article Metrics

          • Downloads (Last 12 months)8
          • Downloads (Last 6 weeks)1

          Other Metrics

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!