Nothing Special   »   [go: up one dir, main page]

skip to main content
10.1145/2584469.2584663acmotherconferencesArticle/Chapter ViewAbstractPublication PagesmodularityConference Proceedingsconference-collections
keynote

Graal and truffle: modularity and separation of concerns as cornerstones for building a multipurpose runtime

Published: 22 April 2014 Publication History

Abstract

Multi-language runtimes providing simultaneously high performance for several programming languages still remain an illusion. Industrial-strength managed language runtimes are built with a focus on one language (e.g., Java or C#). Other languages may compile to the bytecode formats of those managed language runtimes. However, the performance characteristics of the bytecode generation approach are often lagging behind compared to language runtimes specialized for a specific language. The performance of JavaScript is for example still orders of magnitude better on specialized runtimes (e.g., V8 or SpiderMonkey).
We present a solution to this problem by providing guest languages with a new way of interfacing with the host runtime. The semantics of the guest language is communicated to the host runtime not via generating bytecodes, but via an interpreter written in the host language. This gives guest languages a simple way to express the semantics of their operations including language-specific mechanisms for collecting profiling feedback. The efficient machine code is derived from the interpreter via automatic partial evaluation. The main components reused from the underlying runtime are the compiler and the garbage collector. They are both agnostic to the executed guest languages.
The host compiler derives the optimized machine code for hot parts of the guest language application via partial evaluation of the guest language interpreter. The interpreter definition can guide the host compiler to generate deoptimization points, i.e., exits from the compiled code. This allows guest language operations to use speculations: An operation could for example speculate that the type of an incoming parameter is constant. Furthermore, the guest language interpreter can use global assumptions about the system state that are registered with the compiled code. Finally, part of the interpreter's code can be excluded from the partial evaluation and remain shared across the system. This is useful for avoiding code explosion and appropriate for infrequently executed paths of an operation. These basic mechanisms are provided by the underlying language-agnostic host runtime and allow separation of concerns between guest and host runtime.
Guest language objects are stored on the host heap and managed by the host garbage collector. Multiple executing languages can share the same heap. This enables language interoperability without marshaling at the language boundary, because the field value of one language can point to an object of another language. Reusing the allocation system of the host runtime is another major simplification for guest language runtimes.
We implemented Truffle, the guest language runtime framework, on top of the Graal compiler and the HotSpot(TM) virtual machine. So far, there are prototypes for C, J, Python, JavaScript, R, Ruby, and Smalltalk running on top of the Truffle framework. The prototypes are still incomplete with respect to language semantics. However, most of them can run non-trivial benchmarks to demonstrate the core promise of the Truffle system: Multiple languages within one runtime system at competitive performance.

Cited By

View all
  • (2023)Extraction of Virtual Machine Execution TracesProceedings of the 15th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages10.1145/3623507.3623547(94-99)Online publication date: 18-Oct-2023
  • (2023)Optimization-Aware Compiler-Level Event ProfilingACM Transactions on Programming Languages and Systems10.1145/3591473Online publication date: 10-Apr-2023
  • (2021)Architecture-agnostic dynamic type recoveryProceedings of the 18th ACM SIGPLAN International Conference on Managed Programming Languages and Runtimes10.1145/3475738.3480719(54-60)Online publication date: 29-Sep-2021
  • Show More Cited By

Index Terms

  1. Graal and truffle: modularity and separation of concerns as cornerstones for building a multipurpose runtime

    Recommendations

    Comments

    Please enable JavaScript to view thecomments powered by Disqus.

    Information & Contributors

    Information

    Published In

    cover image ACM Other conferences
    MODULARITY '14: Proceedings of the companion publication of the 13th international conference on Modularity
    April 2014
    44 pages
    ISBN:9781450327732
    DOI:10.1145/2584469
    Permission to make digital or hard copies of part or all 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 third-party components of this work must be honored. For all other uses, contact the Owner/Author.

    Sponsors

    • AOSA: Aspect-Oriented Software Association

    In-Cooperation

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 22 April 2014

    Check for updates

    Author Tags

    1. dynamic languages
    2. language implementation
    3. multi-language
    4. optimization
    5. virtual machine

    Qualifiers

    • Keynote

    Conference

    MODULARITY '14
    Sponsor:
    • AOSA

    Acceptance Rates

    Overall Acceptance Rate 41 of 139 submissions, 29%

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)6
    • Downloads (Last 6 weeks)0
    Reflects downloads up to 12 Nov 2024

    Other Metrics

    Citations

    Cited By

    View all
    • (2023)Extraction of Virtual Machine Execution TracesProceedings of the 15th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages10.1145/3623507.3623547(94-99)Online publication date: 18-Oct-2023
    • (2023)Optimization-Aware Compiler-Level Event ProfilingACM Transactions on Programming Languages and Systems10.1145/3591473Online publication date: 10-Apr-2023
    • (2021)Architecture-agnostic dynamic type recoveryProceedings of the 18th ACM SIGPLAN International Conference on Managed Programming Languages and Runtimes10.1145/3475738.3480719(54-60)Online publication date: 29-Sep-2021
    • (2020)trcview: interactive architecture agnostic execution trace analysisProceedings of the 17th International Conference on Managed Programming Languages and Runtimes10.1145/3426182.3426190(89-97)Online publication date: 4-Nov-2020

    View Options

    Get Access

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media