skip to main content
research-article

Pinocchio: bringing reflection to life with first-class interpreters

Published:17 October 2010Publication History
Skip Abstract Section

Abstract

To support development tools like debuggers, runtime systems need to provide a meta-programming interface to alter their semantics and access internal data. Reflective capabilities are typically fixed by the Virtual Machine (VM). Unanticipated reflective features must either be simulated by complex program transformations, or they require the development of a specially tailored VM. We propose a novel approach to behavioral reflection that eliminates the barrier between applications and the VM by manipulating an explicit tower of first-class interpreters. Pinocchio is a proof-of-concept implementation of our approach which enables radical changes to the interpretation of programs by explicitly instantiating subclasses of the base interpreter. We illustrate the design of Pinocchio through non-trivial examples that extend runtime semantics to support debugging, parallel debugging, and back-in-time object-flow debugging. Although performance is not yet addressed, we also discuss numerous opportunities for optimization, which we believe will lead to a practical approach to behavioral reflection.

References

  1. }}H. Abelson, G. J. Sussman, and J. Sussman. Structure and interpretation of computer programs. MIT electrical engineering and computer science series. McGraw-Hill, 1991. ISBN 0-262-01077-1. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. }}A. Adya, J. Howell, M. Theimer, W. J. Bolosky, and J. R. Douceur. Cooperative task management without manual stack management. In ATEC '02: Proceedings of the General Track of the annual conference on USENIX Annual Technical Conference, pages 289--302, Berkeley, CA, USA, 2002. USENIX Association. ISBN 1-880446-00-6. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. }}A. Black, S. Ducasse, O. Nierstrasz, D. Pollet, D. Cassou, and M. Denker. Pharo by Example. Square Bracket Associates, 2009. ISBN 978-3-9523341-4-0.Google ScholarGoogle Scholar
  4. }}C. F. Bolz and A. Rigo. How to not write virtual machines for dynamic languages. In 3rd Workshop on Dynamic Languages and Applications, 2007.Google ScholarGoogle Scholar
  5. }}C. F. Bolz, A. Cuni, M. Fijalkowski, and A. Rigo. Tracing the meta-level: Pypy's tracing jit compiler. In ICOOOLPS '09: Proceedings of the 4th workshop on the Implementation, Compilation, Optimization of Object-Oriented Lan- guages and Programming Systems, pages 18--25, New York, NY, USA, 2009. ACM. ISBN 978-1-60558-541-doi: 10.1145/1565824.1565827. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. }}G. Bracha and D. Ungar. Mirrors: design principles for meta- level facilities of object-oriented programming languages. In Proceedings of the International Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'04), ACM SIGPLAN Notices, pages 331--344, New York, NY, USA, 2004. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. }}J. Brant, B. Foote, R. Johnson, and D. Roberts. Wrappers to the rescue. In Proceedings European Conference on Object Oriented Programming (ECOOP'98), volume 1445 of LNCS, pages 396--417. Springer-Verlag, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. }}S. Chiba, G. Kiczales, and J. Lamping. Avoiding confusion in metacircularity: The meta-helix. In K. Futatsugi and S. Mat- suoka, editors, Proceedings of ISOTAS '96, volume 1049 of Lecture Notes in Computer Science, pages 157--172. Springer, 1996. ISBN 3-540-60954-7. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. }}C. T. H. Daniel P. Friedman and E. Kohlbecker. Programming with continuations. Technical Report 151, Indiana University, Nov. 1984.Google ScholarGoogle ScholarCross RefCross Ref
  10. }}M. Denker. Sub-method Structural and Behavioral Reflection. PhD thesis, University of Bern, May 2008.Google ScholarGoogle Scholar
  11. }}M. Denker, S. Ducasse, A. Lienhard, and P. Marschall. Sub- method reflection. In Journal of Object Technology, Special Issue. Proceedings of TOOLS Europe 2007, volume 6/9, pages 231--251. ETH, Oct. 2007.Google ScholarGoogle Scholar
  12. }}M. Denker, M. Suen, and S. Ducasse. The meta in meta-object architectures.In Proceedings of TOOLS EUROPE 2008, volume 11 of LNBIP, pages 218--237. Springer-Verlag, 2008. doi: 10.1007/978-3-540-69824-1 13.Google ScholarGoogle Scholar
  13. }}T. D'Hondt. Are bytecodes an atavism?In Self-Sustaining Systems: First Workshop, S3 2008 Potsdam, Germany, May 15--16, 2008 Revised Selected Papers, pages 140--155. Springer-Verlag, Berlin, Heidelberg, 2008. ISBN 978-3-540-89274-8. doi: 10.1007/978-3-540-89275-5 8. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. }}R. Douence and M. Südholt. A generic reification technique for object-oriented reflective languages. Higher Order Symbol. Comput., 14(1):7--34, 2001. ISSN 1388-3690. doi: 10.1023/A:1011549115358. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. }}S. Ducasse. Evaluating message passing control techniques in Smalltalk. Journal of Object-Oriented Programming (JOOP), 12(6):39--44, June 1999.Google ScholarGoogle Scholar
  16. }}B. Ford. Parsing expression grammars: a recognition-based syntactic foundation. In POPL '04: Proceedings of the 31st ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pages 111--122, New York, NY, USA, 2004. ACM. ISBN 1-58113-729-X. doi: 10.1145/964001. 964011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. }}A. Goldberg and D. Robson. Smalltalk 80: the Language and its Implementation. Addison Wesley, Reading, Mass., May 1983. ISBN 0-201-13688-0. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. }}K. Gybels, R. Wuyts, S. Ducasse, and M. D'Hondt. Inter-language reflection -- a conceptual model and its implementation. Journal of Computer Languages, Systems and Struc- tures, 32(2-3):109--124, July 2006. doi: 10.1016/j.cl.2005.10.003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. }}T. Harris and K. Fraser. Language support for lightweight transactions. In Object-Oriented Programming, Systems, Languages, and Applications, pages 388--402. ACM Press, New York, NY, USA, Oct. 2003. doi: 10.1145/949305.949340. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. }}C. T. Haynes, D. P. Friedman, and M. Wand. Continuations and coroutines. In LFP '84: Proceedings of the 1984 ACM Symposium on LISP and functional programming, pages 293--298, New York, NY, USA, 1984. ACM. ISBN 0-89791-142-3. doi: 10.1145/800055.802046. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. }}U. Hölzle, C. Chambers, and D. Ungar.Optimizing dynamically-typed object-oriented languages with polymorphic inline caches. In P. America, editor, Proceedings ECOOP '91, volume 512 of LNCS, pages 21--38, Geneva, Switzerland, July 1991. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. }}M. H. Ibrahim. Reflection and metalevel architectures in object-oriented programming (workshop session). In OOP- SLA/ECOOP '90: Proceedings of the European conferenc. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. }}on Object-oriented programming addendum: systems, languages, and applications, pages 73--80, New York, NY, USA, 1991. ACM Press. ISBN 0-89791-443-0.Google ScholarGoogle Scholar
  24. }}D. Ingalls, T. Kaehler, J. Maloney, S. Wallace, and A. Kay. 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), pages 318--326. ACM Press, Nov. 1997. doi: 10.1145/263700.263754. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. }}G. Kiczales. Beyond the black box: Open implementation. IEEE Software, Jan. 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. }}G. Kiczales, J. des Rivières, and D. G. Bobrow. The Art of the Metaobject Protocol. MIT Press, 1991. ISBN 0-262-11158-6. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. }}G. Kiczales, E. Hilsdale, J. Hugunin, M. Kersten, J. Palm, and W. G. Griswold. An overview of AspectJ. In Proceedings ECOOP 2001, number 2072 in LNCS, pages 327--353. Springer Verlag, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. }}A. Lienhard. Dynamic Object Flow Analysis. Phd thesis, University of Bern, Dec. 2008.Google ScholarGoogle Scholar
  29. }}A. Lienhard, T. Giîrba, and O. Nierstrasz. Practical object- oriented back-in-time debugging. In Proceedings of the 22nd European Conference on Object-Oriented Programming (ECOOP'08), volume 5142 of LNCS, pages 592--615. Springer, 200ISBN 978-3-540-70591-doi: 10.1007/ 978-3-540-70592-5 25. ECOOP distinguished paper award. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. }}P. Maes. Concepts and experiments in computational reflection. In Proceedings OOPSLA '87, ACM SIGPLAN Notices, volume 22, pages 147--155, Dec. 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. }}J. Malenfant, M. Jacques, and F.-N. Demers. A tutorial on behavioral reflection and its implementation. In Proceedings of Reflection, pages 1--20, 1996.Google ScholarGoogle Scholar
  32. }}J. McAffer. A Meta-level Architecture for Prototyping Object Systems. Ph.D. thesis, University of Tokyo, Sept. 1995.Google ScholarGoogle Scholar
  33. }}J. McAffer. Engineering the meta level. In G. Kiczales, editor, Proceedings of the 1st International Conference on Metalevel Architectures and Reflection (Reflection 96), San Francisco, USA, Apr. 1996.Google ScholarGoogle Scholar
  34. }}L. Renggli, T. Gîrba, and O. Nierstrasz. Embedding languages without breaking tools. In T. D'Hondt, editor, ECOOP 2010: Proceedings of the 24th European Conference on Object-Oriented Programming, Maribor, Slovenia, volume 6183 of LNCS, pages 380--404. Springer-Verlag, 2010. To appear. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. }}L. Rodríguez, É. Tanter,and J.Noyé. Supportingdynamic crosscutting with partial behavioral reflection: a case study. In Proceedings of the XXIV International Conference of the Chilean Computer Science Society (SCCC 2004), Arica, Chile, Nov. 2004. IEEE.Google ScholarGoogle ScholarCross RefCross Ref
  36. }}D. Röthlisberger, M. Denker, and É. Tanter. Unanticipated partial behavioral reflection. In Advances in Smalltalk -- Proceedings of 14th International Smalltalk Conference (ISC 2006), volume 4406 of LNCS, pages 47--65. Springer, 2007. ISBN 978-3-540-71835-2. doi: 10.1007/978-3-540-71836-9 3. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. }}J. W. Simmons, S. Jefferson, and D. P. Friedman. Language extension via first-class interpreters. Technical Report 362, Indiana University Computer Science Department, Sept. 1992.Google ScholarGoogle Scholar
  38. }}B. C. Smith. Reflection and Semantics in a Procedural Language. Ph.D. thesis, MIT, Cambridge, MA, 1982.Google ScholarGoogle Scholar
  39. }}A. Strauss. Dynamic aspects -- an AOP implementation for Squeak. Master's thesis, University of Bern, Nov. 2008.Google ScholarGoogle Scholar
  40. }}É. Tanter. Reflection and open implementations. Technical Report TR/DCC-2009-13, University of Chile, Nov. 2009.Google ScholarGoogle Scholar
  41. }}É. Tanter, J. Noyé, D. Caromel, and P. Cointe. Partial behavioral reflection: Spatial and temporal selection of reification. In Proceedings of OOPSLA '03, ACM SIGPLAN Notices, pages 27--46, nov 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. }}D. Ungar, A. Spitz, and A. Ausch. 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, pages 11--20, New York, NY, USA, 2005. ACM. ISBN 1-59593-193-7. doi: 10.1145/ 1094855.1094865. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. }}M. Wand and D. Friedman. The Mystery of the Tower Revealed: A Non-Reflective Description of the Reflective Tower. In P. M. North-Holland and D. Nardi, editors, Meta-level Architectures and Reflection, pages 111--134, 1988.Google ScholarGoogle Scholar
  44. }}R. Wuyts and S. Ducasse. Symbiotic reflection between an object-oriented and a logic programming language. In ECOOP 2001 International Workshop on MultiParadigm Programming with Object-Oriented Languages, 2001.Google ScholarGoogle Scholar

Index Terms

  1. Pinocchio: bringing reflection to life with first-class interpreters

      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

      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!