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.
- 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 Scholar
Digital Library
- 75296.Google Scholar
- 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 Scholar
Digital Library
- 2542146.Google Scholar
- E. Barrett, L. Diekmann, and L. Tratt. Fine-grained Language Composition. CoRR, abs/1503.08623, 2015.Google Scholar
- 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 Scholar
Digital Library
- M. Blume. No-longer-foreign: Teaching an ML compiler to speak C natively. Electronic Notes in Theoretical Computer Science, 2001.Google Scholar
- D. Box and C. Sells. Essential .NET. The Common Language Runtime, 2002. Google Scholar
Digital Library
- S. Brunthaler. Efficient Interpretation Using Quickening. In Proceedings of DLS, 2010. URL http://doi.acm.org/10. 1145/1869631.1869633. Google Scholar
Digital Library
- D. Chisnall. The Challenge of Cross-language Interoperability. Commun. ACM, 2013. URL http://doi.acm.org/10. 1145/2534706.2534719. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 317790.Google Scholar
- 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 Scholar
Digital Library
- K. Gray. Safe Cross-Language Inheritance. In ECOOP. 2008. URL http://dx.doi.org/10.1007/978-3-540-70592-5_4. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 1297030.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- S. P. Jones, T. Nordin, and A. Reid. Greencard: a foreignlanguage interface for haskell. In Proc. Haskell Workshop, 1997.Google Scholar
- 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 Scholar
Digital Library
- F. Klock II. The layers of larcenys foreign function interface. In Scheme and Functional Programming Workshop. Citeseer, 2007.Google Scholar
- S. Liang. Java Native Interface: Programmer’s Guide and Reference. Boston, MA, USA, 1st edition, 1999. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- M. D. Network. XPCOM Specification. https://developer. mozilla.org/en-US/docs/Mozilla/XPCOM, 2014.Google Scholar
- Oracle. OpenJDK: Graal project. http://openjdk.java. net/projects/graal/, 2013.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- M. Slee, A. Agarwal, and M. Kwiatkowski. Thrift: Scalable cross-language services implementation. Facebook White Paper, 2007.Google Scholar
- 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 Scholar
Digital Library
- 2544157.Google Scholar
- 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 Scholar
Digital Library
- V. Trifonov and Z. Shao. Safe and principled language interoperation. 1999.Google Scholar
- N. Wang, D. C. Schmidt, and C. O’Ryan. Overview of the CORBA Component Model. In Component-Based Software Engineering, 2001. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 2647517.Google Scholar
- 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 Scholar
Digital Library
- . URL http://doi.acm.org/10.1145/1706299.1706343.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
Index Terms
High-performance cross-language interoperability in a multi-language runtime
Recommendations
High-performance cross-language interoperability in a multi-language runtime
DLS 2015: Proceedings of the 11th Symposium on Dynamic LanguagesProgrammers 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 ...
Practical partial evaluation for high-performance dynamic language runtimes
PLDI 2017: Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and ImplementationMost high-performance dynamic language virtual machines duplicate language semantics in the interpreter, compiler, and runtime system. This violates the principle to not repeat yourself. In contrast, we define languages solely by writing an ...
High-performance language interoperability in multi-language runtimes
SPLASH '14: Proceedings of the companion publication of the 2014 ACM SIGPLAN conference on Systems, Programming, and Applications: Software for HumanityPrograms often consist of parts that are written in different languages because sub-problems lend themselves to being implemented in a particular language. However, multi-language programs often suffer from poor performance, complex cross-language ...






Comments