Yarrow: Reconciling Effect Handlers and Region-Based Memory Management
Abstract
We present a new ML-like programming language Yarrow with algebraic effects and region-based memory management. Reconciling these programming language features into one language is challenging: the non-local control flow of algebraic effects break the stack discipline of function calls and returns that region-based memory management relies on, and multi-shot effect handlers break the invariant that regions can be exited at most once. We present a program logic, called Yarrow Logic (YL), that supports safe and modular reasoning about regions in the presence of one-shot and multi-shot effect handlers. We prove the logic sound w.r.t. the operational semantics of Yarrow which is inspired by the runtime of OCaml but refined for regions. We use YL to prove correctness of a number of case studies with algebraic effects, including checkpointing, asynchronous computation and a LIFO data structure implementation. Since all memory locations used in these case studies are allocated in regions, these case studies avoid using the less efficient garbage collected heap memory. We have formalized Yarrow's operational semantics, the Yarrow program logic, and all our case studies using the Iris separation logic framework on top of the Rocq Prover.
Create a lesson
Related papers
Cambria: Resource Abstraction for Parametrized Algebraic Effects and Handlers
Shared title terminologycs.PLJack Liell-Cock, Sam Staton
Dimensional Type Systems and Deterministic Memory Management
Shared title terminologycs.PLHouston Haynes
A Unifying Metatheorem on Weak-Memory Robustness
Shared title terminologycs.PLGiovanna Kobus Conrado, Stephan Spengler, Mohamed Faouzi Atig et al.
Memory Allocation for Constant-Bounded Programs
Shared title terminologycs.PLVinícius Silva, Kael Soares, Márcio Costa e Fernando Magno Quintão Pereira
Bona: Automatic Management of Dirty Ancilla Borrowing in Quantum Circuits
Shared title terminologycs.PLXiaoquan Xu, Chenke Liu, Boning Meng et al.
PG-MDP: Profile-Guided Memory Dependence Prediction for Area-Constrained Cores
Shared title terminologycs.PLLuke Panayi, Johan Jino, Sebastian S. Kim et al.