Document Open Access Logo

The Design of Terra: Harnessing the Best Features of High-Level and Low-Level Languages

Authors Zachary DeVito, Pat Hanrahan



PDF
Thumbnail PDF

File

LIPIcs.SNAPL.2015.79.pdf
  • Filesize: 332 kB
  • 11 pages

Document Identifiers

Author Details

Zachary DeVito
Pat Hanrahan

Cite AsGet BibTex

Zachary DeVito and Pat Hanrahan. The Design of Terra: Harnessing the Best Features of High-Level and Low-Level Languages. In 1st Summit on Advances in Programming Languages (SNAPL 2015). Leibniz International Proceedings in Informatics (LIPIcs), Volume 32, pp. 79-89, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2015)
https://doi.org/10.4230/LIPIcs.SNAPL.2015.79

Abstract

Applications are often written using a combination of high-level and low-level languages since it allows performance critical parts to be carefully optimized, while other parts can be written more productively. This approach is used in web development, game programming, and in build systems for applications themselves. However, most languages were not designed with interoperability in mind, resulting in glue code and duplicated features that add complexity. We propose a two-language system where both languages were designed to interoperate. Lua is used for our high-level language since it was originally designed with interoperability in mind. We create a new low-level language, Terra, that we designed to interoperate with Lua. It is embedded in Lua, and meta-programmed from it, but has a low level of abstraction suited for writing high-performance code. We discuss important design decisions - compartmentalized runtimes, glue-free interoperation, and meta-programming features - that enable Lua and Terra to be more powerful than the sum of their parts.
Keywords
  • language interoperability
  • meta-programming
  • high-performance
  • Lua

Metrics

  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    0
    PDF Downloads

References

  1. Stefan Behnel, Robert Bradshaw, Craig Citro, Lisandro Dalcin, Dag Sverre Seljebotn, and Kurt Smith. Cython: The best of both worlds. Computing in Science and Engineering, 13.2:31-39, 2011. Google Scholar
  2. Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and Alan Edelman. Julia: A fast dynamic language for technical computing. CoRR, 2012. Google Scholar
  3. Zachary DeVito, James Hegarty, Alex Aiken, Pat Hanrahan, and Jan Vitek. Terra: A multi-stage language for high-performance computing. In PLDI'13, pages 105-116, 2013. Google Scholar
  4. Zachary DeVito, Daniel Ritchie, Matt Fisher, Alex Aiken, and Pat Hanrahan. First-class runtime generation of high-performance types using exotypes. In PLDI'14, pages 77-88, 2014. Google Scholar
  5. Kathryn E. Gray, Robert Bruce Findler, and Matthew Flatt. Fine-grained interoperability through mirrors and contracts. In OOPSLA'05, pages 231-245, 2005. Google Scholar
  6. James Hegarty, John Brunhaver, Zachary DeVito, Jonathan Ragan-Kelley, Noy Cohen, Steven Bell, Artem Vasilyev, Mark Horowitz, and Pat Hanrahan. Darkroom: Compiling high-level image processing code into hardware pipelines. In SIGGRAPH'14, pages 144:1-144:11, 2014. Google Scholar
  7. Martin Hirzel and Robert Grimm. Jeannie: Granting Java native interface developers their wishes. In OOPSLA'07, pages 19-38, 2007. Google Scholar
  8. Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes. The evolution of Lua. In HOPL III, pages 2:1-2:26, 2007. Google Scholar
  9. Roberto Ierusalimschy, Luiz Henrique De Figueiredo, and Waldemar Celes. Passing a language through the eye of a needle. Commun. ACM, 54(7):38-43, July 2011. Google Scholar
  10. Interoperability overview (C#programming guide). URL: https://msdn.microsoft.com/en-us/library/ms173185.aspx.
  11. Gregor Kiczales and Jim Des Rivieres. The Art of the Metaobject Protocol. MIT Press, Cambridge, MA, USA, 1991. Google Scholar
  12. Andreas Klöckner, Nicolas Pinto, Yunsup Lee, Bryan Catanzaro, Paul Ivanov, and Ahmed Fasih. PyCUDA and PyOpenCL: A scripting-based approach to GPU run-time code generation. Parallel Comput., 38(3):157-174, 2012. Google Scholar
  13. Chris Lattner and Vikram Adve. LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation. In CGO'04, 2004. Google Scholar
  14. The LuaJIT project. URL: http://luajit.org/.
  15. Geoffrey Mainland. Explicitly heterogeneous metaprogramming with MetaHaskell. In ICFP'12, pages 311-322, 2012. Google Scholar
  16. John McCarthy. History of LISP. SIGPLAN Not., 13(8):217-223, August 1978. Google Scholar
  17. Tiark Rompf and Martin Odersky. Lightweight modular staging: A pragmatic approach to runtime code generation and compiled dsls. In GPCE'10, pages 127-136, 2010. Google Scholar
  18. John R. Rose and Hans Muller. Integrating the Scheme and C languages. In LFP'92, pages 247-259, 1992. Google Scholar
  19. Jeremy G. Siek and Walid Taha. Gradual typing for functional languages. In Scheme and Functional Programming Workshop, pages 81-92, 2006. Google Scholar
  20. Jeffrey Mark Siskind. Flow-directed lightweight closure conversion. Technical report, NEC Research Institute, Inc., 1999. Google Scholar
  21. Guy L. Steele, Jr. Growing a language. In OOPSLA'98 Addendum, pages 0.01-A1, 1998. Google Scholar
  22. Nathan Sweet. Kryo. URL: https://code.google.com/p/kryo/.
  23. Don Syme, Keith Battocchi, Kenji Takeda, Donna Malayeri, Jomo Fisher, Jack Hu, Tao Liu, Brian McNamara, Daniel Quirk, Matteo Taveggia, Wonseok Chae, Uladzimir Matsveyeu, and Tomas Petricek. F#3.0 - strongly-typed language support for internet-scale information sources. Technical report, Microsoft Research, 2012. Google Scholar
  24. Walid Taha and Tim Sheard. MetaML and multi-stage programming with explicit annotations. In Theoretical Computer Science, pages 203-217. ACM Press, 1999. Google Scholar
  25. Sam Tobin-Hochstadt, Vincent St-Amour, Ryan Culpepper, Matthew Flatt, and Matthias Felleisen. Languages as libraries. In PLDI'11, pages 132-141, 2011. Google Scholar
  26. R. Clint Whaley and Antoine Petitet. Minimizing development and maintenance costs in supporting persistently optimized BLAS. Softw. Pract. Exper., 35(2):101-121, February 2005. Google Scholar
  27. Tobias Wrigstad, Francesco Zappa Nardelli, Sylvain Lebresne, Johan Östlund, and Jan Vitek. Integrating typed and untyped code in a scripting language. In POPL'10, pages 377-388, 2010. Google Scholar
Questions / Remarks / Feedback
X

Feedback for Dagstuhl Publishing


Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail