A High-Level Separation Logic for Heap Space under Garbage Collection (Extended Version) - Inria - Institut national de recherche en sciences et technologies du numérique
Journal Articles Proceedings of the ACM on Programming Languages Year : 2023

A High-Level Separation Logic for Heap Space under Garbage Collection (Extended Version)

Abstract

We present a Separation Logic with space credits for reasoning about heap space in a sequential call-by-value lambda-calculus equipped with garbage collection and mutable state. A key challenge is to design sound, modular, lightweight mechanisms for establishing the unreachability of a block. Prior work in this area uses pointed-by assertions to keep track of the predecessors of every block, but is carried out in the setting of an assembly-like programming language. We take up the challenge in the setting of a high-level language, where a key problem is to identify and reason about the memory locations that the garbage collector considers as roots. For this purpose, we propose novel "stackable" assertions, which keep track of the existence of stack-to-heap pointers without explicitly recording their origin. Furthermore, we explain how to reason about closures -- concrete heap-allocated data structures that implement the abstract concept of a first-class function. We demonstrate the expressiveness and tractability of our program logic via a range of examples, including recursive functions on linked lists, objects implemented using closures and mutable internal state, recursive functions in continuation-passing style, and three stack implementations that exhibit different space bounds. These last three examples illustrate reasoning about the reachability of the items stored in a container as well as amortized reasoning about space. All of our results are proved in Coq on top of Iris.
Fichier principal
Vignette du fichier
spacelambda-extended.pdf (692.92 Ko) Télécharger le fichier
Origin Files produced by the author(s)

Dates and versions

hal-03823056 , version 1 (20-10-2022)
hal-03823056 , version 2 (14-11-2022)

Licence

Identifiers

Cite

Alexandre Moine, Arthur Charguéraud, François Pottier. A High-Level Separation Logic for Heap Space under Garbage Collection (Extended Version). Proceedings of the ACM on Programming Languages, 2023, 7 (POPL), pp.718-747. ⟨10.1145/3571218⟩. ⟨hal-03823056v2⟩
296 View
301 Download

Altmetric

Share

More