Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article

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

Published: 09 June 2014 Publication History

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.
[2]
E. Burmako. Scala macros: let our powers combine!: on how rich syntax and static types work with metaprogramming. In SCALA, 2013.
[3]
S. Chiba. A metaobject protocol for c++. In OOPSLA, 1995.
[4]
A. Chlipala. Ur: Statically-typed metaprogramming with type-level record computation. In PLDI, 2010.
[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.
[6]
L. P. Deutsch and A. M. Schiffman. Efficient implementation of the Smalltalk-80 system. In POPL, 1984.
[7]
Z. DeVito, J. Hegarty, A. Aiken, P. Hanrahan, and J. Vitek. Terra: a multi-stage language for high-performance computing. In PLDI, 2013.
[8]
E. Gamma, R. Helm, R. Johnson, and J. Vlissides. Design patterns: elements of reusable object-oriented software. Addison-Wesley Longman Publishing, Boston, 1995.
[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.
[10]
Google.V8 Javascript engine. http://code.google.com/p/v8.
[11]
Google. Protocol buffers. https://code.google.com/p/protobuf
[12]
J. Hannemann and G. Kiczales. Design pattern implementation in Java and AspectJ. In OOPSLA, 2002.
[13]
U. Hölzle and D. Ungar. Optimizing dynamically-dispatched calls with run-time type feedback. In PLDI, 1994.
[14]
R. Ierusalimschy, L. H. de Figueiredo, and W. Celes. The evolution of lua. In HOPL, 2007.
[15]
G. Kiczales and J. D. Rivieres. The Art of the Metaobject Protocol. MIT Press, Cambridge, MA, 1991.
[16]
O. Kiselyov and C. Shan. Embedded probabilistic programming. In DSL, 2009.
[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.
[18]
Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-based learning applied to document recognition. In Proc. of the IEEE, 1998.
[19]
R. Neal. MCMC using hamiltonian dynamics. Handbook of Markov Chain Monte Carlo, CRC Press, London, 2011.
[20]
G. Neverov and P. Roe. Metaphor: a multi-staged, object-oriented programming language. In GPCE, 2004.
[21]
P. Norvig. Design patterns in dynamic programming. In Object World, 1996.
[22]
Oracle. Java object serialization spec. http://docs.oracle.com/javase/7/docs/platform/serialization/spec/serialTOC.html.
[23]
M. Pall. The LuaJIT project. http://luajit.org.
[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.
[25]
Stan Development Team. Stan: A C++ library for probability and sampling. http://mc-stan.org/.
[26]
N. Sweet. Kryo: Fast, efficient Java serialization and cloning. https://code.google.com/p/kryo
[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.
[28]
W. Taha. A gentle introduction to multi-stage programming. In Domain-Specific Program Generation, 2004.
[29]
W. Taha and T. Sheard. MetaML and multi-stage programming with explicit annotations. In Theoretical Computer Science, 1999.
[30]
J. Talbot, Z. DeVito, and P. Hanrahan. Riposte: a trace-driven compiler and parallel vm for vector code in r. In PACT, 2012.
[31]
D. Wingate, A. Stuhlmüller, and N. D. Goodman. Lightweight implementations of probabilistic programming languages via transformational compilation. In AISTATS, 2011.

Cited By

View all
  • (2021)Copy-and-patch compilation: a fast compilation algorithm for high-level languages and bytecodeProceedings of the ACM on Programming Languages10.1145/34855135:OOPSLA(1-30)Online publication date: 15-Oct-2021
  • (2021)BuildItProceedings of the 2021 IEEE/ACM International Symposium on Code Generation and Optimization10.1109/CGO51591.2021.9370333(39-51)Online publication date: 27-Feb-2021
  • (2016)Building efficient and highly run-time adaptable virtual machinesProceedings of the 12th Symposium on Dynamic Languages10.1145/2989225.2989234(60-71)Online publication date: 1-Nov-2016
  • Show More Cited By

Index Terms

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

    Recommendations

    Comments

    Information & Contributors

    Information

    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
    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 09 June 2014
    Published in SIGPLAN Volume 49, Issue 6

    Check for updates

    Author Tags

    1. DSL
    2. lua
    3. staged computation

    Qualifiers

    • Research-article

    Funding Sources

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)9
    • Downloads (Last 6 weeks)0
    Reflects downloads up to 25 Feb 2025

    Other Metrics

    Citations

    Cited By

    View all
    • (2021)Copy-and-patch compilation: a fast compilation algorithm for high-level languages and bytecodeProceedings of the ACM on Programming Languages10.1145/34855135:OOPSLA(1-30)Online publication date: 15-Oct-2021
    • (2021)BuildItProceedings of the 2021 IEEE/ACM International Symposium on Code Generation and Optimization10.1109/CGO51591.2021.9370333(39-51)Online publication date: 27-Feb-2021
    • (2016)Building efficient and highly run-time adaptable virtual machinesProceedings of the 12th Symposium on Dynamic Languages10.1145/2989225.2989234(60-71)Online publication date: 1-Nov-2016
    • (2016)Static meta-object protocols: towards efficient reflective object-oriented languagesCompanion Proceedings of the 15th International Conference on Modularity10.1145/2892664.2892694(160-167)Online publication date: 14-Mar-2016
    • (2016)The Essence of Multi-stage Evaluation in LMSA List of Successes That Can Change the World10.1007/978-3-319-30936-1_17(318-335)Online publication date: 25-Mar-2016
    • (2020)Multi-stage programming in the large with staged classesProceedings of the 19th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences10.1145/3425898.3426961(35-49)Online publication date: 16-Nov-2020
    • (2017)Functional parallels of sequential imperatives (short paper)Proceedings of the 2017 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation10.1145/3018882.3018891(83-88)Online publication date: 2-Jan-2017
    • (2016)Building efficient and highly run-time adaptable virtual machinesACM SIGPLAN Notices10.1145/3093334.298923452:2(60-71)Online publication date: 1-Nov-2016
    • (2016)Reflections on LMS: exploring front-end alternativesProceedings of the 2016 7th ACM SIGPLAN Symposium on Scala10.1145/2998392.2998399(41-50)Online publication date: 30-Oct-2016
    • (2016)Building efficient and highly run-time adaptable virtual machinesProceedings of the 12th Symposium on Dynamic Languages10.1145/2989225.2989234(60-71)Online publication date: 1-Nov-2016
    • Show More Cited By

    View Options

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Figures

    Tables

    Media

    Share

    Share

    Share this Publication link

    Share on social media