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.
- 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 Scholar
Digital Library
- E. Burmako. Scala macros: let our powers combine!: on how rich syntax and static types work with metaprogramming. In SCALA, 2013. Google Scholar
Digital Library
- S. Chiba. A metaobject protocol for c++. In OOPSLA, 1995. Google Scholar
Digital Library
- A. Chlipala. Ur: Statically-typed metaprogramming with type-level record computation. In PLDI, 2010. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- L. P. Deutsch and A. M. Schiffman. Efficient implementation of the Smalltalk-80 system. In POPL, 1984. Google Scholar
Digital Library
- Z. DeVito, J. Hegarty, A. Aiken, P. Hanrahan, and J. Vitek. Terra: a multi-stage language for high-performance computing. In PLDI, 2013. Google Scholar
Digital Library
- E. Gamma, R. Helm, R. Johnson, and J. Vlissides. Design patterns: elements of reusable object-oriented software. Addison-Wesley Longman Publishing, Boston, 1995. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- Google.V8 Javascript engine. http://code.google.com/p/v8.Google Scholar
- Google. Protocol buffers. https://code.google.com/p/protobufGoogle Scholar
- J. Hannemann and G. Kiczales. Design pattern implementation in Java and AspectJ. In OOPSLA, 2002. Google Scholar
Digital Library
- U. Hölzle and D. Ungar. Optimizing dynamically-dispatched calls with run-time type feedback. In PLDI, 1994. Google Scholar
Digital Library
- R. Ierusalimschy, L. H. de Figueiredo, and W. Celes. The evolution of lua. In HOPL, 2007. Google Scholar
Digital Library
- G. Kiczales and J. D. Rivieres. The Art of the Metaobject Protocol. MIT Press, Cambridge, MA, 1991. Google Scholar
Digital Library
- O. Kiselyov and C. Shan. Embedded probabilistic programming. In DSL, 2009. Google Scholar
Digital Library
- 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 Scholar
- Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-based learning applied to document recognition. In Proc. of the IEEE, 1998.Google Scholar
- R. Neal. MCMC using hamiltonian dynamics. Handbook of Markov Chain Monte Carlo, CRC Press, London, 2011.Google Scholar
- G. Neverov and P. Roe. Metaphor: a multi-staged, object-oriented programming language. In GPCE, 2004.Google Scholar
Cross Ref
- P. Norvig. Design patterns in dynamic programming. In Object World, 1996.Google Scholar
- Oracle. Java object serialization spec. http://docs.oracle.com/javase/7/docs/platform/serialization/spec/serialTOC.html.Google Scholar
- M. Pall. The LuaJIT project. http://luajit.org.Google Scholar
- 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 Scholar
Digital Library
- Stan Development Team. Stan: A C++ library for probability and sampling. http://mc-stan.org/.Google Scholar
- N. Sweet. Kryo: Fast, efficient Java serialization and cloning. https://code.google.com/p/kryoGoogle Scholar
- 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 Scholar
- W. Taha. A gentle introduction to multi-stage programming. In Domain-Specific Program Generation, 2004.Google Scholar
Cross Ref
- W. Taha and T. Sheard. MetaML and multi-stage programming with explicit annotations. In Theoretical Computer Science, 1999. Google Scholar
Digital Library
- J. Talbot, Z. DeVito, and P. Hanrahan. Riposte: a trace-driven compiler and parallel vm for vector code in r. In PACT, 2012. Google Scholar
Digital Library
- D. Wingate, A. Stuhlmüller, and N. D. Goodman. Lightweight implementations of probabilistic programming languages via transformational compilation. In AISTATS, 2011.Google Scholar
Index Terms
First-class runtime generation of high-performance types using exotypes
Recommendations
First-class runtime generation of high-performance types using exotypes
PLDI '14: Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and ImplementationWe 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 ...
Terra: a multi-stage language for high-performance computing
PLDI '13High-performance computing applications, such as auto-tuners and domain-specific languages, rely on generative programming techniques to achieve high performance and portability. However, these systems are often implemented in multiple disparate ...
Terra: a multi-stage language for high-performance computing
PLDI '13: Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and ImplementationHigh-performance computing applications, such as auto-tuners and domain-specific languages, rely on generative programming techniques to achieve high performance and portability. However, these systems are often implemented in multiple disparate ...







Comments