skip to main content
10.1145/3354166.3354181acmotherconferencesArticle/Chapter ViewAbstractPublication PagesppdpConference Proceedingsconference-collections
research-article

Under Control: Compositionally Correct Closure Conversion with Mutable State

Published: 07 October 2019 Publication History

Abstract

Compositional compiler verification aims to ensure correct compilation of components, not just whole programs. Perconti and Ahmed [2014] propose a methodology for compositional compiler correctness that supports linking with code of arbitrary provenance. In particular, they allow compiled components to be linked with code whose functionality cannot even be expressed in the compiler's own source language. The essence of their approach is to define a multi-language system that formalizes interoperability between the source and target languages so that compiler correctness can be stated as contextual equivalence in the multi-language. They illustrate this methodology on a two-pass type-preserving compiler for a polymorphic language with recursive types.
We show how to extend this multi-language compiler-verification approach to a source language with ML-style mutable references. We present the first compositional correctness proof of typed closure conversion for a language with mutable state. More importantly, we show we can extend our target language with first-class control (call/cc) yielding a compiler correctness theorem that allows components compiled from the source language (without call/cc) to be linked with target-language components (with call/cc) whose extensional behavior cannot be expressed in the source. A nontrivial technical contribution is the design of the multi-language logical relation used to carry out the proof of compiler correctness. This is semantically challenging due to the mix of parametric polymorphism and mutable state in both interoperating languages.
We use a blue font to typeset our source language and a bold red to typeset the target. The paper will be much easier to read if viewed/printed in color.

References

[1]
Amal Ahmed. 2006. Step-Indexed Syntactic Logical Relations for Recursive and Quantified Types. In European Symposium on Programming (ESOP). 69--83.
[2]
Amal Ahmed and Matthias Blume. 2008. Typed Closure Conversion Preserves Observational Equivalence. In International Conference on Functional Programming (ICFP), Victoria, British Columbia, Canada. 157--168.
[3]
Amal Ahmed and Matthias Blume. 2011. An Equivalence-Preserving CPS Translation via Multi-Language Semantics. In International Conference on Functional Programming (ICFP), Tokyo, Japan. 431--444.
[4]
Amal Ahmed, Derek Dreyer, and Andreas Rossberg. 2009. State-Dependent Representation Independence. In ACM Symposium on Principles of Programming Languages (POPL), Savannah, Georgia.
[5]
Amal Jamil Ahmed. 2004. Semantics of Types for Mutable State. Ph.D. Dissertation. Princeton University.
[6]
Nick Benton and Chung-Kil Hur. 2009. Biorthogonality, Step-Indexing and Compiler Correctness. In International Conference on Functional Programming(ICFP), Edinburgh, Scotland.
[7]
Nick Benton, Andrew Kennedy, and George Russell. 1998. Compiling Standard ML to Java Bytecodes. In International Conference on Functional Programming (ICFP), Baltimore, Maryland, USA. 129--140. http://doi.acm.org/10.1145/289423.289435
[8]
Christos Dimoulas, Sam Tobin-Hochstadt, and Matthias Felleisen. 2012. Complete Monitors for Behavioral Contracts. In European Symposium on Programming(ESOP).
[9]
Derek Dreyer, Georg Neis, and Lars Birkedal. 2012. The Impact of Higher-Order State and Control Effects on Local Relational Reasoning. Journal of Functional Programming 22, 4&5 (2012), 477--528.
[10]
Chung-Kil Hur and Derek Dreyer. 2011. A Kripke logical relation between ML and assembly. In ACM Symposium on Principles of Programming Languages (POPL), Austin, Texas.
[11]
Jeehoon Kang, Yoonseung Kim, Chung-Kil Hur, Derek Dreyer, and Viktor Vafeiadis. 2016. Lightweight Verification of Separate Compilation. In ACM Symposium on Principles of Programming Languages (POPL), St. Petersburg, Florida. ACM, 178--190.
[12]
Shriram Krishnamurthi, Peter Walton Hopkins, Jay Mccarthy, Paul T. Graunke, Greg Pettyjohn, and Matthias Felleisen. 2007. Implementation and use of the PLT Scheme web server. (2007).
[13]
Phillip Mates, Jamie Perconti, and Amal Ahmed. 2019. Under Control: Compositionally Correct Closure Conversion with Mutable State (Technical Appendix). (July 2019). Available at http://www.ccs.neu.edu/home/amal/papers/refcc-tr.pdf.
[14]
Jacob Matthews and Robert Bruce Findler. 2007. Operational Semantics for Multi-Language Programs. In ACM Symposium on Principles of Programming Languages (POPL), Nice, France. 3--10.
[15]
Yasuhiko Minamide, Greg Morrisett, and Robert Harper. 1996. Typed Closure Conversion. In ACM Symposium on Principles of Programming Languages (POPL), St. Petersburg Beach, Florida. 271--283.
[16]
Greg Morrisett, David Walker, Karl Crary, and Neal Glew. 1999. From System F to Typed Assembly Language. ACM Transactions on Programming Languages and Systems 21, 3 (May 1999), 527--568.
[17]
Georg Neis.2018. Compositional Compiler Correctness via Parametric Simulations. Ph.D. Dissertation. Saarland University.
[18]
Georg Neis, Chung-Kil Hur, Jan-Oliver Kaiser, Craig McLaughlin, Derek Dreyer, and Viktor Vafeiadis. 2015. Pilsner: A Compositionally Verified Compiler for a Higher-Order Imperative Language. In International Conference on Functional Programming (ICFP), Vancouver, British Columbia, Canada.
[19]
Max S. New, William J. Bowman, and Amal Ahmed. 2016. Fully Abstract Compilation via Universal Embedding. In International Conference on Functional Programming (ICFP), Nara, Japan.
[20]
Marco Patrignani, Amal Ahmed, and Dave Clarke. 2019. Formal Approaches to Secure Compilation: A Survey of Fully Abstract Compilation and Related Work. Comput. Surveys 51, 6, Article 125 (Feb. 2019), 36 pages.
[21]
Daniel Patterson and Amal Ahmed. 2017. Linking Types for Multi-Language Software: Have Your Cake and Eat It Too. In 2nd Summit on Advances in Programming Languages (SNAPL 2017) (Leibniz International Proceedings in Informatics (LIPIcs)), Benjamin S. Lerner, Rastislav Bodík, and Shriram Krishnamurthi (Eds.), Vol. 71. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany, 12:1--12.15. https://doi.org/10.4230/LIPIcs.SNAPL.2017.12
[22]
Daniel Patterson and Amal Ahmed. 2019. The Next 700 Compiler Correctness Theorems (Functional Pearl). PACMPL 3, ICFP (Aug. 2019).
[23]
Daniel Patterson, Jamie Perconti, Christos Dimoulas, and Amal Ahmed. 2017. Fun TAL: Reasonably Mixing a Functional Language with Assembly. In ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), Barcelona, Spain.
[24]
James T. Perconti and Amal Ahmed. 2014. Verifying an Open Compiler Using Multi-Language Semantics. In European Symposium on Programming (ESOP).
[25]
Christian Queinnec. 2003. Inverting Back the Inversion of Control or, Continuations Versus Page-centric Programming. SIGPLAN Not. 38, 2 (Feb. 2003), 57--64.
[26]
Gabriel Scherer, Max S. New, Nick Rioux, and Amal Ahmed. 2018. FabULous Interoperability for ML and a Linear Language. In FOSSACS.
[27]
Gordon Stewart, Lennart Beringer, Santiago Cuellar, and Andrew W. Appel. 2015. Compositional CompCert. In ACM Symposium on Principles of Programming Languages (POPL), Mumbai, India.
[28]
James Gordon Stewart. 2015. Verified Separate Compilation for C. Ph.D. Dissertation. Princeton University.
[29]
Peng Wang, Santiago Cuellar, and Adam Chlipala. 2014. Compiler Verification Meets Cross-Language Linking via Data Abstraction. In ACM Symposium on Object Oriented Programming: Systems, Languages, and Applications (OOPSLA).
[30]
Yuting Wang, Pierre Wilke, and Zhong Shao. 2019. An Abstract Stack Based Approach to Verified Compositional Compilation to Machine Code. In ACM Symposium on Principles of Programming Languages (POPL), Lisbon, Portugal.

Cited By

View all
  • (2024)Realistic Realizability: Specifying ABIs You Can Count OnProceedings of the ACM on Programming Languages10.1145/36897558:OOPSLA2(1249-1278)Online publication date: 8-Oct-2024
  • (2023)Melocoton: A Program Logic for Verified Interoperability Between OCaml and CProceedings of the ACM on Programming Languages10.1145/36228237:OOPSLA2(716-744)Online publication date: 16-Oct-2023
  • (2023)Defunctionalization with Dependent TypesProceedings of the ACM on Programming Languages10.1145/35912417:PLDI(516-538)Online publication date: 6-Jun-2023
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Other conferences
PPDP '19: Proceedings of the 21st International Symposium on Principles and Practice of Declarative Programming
October 2019
280 pages
ISBN:9781450372497
DOI:10.1145/3354166
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 the author(s) 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].

In-Cooperation

  • Sony: Sony Corporation

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 07 October 2019

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Compiler correctness
  2. first-class continuations
  3. logical relations
  4. multi-language semantics
  5. mutable state
  6. typed closure conversion

Qualifiers

  • Research-article
  • Research
  • Refereed limited

Conference

PPDP '19

Acceptance Rates

PPDP '19 Paper Acceptance Rate 19 of 45 submissions, 42%;
Overall Acceptance Rate 230 of 486 submissions, 47%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)3
  • Downloads (Last 6 weeks)0
Reflects downloads up to 05 Mar 2025

Other Metrics

Citations

Cited By

View all
  • (2024)Realistic Realizability: Specifying ABIs You Can Count OnProceedings of the ACM on Programming Languages10.1145/36897558:OOPSLA2(1249-1278)Online publication date: 8-Oct-2024
  • (2023)Melocoton: A Program Logic for Verified Interoperability Between OCaml and CProceedings of the ACM on Programming Languages10.1145/36228237:OOPSLA2(716-744)Online publication date: 16-Oct-2023
  • (2023)Defunctionalization with Dependent TypesProceedings of the ACM on Programming Languages10.1145/35912417:PLDI(516-538)Online publication date: 6-Jun-2023
  • (2023)DimSum: A Decentralized Approach to Multi-language Semantics and VerificationProceedings of the ACM on Programming Languages10.1145/35712207:POPL(775-805)Online publication date: 9-Jan-2023
  • (2023)A Metalanguage for Cost-Aware Denotational Semantics2023 38th Annual ACM/IEEE Symposium on Logic in Computer Science (LICS)10.1109/LICS56636.2023.10175777(1-14)Online publication date: 26-Jun-2023
  • (2019)The next 700 compiler correctness theorems (functional pearl)Proceedings of the ACM on Programming Languages10.1145/33416893:ICFP(1-29)Online publication date: 26-Jul-2019

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