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

Pallene: : A companion language for Lua

Published: 01 April 2020 Publication History
  • Get Citation Alerts
  • Highlights

    We present Pallene, a typed and ahead-of-time-compiled subset of Lua.
    Pallene has a simple and portable implementation that is still very efficient.
    Pallene is an order of magnitude faster than Lua and as fast as a JIT compiler.
    Pallene may be specially useful for performance-sensitive Lua extension modules.
    Run-time tag checking is not incompatible with efficient typed code.

    Abstract

    The simplicity and flexibility of dynamic languages make them popular for prototyping and scripting, but the lack of compile-time type information makes it challenging to generate efficient executable code.
    Inspired by ideas from scripting, just-in-time compilers, and optional type systems, we have developed Pallene, a typed companion language to the Lua scripting language, intended for writing lower-level libraries and extension modules. It plays the role of a system language in the scripting paradigm, but one that has been explicitly designed to interoperate with Lua. Pallene is designed to be efficient, to interoperate seamlessly with Lua (even sharing its runtime), and to be familiar to Lua programmers. It should also be simple, easy to understand, and easy to implement, so it can be as portable as maintainable as Lua itself.
    In this paper, we discuss the rationale for Pallene's design and present a description of its syntax, type system, and semantics. We also compare the performance of Pallene extension modules against pure Lua (both interpreted and JIT-compiled), against C extension modules (operating with Lua data structures), and also against programs fully written in C, which provide a familiar baseline. The results corroborate our hypothesis that Pallene has the potential to be a low-level counterpart to Lua. The performance of Lua extension modules written in Pallene can be better than that of equivalent modules written in C and it is competitive with the performance from a JIT compiler, despite the vastly simpler implementation.
    This is a revised and extended version of a SBLP 2018 paper with a similar title [1].

    References

    [1]
    H.M. Gualandi, R. Ierusalimschy, Pallene: a statically typed companion language for Lua, in: Proceedings of the XXII Brazilian Symposium on Programming Languages, SBLP, 2018, pp. 19–26. https://doi.org/10.1145/3264637.3264640.
    [2]
    J.K. Ousterhout, Scripting: higher-level programming for the 21st century, Computer 31 (3) (1998) 23–30,.
    [3]
    L.P. Deutsch, A.M. Schiffman, Efficient implementation of the Smalltalk-80 system, in: Proceedings of the 11th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, POPL '84, 1984, pp. 297–302. https://doi.org/10.1145/800017.800542.
    [4]
    Guerra, J. (Feb. 2017): LuaJIT hacking: Getting next() out of the NYIlist. CloudFare Blog https://blog.cloudflare.com/luajit-hacking-getting-next-out-of-the-nyi-list/.
    [5]
    Antonov, P.; et al. (2013): V8 optimization killers. retrieved in 2017-01-08 https://github.com/petkaantonov/bluebird/wiki/Optimization-killers.
    [6]
    S. Tobin-Hochstadt, M. Felleisen, Interlanguage migration: from scripts to programs, in: Companion to the 21st ACM SIGPLAN Symposium on Object-Oriented Programming Systems, Languages, and Applications, OOPSLA '06, 2006, pp. 964–974. https://doi.org/10.1145/1176617.1176755.
    [7]
    J.G. Siek, W. Taha, Gradual typing for functional languages, in: Scheme and Functional Programming Workshop 6, 2006, pp. 81–92.
    [8]
    G. Bracha, Pluggable type systems, in: OOPSLA04 Workshop on Revival of Dynamic Languages, 2004.
    [9]
    Pall, M. (2005): LuaJIT, a just-in-time compiler for Lua. http://luajit.org/luajit.html.
    [10]
    R. Ierusalimschy, L.H. De Figueiredo, W. Celes, Passing a language through the eye of a needle, Commun. ACM 54 (7) (2011) 38–43,.
    [11]
    R. Ierusalimschy, L.H. de Figueiredo, W. Celes, The evolution of Lua, in: Proceedings of the Third ACM SIGPLAN Conference on History of Programming Languages, HOPL III, 2007, pp. 2–1–2–26 https://doi.org/10.1145/1238844.1238846.
    [12]
    Mogilefsky, B. (May 1999): Lua in Grim Fandango, Grim Fandango Network. https://www.grimfandango.net/features/articles/lua-in-grim-fandango.
    [13]
    A. Gal, C.W. Probst, M. Franz HotpathVM, An effective JIT compiler for resource-constrained devices, in: Proceedings of the 2nd International Conference on Virtual Execution Environments, VEE '06, 2006, pp. 144–153. https://doi.org/10.1145/1134760.1134780.
    [14]
    C.F. Bolz, A. Cuni, M. Fijalkowski, A. Rigo, Tracing the meta-level: PyPy's tracing JIT compiler, in: Proceedings of the 4th Workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems, ICOOOLPS '09, 2009, pp. 18–25. https://doi.org/10.1145/1565824.1565827.
    [15]
    The PyPy Project, RPython official documentation (2016) : https://rpython.readthedocs.io/.
    [16]
    T. Würthinger, C. Wimmer, A. Wöß, L. Stadler, G. Duboscq, C. Humer, G. Richards, D. Simon, M. Wolczko, One VM to rule them all, in: Proceedings of the 2013 ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming & Software, Onward! 2013, 2013, pp. 187–204. https://doi.org/10.1145/2509578.2509581.
    [17]
    Pall, M.; et al. (2014): Not yet implemented operations in LuaJIT, LuaJIT documentation Wiki. retrieved 2017-01-08 http://wiki.luajit.org/NYI.
    [18]
    Pall, M. : LuaJIT performance tips. lua-l mailing list (nov 2012). URL http://wiki.luajit.org/Numerical-Computing-Performance-Guide.
    [19]
    Guerra Giraldez, J. (2016): LOOM - a LuaJIT performance visualizer. https://github.com/cloudflare/loom.
    [20]
    Guerra Giraldez, J. : The rocky road to MCode. Talk at Lua Moscow conference, 2017 (2017). URL https://www.youtube.com/watch?v=sz2CuDpltmM.
    [21]
    E. Barrett, C.F. Bolz-Tereick, R. Killick, S. Mount, L. Tratt, Virtual machine warmup blows hot and cold, in: Proceedings of the 32nd Annual Conference on Object-Oriented Programming Systems, Languages, and Applications, OOPSLA '17, 2017, https://doi.org/10.1145/3133876.
    [22]
    H.M. Gualandi, Typing dynamic languages – a review, Master's thesis Pontifícia Universidade Católica do Rio de Janeiro (PUC-Rio), 2015.
    [23]
    Graham, P. (1996) : ANSI Common LISP, Apt, Alan R. http://www.paulgraham.com/acl.html.
    [24]
    J.G. Siek, M.M. Vitousek, M. Cimini, J.T. Boyland, Refined criteria for gradual typing, in: 1st Summit on Advances in Programming Languages, SNAPL '2015, 2015, pp. 274–293. https://doi.org/10.4230/LIPIcs.SNAPL.2015.274.
    [25]
    A. Takikawa, D. Feltey, B. Greenman, M.S. New, J. Vitek, M. Felleisen, Is sound gradual typing dead?, in: Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL '16, 2016, pp. 456–468,.
    [26]
    A.M. Maidl, F. Mascarenhas, R. Ierusalimschy, A formalization of typed Lua, in: Proceedings of the 11th Symposium on Dynamic Languages, DLS 2015, 2015, pp. 13–25. https://doi.org/10.1145/2816707.2816709.
    [28]
    Pall, M. (nov 2009): LuaJIT 2.0 intellectual property disclosure and research opportunities, lua-l mailing list. http://lua-users.org/lists/lua-l/2009-11/msg00089.html.
    [29]
    M.M. Vitousek, C. Swords, J.G. Siek, Big types in little runtime: open-world soundness and collaborative blame for gradual type systems, in: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages, POPL 2017, 2017, pp. 762–774. https://doi.org/10.1145/3009837.3009849.
    [30]
    G. Bierman, M. Abadi, M. Torgersen, Understanding TypeScript, in: 28th European Conference on Object-Oriented Programming, ECOOP '14, 2014, pp. 257–281. https://doi.org/10.1007/978-3-662-44202-9_11.
    [31]
    D. Ancona, M. Ancona, A. Cuni, N.D. Matsakis, RPython: a step towards reconciling dynamically and statically typed OO languages, in: Proceedings of the 2007 Symposium on Dynamic Languages, DLS '07, 2007, pp. 53–64. https://doi.org/10.1145/1297081.1297091.
    [32]
    S. Behnel, R. Bradshaw, C. Citro, L. Dalcin, D. Seljebotn, K. Smith, Cython: the best of both worlds, Comput. Sci. Eng. 13 (2) (2011) 31–39,.
    [33]
    Z. DeVito, Terra: simplifying high-performance programming using multi-stage programming, Ph.D. thesis Stanford University, Dec. 2014.
    [34]
    M. Soldevila, B. Ziliani, B. Silvestre, D. Fridlender, F. Mascarenhas, Decoding lua: formal semantics for the developer and the semanticist, in: Proceedings of the 13th ACM SIGPLAN International Symposium on Dynamic Languages, DLS 2017, 2017, pp. 75–86. https://doi.org/10.1145/3133841.3133848 https://arxiv.org/pdf/1706.02400.pdf.
    [35]
    Maidl, A.M.; Mascarenhas, F.; Ligneul, G.; Muhammad, H.; Gualandi, H.M. (2018): Source code repository for the Titan programming language. https://github.com/titan-lang/titan.

    Cited By

    View all
    • (2023)Towards Sparse Synchronous Programming in LuaProceedings of Cyber-Physical Systems and Internet of Things Week 202310.1145/3576914.3587502(361-366)Online publication date: 9-May-2023
    • (2022)A Foreign Function Interface for PalleneProceedings of the XXVI Brazilian Symposium on Programming Languages10.1145/3561320.3561321(32-40)Online publication date: 6-Oct-2022
    • (2021)A Surprisingly Simple Lua CompilerProceedings of the 25th Brazilian Symposium on Programming Languages10.1145/3475061.3475077(1-8)Online publication date: 27-Sep-2021

    Index Terms

    1. Pallene: A companion language for Lua
          Index terms have been assigned to the content through auto-classification.

          Recommendations

          Comments

          Information & Contributors

          Information

          Published In

          cover image Science of Computer Programming
          Science of Computer Programming  Volume 189, Issue C
          Apr 2020
          65 pages

          Publisher

          Elsevier North-Holland, Inc.

          United States

          Publication History

          Published: 01 April 2020

          Author Tags

          1. Dynamic languages
          2. Scripting languages
          3. Just-in-time compilers
          4. Type systems
          5. Gradual typing

          Qualifiers

          • Research-article

          Contributors

          Other Metrics

          Bibliometrics & Citations

          Bibliometrics

          Article Metrics

          • Downloads (Last 12 months)0
          • Downloads (Last 6 weeks)0

          Other Metrics

          Citations

          Cited By

          View all
          • (2023)Towards Sparse Synchronous Programming in LuaProceedings of Cyber-Physical Systems and Internet of Things Week 202310.1145/3576914.3587502(361-366)Online publication date: 9-May-2023
          • (2022)A Foreign Function Interface for PalleneProceedings of the XXVI Brazilian Symposium on Programming Languages10.1145/3561320.3561321(32-40)Online publication date: 6-Oct-2022
          • (2021)A Surprisingly Simple Lua CompilerProceedings of the 25th Brazilian Symposium on Programming Languages10.1145/3475061.3475077(1-8)Online publication date: 27-Sep-2021

          View Options

          View options

          Get Access

          Login options

          Media

          Figures

          Other

          Tables

          Share

          Share

          Share this Publication link

          Share on social media