Skip to main navigation Skip to search Skip to main content

Closure Conversion, Flat Environments, and the Complexity of Abstract Machines

  • Beniamino Accattoli
  • , Cláudio Belo Lourenço
  • , Dan R. Ghica
  • , Giulio Guerrieri
  • , Claudio Sacerdoti Coen
  • Huawei Central Software Institute
  • University of Birmingham
  • University of Sussex
  • University of Bologna

Research output: Chapter in Book/Report/Conference proceedingConference contributionpeer-review

Abstract

Closure conversion is a program transformation at work in compilers for functional languages to turn inner functions into global ones, by building closures pairing the transformed functions with the environment of their free variables. Abstract machines rely on similar and yet different concepts of closures and environments. We study the relationship between the two approaches. We adopt a simple λ -calculus with tuples as source language and study abstract machines for both the source language and the target of closure conversion. Moreover, we focus on the simple case of flat closures/environments (no sharing of environments). We provide three contributions. Firstly, a new simple proof technique for the correctness of closure conversion, inspired by abstract machines. Secondly, we show how the closure invariants of the target language allow us to design a new way of handling environments in abstract machines, not suffering the shortcomings of other styles. Thirdly, we study the machines from the point of view of time complexity. We show that closure conversion decreases various dynamic costs while increasing the size of the initial code. Despite these changes, the overall complexity of the machines before and after closure conversion turns out to be the same.

Original languageEnglish
Title of host publicationProceedings of the 27th International Symposium on Principles and Practice of Declarative Programming, PPDP 2025, Co-located with the 41st International Conference on Logic Programming
EditorsMalgorzata Biernacka, Carlos Olarte, Francesco Ricca, James Cheney
PublisherAssociation for Computing Machinery, Inc
ISBN (Electronic)9798400720857
DOIs
Publication statusPublished - 13 Dec 2025
Event27th International Symposium on Principles and Practice of Declarative Programming, PPDP 2025 - Rende, Italy
Duration: 10 Sept 202511 Sept 2025

Publication series

NameProceedings of the 27th International Symposium on Principles and Practice of Declarative Programming, PPDP 2025, Co-located with the 41st International Conference on Logic Programming

Conference

Conference27th International Symposium on Principles and Practice of Declarative Programming, PPDP 2025
Country/TerritoryItaly
CityRende
Period10/09/2511/09/25

Keywords

  • Lambda calculus
  • abstract machine
  • program transformation

Fingerprint

Dive into the research topics of 'Closure Conversion, Flat Environments, and the Complexity of Abstract Machines'. Together they form a unique fingerprint.

Cite this