skip to main content
10.1145/3359061.3361077acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
short-paper

Practical second Futamura projection: partial evaluation for high-performance language interpreters

Published: 20 October 2019 Publication History

Abstract

Partial evaluation, based on the first Futamura projection, allows compiling language interpreters with given user programs to efficient target programs. GraalVM is an example system that implements this mechanism. It combines partial evaluation with profiling information and dynamic compilation, to transform interpreters into high-performance machine code at run time. However, partial evaluation is compile-time intensive, as it requires the abstract interpretation of interpreter implementations. Thus, optimizing partial evaluation is still subject to research to this day. We present an approach to speed up partial evaluation, by generating source code ahead of time, which performs partial evaluation specific to interpreter implementations. Generated code, when executed for a given user program at run time, directly emits partially evaluated interpreter instructions for language constructs it knows and sees in the program. This yields the target program faster than performing the first Futamura projection. The generated source code behaves similarly to a specialized partial evaluator deduced by performing the second Futamura projection, although no self-applying partial evaluator is involved during code generation.

References

[1]
L. Birkedal and M. Welinder. 1994. Hand-writing program generator generators. In PLILP.
[2]
C. F. Bolz, M. Leuschel, and A. Rigo. 2010. Towards Just-In-Time Partial Evaluation of Prolog. In LOPSTR.
[3]
G. Duboscq, T. Würthinger, L. Stadler, C. Wimmer, D. Simon, and H. Mössenböck. 2013. An Intermediate Representation for Speculative Optimizations in a Dynamic Compiler. In VMIL.
[4]
J. Eisl, M. Grimmer, D. Simon, T. Würthinger, and H. Mössenböck. 2016. Trace-based Register Allocation in a JIT Compiler. In PPPJ.
[5]
Y. Futamura. 1971. Partial evaluation of computation process – an approach to a compiler-compiler. Systems, Computers, Controls (1971).
[6]
U. Hölzle, C. Chambers, and D. Ungar. 1992. Debugging Optimized Code with Dynamic Deoptimization. In PLDI.
[7]
D. Leopoldseder, L. Stadler, T. Würthinger, J. Eisl, D. Simon, and H. Mössenböck. 2018. Dominance-based Duplication Simulation (DBDS): Code Duplication to Enable Compiler Optimizations. In CGO.
[8]
L. Michael, J. Jesper, V. Wim, and B. Maurice. 2002. Offline Specialisation in Prolog Using a Hand-Written Compiler Generator. CoRR (2002).
[9]
M. Rigger, M. Grimmer, C. Wimmer, T. Würthinger, and H. Mössenböck. 2016. Bringing Low-level Languages to the JVM: Efficient Execution of LLVM IR on Truffle. In VMIL.
[10]
U. P. Schultz, J. L. Lawall, and C. Consel. 2003. Automatic Program Specialization for Java. TOPLAS (2003).
[11]
A. Shali and W. R. Cook. 2011. Hybrid Partial Evaluation. In OOPSLA.
[12]
T. Würthinger, C. Wimmer, C. Humer, A. Wöss, L. Stadler, C. Seaton, G. Duboscq, D. Simon, and M. Grimmer. 2017. Practical Partial Evaluation for High-performance Dynamic Language Runtimes. In PLDI.

Cited By

View all
  • (2025)Honey Potion: An eBPF Backend for ElixirProceedings of the 23rd ACM/IEEE International Symposium on Code Generation and Optimization10.1145/3696443.3708923(660-674)Online publication date: 1-Mar-2025
  • (2024)Partial program analysis for staged compilation systemsFormal Methods in System Design10.1007/s10703-024-00458-xOnline publication date: 13-Jun-2024
  • (2022)Principles of Staged Static+Dynamic Partial AnalysisStatic Analysis10.1007/978-3-031-22308-2_4(44-73)Online publication date: 2-Dec-2022

Index Terms

  1. Practical second Futamura projection: partial evaluation for high-performance language interpreters

          Recommendations

          Comments

          Information & Contributors

          Information

          Published In

          cover image ACM Conferences
          SPLASH Companion 2019: Proceedings Companion of the 2019 ACM SIGPLAN International Conference on Systems, Programming, Languages, and Applications: Software for Humanity
          October 2019
          58 pages
          ISBN:9781450369923
          DOI:10.1145/3359061
          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]

          Sponsors

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          Published: 20 October 2019

          Permissions

          Request permissions for this article.

          Check for updates

          Author Tags

          1. Futamura projection
          2. code generation
          3. dynamic compilation
          4. interpretation
          5. partial evaluation

          Qualifiers

          • Short-paper

          Conference

          SPLASH '19
          Sponsor:

          Acceptance Rates

          Overall Acceptance Rate 268 of 1,244 submissions, 22%

          Upcoming Conference

          Contributors

          Other Metrics

          Bibliometrics & Citations

          Bibliometrics

          Article Metrics

          • Downloads (Last 12 months)23
          • Downloads (Last 6 weeks)2
          Reflects downloads up to 28 Feb 2025

          Other Metrics

          Citations

          Cited By

          View all
          • (2025)Honey Potion: An eBPF Backend for ElixirProceedings of the 23rd ACM/IEEE International Symposium on Code Generation and Optimization10.1145/3696443.3708923(660-674)Online publication date: 1-Mar-2025
          • (2024)Partial program analysis for staged compilation systemsFormal Methods in System Design10.1007/s10703-024-00458-xOnline publication date: 13-Jun-2024
          • (2022)Principles of Staged Static+Dynamic Partial AnalysisStatic Analysis10.1007/978-3-031-22308-2_4(44-73)Online publication date: 2-Dec-2022

          View Options

          Login options

          View options

          PDF

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader

          Figures

          Tables

          Media

          Share

          Share

          Share this Publication link

          Share on social media