skip to main content
research-article

First-class runtime generation of high-performance types using exotypes

Published:09 June 2014Publication History
Skip Abstract Section

Abstract

We introduce exotypes, user-defined types that combine the flexibility of meta-object protocols in dynamically-typed languages with the performance control of low-level languages. Like objects in dynamic languages, exotypes are defined programmatically at run-time, allowing behavior based on external data such as a database schema. To achieve high performance, we use staged programming to define the behavior of an exotype during a runtime compilation step and implement exotypes in Terra, a low-level staged programming language.

We show how exotype constructors compose, and use exotypes to implement high-performance libraries for serialization, dynamic assembly, automatic differentiation, and probabilistic programming. Each exotype achieves expressiveness similar to libraries written in dynamically-typed languages but implements optimizations that exceed the performance of existing libraries written in low-level statically-typed languages. Though each implementation is significantly shorter, our serialization library is 11 times faster than Kryo, and our dynamic assembler is 3--20 times faster than Google's Chrome assembler.

References

  1. D. Ancona, M. Ancona, A. Cuni, and N. D. Matsakis. RPython: a step towards reconciling dynamically and statically typed OO languages. In DLS, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. E. Burmako. Scala macros: let our powers combine!: on how rich syntax and static types work with metaprogramming. In SCALA, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. S. Chiba. A metaobject protocol for c++. In OOPSLA, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. A. Chlipala. Ur: Statically-typed metaprogramming with type-level record computation. In PLDI, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. G. Corliss, C. Faure, A. Griewank, L. Hascoët, and U. Naumann, editors. Automatic Differentiation of Algorithms: From Simulation to Optimization, Computer and Information Science, New York, 2002. Springer. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. L. P. Deutsch and A. M. Schiffman. Efficient implementation of the Smalltalk-80 system. In POPL, 1984. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Z. DeVito, J. Hegarty, A. Aiken, P. Hanrahan, and J. Vitek. Terra: a multi-stage language for high-performance computing. In PLDI, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. E. Gamma, R. Helm, R. Johnson, and J. Vlissides. Design patterns: elements of reusable object-oriented software. Addison-Wesley Longman Publishing, Boston, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. N. D. Goodman, V. K. Mansinghka, D. M. Roy, K. Bonawitz, and J. B. Tenenbaum. Church: a language for generative models. In UAI, 2008.Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Google.V8 Javascript engine. http://code.google.com/p/v8.Google ScholarGoogle Scholar
  11. Google. Protocol buffers. https://code.google.com/p/protobufGoogle ScholarGoogle Scholar
  12. J. Hannemann and G. Kiczales. Design pattern implementation in Java and AspectJ. In OOPSLA, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. U. Hölzle and D. Ungar. Optimizing dynamically-dispatched calls with run-time type feedback. In PLDI, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. R. Ierusalimschy, L. H. de Figueiredo, and W. Celes. The evolution of lua. In HOPL, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. G. Kiczales and J. D. Rivieres. The Art of the Metaobject Protocol. MIT Press, Cambridge, MA, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. O. Kiselyov and C. Shan. Embedded probabilistic programming. In DSL, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. J. Lamping, G. Kiczales, L. H. Rodriguez, Jr., and E. Ruf. An architecture for an open compiler. In IMSA'92 workshop on reflection and meta-level architectures, 1992.Google ScholarGoogle Scholar
  18. Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-based learning applied to document recognition. In Proc. of the IEEE, 1998.Google ScholarGoogle Scholar
  19. R. Neal. MCMC using hamiltonian dynamics. Handbook of Markov Chain Monte Carlo, CRC Press, London, 2011.Google ScholarGoogle Scholar
  20. G. Neverov and P. Roe. Metaphor: a multi-staged, object-oriented programming language. In GPCE, 2004.Google ScholarGoogle ScholarCross RefCross Ref
  21. P. Norvig. Design patterns in dynamic programming. In Object World, 1996.Google ScholarGoogle Scholar
  22. Oracle. Java object serialization spec. http://docs.oracle.com/javase/7/docs/platform/serialization/spec/serialTOC.html.Google ScholarGoogle Scholar
  23. M. Pall. The LuaJIT project. http://luajit.org.Google ScholarGoogle Scholar
  24. T. Rompf, A. K. Sujeeth, N. Amin, K. J. Brown, V. Jovanovic, H. Lee, M. Jonnalagedda, K. Olukotun, and M. Odersky. Optimizing data structures in high-level programs: new directions for extensible compilers based on staging. In POPL, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Stan Development Team. Stan: A C++ library for probability and sampling. http://mc-stan.org/.Google ScholarGoogle Scholar
  26. N. Sweet. Kryo: Fast, efficient Java serialization and cloning. https://code.google.com/p/kryoGoogle ScholarGoogle Scholar
  27. D. Syme, K. Battocchi, K. Takeda, D. Malayeri, J. Fisher, J. Hu, T Liu, B. McNamara, D. Quirk, M. Taveggia, W. Chae, U. Matsveyeu, and T. Petricek. F#3.0 - strongly-typed language support for internet-scale information sources. Technical report, 2012. http://research.microsoft.com/apps/pubs/?id=173076.Google ScholarGoogle Scholar
  28. W. Taha. A gentle introduction to multi-stage programming. In Domain-Specific Program Generation, 2004.Google ScholarGoogle ScholarCross RefCross Ref
  29. W. Taha and T. Sheard. MetaML and multi-stage programming with explicit annotations. In Theoretical Computer Science, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. J. Talbot, Z. DeVito, and P. Hanrahan. Riposte: a trace-driven compiler and parallel vm for vector code in r. In PACT, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. D. Wingate, A. Stuhlmüller, and N. D. Goodman. Lightweight implementations of probabilistic programming languages via transformational compilation. In AISTATS, 2011.Google ScholarGoogle Scholar

Index Terms

  1. First-class runtime generation of high-performance types using exotypes

    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 49, Issue 6
      PLDI '14
      June 2014
      598 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/2666356
      • Editor:
      • Andy Gill
      Issue’s Table of Contents
      • cover image ACM Conferences
        PLDI '14: Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation
        June 2014
        619 pages
        ISBN:9781450327848
        DOI:10.1145/2594291

      Copyright © 2014 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 9 June 2014

      Check for updates

      Qualifiers

      • research-article

    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!