skip to main content
10.1145/2816707.2816714acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

High-performance cross-language interoperability in a multi-language runtime

Published:21 October 2015Publication History

ABSTRACT

Programmers combine different programming languages because it allows them to use the most suitable language for a given problem, to gradually migrate existing projects from one language to another, or to reuse existing source code. However, existing cross-language mechanisms suffer from complex interfaces, insufficient flexibility, or poor performance. We present the TruffleVM, a multi-language runtime that allows composing different language implementations in a seamless way. It reduces the amount of required boiler-plate code to a minimum by allowing programmers to access foreign functions or objects by using the notation of the host language. We compose language implementations that translate source code to an intermediate representation (IR), which is executed on top of a shared runtime system. Language implementations use language-independent messages that the runtime resolves at their first execution by transforming them to efficient foreign-language-specific operations. The TruffleVM avoids conversion or marshaling of foreign objects at the language boundary and allows the dynamic compiler to perform its optimizations across language boundaries, which guarantees high performance. This paper presents an implementation of our ideas based on the Truffle system and its guest language implementations JavaScript, Ruby, and C.

References

  1. M. Abadi, L. Cardelli, B. Pierce, and G. Plotkin. Dynamic Typing in a Statically-typed Language. In Proceedings of POPL, 1989. URL http://doi.acm.org/10.1145/75277. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. 75296.Google ScholarGoogle Scholar
  3. E. Barrett, C. F. Bolz, and L. Tratt. Unipycation: A Case Study in Cross-language Tracing. In Proceedings of the 7th VMIL, 2013. URL http://doi.acm.org/10.1145/2542142. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. 2542146.Google ScholarGoogle Scholar
  5. E. Barrett, L. Diekmann, and L. Tratt. Fine-grained Language Composition. CoRR, abs/1503.08623, 2015.Google ScholarGoogle Scholar
  6. D. M. Beazley et al. SWIG: An easy to use tool for integrating scripting languages with C and C++. In Proceedings of USENIX Tcl/Tk workshop, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. M. Blume. No-longer-foreign: Teaching an ML compiler to speak C natively. Electronic Notes in Theoretical Computer Science, 2001.Google ScholarGoogle Scholar
  8. D. Box and C. Sells. Essential .NET. The Common Language Runtime, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. S. Brunthaler. Efficient Interpretation Using Quickening. In Proceedings of DLS, 2010. URL http://doi.acm.org/10. 1145/1869631.1869633. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. D. Chisnall. The Challenge of Cross-language Interoperability. Commun. ACM, 2013. URL http://doi.acm.org/10. 1145/2534706.2534719. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. S. Finne, D. Leijen, E. Meijer, and S. Peyton Jones. Calling Hell from Heaven and Heaven from Hell. In Proceedings of ICFP, 1999. URL http://doi.acm.org/10.1145/317636. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. 317790.Google ScholarGoogle Scholar
  13. P. J. Fleming and J. J. Wallace. How not to lie with statistics: The correct way to summarize benchmark results. 1986. URL http://doi.acm.org/10.1145/5666.5673. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. K. Gray. Safe Cross-Language Inheritance. In ECOOP. 2008. URL http://dx.doi.org/10.1007/978-3-540-70592-5_4. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. K. E. Gray, R. B. Findler, and M. Flatt. Fine-grained Interoperability Through Mirrors and Contracts. In Proceedings of OOPSLA, 2005. URL http://doi.acm.org/10.1145/ 1094811.1094830. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. M. Grimmer. High-performance language interoperability in multi-language runtimes. In Proceedings of SPLASH, 2014. URL http://doi.acm.org/10.1145/2660252.2660256. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. M. Grimmer, M. Rigger, R. Schatz, L. Stadler, and H. Mössenböck. TruffleC: Dynamic Execution of C on a Java Virtual Machine. In Proceedings of PPPJ, 2014. URL http://dx.doi.org/10.1145/2647508.2647528. Google ScholarGoogle ScholarCross RefCross Ref
  18. M. Grimmer, T. Würthinger, A. Wöß, and H. Mössenböck. An Efficient Approach for Accessing C Data Structures from JavaScript. In Proceedings of ICOOOLPS, 2014. URL http: //dx.doi.org/10.1145/2633301.2633302. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. M. Grimmer, R. Schatz, C. Seaton, T. Würthinger, and H. Mössenböck. Memory-safe Execution of C on a Java VM. In Proceedings of PLAS, 2015. URL http://doi.acm.org/ 10.1145/2786558.2786565. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. M. Grimmer, C. Seaton, T. Wuerthinger, and H. Moessenboeck. Dynamically Composing Languages in a Modular Way: Supporting C Extensions for Dynamic Languages. In Proceedings of MODULARITY, 2015. URL http://doi.acm. org/10.1145/2724525.2728790. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. M. Hirzel and R. Grimm. Jeannie: Granting Java Native Interface Developers Their Wishes. In Proceedings of OOPSLA, 2007. URL http://doi.acm.org/10.1145/1297027. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. 1297030.Google ScholarGoogle Scholar
  23. U. Hölzle, C. Chambers, and D. Ungar. Optimizing Dynamically-typed Object-oriented Languages with Polymorphic Inline Caches. In ECOOP. 1991.. URL http: //dx.doi.org/10.1007/BFb0057013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. U. Hölzle, C. Chambers, and D. Ungar. Debugging Optimized Code with Dynamic Deoptimization. In Proceedings of PLDI, 1992. URL http://doi.acm.org/10.1145/143095.143114. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. S. P. Jones, T. Nordin, and A. Reid. Greencard: a foreignlanguage interface for haskell. In Proc. Haskell Workshop, 1997.Google ScholarGoogle Scholar
  26. S. Kell and C. Irwin. Virtual machines should be invisible. In Proceedings of SPLASH, 2011. URL http://doi.acm.org/ 10.1145/2095050.2095099. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. F. Klock II. The layers of larcenys foreign function interface. In Scheme and Functional Programming Workshop. Citeseer, 2007.Google ScholarGoogle Scholar
  28. S. Liang. Java Native Interface: Programmer’s Guide and Reference. Boston, MA, USA, 1st edition, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. J. Matthews and R. B. Findler. Operational semantics for multi-language programs. In Proceedings of POPL, 2007. URL http://doi.acm.org/10.1145/1190216.1190220. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. M. D. Network. XPCOM Specification. https://developer. mozilla.org/en-US/docs/Mozilla/XPCOM, 2014.Google ScholarGoogle Scholar
  31. Oracle. OpenJDK: Graal project. http://openjdk.java. net/projects/graal/, 2013.Google ScholarGoogle Scholar
  32. J. Reppy and C. Song. Application-specific Foreign-interface Generation. In Proceedings of GPCE, 2006.. URL http: //doi.acm.org/10.1145/1173706.1173714. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. J. R. Rose and H. Muller. Integrating the scheme and c languages. In Proceedings of LFP, 1992. URL http://doi. acm.org/10.1145/141471.141559. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. M. Slee, A. Agarwal, and M. Kwiatkowski. Thrift: Scalable cross-language services implementation. Facebook White Paper, 2007.Google ScholarGoogle Scholar
  35. L. Stadler, T. Würthinger, and H. Mössenböck. Partial Escape Analysis and Scalar Replacement for Java. In Proceedings of CGO, 2014.. URL http://doi.acm.org/10.1145/2544137. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. 2544157.Google ScholarGoogle Scholar
  37. L. Stepanian, A. D. Brown, A. Kielstra, G. Koblents, and K. Stoodley. Inlining Java Native Calls at Runtime. In Proceedings of VEE, 2005. URL http://doi.acm.org/10. 1145/1064979.1064997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. V. Trifonov and Z. Shao. Safe and principled language interoperation. 1999.Google ScholarGoogle Scholar
  39. N. Wang, D. C. Schmidt, and C. O’Ryan. Overview of the CORBA Component Model. In Component-Based Software Engineering, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. M. Wegiel and C. Krintz. Cross-language, Type-safe, and Transparent Object Sharing for Co-located Managed Runtimes. In Proceedings of OOPSLA, 2010. URL http://doi. acm.org/10.1145/1869459.1869479. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. A. Wöß, C. Wirth, D. Bonetta, C. Seaton, C. Humer, and H. Mössenböck. An Object Storage Model for the Truffle Language Implementation Framework. In Proceedings of PPPJ, 2014. URL http://dx.doi.org/10.1145/2647508. Google ScholarGoogle ScholarCross RefCross Ref
  42. 2647517.Google ScholarGoogle Scholar
  43. T. Wrigstad, F. Z. Nardelli, S. Lebresne, J. Östlund, and J. Vitek. Integrating typed and untyped code in a scripting language. In Proceedings of POPL, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. . URL http://doi.acm.org/10.1145/1706299.1706343.Google ScholarGoogle Scholar
  45. T. Würthinger, A. Wöß, L. Stadler, G. Duboscq, D. Simon, and C. Wimmer. Self-optimizing AST interpreters. In Proceedings of DLS, 2012.. URL http://doi.acm.org/10. 1145/2384577.2384587. Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. T. Würthinger, C. Wimmer, A. Wöß, L. Stadler, G. Duboscq, C. Humer, G. Richards, D. Simon, and M. Wolczko. One VM to rule them all. In Proceedings of ONWARD!, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. High-performance cross-language interoperability in a multi-language runtime

    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
    • Published in

      cover image ACM Conferences
      DLS 2015: Proceedings of the 11th Symposium on Dynamic Languages
      October 2015
      176 pages
      ISBN:9781450336901
      DOI:10.1145/2816707
      • cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 51, Issue 2
        DLS '15
        Feburary 2016
        176 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/2936313
        • Editor:
        • Andy Gill
        Issue’s Table of Contents

      Copyright © 2015 ACM

      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: 21 October 2015

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • research-article

      Acceptance Rates

      Overall Acceptance Rate32of77submissions,42%

      Upcoming Conference

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader